From 3a2820ab90e61c89649f67fe2c0423b15673576b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 18 Feb 2022 01:45:09 +0000 Subject: [PATCH] CodeGen from PR 17753 in Azure/azure-rest-api-specs Adding xms identifiers for RPs (#17753) * Adding x-ms-identifiers for AD Hybrid Health Service * remove added properties * Adding xms-identifiers for AlertsManagement * revert changes related to files outside resource-manager * Adding xms-ids for ApiManagement * adding xms-ids for AzureData * Adding xms-ids for COnfidentialLedger * Adding xms ids for Confluent * Adding xms-ids for CostManagement * Adding xms ids for DataBox * Adding xms ids for DataBricks * fix typos * Corrections after rebasing * corrections after rebase * fixing invalid format errors * changing the format to uuid for all Ids * prettier fix * prettier fix 2 * reverting package files to main * revert noisy prettifier changes * revert some format changes in adhybrid * reverting noisy changes * removing adhybrid and alerts management * remove azuredata * remove apimanagement files from this PR --- .../azure-mgmt-databricks/_meta.json | 10 +- .../azure/mgmt/databricks/__init__.py | 9 +- .../_azure_databricks_management_client.py | 107 +- .../azure/mgmt/databricks/_configuration.py | 20 +- .../azure/mgmt/databricks/_metadata.json | 26 +- .../azure/mgmt/databricks/_patch.py | 31 + .../azure/mgmt/databricks/_vendor.py | 27 + .../azure/mgmt/databricks/_version.py | 2 +- .../azure/mgmt/databricks/aio/__init__.py | 5 + .../_azure_databricks_management_client.py | 95 +- .../mgmt/databricks/aio/_configuration.py | 7 +- .../azure/mgmt/databricks/aio/_patch.py | 31 + .../databricks/aio/operations/__init__.py | 2 + .../databricks/aio/operations/_operations.py | 47 +- ...twork_dependencies_endpoints_operations.py | 102 ++ ...private_endpoint_connections_operations.py | 237 ++- .../_private_link_resources_operations.py | 99 +- .../operations/_vnet_peering_operations.py | 237 ++- .../aio/operations/_workspaces_operations.py | 340 ++-- .../azure/mgmt/databricks/models/__init__.py | 126 +- ...zure_databricks_management_client_enums.py | 41 +- .../azure/mgmt/databricks/models/_models.py | 1430 ----------------- .../mgmt/databricks/models/_models_py3.py | 871 +++++++--- .../mgmt/databricks/operations/__init__.py | 2 + .../mgmt/databricks/operations/_operations.py | 88 +- ...twork_dependencies_endpoints_operations.py | 139 ++ ...private_endpoint_connections_operations.py | 472 ++++-- .../_private_link_resources_operations.py | 202 ++- .../operations/_vnet_peering_operations.py | 472 ++++-- .../operations/_workspaces_operations.py | 645 +++++--- 30 files changed, 2844 insertions(+), 3078 deletions(-) create mode 100644 sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_patch.py create mode 100644 sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_vendor.py create mode 100644 sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/_patch.py create mode 100644 sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_outbound_network_dependencies_endpoints_operations.py delete mode 100644 sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_models.py create mode 100644 sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_outbound_network_dependencies_endpoints_operations.py diff --git a/sdk/databricks/azure-mgmt-databricks/_meta.json b/sdk/databricks/azure-mgmt-databricks/_meta.json index 226316ddd10d..b3068ee7c084 100644 --- a/sdk/databricks/azure-mgmt-databricks/_meta.json +++ b/sdk/databricks/azure-mgmt-databricks/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.1", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "fa3ba1acdd45ddad8950133befc5b0a6f1ee5163", + "commit": "1659cfde425308fc46b5f2cd962c3be40ba04ace", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/databricks/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.8.1 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", + "autorest_command": "autorest specification/databricks/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/databricks/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/__init__.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/__init__.py index 00df8e78c17d..bded089670ab 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/__init__.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AzureDatabricksManagementClient'] -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/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_azure_databricks_management_client.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_azure_databricks_management_client.py index d0ddf4a60c74..42b06a27537d 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_azure_databricks_management_client.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_azure_databricks_management_client.py @@ -6,28 +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 AzureDatabricksManagementClientConfiguration +from .operations import Operations, OutboundNetworkDependenciesEndpointsOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, VNetPeeringOperations, WorkspacesOperations + 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 AzureDatabricksManagementClientConfiguration -from .operations import WorkspacesOperations -from .operations import Operations -from .operations import PrivateLinkResourcesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import VNetPeeringOperations -from . import models - -class AzureDatabricksManagementClient(object): +class AzureDatabricksManagementClient: """The Microsoft Azure management APIs allow end users to operate on Azure Databricks Workspace resources. :ivar workspaces: WorkspacesOperations operations @@ -35,65 +29,74 @@ class AzureDatabricksManagementClient(object): :ivar operations: Operations operations :vartype operations: azure_databricks_management_client.operations.Operations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure_databricks_management_client.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure_databricks_management_client.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure_databricks_management_client.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure_databricks_management_client.operations.PrivateEndpointConnectionsOperations + :ivar outbound_network_dependencies_endpoints: OutboundNetworkDependenciesEndpointsOperations + operations + :vartype outbound_network_dependencies_endpoints: + azure_databricks_management_client.operations.OutboundNetworkDependenciesEndpointsOperations :ivar vnet_peering: VNetPeeringOperations operations :vartype vnet_peering: azure_databricks_management_client.operations.VNetPeeringOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :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 = AzureDatabricksManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureDatabricksManagementClientConfiguration(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._serialize.client_side_validation = False + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.outbound_network_dependencies_endpoints = OutboundNetworkDependenciesEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.vnet_peering = VNetPeeringOperations(self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vnet_peering = VNetPeeringOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + 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/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_configuration.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_configuration.py index 37c43da379a8..fcda56303715 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_configuration.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_configuration.py @@ -6,18 +6,16 @@ # 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 @@ -35,19 +33,19 @@ class AzureDatabricksManagementClientConfiguration(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(AzureDatabricksManagementClientConfiguration, 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(AzureDatabricksManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id + self.api_version = "2021-04-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-databricks/{}'.format(VERSION)) self._configure(**kwargs) @@ -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/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_metadata.json b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_metadata.json index 4f32e60012df..fbd844fad1ba 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_metadata.json +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "", - "total_api_version_list": ["2018-04-01", "2021-04-01-preview"], + "chosen_version": "2021-04-01-preview", + "total_api_version_list": ["2021-04-01-preview"], "client": { "name": "AzureDatabricksManagementClient", "filename": "_azure_databricks_management_client", "description": "The Microsoft Azure management APIs allow end users to operate on Azure Databricks Workspace resources.", - "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\": [\"AzureDatabricksManagementClientConfiguration\"]}}, \"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\": [\"AzureDatabricksManagementClientConfiguration\"]}}, \"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\": [\"AzureDatabricksManagementClientConfiguration\"]}}, \"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\": [\"AzureDatabricksManagementClientConfiguration\"]}}, \"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,17 +91,17 @@ "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": { "workspaces": "WorkspacesOperations", "operations": "Operations", "private_link_resources": "PrivateLinkResourcesOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "outbound_network_dependencies_endpoints": "OutboundNetworkDependenciesEndpointsOperations", "vnet_peering": "VNetPeeringOperations" } } \ No newline at end of file diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_patch.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_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/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_vendor.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_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/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_version.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_version.py index 653b73a4a199..e5754a47ce68 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_version.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/__init__.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/__init__.py index 4d341ec3f5c4..062a2f1407d6 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/__init__.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/__init__.py @@ -8,3 +8,8 @@ from ._azure_databricks_management_client import AzureDatabricksManagementClient __all__ = ['AzureDatabricksManagementClient'] + +# `._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/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/_azure_databricks_management_client.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/_azure_databricks_management_client.py index 8376d40c3e1e..32030062a5c9 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/_azure_databricks_management_client.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/_azure_databricks_management_client.py @@ -6,26 +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 AzureDatabricksManagementClientConfiguration +from .operations import Operations, OutboundNetworkDependenciesEndpointsOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, VNetPeeringOperations, WorkspacesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import AzureDatabricksManagementClientConfiguration -from .operations import WorkspacesOperations -from .operations import Operations -from .operations import PrivateLinkResourcesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import VNetPeeringOperations -from .. import models - - -class AzureDatabricksManagementClient(object): +class AzureDatabricksManagementClient: """The Microsoft Azure management APIs allow end users to operate on Azure Databricks Workspace resources. :ivar workspaces: WorkspacesOperations operations @@ -33,63 +29,74 @@ class AzureDatabricksManagementClient(object): :ivar operations: Operations operations :vartype operations: azure_databricks_management_client.aio.operations.Operations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure_databricks_management_client.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure_databricks_management_client.aio.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure_databricks_management_client.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure_databricks_management_client.aio.operations.PrivateEndpointConnectionsOperations + :ivar outbound_network_dependencies_endpoints: OutboundNetworkDependenciesEndpointsOperations + operations + :vartype outbound_network_dependencies_endpoints: + azure_databricks_management_client.aio.operations.OutboundNetworkDependenciesEndpointsOperations :ivar vnet_peering: VNetPeeringOperations operations :vartype vnet_peering: azure_databricks_management_client.aio.operations.VNetPeeringOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :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 = AzureDatabricksManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AzureDatabricksManagementClientConfiguration(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.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.outbound_network_dependencies_endpoints = OutboundNetworkDependenciesEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.vnet_peering = VNetPeeringOperations(self._client, self._config, self._serialize, self._deserialize) + - self.workspaces = WorkspacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vnet_peering = VNetPeeringOperations( - 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/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/_configuration.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/_configuration.py index a06bbe6c18f7..f4441b50ebb0 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/_configuration.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/_configuration.py @@ -10,7 +10,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 @@ -37,14 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AzureDatabricksManagementClientConfiguration, 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(AzureDatabricksManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id + self.api_version = "2021-04-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-databricks/{}'.format(VERSION)) self._configure(**kwargs) @@ -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/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/_patch.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/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/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/__init__.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/__init__.py index 6fc97620650a..50c9331a9943 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/__init__.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/__init__.py @@ -10,6 +10,7 @@ from ._operations import Operations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._outbound_network_dependencies_endpoints_operations import OutboundNetworkDependenciesEndpointsOperations from ._vnet_peering_operations import VNetPeeringOperations __all__ = [ @@ -17,5 +18,6 @@ 'Operations', 'PrivateLinkResourcesOperations', 'PrivateEndpointConnectionsOperations', + 'OutboundNetworkDependenciesEndpointsOperations', 'VNetPeeringOperations', ] diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_operations.py index 9a3c8f881553..be5e6a8b04bb 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/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,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,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 OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_databricks_management_client.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_databricks_management_client.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +97,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_outbound_network_dependencies_endpoints_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_outbound_network_dependencies_endpoints_operations.py new file mode 100644 index 000000000000..d8930838018a --- /dev/null +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_outbound_network_dependencies_endpoints_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, List, 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._outbound_network_dependencies_endpoints_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OutboundNetworkDependenciesEndpointsOperations: + """OutboundNetworkDependenciesEndpointsOperations 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_databricks_management_client.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 list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> List["_models.OutboundEnvironmentEndpoint"]: + """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified Workspace. + + Gets the list of endpoints that VNET Injected Workspace calls Azure Databricks Control Plane. + You must configure outbound access with these endpoints. For more information, see + https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/udr. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of OutboundEnvironmentEndpoint, or the result of cls(response) + :rtype: list[~azure_databricks_management_client.models.OutboundEnvironmentEndpoint] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.OutboundEnvironmentEndpoint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + template_url=self.list.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[OutboundEnvironmentEndpoint]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints'} # type: ignore + diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_endpoint_connections_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_endpoint_connections_operations.py index 291c6ec83a02..51bea9175d0d 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_endpoint_connections_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._private_endpoint_connections_operations import build_create_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,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -58,8 +64,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_databricks_management_client.models.PrivateEndpointConnectionsList] + :return: An iterator like instance of either PrivateEndpointConnectionsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_databricks_management_client.models.PrivateEndpointConnectionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionsList"] @@ -67,36 +75,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - '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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + 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('PrivateEndpointConnectionsList', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,17 +114,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -147,34 +154,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -183,8 +180,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -198,40 +197,29 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') - # 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_request_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_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(private_endpoint_connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -243,8 +231,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -264,18 +255,24 @@ async def begin_create( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. - :type private_endpoint_connection: ~azure_databricks_management_client.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure_databricks_management_client.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + :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 PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_databricks_management_client.models.PrivateEndpointConnection] - :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 PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure_databricks_management_client.models.PrivateEndpointConnection] + :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.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -288,28 +285,21 @@ async def begin_create( workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + 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('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -321,6 +311,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( @@ -335,41 +326,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -389,15 +371,17 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + :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', @@ -412,22 +396,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -439,4 +415,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.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_link_resources_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_link_resources_operations.py index d8d70c948f4f..7d99098c52cf 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_link_resources_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_private_link_resources_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._private_link_resources_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourcesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_databricks_management_client.models.PrivateLinkResourcesList] + :return: An iterator like instance of either PrivateLinkResourcesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_databricks_management_client.models.PrivateLinkResourcesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesList"] @@ -65,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - '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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + 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('PrivateLinkResourcesList', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +112,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateLinkResources'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -145,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'groupId': self._serialize.url("group_id", group_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + group_id=group_id, + 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GroupIdInformation', pipeline_response) @@ -181,4 +178,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateLinkResources/{groupId}'} # type: ignore + diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_vnet_peering_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_vnet_peering_operations.py index 277be5245873..8143d7c37eac 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_vnet_peering_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_vnet_peering_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._vnet_peering_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_workspace_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -68,34 +74,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + peering_name=peering_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 if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -106,8 +102,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -120,41 +118,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + peering_name=peering_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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -172,15 +161,17 @@ async def begin_delete( :type peering_name: str :keyword callable cls: A custom type or function 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. + :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', @@ -195,22 +186,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'peeringName': self._serialize.url("peering_name", peering_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: @@ -222,6 +205,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.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}'} # type: ignore async def _create_or_update_initial( @@ -237,40 +221,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), - } - url = self._client.format_url(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(virtual_network_peering_parameters, 'VirtualNetworkPeering') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + peering_name=peering_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(virtual_network_peering_parameters, 'VirtualNetworkPeering') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('VirtualNetworkPeering', pipeline_response) @@ -282,8 +255,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.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -302,18 +278,24 @@ async def begin_create_or_update( :type peering_name: str :param virtual_network_peering_parameters: Parameters supplied to the create workspace vNet Peering. - :type virtual_network_peering_parameters: ~azure_databricks_management_client.models.VirtualNetworkPeering + :type virtual_network_peering_parameters: + ~azure_databricks_management_client.models.VirtualNetworkPeering :keyword callable cls: A custom type or function 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. + :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 VirtualNetworkPeering or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_databricks_management_client.models.VirtualNetworkPeering] - :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 VirtualNetworkPeering or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure_databricks_management_client.models.VirtualNetworkPeering] + :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.VirtualNetworkPeering"] lro_delay = kwargs.pop( 'polling_interval', @@ -326,28 +308,21 @@ async def begin_create_or_update( workspace_name=workspace_name, peering_name=peering_name, virtual_network_peering_parameters=virtual_network_peering_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('VirtualNetworkPeering', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'peeringName': self._serialize.url("peering_name", peering_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: @@ -359,8 +334,10 @@ 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.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}'} # type: ignore + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -374,8 +351,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualNetworkPeeringList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_databricks_management_client.models.VirtualNetworkPeeringList] + :return: An iterator like instance of either VirtualNetworkPeeringList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_databricks_management_client.models.VirtualNetworkPeeringList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkPeeringList"] @@ -383,36 +362,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - '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_by_workspace_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_workspace.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_workspace_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + 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('VirtualNetworkPeeringList', pipeline_response) + deserialized = self._deserialize("VirtualNetworkPeeringList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,12 +401,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_workspaces_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_workspaces_operations.py index a95a73ba1a34..6e33f43c6105 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_workspaces_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/aio/operations/_workspaces_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._workspaces_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,33 +71,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Workspace', pipeline_response) @@ -100,8 +96,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -113,40 +111,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + 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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -161,15 +150,17 @@ async def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function 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. + :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', @@ -183,21 +174,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -209,6 +193,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.Databricks/workspaces/{workspaceName}'} # type: ignore async def _create_or_update_initial( @@ -223,39 +208,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Workspace') - # 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + 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, 'Workspace') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Workspace', pipeline_response) @@ -267,8 +241,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.Databricks/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -286,15 +263,20 @@ async def begin_create_or_update( :type parameters: ~azure_databricks_management_client.models.Workspace :keyword callable cls: A custom type or function 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. + :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 Workspace or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_databricks_management_client.models.Workspace] - :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 Workspace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure_databricks_management_client.models.Workspace] + :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.Workspace"] lro_delay = kwargs.pop( 'polling_interval', @@ -306,27 +288,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_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('Workspace', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -338,6 +314,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.Databricks/workspaces/{workspaceName}'} # type: ignore async def _update_initial( @@ -352,39 +329,28 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'WorkspaceUpdate') - # 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_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._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, 'WorkspaceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -394,8 +360,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -413,15 +382,20 @@ async def begin_update( :type parameters: ~azure_databricks_management_client.models.WorkspaceUpdate :keyword callable cls: A custom type or function 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. + :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 Workspace or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_databricks_management_client.models.Workspace] - :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 Workspace or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure_databricks_management_client.models.Workspace] + :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.Workspace"] lro_delay = kwargs.pop( 'polling_interval', @@ -433,27 +407,21 @@ async def begin_update( resource_group_name=resource_group_name, workspace_name=workspace_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('Workspace', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -465,8 +433,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -478,7 +448,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_databricks_management_client.models.WorkspaceListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_databricks_management_client.models.WorkspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] @@ -486,35 +457,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - '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_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + 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('WorkspaceListResult', pipeline_response) + deserialized = self._deserialize("WorkspaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -527,17 +494,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces'} # type: ignore + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -546,7 +515,8 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_databricks_management_client.models.WorkspaceListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_databricks_management_client.models.WorkspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] @@ -554,34 +524,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + 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, + 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('WorkspaceListResult', pipeline_response) + deserialized = self._deserialize("WorkspaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -594,12 +559,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/__init__.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/__init__.py index 4645c40c923c..0a8a32558a7b 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/__init__.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/__init__.py @@ -6,86 +6,49 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AddressSpace - from ._models_py3 import CreatedBy - from ._models_py3 import Encryption - from ._models_py3 import EncryptionEntitiesDefinition - from ._models_py3 import EncryptionV2 - from ._models_py3 import EncryptionV2KeyVaultProperties - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorInfo - from ._models_py3 import ErrorResponse - from ._models_py3 import GroupIdInformation - from ._models_py3 import GroupIdInformationProperties - from ._models_py3 import ManagedIdentityConfiguration - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionProperties - from ._models_py3 import PrivateEndpointConnectionsList - from ._models_py3 import PrivateLinkResourcesList - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import Resource - from ._models_py3 import Sku - from ._models_py3 import SystemData - from ._models_py3 import TrackedResource - from ._models_py3 import VirtualNetworkPeering - from ._models_py3 import VirtualNetworkPeeringList - from ._models_py3 import VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork - from ._models_py3 import VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork - from ._models_py3 import Workspace - from ._models_py3 import WorkspaceCustomBooleanParameter - from ._models_py3 import WorkspaceCustomObjectParameter - from ._models_py3 import WorkspaceCustomParameters - from ._models_py3 import WorkspaceCustomStringParameter - from ._models_py3 import WorkspaceEncryptionParameter - from ._models_py3 import WorkspaceListResult - from ._models_py3 import WorkspacePropertiesEncryption - from ._models_py3 import WorkspaceProviderAuthorization - from ._models_py3 import WorkspaceUpdate -except (SyntaxError, ImportError): - from ._models import AddressSpace # type: ignore - from ._models import CreatedBy # type: ignore - from ._models import Encryption # type: ignore - from ._models import EncryptionEntitiesDefinition # type: ignore - from ._models import EncryptionV2 # type: ignore - from ._models import EncryptionV2KeyVaultProperties # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorInfo # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import GroupIdInformation # type: ignore - from ._models import GroupIdInformationProperties # type: ignore - from ._models import ManagedIdentityConfiguration # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionProperties # type: ignore - from ._models import PrivateEndpointConnectionsList # type: ignore - from ._models import PrivateLinkResourcesList # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import Resource # type: ignore - from ._models import Sku # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import VirtualNetworkPeering # type: ignore - from ._models import VirtualNetworkPeeringList # type: ignore - from ._models import VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork # type: ignore - from ._models import VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork # type: ignore - from ._models import Workspace # type: ignore - from ._models import WorkspaceCustomBooleanParameter # type: ignore - from ._models import WorkspaceCustomObjectParameter # type: ignore - from ._models import WorkspaceCustomParameters # type: ignore - from ._models import WorkspaceCustomStringParameter # type: ignore - from ._models import WorkspaceEncryptionParameter # type: ignore - from ._models import WorkspaceListResult # type: ignore - from ._models import WorkspacePropertiesEncryption # type: ignore - from ._models import WorkspaceProviderAuthorization # type: ignore - from ._models import WorkspaceUpdate # type: ignore +from ._models_py3 import AddressSpace +from ._models_py3 import CreatedBy +from ._models_py3 import Encryption +from ._models_py3 import EncryptionEntitiesDefinition +from ._models_py3 import EncryptionV2 +from ._models_py3 import EncryptionV2KeyVaultProperties +from ._models_py3 import EndpointDependency +from ._models_py3 import EndpointDetail +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorInfo +from ._models_py3 import ErrorResponse +from ._models_py3 import GroupIdInformation +from ._models_py3 import GroupIdInformationProperties +from ._models_py3 import ManagedIdentityConfiguration +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OutboundEnvironmentEndpoint +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionProperties +from ._models_py3 import PrivateEndpointConnectionsList +from ._models_py3 import PrivateLinkResourcesList +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import Sku +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import VirtualNetworkPeering +from ._models_py3 import VirtualNetworkPeeringList +from ._models_py3 import VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork +from ._models_py3 import VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork +from ._models_py3 import Workspace +from ._models_py3 import WorkspaceCustomBooleanParameter +from ._models_py3 import WorkspaceCustomObjectParameter +from ._models_py3 import WorkspaceCustomParameters +from ._models_py3 import WorkspaceCustomStringParameter +from ._models_py3 import WorkspaceEncryptionParameter +from ._models_py3 import WorkspaceListResult +from ._models_py3 import WorkspacePropertiesEncryption +from ._models_py3 import WorkspaceProviderAuthorization +from ._models_py3 import WorkspaceUpdate + from ._azure_databricks_management_client_enums import ( CreatedByType, @@ -108,6 +71,8 @@ 'EncryptionEntitiesDefinition', 'EncryptionV2', 'EncryptionV2KeyVaultProperties', + 'EndpointDependency', + 'EndpointDetail', 'ErrorDetail', 'ErrorInfo', 'ErrorResponse', @@ -117,6 +82,7 @@ 'Operation', 'OperationDisplay', 'OperationListResult', + 'OutboundEnvironmentEndpoint', 'PrivateEndpoint', 'PrivateEndpointConnection', 'PrivateEndpointConnectionProperties', diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_azure_databricks_management_client_enums.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_azure_databricks_management_client_enums.py index a0ccab790f46..6c8a61431daf 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_azure_databricks_management_client_enums.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_azure_databricks_management_client_enums.py @@ -6,27 +6,12 @@ # 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 CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -35,7 +20,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class CustomParameterType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CustomParameterType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning status of the workspace. """ @@ -43,13 +28,13 @@ class CustomParameterType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): OBJECT = "Object" STRING = "String" -class EncryptionKeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionKeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Keyvault """ MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeySource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption keySource (provider). Possible values (case-insensitive): Default, Microsoft.Keyvault """ @@ -57,7 +42,7 @@ class KeySource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" MICROSOFT_KEYVAULT = "Microsoft.Keyvault" -class PeeringProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PeeringProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -66,7 +51,7 @@ class PeeringProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu DELETING = "Deleting" FAILED = "Failed" -class PeeringState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PeeringState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the virtual network peering. """ @@ -74,7 +59,7 @@ class PeeringState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CONNECTED = "Connected" DISCONNECTED = "Disconnected" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -84,7 +69,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateLinkServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of a private endpoint connection """ @@ -93,7 +78,7 @@ class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning status of the workspace. """ @@ -109,7 +94,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The network access type for accessing workspace. Set value to disabled to access workspace only via private link. """ @@ -117,7 +102,7 @@ class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class RequiredNsgRules(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RequiredNsgRules(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets a value indicating whether data plane (clusters) to control plane communication happen over private endpoint. Supported values are 'AllRules' and 'NoAzureDatabricksRules'. 'NoAzureServiceRules' value is for internal use only. diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_models.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_models.py deleted file mode 100644 index 30cd1f13f340..000000000000 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_models.py +++ /dev/null @@ -1,1430 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AddressSpace(msrest.serialization.Model): - """AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network. - - :param address_prefixes: A list of address blocks reserved for this virtual network in CIDR - notation. - :type address_prefixes: list[str] - """ - - _attribute_map = { - 'address_prefixes': {'key': 'addressPrefixes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(AddressSpace, self).__init__(**kwargs) - self.address_prefixes = kwargs.get('address_prefixes', None) - - -class CreatedBy(msrest.serialization.Model): - """Provides details of the entity that created/updated the workspace. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar oid: The Object ID that created the workspace. - :vartype oid: str - :ivar puid: The Personal Object ID corresponding to the object ID above. - :vartype puid: str - :ivar application_id: The application ID of the application that initiated the creation of the - workspace. For example, Azure Portal. - :vartype application_id: str - """ - - _validation = { - 'oid': {'readonly': True}, - 'puid': {'readonly': True}, - 'application_id': {'readonly': True}, - } - - _attribute_map = { - 'oid': {'key': 'oid', 'type': 'str'}, - 'puid': {'key': 'puid', 'type': 'str'}, - 'application_id': {'key': 'applicationId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreatedBy, self).__init__(**kwargs) - self.oid = None - self.puid = None - self.application_id = None - - -class Encryption(msrest.serialization.Model): - """The object that contains details of encryption used on the workspace. - - :param key_source: The encryption keySource (provider). Possible values (case-insensitive): - Default, Microsoft.Keyvault. Possible values include: "Default", "Microsoft.Keyvault". Default - value: "Default". - :type key_source: str or ~azure_databricks_management_client.models.KeySource - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str - """ - - _attribute_map = { - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'key_name': {'key': 'KeyName', 'type': 'str'}, - 'key_version': {'key': 'keyversion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyvaulturi', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Encryption, self).__init__(**kwargs) - self.key_source = kwargs.get('key_source', "Default") - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - - -class EncryptionEntitiesDefinition(msrest.serialization.Model): - """Encryption entities for databricks workspace resource. - - :param managed_services: Encryption properties for the databricks managed services. - :type managed_services: ~azure_databricks_management_client.models.EncryptionV2 - """ - - _attribute_map = { - 'managed_services': {'key': 'managedServices', 'type': 'EncryptionV2'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionEntitiesDefinition, self).__init__(**kwargs) - self.managed_services = kwargs.get('managed_services', None) - - -class EncryptionV2(msrest.serialization.Model): - """The object that contains details of encryption used on the workspace. - - All required parameters must be populated in order to send to Azure. - - :param key_source: Required. The encryption keySource (provider). Possible values - (case-insensitive): Microsoft.Keyvault. Possible values include: "Microsoft.Keyvault". - :type key_source: str or ~azure_databricks_management_client.models.EncryptionKeySource - :param key_vault_properties: Key Vault input properties for encryption. - :type key_vault_properties: - ~azure_databricks_management_client.models.EncryptionV2KeyVaultProperties - """ - - _validation = { - 'key_source': {'required': True}, - } - - _attribute_map = { - 'key_source': {'key': 'keySource', 'type': 'str'}, - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'EncryptionV2KeyVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionV2, self).__init__(**kwargs) - self.key_source = kwargs['key_source'] - self.key_vault_properties = kwargs.get('key_vault_properties', None) - - -class EncryptionV2KeyVaultProperties(msrest.serialization.Model): - """Key Vault input properties for encryption. - - All required parameters must be populated in order to send to Azure. - - :param key_vault_uri: Required. The Uri of KeyVault. - :type key_vault_uri: str - :param key_name: Required. The name of KeyVault key. - :type key_name: str - :param key_version: Required. The version of KeyVault key. - :type key_version: str - """ - - _validation = { - 'key_vault_uri': {'required': True}, - 'key_name': {'required': True}, - 'key_version': {'required': True}, - } - - _attribute_map = { - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'key_version': {'key': 'keyVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionV2KeyVaultProperties, self).__init__(**kwargs) - self.key_vault_uri = kwargs['key_vault_uri'] - self.key_name = kwargs['key_name'] - self.key_version = kwargs['key_version'] - - -class ErrorDetail(msrest.serialization.Model): - """Error details. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. The error's code. - :type code: str - :param message: Required. A human readable error message. - :type message: str - :param target: Indicates which property in the request is responsible for the error. - :type target: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.target = kwargs.get('target', None) - - -class ErrorInfo(msrest.serialization.Model): - """The code and message for an error. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. A machine readable error code. - :type code: str - :param message: Required. A human readable error message. - :type message: str - :param details: error details. - :type details: list[~azure_databricks_management_client.models.ErrorDetail] - :param innererror: Inner error details if they exist. - :type innererror: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'innererror': {'key': 'innererror', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorInfo, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.details = kwargs.get('details', None) - self.innererror = kwargs.get('innererror', None) - - -class ErrorResponse(msrest.serialization.Model): - """Contains details when the response code indicates an error. - - All required parameters must be populated in order to send to Azure. - - :param error: Required. The error details. - :type error: ~azure_databricks_management_client.models.ErrorInfo - """ - - _validation = { - 'error': {'required': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs['error'] - - -class Resource(msrest.serialization.Model): - """The core properties of ARM resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class GroupIdInformation(Resource): - """The group information for creating a private endpoint on a workspace. - - 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: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :vartype type: str - :param properties: Required. The group id properties. - :type properties: ~azure_databricks_management_client.models.GroupIdInformationProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'GroupIdInformationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(GroupIdInformation, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class GroupIdInformationProperties(msrest.serialization.Model): - """The properties for a group information object. - - :param group_id: The group id. - :type group_id: str - :param required_members: The required members for a specific group id. - :type required_members: list[str] - :param required_zone_names: The required DNS zones for a specific group id. - :type required_zone_names: list[str] - """ - - _attribute_map = { - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(GroupIdInformationProperties, self).__init__(**kwargs) - self.group_id = kwargs.get('group_id', None) - self.required_members = kwargs.get('required_members', None) - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class ManagedIdentityConfiguration(msrest.serialization.Model): - """The Managed Identity details for storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The objectId of the Managed Identity that is linked to the Managed Storage - account. - :vartype principal_id: str - :ivar tenant_id: The tenant Id where the Managed Identity is created. - :vartype tenant_id: str - :ivar type: The type of Identity created. It can be either SystemAssigned or UserAssigned. - :vartype type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIdentityConfiguration, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = None - - -class Operation(msrest.serialization.Model): - """REST API operation. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that represents the operation. - :type display: ~azure_databricks_management_client.models.OperationDisplay - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - - -class OperationDisplay(msrest.serialization.Model): - """The object that represents the operation. - - :param provider: Service provider: Microsoft.ResourceProvider. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Operation type: Read, write, delete, etc. - :type operation: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Resource Provider operations supported by the Resource Provider resource - provider. - :type value: list[~azure_databricks_management_client.models.Operation] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The private endpoint property of a private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(msrest.serialization.Model): - """The private endpoint connection of a workspace. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param properties: Required. The private endpoint connection properties. - :type properties: - ~azure_databricks_management_client.models.PrivateEndpointConnectionProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = kwargs['properties'] - - -class PrivateEndpointConnectionProperties(msrest.serialization.Model): - """The properties of a private endpoint connection. - - 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 private_endpoint: Private endpoint. - :type private_endpoint: ~azure_databricks_management_client.models.PrivateEndpoint - :param private_link_service_connection_state: Required. Private endpoint connection state. - :type private_link_service_connection_state: - ~azure_databricks_management_client.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure_databricks_management_client.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'private_link_service_connection_state': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs['private_link_service_connection_state'] - self.provisioning_state = None - - -class PrivateEndpointConnectionsList(msrest.serialization.Model): - """List of private link connections. - - :param value: The list of returned private endpoint connection. - :type value: list[~azure_databricks_management_client.models.PrivateEndpointConnection] - :param next_link: The URL to get the next set of endpoint connections. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionsList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkResourcesList(msrest.serialization.Model): - """The available private link resources for a workspace. - - :param value: The list of available private link resources for a workspace. - :type value: list[~azure_databricks_management_client.models.GroupIdInformation] - :param next_link: The URL to get the next set of private link resources. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GroupIdInformation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourcesList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """The current state of a private endpoint connection. - - All required parameters must be populated in order to send to Azure. - - :param status: Required. The status of a private endpoint connection. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or - ~azure_databricks_management_client.models.PrivateLinkServiceConnectionStatus - :param description: The description for the current state of a private endpoint connection. - :type description: str - :param action_required: Actions required for a private endpoint connection. - :type action_required: str - """ - - _validation = { - 'status': {'required': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs['status'] - self.description = kwargs.get('description', None) - self.action_required = kwargs.get('action_required', None) - - -class Sku(msrest.serialization.Model): - """SKU for the resource. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The SKU name. - :type name: str - :param tier: The SKU tier. - :type tier: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = kwargs.get('tier', 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_databricks_management_client.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_databricks_management_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :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 TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class VirtualNetworkPeering(msrest.serialization.Model): - """Peerings in a VirtualNetwork resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Name of the virtual network peering resource. - :vartype name: str - :ivar id: Resource ID. - :vartype id: str - :ivar type: type of the virtual network peering resource. - :vartype type: str - :param allow_virtual_network_access: Whether the VMs in the local virtual network space would - be able to access the VMs in remote virtual network space. - :type allow_virtual_network_access: bool - :param allow_forwarded_traffic: Whether the forwarded traffic from the VMs in the local virtual - network will be allowed/disallowed in remote virtual network. - :type allow_forwarded_traffic: bool - :param allow_gateway_transit: If gateway links can be used in remote virtual networking to link - to this virtual network. - :type allow_gateway_transit: bool - :param use_remote_gateways: If remote gateways can be used on this virtual network. If the flag - is set to true, and allowGatewayTransit on remote peering is also true, virtual network will - use gateways of remote virtual network for transit. Only one peering can have this flag set to - true. This flag cannot be set if virtual network already has a gateway. - :type use_remote_gateways: bool - :param databricks_virtual_network: The remote virtual network should be in the same region. See - here to learn more - (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). - :type databricks_virtual_network: - ~azure_databricks_management_client.models.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork - :param databricks_address_space: The reference to the databricks virtual network address space. - :type databricks_address_space: ~azure_databricks_management_client.models.AddressSpace - :param remote_virtual_network: Required. The remote virtual network should be in the same - region. See here to learn more - (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). - :type remote_virtual_network: - ~azure_databricks_management_client.models.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork - :param remote_address_space: The reference to the remote virtual network address space. - :type remote_address_space: ~azure_databricks_management_client.models.AddressSpace - :ivar peering_state: The status of the virtual network peering. Possible values include: - "Initiated", "Connected", "Disconnected". - :vartype peering_state: str or ~azure_databricks_management_client.models.PeeringState - :ivar provisioning_state: The provisioning state of the virtual network peering resource. - Possible values include: "Succeeded", "Updating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure_databricks_management_client.models.PeeringProvisioningState - """ - - _validation = { - 'name': {'readonly': True}, - 'id': {'readonly': True}, - 'type': {'readonly': True}, - 'remote_virtual_network': {'required': True}, - 'peering_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'allow_virtual_network_access': {'key': 'properties.allowVirtualNetworkAccess', 'type': 'bool'}, - 'allow_forwarded_traffic': {'key': 'properties.allowForwardedTraffic', 'type': 'bool'}, - 'allow_gateway_transit': {'key': 'properties.allowGatewayTransit', 'type': 'bool'}, - 'use_remote_gateways': {'key': 'properties.useRemoteGateways', 'type': 'bool'}, - 'databricks_virtual_network': {'key': 'properties.databricksVirtualNetwork', 'type': 'VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork'}, - 'databricks_address_space': {'key': 'properties.databricksAddressSpace', 'type': 'AddressSpace'}, - 'remote_virtual_network': {'key': 'properties.remoteVirtualNetwork', 'type': 'VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork'}, - 'remote_address_space': {'key': 'properties.remoteAddressSpace', 'type': 'AddressSpace'}, - 'peering_state': {'key': 'properties.peeringState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkPeering, self).__init__(**kwargs) - self.name = None - self.id = None - self.type = None - self.allow_virtual_network_access = kwargs.get('allow_virtual_network_access', None) - self.allow_forwarded_traffic = kwargs.get('allow_forwarded_traffic', None) - self.allow_gateway_transit = kwargs.get('allow_gateway_transit', None) - self.use_remote_gateways = kwargs.get('use_remote_gateways', None) - self.databricks_virtual_network = kwargs.get('databricks_virtual_network', None) - self.databricks_address_space = kwargs.get('databricks_address_space', None) - self.remote_virtual_network = kwargs['remote_virtual_network'] - self.remote_address_space = kwargs.get('remote_address_space', None) - self.peering_state = None - self.provisioning_state = None - - -class VirtualNetworkPeeringList(msrest.serialization.Model): - """Gets all virtual network peerings under a workspace. - - :param value: List of virtual network peerings on workspace. - :type value: list[~azure_databricks_management_client.models.VirtualNetworkPeering] - :param next_link: URL to get the next set of virtual network peering list results if there are - any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VirtualNetworkPeering]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkPeeringList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork(msrest.serialization.Model): - """The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). - - :param id: The Id of the databricks virtual network. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork(msrest.serialization.Model): - """The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). - - :param id: The Id of the remote virtual network. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class Workspace(TrackedResource): - """Information about workspace. - - 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: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param sku: The SKU of the resource. - :type sku: ~azure_databricks_management_client.models.Sku - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure_databricks_management_client.models.SystemData - :param managed_resource_group_id: Required. The managed resource group Id. - :type managed_resource_group_id: str - :param parameters: The workspace's custom parameters. - :type parameters: ~azure_databricks_management_client.models.WorkspaceCustomParameters - :ivar provisioning_state: The workspace provisioning state. Possible values include: - "Accepted", "Running", "Ready", "Creating", "Created", "Deleting", "Deleted", "Canceled", - "Failed", "Succeeded", "Updating". - :vartype provisioning_state: str or - ~azure_databricks_management_client.models.ProvisioningState - :param ui_definition_uri: The blob URI where the UI definition file is located. - :type ui_definition_uri: str - :param authorizations: The workspace provider authorizations. - :type authorizations: - list[~azure_databricks_management_client.models.WorkspaceProviderAuthorization] - :param created_by: Indicates the Object ID, PUID and Application ID of entity that created the - workspace. - :type created_by: ~azure_databricks_management_client.models.CreatedBy - :param updated_by: Indicates the Object ID, PUID and Application ID of entity that last updated - the workspace. - :type updated_by: ~azure_databricks_management_client.models.CreatedBy - :ivar created_date_time: Specifies the date and time when the workspace is created. - :vartype created_date_time: ~datetime.datetime - :ivar workspace_id: The unique identifier of the databricks workspace in databricks control - plane. - :vartype workspace_id: str - :ivar workspace_url: The workspace URL which is of the format - 'adb-{workspaceId}.{random}.azuredatabricks.net'. - :vartype workspace_url: str - :param storage_account_identity: The details of Managed Identity of Storage Account. - :type storage_account_identity: - ~azure_databricks_management_client.models.ManagedIdentityConfiguration - :param encryption: Encryption properties for databricks workspace. - :type encryption: ~azure_databricks_management_client.models.WorkspacePropertiesEncryption - :ivar private_endpoint_connections: Private endpoint connections created on the workspace. - :vartype private_endpoint_connections: - list[~azure_databricks_management_client.models.PrivateEndpointConnection] - :param public_network_access: The network access type for accessing workspace. Set value to - disabled to access workspace only via private link. Possible values include: "Enabled", - "Disabled". - :type public_network_access: str or - ~azure_databricks_management_client.models.PublicNetworkAccess - :param required_nsg_rules: Gets or sets a value indicating whether data plane (clusters) to - control plane communication happen over private endpoint. Supported values are 'AllRules' and - 'NoAzureDatabricksRules'. 'NoAzureServiceRules' value is for internal use only. Possible values - include: "AllRules", "NoAzureDatabricksRules", "NoAzureServiceRules". - :type required_nsg_rules: str or ~azure_databricks_management_client.models.RequiredNsgRules - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'managed_resource_group_id': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'created_date_time': {'readonly': True}, - 'workspace_id': {'readonly': True}, - 'workspace_url': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'managed_resource_group_id': {'key': 'properties.managedResourceGroupId', 'type': 'str'}, - 'parameters': {'key': 'properties.parameters', 'type': 'WorkspaceCustomParameters'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'ui_definition_uri': {'key': 'properties.uiDefinitionUri', 'type': 'str'}, - 'authorizations': {'key': 'properties.authorizations', 'type': '[WorkspaceProviderAuthorization]'}, - 'created_by': {'key': 'properties.createdBy', 'type': 'CreatedBy'}, - 'updated_by': {'key': 'properties.updatedBy', 'type': 'CreatedBy'}, - 'created_date_time': {'key': 'properties.createdDateTime', 'type': 'iso-8601'}, - 'workspace_id': {'key': 'properties.workspaceId', 'type': 'str'}, - 'workspace_url': {'key': 'properties.workspaceUrl', 'type': 'str'}, - 'storage_account_identity': {'key': 'properties.storageAccountIdentity', 'type': 'ManagedIdentityConfiguration'}, - 'encryption': {'key': 'properties.encryption', 'type': 'WorkspacePropertiesEncryption'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'required_nsg_rules': {'key': 'properties.requiredNsgRules', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Workspace, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.system_data = None - self.managed_resource_group_id = kwargs['managed_resource_group_id'] - self.parameters = kwargs.get('parameters', None) - self.provisioning_state = None - self.ui_definition_uri = kwargs.get('ui_definition_uri', None) - self.authorizations = kwargs.get('authorizations', None) - self.created_by = kwargs.get('created_by', None) - self.updated_by = kwargs.get('updated_by', None) - self.created_date_time = None - self.workspace_id = None - self.workspace_url = None - self.storage_account_identity = kwargs.get('storage_account_identity', None) - self.encryption = kwargs.get('encryption', None) - self.private_endpoint_connections = None - self.public_network_access = kwargs.get('public_network_access', None) - self.required_nsg_rules = kwargs.get('required_nsg_rules', None) - - -class WorkspaceCustomBooleanParameter(msrest.serialization.Model): - """The value which should be used for this field. - - 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 type: The type of variable that this is. Possible values include: "Bool", "Object", - "String". - :vartype type: str or ~azure_databricks_management_client.models.CustomParameterType - :param value: Required. The value which should be used for this field. - :type value: bool - """ - - _validation = { - 'type': {'readonly': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceCustomBooleanParameter, self).__init__(**kwargs) - self.type = None - self.value = kwargs['value'] - - -class WorkspaceCustomObjectParameter(msrest.serialization.Model): - """The value which should be used for this field. - - 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 type: The type of variable that this is. Possible values include: "Bool", "Object", - "String". - :vartype type: str or ~azure_databricks_management_client.models.CustomParameterType - :param value: Required. The value which should be used for this field. - :type value: any - """ - - _validation = { - 'type': {'readonly': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceCustomObjectParameter, self).__init__(**kwargs) - self.type = None - self.value = kwargs['value'] - - -class WorkspaceCustomParameters(msrest.serialization.Model): - """Custom Parameters used for Cluster Creation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param aml_workspace_id: The ID of a Azure Machine Learning workspace to link with Databricks - workspace. - :type aml_workspace_id: - ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param custom_virtual_network_id: The ID of a Virtual Network where this Databricks Cluster - should be created. - :type custom_virtual_network_id: - ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param custom_public_subnet_name: The name of a Public Subnet within the Virtual Network. - :type custom_public_subnet_name: - ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param custom_private_subnet_name: The name of the Private Subnet within the Virtual Network. - :type custom_private_subnet_name: - ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param enable_no_public_ip: Should the Public IP be Disabled?. - :type enable_no_public_ip: - ~azure_databricks_management_client.models.WorkspaceCustomBooleanParameter - :param load_balancer_backend_pool_name: Name of the outbound Load Balancer Backend Pool for - Secure Cluster Connectivity (No Public IP). - :type load_balancer_backend_pool_name: - ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param load_balancer_id: Resource URI of Outbound Load balancer for Secure Cluster Connectivity - (No Public IP) workspace. - :type load_balancer_id: - ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param nat_gateway_name: Name of the NAT gateway for Secure Cluster Connectivity (No Public IP) - workspace subnets. - :type nat_gateway_name: - ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param public_ip_name: Name of the Public IP for No Public IP workspace with managed vNet. - :type public_ip_name: ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param prepare_encryption: Prepare the workspace for encryption. Enables the Managed Identity - for managed storage account. - :type prepare_encryption: - ~azure_databricks_management_client.models.WorkspaceCustomBooleanParameter - :param encryption: Contains the encryption details for Customer-Managed Key (CMK) enabled - workspace. - :type encryption: ~azure_databricks_management_client.models.WorkspaceEncryptionParameter - :param require_infrastructure_encryption: A boolean indicating whether or not the DBFS root - file system will be enabled with secondary layer of encryption with platform managed keys for - data at rest. - :type require_infrastructure_encryption: - ~azure_databricks_management_client.models.WorkspaceCustomBooleanParameter - :param storage_account_name: Default DBFS storage account name. - :type storage_account_name: - ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param storage_account_sku_name: Storage account SKU name, ex: Standard_GRS, Standard_LRS. - Refer https://aka.ms/storageskus for valid inputs. - :type storage_account_sku_name: - ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param vnet_address_prefix: Address prefix for Managed virtual network. Default value for this - input is 10.139. - :type vnet_address_prefix: - ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :ivar resource_tags: Tags applied to resources under Managed resource group. These can be - updated by updating tags at workspace level. - :vartype resource_tags: - ~azure_databricks_management_client.models.WorkspaceCustomObjectParameter - """ - - _validation = { - 'resource_tags': {'readonly': True}, - } - - _attribute_map = { - 'aml_workspace_id': {'key': 'amlWorkspaceId', 'type': 'WorkspaceCustomStringParameter'}, - 'custom_virtual_network_id': {'key': 'customVirtualNetworkId', 'type': 'WorkspaceCustomStringParameter'}, - 'custom_public_subnet_name': {'key': 'customPublicSubnetName', 'type': 'WorkspaceCustomStringParameter'}, - 'custom_private_subnet_name': {'key': 'customPrivateSubnetName', 'type': 'WorkspaceCustomStringParameter'}, - 'enable_no_public_ip': {'key': 'enableNoPublicIp', 'type': 'WorkspaceCustomBooleanParameter'}, - 'load_balancer_backend_pool_name': {'key': 'loadBalancerBackendPoolName', 'type': 'WorkspaceCustomStringParameter'}, - 'load_balancer_id': {'key': 'loadBalancerId', 'type': 'WorkspaceCustomStringParameter'}, - 'nat_gateway_name': {'key': 'natGatewayName', 'type': 'WorkspaceCustomStringParameter'}, - 'public_ip_name': {'key': 'publicIpName', 'type': 'WorkspaceCustomStringParameter'}, - 'prepare_encryption': {'key': 'prepareEncryption', 'type': 'WorkspaceCustomBooleanParameter'}, - 'encryption': {'key': 'encryption', 'type': 'WorkspaceEncryptionParameter'}, - 'require_infrastructure_encryption': {'key': 'requireInfrastructureEncryption', 'type': 'WorkspaceCustomBooleanParameter'}, - 'storage_account_name': {'key': 'storageAccountName', 'type': 'WorkspaceCustomStringParameter'}, - 'storage_account_sku_name': {'key': 'storageAccountSkuName', 'type': 'WorkspaceCustomStringParameter'}, - 'vnet_address_prefix': {'key': 'vnetAddressPrefix', 'type': 'WorkspaceCustomStringParameter'}, - 'resource_tags': {'key': 'resourceTags', 'type': 'WorkspaceCustomObjectParameter'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceCustomParameters, self).__init__(**kwargs) - self.aml_workspace_id = kwargs.get('aml_workspace_id', None) - self.custom_virtual_network_id = kwargs.get('custom_virtual_network_id', None) - self.custom_public_subnet_name = kwargs.get('custom_public_subnet_name', None) - self.custom_private_subnet_name = kwargs.get('custom_private_subnet_name', None) - self.enable_no_public_ip = kwargs.get('enable_no_public_ip', None) - self.load_balancer_backend_pool_name = kwargs.get('load_balancer_backend_pool_name', None) - self.load_balancer_id = kwargs.get('load_balancer_id', None) - self.nat_gateway_name = kwargs.get('nat_gateway_name', None) - self.public_ip_name = kwargs.get('public_ip_name', None) - self.prepare_encryption = kwargs.get('prepare_encryption', None) - self.encryption = kwargs.get('encryption', None) - self.require_infrastructure_encryption = kwargs.get('require_infrastructure_encryption', None) - self.storage_account_name = kwargs.get('storage_account_name', None) - self.storage_account_sku_name = kwargs.get('storage_account_sku_name', None) - self.vnet_address_prefix = kwargs.get('vnet_address_prefix', None) - self.resource_tags = None - - -class WorkspaceCustomStringParameter(msrest.serialization.Model): - """The Value. - - 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 type: The type of variable that this is. Possible values include: "Bool", "Object", - "String". - :vartype type: str or ~azure_databricks_management_client.models.CustomParameterType - :param value: Required. The value which should be used for this field. - :type value: str - """ - - _validation = { - 'type': {'readonly': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceCustomStringParameter, self).__init__(**kwargs) - self.type = None - self.value = kwargs['value'] - - -class WorkspaceEncryptionParameter(msrest.serialization.Model): - """The object that contains details of encryption used on the workspace. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of variable that this is. Possible values include: "Bool", "Object", - "String". - :vartype type: str or ~azure_databricks_management_client.models.CustomParameterType - :param value: The value which should be used for this field. - :type value: ~azure_databricks_management_client.models.Encryption - """ - - _validation = { - 'type': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'Encryption'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceEncryptionParameter, self).__init__(**kwargs) - self.type = None - self.value = kwargs.get('value', None) - - -class WorkspaceListResult(msrest.serialization.Model): - """List of workspaces. - - :param value: The array of workspaces. - :type value: list[~azure_databricks_management_client.models.Workspace] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Workspace]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class WorkspacePropertiesEncryption(msrest.serialization.Model): - """Encryption properties for databricks workspace. - - All required parameters must be populated in order to send to Azure. - - :param entities: Required. Encryption entities definition for the workspace. - :type entities: ~azure_databricks_management_client.models.EncryptionEntitiesDefinition - """ - - _validation = { - 'entities': {'required': True}, - } - - _attribute_map = { - 'entities': {'key': 'entities', 'type': 'EncryptionEntitiesDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspacePropertiesEncryption, self).__init__(**kwargs) - self.entities = kwargs['entities'] - - -class WorkspaceProviderAuthorization(msrest.serialization.Model): - """The workspace provider authorization. - - All required parameters must be populated in order to send to Azure. - - :param principal_id: Required. The provider's principal identifier. This is the identity that - the provider will use to call ARM to manage the workspace resources. - :type principal_id: str - :param role_definition_id: Required. The provider's role definition identifier. This role will - define all the permissions that the provider must have on the workspace's container resource - group. This role definition cannot have permission to delete the resource group. - :type role_definition_id: str - """ - - _validation = { - 'principal_id': {'required': True}, - 'role_definition_id': {'required': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceProviderAuthorization, self).__init__(**kwargs) - self.principal_id = kwargs['principal_id'] - self.role_definition_id = kwargs['role_definition_id'] - - -class WorkspaceUpdate(msrest.serialization.Model): - """An update to a workspace. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_models_py3.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_models_py3.py index e8e7c355d599..6ff915e7a93c 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_models_py3.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/models/_models_py3.py @@ -18,9 +18,9 @@ class AddressSpace(msrest.serialization.Model): """AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network. - :param address_prefixes: A list of address blocks reserved for this virtual network in CIDR + :ivar address_prefixes: A list of address blocks reserved for this virtual network in CIDR notation. - :type address_prefixes: list[str] + :vartype address_prefixes: list[str] """ _attribute_map = { @@ -33,6 +33,11 @@ def __init__( address_prefixes: Optional[List[str]] = None, **kwargs ): + """ + :keyword address_prefixes: A list of address blocks reserved for this virtual network in CIDR + notation. + :paramtype address_prefixes: list[str] + """ super(AddressSpace, self).__init__(**kwargs) self.address_prefixes = address_prefixes @@ -67,6 +72,8 @@ def __init__( self, **kwargs ): + """ + """ super(CreatedBy, self).__init__(**kwargs) self.oid = None self.puid = None @@ -76,16 +83,16 @@ def __init__( class Encryption(msrest.serialization.Model): """The object that contains details of encryption used on the workspace. - :param key_source: The encryption keySource (provider). Possible values (case-insensitive): + :ivar key_source: The encryption keySource (provider). Possible values (case-insensitive): Default, Microsoft.Keyvault. Possible values include: "Default", "Microsoft.Keyvault". Default value: "Default". - :type key_source: str or ~azure_databricks_management_client.models.KeySource - :param key_name: The name of KeyVault key. - :type key_name: str - :param key_version: The version of KeyVault key. - :type key_version: str - :param key_vault_uri: The Uri of KeyVault. - :type key_vault_uri: str + :vartype key_source: str or ~azure_databricks_management_client.models.KeySource + :ivar key_name: The name of KeyVault key. + :vartype key_name: str + :ivar key_version: The version of KeyVault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of KeyVault. + :vartype key_vault_uri: str """ _attribute_map = { @@ -104,6 +111,18 @@ def __init__( key_vault_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_source: The encryption keySource (provider). Possible values (case-insensitive): + Default, Microsoft.Keyvault. Possible values include: "Default", "Microsoft.Keyvault". Default + value: "Default". + :paramtype key_source: str or ~azure_databricks_management_client.models.KeySource + :keyword key_name: The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: The version of KeyVault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of KeyVault. + :paramtype key_vault_uri: str + """ super(Encryption, self).__init__(**kwargs) self.key_source = key_source self.key_name = key_name @@ -114,8 +133,8 @@ def __init__( class EncryptionEntitiesDefinition(msrest.serialization.Model): """Encryption entities for databricks workspace resource. - :param managed_services: Encryption properties for the databricks managed services. - :type managed_services: ~azure_databricks_management_client.models.EncryptionV2 + :ivar managed_services: Encryption properties for the databricks managed services. + :vartype managed_services: ~azure_databricks_management_client.models.EncryptionV2 """ _attribute_map = { @@ -128,6 +147,10 @@ def __init__( managed_services: Optional["EncryptionV2"] = None, **kwargs ): + """ + :keyword managed_services: Encryption properties for the databricks managed services. + :paramtype managed_services: ~azure_databricks_management_client.models.EncryptionV2 + """ super(EncryptionEntitiesDefinition, self).__init__(**kwargs) self.managed_services = managed_services @@ -137,11 +160,11 @@ class EncryptionV2(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_source: Required. The encryption keySource (provider). Possible values + :ivar key_source: Required. The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Keyvault. Possible values include: "Microsoft.Keyvault". - :type key_source: str or ~azure_databricks_management_client.models.EncryptionKeySource - :param key_vault_properties: Key Vault input properties for encryption. - :type key_vault_properties: + :vartype key_source: str or ~azure_databricks_management_client.models.EncryptionKeySource + :ivar key_vault_properties: Key Vault input properties for encryption. + :vartype key_vault_properties: ~azure_databricks_management_client.models.EncryptionV2KeyVaultProperties """ @@ -161,6 +184,14 @@ def __init__( key_vault_properties: Optional["EncryptionV2KeyVaultProperties"] = None, **kwargs ): + """ + :keyword key_source: Required. The encryption keySource (provider). Possible values + (case-insensitive): Microsoft.Keyvault. Possible values include: "Microsoft.Keyvault". + :paramtype key_source: str or ~azure_databricks_management_client.models.EncryptionKeySource + :keyword key_vault_properties: Key Vault input properties for encryption. + :paramtype key_vault_properties: + ~azure_databricks_management_client.models.EncryptionV2KeyVaultProperties + """ super(EncryptionV2, self).__init__(**kwargs) self.key_source = key_source self.key_vault_properties = key_vault_properties @@ -171,12 +202,12 @@ class EncryptionV2KeyVaultProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_vault_uri: Required. The Uri of KeyVault. - :type key_vault_uri: str - :param key_name: Required. The name of KeyVault key. - :type key_name: str - :param key_version: Required. The version of KeyVault key. - :type key_version: str + :ivar key_vault_uri: Required. The Uri of KeyVault. + :vartype key_vault_uri: str + :ivar key_name: Required. The name of KeyVault key. + :vartype key_name: str + :ivar key_version: Required. The version of KeyVault key. + :vartype key_version: str """ _validation = { @@ -199,23 +230,113 @@ def __init__( key_version: str, **kwargs ): + """ + :keyword key_vault_uri: Required. The Uri of KeyVault. + :paramtype key_vault_uri: str + :keyword key_name: Required. The name of KeyVault key. + :paramtype key_name: str + :keyword key_version: Required. The version of KeyVault key. + :paramtype key_version: str + """ super(EncryptionV2KeyVaultProperties, self).__init__(**kwargs) self.key_vault_uri = key_vault_uri self.key_name = key_name self.key_version = key_version +class EndpointDependency(msrest.serialization.Model): + """A domain name or IP address the Workspace is reaching at. + + :ivar domain_name: The domain name of the dependency. + :vartype domain_name: str + :ivar endpoint_details: The Ports used when connecting to domainName. + :vartype endpoint_details: list[~azure_databricks_management_client.models.EndpointDetail] + """ + + _attribute_map = { + 'domain_name': {'key': 'domainName', 'type': 'str'}, + 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + } + + def __init__( + self, + *, + domain_name: Optional[str] = None, + endpoint_details: Optional[List["EndpointDetail"]] = None, + **kwargs + ): + """ + :keyword domain_name: The domain name of the dependency. + :paramtype domain_name: str + :keyword endpoint_details: The Ports used when connecting to domainName. + :paramtype endpoint_details: list[~azure_databricks_management_client.models.EndpointDetail] + """ + super(EndpointDependency, self).__init__(**kwargs) + self.domain_name = domain_name + self.endpoint_details = endpoint_details + + +class EndpointDetail(msrest.serialization.Model): + """Connect information from the Workspace to a single endpoint. + + :ivar ip_address: An IP Address that Domain Name currently resolves to. + :vartype ip_address: str + :ivar port: The port an endpoint is connected to. + :vartype port: int + :ivar latency: The time in milliseconds it takes for the connection to be created from the + Workspace to this IpAddress at this Port. + :vartype latency: float + :ivar is_accessible: Whether it is possible to create a connection from the Workspace to this + IpAddress at this Port. + :vartype is_accessible: bool + """ + + _attribute_map = { + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + 'latency': {'key': 'latency', 'type': 'float'}, + 'is_accessible': {'key': 'isAccessible', 'type': 'bool'}, + } + + def __init__( + self, + *, + ip_address: Optional[str] = None, + port: Optional[int] = None, + latency: Optional[float] = None, + is_accessible: Optional[bool] = None, + **kwargs + ): + """ + :keyword ip_address: An IP Address that Domain Name currently resolves to. + :paramtype ip_address: str + :keyword port: The port an endpoint is connected to. + :paramtype port: int + :keyword latency: The time in milliseconds it takes for the connection to be created from the + Workspace to this IpAddress at this Port. + :paramtype latency: float + :keyword is_accessible: Whether it is possible to create a connection from the Workspace to + this IpAddress at this Port. + :paramtype is_accessible: bool + """ + super(EndpointDetail, self).__init__(**kwargs) + self.ip_address = ip_address + self.port = port + self.latency = latency + self.is_accessible = is_accessible + + class ErrorDetail(msrest.serialization.Model): """Error details. All required parameters must be populated in order to send to Azure. - :param code: Required. The error's code. - :type code: str - :param message: Required. A human readable error message. - :type message: str - :param target: Indicates which property in the request is responsible for the error. - :type target: str + :ivar code: Required. The error's code. + :vartype code: str + :ivar message: Required. A human readable error message. + :vartype message: str + :ivar target: Indicates which property in the request is responsible for the error. + :vartype target: str """ _validation = { @@ -237,6 +358,14 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword code: Required. The error's code. + :paramtype code: str + :keyword message: Required. A human readable error message. + :paramtype message: str + :keyword target: Indicates which property in the request is responsible for the error. + :paramtype target: str + """ super(ErrorDetail, self).__init__(**kwargs) self.code = code self.message = message @@ -248,14 +377,14 @@ class ErrorInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. A machine readable error code. - :type code: str - :param message: Required. A human readable error message. - :type message: str - :param details: error details. - :type details: list[~azure_databricks_management_client.models.ErrorDetail] - :param innererror: Inner error details if they exist. - :type innererror: str + :ivar code: Required. A machine readable error code. + :vartype code: str + :ivar message: Required. A human readable error message. + :vartype message: str + :ivar details: error details. + :vartype details: list[~azure_databricks_management_client.models.ErrorDetail] + :ivar innererror: Inner error details if they exist. + :vartype innererror: str """ _validation = { @@ -279,6 +408,16 @@ def __init__( innererror: Optional[str] = None, **kwargs ): + """ + :keyword code: Required. A machine readable error code. + :paramtype code: str + :keyword message: Required. A human readable error message. + :paramtype message: str + :keyword details: error details. + :paramtype details: list[~azure_databricks_management_client.models.ErrorDetail] + :keyword innererror: Inner error details if they exist. + :paramtype innererror: str + """ super(ErrorInfo, self).__init__(**kwargs) self.code = code self.message = message @@ -291,8 +430,8 @@ class ErrorResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param error: Required. The error details. - :type error: ~azure_databricks_management_client.models.ErrorInfo + :ivar error: Required. The error details. + :vartype error: ~azure_databricks_management_client.models.ErrorInfo """ _validation = { @@ -309,6 +448,10 @@ def __init__( error: "ErrorInfo", **kwargs ): + """ + :keyword error: Required. The error details. + :paramtype error: ~azure_databricks_management_client.models.ErrorInfo + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -344,6 +487,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -365,8 +510,8 @@ class GroupIdInformation(Resource): :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. :vartype type: str - :param properties: Required. The group id properties. - :type properties: ~azure_databricks_management_client.models.GroupIdInformationProperties + :ivar properties: Required. The group id properties. + :vartype properties: ~azure_databricks_management_client.models.GroupIdInformationProperties """ _validation = { @@ -389,6 +534,10 @@ def __init__( properties: "GroupIdInformationProperties", **kwargs ): + """ + :keyword properties: Required. The group id properties. + :paramtype properties: ~azure_databricks_management_client.models.GroupIdInformationProperties + """ super(GroupIdInformation, self).__init__(**kwargs) self.properties = properties @@ -396,12 +545,12 @@ def __init__( class GroupIdInformationProperties(msrest.serialization.Model): """The properties for a group information object. - :param group_id: The group id. - :type group_id: str - :param required_members: The required members for a specific group id. - :type required_members: list[str] - :param required_zone_names: The required DNS zones for a specific group id. - :type required_zone_names: list[str] + :ivar group_id: The group id. + :vartype group_id: str + :ivar required_members: The required members for a specific group id. + :vartype required_members: list[str] + :ivar required_zone_names: The required DNS zones for a specific group id. + :vartype required_zone_names: list[str] """ _attribute_map = { @@ -418,6 +567,14 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword group_id: The group id. + :paramtype group_id: str + :keyword required_members: The required members for a specific group id. + :paramtype required_members: list[str] + :keyword required_zone_names: The required DNS zones for a specific group id. + :paramtype required_zone_names: list[str] + """ super(GroupIdInformationProperties, self).__init__(**kwargs) self.group_id = group_id self.required_members = required_members @@ -454,6 +611,8 @@ def __init__( self, **kwargs ): + """ + """ super(ManagedIdentityConfiguration, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -463,10 +622,10 @@ def __init__( class Operation(msrest.serialization.Model): """REST API operation. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that represents the operation. - :type display: ~azure_databricks_management_client.models.OperationDisplay + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~azure_databricks_management_client.models.OperationDisplay """ _attribute_map = { @@ -481,6 +640,12 @@ def __init__( display: Optional["OperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that represents the operation. + :paramtype display: ~azure_databricks_management_client.models.OperationDisplay + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -489,12 +654,12 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that represents the operation. - :param provider: Service provider: Microsoft.ResourceProvider. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Operation type: Read, write, delete, etc. - :type operation: str + :ivar provider: Service provider: Microsoft.ResourceProvider. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str """ _attribute_map = { @@ -511,6 +676,14 @@ def __init__( operation: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft.ResourceProvider. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Operation type: Read, write, delete, etc. + :paramtype operation: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -520,11 +693,11 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Resource Provider operations supported by the Resource Provider resource + :ivar value: List of Resource Provider operations supported by the Resource Provider resource provider. - :type value: list[~azure_databricks_management_client.models.Operation] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str + :vartype value: list[~azure_databricks_management_client.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { @@ -539,11 +712,52 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of Resource Provider operations supported by the Resource Provider + resource provider. + :paramtype value: list[~azure_databricks_management_client.models.Operation] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link +class OutboundEnvironmentEndpoint(msrest.serialization.Model): + """Egress endpoints which Workspace connects to for common purposes. + + :ivar category: The category of endpoints accessed by the Workspace, e.g. azure-storage, + azure-mysql, etc. + :vartype category: str + :ivar endpoints: The endpoints that Workspace connect to. + :vartype endpoints: list[~azure_databricks_management_client.models.EndpointDependency] + """ + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + } + + def __init__( + self, + *, + category: Optional[str] = None, + endpoints: Optional[List["EndpointDependency"]] = None, + **kwargs + ): + """ + :keyword category: The category of endpoints accessed by the Workspace, e.g. azure-storage, + azure-mysql, etc. + :paramtype category: str + :keyword endpoints: The endpoints that Workspace connect to. + :paramtype endpoints: list[~azure_databricks_management_client.models.EndpointDependency] + """ + super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + self.category = category + self.endpoints = endpoints + + class PrivateEndpoint(msrest.serialization.Model): """The private endpoint property of a private endpoint connection. @@ -565,6 +779,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -582,8 +798,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :param properties: Required. The private endpoint connection properties. - :type properties: + :ivar properties: Required. The private endpoint connection properties. + :vartype properties: ~azure_databricks_management_client.models.PrivateEndpointConnectionProperties """ @@ -607,6 +823,11 @@ def __init__( properties: "PrivateEndpointConnectionProperties", **kwargs ): + """ + :keyword properties: Required. The private endpoint connection properties. + :paramtype properties: + ~azure_databricks_management_client.models.PrivateEndpointConnectionProperties + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.id = None self.name = None @@ -621,10 +842,10 @@ class PrivateEndpointConnectionProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param private_endpoint: Private endpoint. - :type private_endpoint: ~azure_databricks_management_client.models.PrivateEndpoint - :param private_link_service_connection_state: Required. Private endpoint connection state. - :type private_link_service_connection_state: + :ivar private_endpoint: Private endpoint. + :vartype private_endpoint: ~azure_databricks_management_client.models.PrivateEndpoint + :ivar private_link_service_connection_state: Required. Private endpoint connection state. + :vartype private_link_service_connection_state: ~azure_databricks_management_client.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed". @@ -650,6 +871,13 @@ def __init__( private_endpoint: Optional["PrivateEndpoint"] = None, **kwargs ): + """ + :keyword private_endpoint: Private endpoint. + :paramtype private_endpoint: ~azure_databricks_management_client.models.PrivateEndpoint + :keyword private_link_service_connection_state: Required. Private endpoint connection state. + :paramtype private_link_service_connection_state: + ~azure_databricks_management_client.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -659,10 +887,10 @@ def __init__( class PrivateEndpointConnectionsList(msrest.serialization.Model): """List of private link connections. - :param value: The list of returned private endpoint connection. - :type value: list[~azure_databricks_management_client.models.PrivateEndpointConnection] - :param next_link: The URL to get the next set of endpoint connections. - :type next_link: str + :ivar value: The list of returned private endpoint connection. + :vartype value: list[~azure_databricks_management_client.models.PrivateEndpointConnection] + :ivar next_link: The URL to get the next set of endpoint connections. + :vartype next_link: str """ _attribute_map = { @@ -677,6 +905,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of returned private endpoint connection. + :paramtype value: list[~azure_databricks_management_client.models.PrivateEndpointConnection] + :keyword next_link: The URL to get the next set of endpoint connections. + :paramtype next_link: str + """ super(PrivateEndpointConnectionsList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -685,10 +919,10 @@ def __init__( class PrivateLinkResourcesList(msrest.serialization.Model): """The available private link resources for a workspace. - :param value: The list of available private link resources for a workspace. - :type value: list[~azure_databricks_management_client.models.GroupIdInformation] - :param next_link: The URL to get the next set of private link resources. - :type next_link: str + :ivar value: The list of available private link resources for a workspace. + :vartype value: list[~azure_databricks_management_client.models.GroupIdInformation] + :ivar next_link: The URL to get the next set of private link resources. + :vartype next_link: str """ _attribute_map = { @@ -703,6 +937,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of available private link resources for a workspace. + :paramtype value: list[~azure_databricks_management_client.models.GroupIdInformation] + :keyword next_link: The URL to get the next set of private link resources. + :paramtype next_link: str + """ super(PrivateLinkResourcesList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -713,14 +953,14 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. The status of a private endpoint connection. Possible values include: + :ivar status: Required. The status of a private endpoint connection. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or + :vartype status: str or ~azure_databricks_management_client.models.PrivateLinkServiceConnectionStatus - :param description: The description for the current state of a private endpoint connection. - :type description: str - :param action_required: Actions required for a private endpoint connection. - :type action_required: str + :ivar description: The description for the current state of a private endpoint connection. + :vartype description: str + :ivar action_required: Actions required for a private endpoint connection. + :vartype action_required: str """ _validation = { @@ -741,6 +981,16 @@ def __init__( action_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Required. The status of a private endpoint connection. Possible values + include: "Pending", "Approved", "Rejected", "Disconnected". + :paramtype status: str or + ~azure_databricks_management_client.models.PrivateLinkServiceConnectionStatus + :keyword description: The description for the current state of a private endpoint connection. + :paramtype description: str + :keyword action_required: Actions required for a private endpoint connection. + :paramtype action_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -752,10 +1002,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The SKU name. - :type name: str - :param tier: The SKU tier. - :type tier: str + :ivar name: Required. The SKU name. + :vartype name: str + :ivar tier: The SKU tier. + :vartype tier: str """ _validation = { @@ -774,6 +1024,12 @@ def __init__( tier: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. The SKU name. + :paramtype name: str + :keyword tier: The SKU tier. + :paramtype tier: str + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -782,20 +1038,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_databricks_management_client.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_databricks_management_client.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_databricks_management_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure_databricks_management_client.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -818,6 +1074,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_databricks_management_client.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_databricks_management_client.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -842,10 +1115,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -870,6 +1143,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -888,34 +1167,34 @@ class VirtualNetworkPeering(msrest.serialization.Model): :vartype id: str :ivar type: type of the virtual network peering resource. :vartype type: str - :param allow_virtual_network_access: Whether the VMs in the local virtual network space would - be able to access the VMs in remote virtual network space. - :type allow_virtual_network_access: bool - :param allow_forwarded_traffic: Whether the forwarded traffic from the VMs in the local virtual + :ivar allow_virtual_network_access: Whether the VMs in the local virtual network space would be + able to access the VMs in remote virtual network space. + :vartype allow_virtual_network_access: bool + :ivar allow_forwarded_traffic: Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network. - :type allow_forwarded_traffic: bool - :param allow_gateway_transit: If gateway links can be used in remote virtual networking to link + :vartype allow_forwarded_traffic: bool + :ivar allow_gateway_transit: If gateway links can be used in remote virtual networking to link to this virtual network. - :type allow_gateway_transit: bool - :param use_remote_gateways: If remote gateways can be used on this virtual network. If the flag + :vartype allow_gateway_transit: bool + :ivar use_remote_gateways: If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. - :type use_remote_gateways: bool - :param databricks_virtual_network: The remote virtual network should be in the same region. See + :vartype use_remote_gateways: bool + :ivar databricks_virtual_network: The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). - :type databricks_virtual_network: + :vartype databricks_virtual_network: ~azure_databricks_management_client.models.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork - :param databricks_address_space: The reference to the databricks virtual network address space. - :type databricks_address_space: ~azure_databricks_management_client.models.AddressSpace - :param remote_virtual_network: Required. The remote virtual network should be in the same + :ivar databricks_address_space: The reference to the databricks virtual network address space. + :vartype databricks_address_space: ~azure_databricks_management_client.models.AddressSpace + :ivar remote_virtual_network: Required. The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). - :type remote_virtual_network: + :vartype remote_virtual_network: ~azure_databricks_management_client.models.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork - :param remote_address_space: The reference to the remote virtual network address space. - :type remote_address_space: ~azure_databricks_management_client.models.AddressSpace + :ivar remote_address_space: The reference to the remote virtual network address space. + :vartype remote_address_space: ~azure_databricks_management_client.models.AddressSpace :ivar peering_state: The status of the virtual network peering. Possible values include: "Initiated", "Connected", "Disconnected". :vartype peering_state: str or ~azure_databricks_management_client.models.PeeringState @@ -963,6 +1242,37 @@ def __init__( remote_address_space: Optional["AddressSpace"] = None, **kwargs ): + """ + :keyword allow_virtual_network_access: Whether the VMs in the local virtual network space would + be able to access the VMs in remote virtual network space. + :paramtype allow_virtual_network_access: bool + :keyword allow_forwarded_traffic: Whether the forwarded traffic from the VMs in the local + virtual network will be allowed/disallowed in remote virtual network. + :paramtype allow_forwarded_traffic: bool + :keyword allow_gateway_transit: If gateway links can be used in remote virtual networking to + link to this virtual network. + :paramtype allow_gateway_transit: bool + :keyword use_remote_gateways: If remote gateways can be used on this virtual network. If the + flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network + will use gateways of remote virtual network for transit. Only one peering can have this flag + set to true. This flag cannot be set if virtual network already has a gateway. + :paramtype use_remote_gateways: bool + :keyword databricks_virtual_network: The remote virtual network should be in the same region. + See here to learn more + (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). + :paramtype databricks_virtual_network: + ~azure_databricks_management_client.models.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork + :keyword databricks_address_space: The reference to the databricks virtual network address + space. + :paramtype databricks_address_space: ~azure_databricks_management_client.models.AddressSpace + :keyword remote_virtual_network: Required. The remote virtual network should be in the same + region. See here to learn more + (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). + :paramtype remote_virtual_network: + ~azure_databricks_management_client.models.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork + :keyword remote_address_space: The reference to the remote virtual network address space. + :paramtype remote_address_space: ~azure_databricks_management_client.models.AddressSpace + """ super(VirtualNetworkPeering, self).__init__(**kwargs) self.name = None self.id = None @@ -982,11 +1292,11 @@ def __init__( class VirtualNetworkPeeringList(msrest.serialization.Model): """Gets all virtual network peerings under a workspace. - :param value: List of virtual network peerings on workspace. - :type value: list[~azure_databricks_management_client.models.VirtualNetworkPeering] - :param next_link: URL to get the next set of virtual network peering list results if there are + :ivar value: List of virtual network peerings on workspace. + :vartype value: list[~azure_databricks_management_client.models.VirtualNetworkPeering] + :ivar next_link: URL to get the next set of virtual network peering list results if there are any. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1001,6 +1311,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of virtual network peerings on workspace. + :paramtype value: list[~azure_databricks_management_client.models.VirtualNetworkPeering] + :keyword next_link: URL to get the next set of virtual network peering list results if there + are any. + :paramtype next_link: str + """ super(VirtualNetworkPeeringList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1009,8 +1326,8 @@ def __init__( class VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork(msrest.serialization.Model): """The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). - :param id: The Id of the databricks virtual network. - :type id: str + :ivar id: The Id of the databricks virtual network. + :vartype id: str """ _attribute_map = { @@ -1023,6 +1340,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The Id of the databricks virtual network. + :paramtype id: str + """ super(VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork, self).__init__(**kwargs) self.id = id @@ -1030,8 +1351,8 @@ def __init__( class VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork(msrest.serialization.Model): """The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). - :param id: The Id of the remote virtual network. - :type id: str + :ivar id: The Id of the remote virtual network. + :vartype id: str """ _attribute_map = { @@ -1044,6 +1365,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The Id of the remote virtual network. + :paramtype id: str + """ super(VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork, self).__init__(**kwargs) self.id = id @@ -1063,34 +1388,34 @@ class Workspace(TrackedResource): :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param sku: The SKU of the resource. - :type sku: ~azure_databricks_management_client.models.Sku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar sku: The SKU of the resource. + :vartype sku: ~azure_databricks_management_client.models.Sku :ivar system_data: The system metadata relating to this resource. :vartype system_data: ~azure_databricks_management_client.models.SystemData - :param managed_resource_group_id: Required. The managed resource group Id. - :type managed_resource_group_id: str - :param parameters: The workspace's custom parameters. - :type parameters: ~azure_databricks_management_client.models.WorkspaceCustomParameters + :ivar managed_resource_group_id: Required. The managed resource group Id. + :vartype managed_resource_group_id: str + :ivar parameters: The workspace's custom parameters. + :vartype parameters: ~azure_databricks_management_client.models.WorkspaceCustomParameters :ivar provisioning_state: The workspace provisioning state. Possible values include: "Accepted", "Running", "Ready", "Creating", "Created", "Deleting", "Deleted", "Canceled", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure_databricks_management_client.models.ProvisioningState - :param ui_definition_uri: The blob URI where the UI definition file is located. - :type ui_definition_uri: str - :param authorizations: The workspace provider authorizations. - :type authorizations: + :ivar ui_definition_uri: The blob URI where the UI definition file is located. + :vartype ui_definition_uri: str + :ivar authorizations: The workspace provider authorizations. + :vartype authorizations: list[~azure_databricks_management_client.models.WorkspaceProviderAuthorization] - :param created_by: Indicates the Object ID, PUID and Application ID of entity that created the + :ivar created_by: Indicates the Object ID, PUID and Application ID of entity that created the workspace. - :type created_by: ~azure_databricks_management_client.models.CreatedBy - :param updated_by: Indicates the Object ID, PUID and Application ID of entity that last updated + :vartype created_by: ~azure_databricks_management_client.models.CreatedBy + :ivar updated_by: Indicates the Object ID, PUID and Application ID of entity that last updated the workspace. - :type updated_by: ~azure_databricks_management_client.models.CreatedBy + :vartype updated_by: ~azure_databricks_management_client.models.CreatedBy :ivar created_date_time: Specifies the date and time when the workspace is created. :vartype created_date_time: ~datetime.datetime :ivar workspace_id: The unique identifier of the databricks workspace in databricks control @@ -1099,24 +1424,24 @@ class Workspace(TrackedResource): :ivar workspace_url: The workspace URL which is of the format 'adb-{workspaceId}.{random}.azuredatabricks.net'. :vartype workspace_url: str - :param storage_account_identity: The details of Managed Identity of Storage Account. - :type storage_account_identity: + :ivar storage_account_identity: The details of Managed Identity of Storage Account. + :vartype storage_account_identity: ~azure_databricks_management_client.models.ManagedIdentityConfiguration - :param encryption: Encryption properties for databricks workspace. - :type encryption: ~azure_databricks_management_client.models.WorkspacePropertiesEncryption + :ivar encryption: Encryption properties for databricks workspace. + :vartype encryption: ~azure_databricks_management_client.models.WorkspacePropertiesEncryption :ivar private_endpoint_connections: Private endpoint connections created on the workspace. :vartype private_endpoint_connections: list[~azure_databricks_management_client.models.PrivateEndpointConnection] - :param public_network_access: The network access type for accessing workspace. Set value to + :ivar public_network_access: The network access type for accessing workspace. Set value to disabled to access workspace only via private link. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or + :vartype public_network_access: str or ~azure_databricks_management_client.models.PublicNetworkAccess - :param required_nsg_rules: Gets or sets a value indicating whether data plane (clusters) to + :ivar required_nsg_rules: Gets or sets a value indicating whether data plane (clusters) to control plane communication happen over private endpoint. Supported values are 'AllRules' and 'NoAzureDatabricksRules'. 'NoAzureServiceRules' value is for internal use only. Possible values include: "AllRules", "NoAzureDatabricksRules", "NoAzureServiceRules". - :type required_nsg_rules: str or ~azure_databricks_management_client.models.RequiredNsgRules + :vartype required_nsg_rules: str or ~azure_databricks_management_client.models.RequiredNsgRules """ _validation = { @@ -1176,6 +1501,45 @@ def __init__( required_nsg_rules: Optional[Union[str, "RequiredNsgRules"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword sku: The SKU of the resource. + :paramtype sku: ~azure_databricks_management_client.models.Sku + :keyword managed_resource_group_id: Required. The managed resource group Id. + :paramtype managed_resource_group_id: str + :keyword parameters: The workspace's custom parameters. + :paramtype parameters: ~azure_databricks_management_client.models.WorkspaceCustomParameters + :keyword ui_definition_uri: The blob URI where the UI definition file is located. + :paramtype ui_definition_uri: str + :keyword authorizations: The workspace provider authorizations. + :paramtype authorizations: + list[~azure_databricks_management_client.models.WorkspaceProviderAuthorization] + :keyword created_by: Indicates the Object ID, PUID and Application ID of entity that created + the workspace. + :paramtype created_by: ~azure_databricks_management_client.models.CreatedBy + :keyword updated_by: Indicates the Object ID, PUID and Application ID of entity that last + updated the workspace. + :paramtype updated_by: ~azure_databricks_management_client.models.CreatedBy + :keyword storage_account_identity: The details of Managed Identity of Storage Account. + :paramtype storage_account_identity: + ~azure_databricks_management_client.models.ManagedIdentityConfiguration + :keyword encryption: Encryption properties for databricks workspace. + :paramtype encryption: ~azure_databricks_management_client.models.WorkspacePropertiesEncryption + :keyword public_network_access: The network access type for accessing workspace. Set value to + disabled to access workspace only via private link. Possible values include: "Enabled", + "Disabled". + :paramtype public_network_access: str or + ~azure_databricks_management_client.models.PublicNetworkAccess + :keyword required_nsg_rules: Gets or sets a value indicating whether data plane (clusters) to + control plane communication happen over private endpoint. Supported values are 'AllRules' and + 'NoAzureDatabricksRules'. 'NoAzureServiceRules' value is for internal use only. Possible values + include: "AllRules", "NoAzureDatabricksRules", "NoAzureServiceRules". + :paramtype required_nsg_rules: str or + ~azure_databricks_management_client.models.RequiredNsgRules + """ super(Workspace, self).__init__(tags=tags, location=location, **kwargs) self.sku = sku self.system_data = None @@ -1206,8 +1570,8 @@ class WorkspaceCustomBooleanParameter(msrest.serialization.Model): :ivar type: The type of variable that this is. Possible values include: "Bool", "Object", "String". :vartype type: str or ~azure_databricks_management_client.models.CustomParameterType - :param value: Required. The value which should be used for this field. - :type value: bool + :ivar value: Required. The value which should be used for this field. + :vartype value: bool """ _validation = { @@ -1226,6 +1590,10 @@ def __init__( value: bool, **kwargs ): + """ + :keyword value: Required. The value which should be used for this field. + :paramtype value: bool + """ super(WorkspaceCustomBooleanParameter, self).__init__(**kwargs) self.type = None self.value = value @@ -1241,8 +1609,8 @@ class WorkspaceCustomObjectParameter(msrest.serialization.Model): :ivar type: The type of variable that this is. Possible values include: "Bool", "Object", "String". :vartype type: str or ~azure_databricks_management_client.models.CustomParameterType - :param value: Required. The value which should be used for this field. - :type value: any + :ivar value: Required. The value which should be used for this field. + :vartype value: any """ _validation = { @@ -1261,6 +1629,10 @@ def __init__( value: Any, **kwargs ): + """ + :keyword value: Required. The value which should be used for this field. + :paramtype value: any + """ super(WorkspaceCustomObjectParameter, self).__init__(**kwargs) self.type = None self.value = value @@ -1271,59 +1643,60 @@ class WorkspaceCustomParameters(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param aml_workspace_id: The ID of a Azure Machine Learning workspace to link with Databricks + :ivar aml_workspace_id: The ID of a Azure Machine Learning workspace to link with Databricks workspace. - :type aml_workspace_id: + :vartype aml_workspace_id: ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param custom_virtual_network_id: The ID of a Virtual Network where this Databricks Cluster + :ivar custom_virtual_network_id: The ID of a Virtual Network where this Databricks Cluster should be created. - :type custom_virtual_network_id: + :vartype custom_virtual_network_id: ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param custom_public_subnet_name: The name of a Public Subnet within the Virtual Network. - :type custom_public_subnet_name: + :ivar custom_public_subnet_name: The name of a Public Subnet within the Virtual Network. + :vartype custom_public_subnet_name: ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param custom_private_subnet_name: The name of the Private Subnet within the Virtual Network. - :type custom_private_subnet_name: + :ivar custom_private_subnet_name: The name of the Private Subnet within the Virtual Network. + :vartype custom_private_subnet_name: ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param enable_no_public_ip: Should the Public IP be Disabled?. - :type enable_no_public_ip: + :ivar enable_no_public_ip: Should the Public IP be Disabled?. + :vartype enable_no_public_ip: ~azure_databricks_management_client.models.WorkspaceCustomBooleanParameter - :param load_balancer_backend_pool_name: Name of the outbound Load Balancer Backend Pool for + :ivar load_balancer_backend_pool_name: Name of the outbound Load Balancer Backend Pool for Secure Cluster Connectivity (No Public IP). - :type load_balancer_backend_pool_name: + :vartype load_balancer_backend_pool_name: ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param load_balancer_id: Resource URI of Outbound Load balancer for Secure Cluster Connectivity + :ivar load_balancer_id: Resource URI of Outbound Load balancer for Secure Cluster Connectivity (No Public IP) workspace. - :type load_balancer_id: + :vartype load_balancer_id: ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param nat_gateway_name: Name of the NAT gateway for Secure Cluster Connectivity (No Public IP) + :ivar nat_gateway_name: Name of the NAT gateway for Secure Cluster Connectivity (No Public IP) workspace subnets. - :type nat_gateway_name: + :vartype nat_gateway_name: ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param public_ip_name: Name of the Public IP for No Public IP workspace with managed vNet. - :type public_ip_name: ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param prepare_encryption: Prepare the workspace for encryption. Enables the Managed Identity + :ivar public_ip_name: Name of the Public IP for No Public IP workspace with managed vNet. + :vartype public_ip_name: + ~azure_databricks_management_client.models.WorkspaceCustomStringParameter + :ivar prepare_encryption: Prepare the workspace for encryption. Enables the Managed Identity for managed storage account. - :type prepare_encryption: + :vartype prepare_encryption: ~azure_databricks_management_client.models.WorkspaceCustomBooleanParameter - :param encryption: Contains the encryption details for Customer-Managed Key (CMK) enabled + :ivar encryption: Contains the encryption details for Customer-Managed Key (CMK) enabled workspace. - :type encryption: ~azure_databricks_management_client.models.WorkspaceEncryptionParameter - :param require_infrastructure_encryption: A boolean indicating whether or not the DBFS root - file system will be enabled with secondary layer of encryption with platform managed keys for - data at rest. - :type require_infrastructure_encryption: + :vartype encryption: ~azure_databricks_management_client.models.WorkspaceEncryptionParameter + :ivar require_infrastructure_encryption: A boolean indicating whether or not the DBFS root file + system will be enabled with secondary layer of encryption with platform managed keys for data + at rest. + :vartype require_infrastructure_encryption: ~azure_databricks_management_client.models.WorkspaceCustomBooleanParameter - :param storage_account_name: Default DBFS storage account name. - :type storage_account_name: + :ivar storage_account_name: Default DBFS storage account name. + :vartype storage_account_name: ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param storage_account_sku_name: Storage account SKU name, ex: Standard_GRS, Standard_LRS. - Refer https://aka.ms/storageskus for valid inputs. - :type storage_account_sku_name: + :ivar storage_account_sku_name: Storage account SKU name, ex: Standard_GRS, Standard_LRS. Refer + https://aka.ms/storageskus for valid inputs. + :vartype storage_account_sku_name: ~azure_databricks_management_client.models.WorkspaceCustomStringParameter - :param vnet_address_prefix: Address prefix for Managed virtual network. Default value for this + :ivar vnet_address_prefix: Address prefix for Managed virtual network. Default value for this input is 10.139. - :type vnet_address_prefix: + :vartype vnet_address_prefix: ~azure_databricks_management_client.models.WorkspaceCustomStringParameter :ivar resource_tags: Tags applied to resources under Managed resource group. These can be updated by updating tags at workspace level. @@ -1374,6 +1747,63 @@ def __init__( vnet_address_prefix: Optional["WorkspaceCustomStringParameter"] = None, **kwargs ): + """ + :keyword aml_workspace_id: The ID of a Azure Machine Learning workspace to link with Databricks + workspace. + :paramtype aml_workspace_id: + ~azure_databricks_management_client.models.WorkspaceCustomStringParameter + :keyword custom_virtual_network_id: The ID of a Virtual Network where this Databricks Cluster + should be created. + :paramtype custom_virtual_network_id: + ~azure_databricks_management_client.models.WorkspaceCustomStringParameter + :keyword custom_public_subnet_name: The name of a Public Subnet within the Virtual Network. + :paramtype custom_public_subnet_name: + ~azure_databricks_management_client.models.WorkspaceCustomStringParameter + :keyword custom_private_subnet_name: The name of the Private Subnet within the Virtual Network. + :paramtype custom_private_subnet_name: + ~azure_databricks_management_client.models.WorkspaceCustomStringParameter + :keyword enable_no_public_ip: Should the Public IP be Disabled?. + :paramtype enable_no_public_ip: + ~azure_databricks_management_client.models.WorkspaceCustomBooleanParameter + :keyword load_balancer_backend_pool_name: Name of the outbound Load Balancer Backend Pool for + Secure Cluster Connectivity (No Public IP). + :paramtype load_balancer_backend_pool_name: + ~azure_databricks_management_client.models.WorkspaceCustomStringParameter + :keyword load_balancer_id: Resource URI of Outbound Load balancer for Secure Cluster + Connectivity (No Public IP) workspace. + :paramtype load_balancer_id: + ~azure_databricks_management_client.models.WorkspaceCustomStringParameter + :keyword nat_gateway_name: Name of the NAT gateway for Secure Cluster Connectivity (No Public + IP) workspace subnets. + :paramtype nat_gateway_name: + ~azure_databricks_management_client.models.WorkspaceCustomStringParameter + :keyword public_ip_name: Name of the Public IP for No Public IP workspace with managed vNet. + :paramtype public_ip_name: + ~azure_databricks_management_client.models.WorkspaceCustomStringParameter + :keyword prepare_encryption: Prepare the workspace for encryption. Enables the Managed Identity + for managed storage account. + :paramtype prepare_encryption: + ~azure_databricks_management_client.models.WorkspaceCustomBooleanParameter + :keyword encryption: Contains the encryption details for Customer-Managed Key (CMK) enabled + workspace. + :paramtype encryption: ~azure_databricks_management_client.models.WorkspaceEncryptionParameter + :keyword require_infrastructure_encryption: A boolean indicating whether or not the DBFS root + file system will be enabled with secondary layer of encryption with platform managed keys for + data at rest. + :paramtype require_infrastructure_encryption: + ~azure_databricks_management_client.models.WorkspaceCustomBooleanParameter + :keyword storage_account_name: Default DBFS storage account name. + :paramtype storage_account_name: + ~azure_databricks_management_client.models.WorkspaceCustomStringParameter + :keyword storage_account_sku_name: Storage account SKU name, ex: Standard_GRS, Standard_LRS. + Refer https://aka.ms/storageskus for valid inputs. + :paramtype storage_account_sku_name: + ~azure_databricks_management_client.models.WorkspaceCustomStringParameter + :keyword vnet_address_prefix: Address prefix for Managed virtual network. Default value for + this input is 10.139. + :paramtype vnet_address_prefix: + ~azure_databricks_management_client.models.WorkspaceCustomStringParameter + """ super(WorkspaceCustomParameters, self).__init__(**kwargs) self.aml_workspace_id = aml_workspace_id self.custom_virtual_network_id = custom_virtual_network_id @@ -1403,8 +1833,8 @@ class WorkspaceCustomStringParameter(msrest.serialization.Model): :ivar type: The type of variable that this is. Possible values include: "Bool", "Object", "String". :vartype type: str or ~azure_databricks_management_client.models.CustomParameterType - :param value: Required. The value which should be used for this field. - :type value: str + :ivar value: Required. The value which should be used for this field. + :vartype value: str """ _validation = { @@ -1423,6 +1853,10 @@ def __init__( value: str, **kwargs ): + """ + :keyword value: Required. The value which should be used for this field. + :paramtype value: str + """ super(WorkspaceCustomStringParameter, self).__init__(**kwargs) self.type = None self.value = value @@ -1436,8 +1870,8 @@ class WorkspaceEncryptionParameter(msrest.serialization.Model): :ivar type: The type of variable that this is. Possible values include: "Bool", "Object", "String". :vartype type: str or ~azure_databricks_management_client.models.CustomParameterType - :param value: The value which should be used for this field. - :type value: ~azure_databricks_management_client.models.Encryption + :ivar value: The value which should be used for this field. + :vartype value: ~azure_databricks_management_client.models.Encryption """ _validation = { @@ -1455,6 +1889,10 @@ def __init__( value: Optional["Encryption"] = None, **kwargs ): + """ + :keyword value: The value which should be used for this field. + :paramtype value: ~azure_databricks_management_client.models.Encryption + """ super(WorkspaceEncryptionParameter, self).__init__(**kwargs) self.type = None self.value = value @@ -1463,10 +1901,10 @@ def __init__( class WorkspaceListResult(msrest.serialization.Model): """List of workspaces. - :param value: The array of workspaces. - :type value: list[~azure_databricks_management_client.models.Workspace] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str + :ivar value: The array of workspaces. + :vartype value: list[~azure_databricks_management_client.models.Workspace] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -1481,6 +1919,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The array of workspaces. + :paramtype value: list[~azure_databricks_management_client.models.Workspace] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ super(WorkspaceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1491,8 +1935,8 @@ class WorkspacePropertiesEncryption(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param entities: Required. Encryption entities definition for the workspace. - :type entities: ~azure_databricks_management_client.models.EncryptionEntitiesDefinition + :ivar entities: Required. Encryption entities definition for the workspace. + :vartype entities: ~azure_databricks_management_client.models.EncryptionEntitiesDefinition """ _validation = { @@ -1509,6 +1953,10 @@ def __init__( entities: "EncryptionEntitiesDefinition", **kwargs ): + """ + :keyword entities: Required. Encryption entities definition for the workspace. + :paramtype entities: ~azure_databricks_management_client.models.EncryptionEntitiesDefinition + """ super(WorkspacePropertiesEncryption, self).__init__(**kwargs) self.entities = entities @@ -1518,13 +1966,13 @@ class WorkspaceProviderAuthorization(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param principal_id: Required. The provider's principal identifier. This is the identity that + :ivar principal_id: Required. The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the workspace resources. - :type principal_id: str - :param role_definition_id: Required. The provider's role definition identifier. This role will + :vartype principal_id: str + :ivar role_definition_id: Required. The provider's role definition identifier. This role will define all the permissions that the provider must have on the workspace's container resource group. This role definition cannot have permission to delete the resource group. - :type role_definition_id: str + :vartype role_definition_id: str """ _validation = { @@ -1544,6 +1992,15 @@ def __init__( role_definition_id: str, **kwargs ): + """ + :keyword principal_id: Required. The provider's principal identifier. This is the identity that + the provider will use to call ARM to manage the workspace resources. + :paramtype principal_id: str + :keyword role_definition_id: Required. The provider's role definition identifier. This role + will define all the permissions that the provider must have on the workspace's container + resource group. This role definition cannot have permission to delete the resource group. + :paramtype role_definition_id: str + """ super(WorkspaceProviderAuthorization, self).__init__(**kwargs) self.principal_id = principal_id self.role_definition_id = role_definition_id @@ -1552,8 +2009,8 @@ def __init__( class WorkspaceUpdate(msrest.serialization.Model): """An update to a workspace. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1566,5 +2023,9 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(WorkspaceUpdate, self).__init__(**kwargs) self.tags = tags diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/__init__.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/__init__.py index 6fc97620650a..50c9331a9943 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/__init__.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/__init__.py @@ -10,6 +10,7 @@ from ._operations import Operations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._outbound_network_dependencies_endpoints_operations import OutboundNetworkDependenciesEndpointsOperations from ._vnet_peering_operations import VNetPeeringOperations __all__ = [ @@ -17,5 +18,6 @@ 'Operations', 'PrivateLinkResourcesOperations', 'PrivateEndpointConnectionsOperations', + 'OutboundNetworkDependenciesEndpointsOperations', 'VNetPeeringOperations', ] diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_operations.py index 311dc36ebf05..edd9832e9c33 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/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-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Databricks/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,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available RP operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_databricks_management_client.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure_databricks_management_client.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +123,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_outbound_network_dependencies_endpoints_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_outbound_network_dependencies_endpoints_operations.py new file mode 100644 index 000000000000..b795c11737ca --- /dev/null +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_outbound_network_dependencies_endpoints_operations.py @@ -0,0 +1,139 @@ +# 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, List, 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_list_request( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "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 OutboundNetworkDependenciesEndpointsOperations(object): + """OutboundNetworkDependenciesEndpointsOperations 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_databricks_management_client.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, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> List["_models.OutboundEnvironmentEndpoint"]: + """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified Workspace. + + Gets the list of endpoints that VNET Injected Workspace calls Azure Databricks Control Plane. + You must configure outbound access with these endpoints. For more information, see + https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/udr. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of OutboundEnvironmentEndpoint, or the result of cls(response) + :rtype: list[~azure_databricks_management_client.models.OutboundEnvironmentEndpoint] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.OutboundEnvironmentEndpoint"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + template_url=self.list.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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[OutboundEnvironmentEndpoint]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints'} # type: ignore + diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_endpoint_connections_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_endpoint_connections_operations.py index 9d91ad76eb51..3be82ddbf6e6 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_endpoint_connections_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_endpoint_connections_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_request( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "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 + ) + + +def build_get_request( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_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_request_initial( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_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 PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionsList"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionsList"]: """List private endpoint connections. List private endpoint connections of the workspace. @@ -63,8 +221,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_databricks_management_client.models.PrivateEndpointConnectionsList] + :return: An iterator like instance of either PrivateEndpointConnectionsList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure_databricks_management_client.models.PrivateEndpointConnectionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionsList"] @@ -72,36 +232,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - '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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + 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('PrivateEndpointConnectionsList', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,25 +271,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Get private endpoint connection. Get a private endpoint connection properties for a workspace. @@ -153,34 +311,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -189,56 +337,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_request_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_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(private_endpoint_connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -250,17 +388,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - private_endpoint_connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Update private endpoint connection status. Update the status of a private endpoint connection with the specified name. @@ -272,18 +412,24 @@ def begin_create( :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str :param private_endpoint_connection: The private endpoint connection with updated properties. - :type private_endpoint_connection: ~azure_databricks_management_client.models.PrivateEndpointConnection + :type private_endpoint_connection: + ~azure_databricks_management_client.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + :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 PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure_databricks_management_client.models.PrivateEndpointConnection] - :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 PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure_databricks_management_client.models.PrivateEndpointConnection] + :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.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,28 +442,21 @@ def begin_create( workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + 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('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -329,64 +468,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_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-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Remove private endpoint connection. Remove private endpoint connection with the specified name. @@ -399,15 +528,17 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + :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', @@ -422,22 +553,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -449,4 +572,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.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_link_resources_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_link_resources_operations.py index 15d242800838..22593a60d7ae 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_link_resources_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_private_link_resources_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_request( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateLinkResources') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "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 + ) + + +def build_get_request( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + group_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateLinkResources/{groupId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "groupId": _SERIALIZER.url("group_id", group_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 PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourcesList"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourcesList"]: """List private link resources. List private link resources for a given workspace. @@ -61,8 +135,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourcesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_databricks_management_client.models.PrivateLinkResourcesList] + :return: An iterator like instance of either PrivateLinkResourcesList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure_databricks_management_client.models.PrivateLinkResourcesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesList"] @@ -70,36 +146,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - '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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + 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('PrivateLinkResourcesList', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourcesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +185,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateLinkResources'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - group_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GroupIdInformation" + resource_group_name: str, + workspace_name: str, + group_id: str, + **kwargs: Any + ) -> "_models.GroupIdInformation": """Get the specified private link resource. Get the specified private link resource for the given group id (sub-resource). @@ -151,34 +225,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'groupId': self._serialize.url("group_id", group_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + group_id=group_id, + 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GroupIdInformation', pipeline_response) @@ -187,4 +251,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateLinkResources/{groupId}'} # type: ignore + diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_vnet_peering_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_vnet_peering_operations.py index ec4fb642db5d..a10e056d54a4 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_vnet_peering_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_vnet_peering_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_get_request( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + peering_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "peeringName": _SERIALIZER.url("peering_name", peering_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_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_delete_request_initial( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + peering_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "peeringName": _SERIALIZER.url("peering_name", peering_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_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_create_or_update_request_initial( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + peering_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "peeringName": _SERIALIZER.url("peering_name", peering_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[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_list_by_workspace_request( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "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 VNetPeeringOperations(object): """VNetPeeringOperations operations. @@ -47,14 +205,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - peering_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.VirtualNetworkPeering"] + resource_group_name: str, + workspace_name: str, + peering_name: str, + **kwargs: Any + ) -> Optional["_models.VirtualNetworkPeering"]: """Gets the workspace vNet Peering. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -73,34 +231,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + peering_name=peering_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 if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -111,64 +259,55 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - peering_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + peering_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 = "2018-04-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + peering_name=peering_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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - peering_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + peering_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the workspace vNetPeering. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -179,15 +318,17 @@ def begin_delete( :type peering_name: str :keyword callable cls: A custom type or function 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. + :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', @@ -202,22 +343,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'peeringName': self._serialize.url("peering_name", peering_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: @@ -229,56 +362,45 @@ 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.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - peering_name, # type: str - virtual_network_peering_parameters, # type: "_models.VirtualNetworkPeering" - **kwargs # type: Any - ): - # type: (...) -> "_models.VirtualNetworkPeering" + resource_group_name: str, + workspace_name: str, + peering_name: str, + virtual_network_peering_parameters: "_models.VirtualNetworkPeering", + **kwargs: Any + ) -> "_models.VirtualNetworkPeering": cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkPeering"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'peeringName': self._serialize.url("peering_name", peering_name, 'str'), - } - url = self._client.format_url(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(virtual_network_peering_parameters, 'VirtualNetworkPeering') - # 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + peering_name=peering_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(virtual_network_peering_parameters, 'VirtualNetworkPeering') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('VirtualNetworkPeering', pipeline_response) @@ -290,17 +412,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.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - peering_name, # type: str - virtual_network_peering_parameters, # type: "_models.VirtualNetworkPeering" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.VirtualNetworkPeering"] + resource_group_name: str, + workspace_name: str, + peering_name: str, + virtual_network_peering_parameters: "_models.VirtualNetworkPeering", + **kwargs: Any + ) -> LROPoller["_models.VirtualNetworkPeering"]: """Creates vNet Peering for workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -311,18 +435,24 @@ def begin_create_or_update( :type peering_name: str :param virtual_network_peering_parameters: Parameters supplied to the create workspace vNet Peering. - :type virtual_network_peering_parameters: ~azure_databricks_management_client.models.VirtualNetworkPeering + :type virtual_network_peering_parameters: + ~azure_databricks_management_client.models.VirtualNetworkPeering :keyword callable cls: A custom type or function 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. + :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 VirtualNetworkPeering or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure_databricks_management_client.models.VirtualNetworkPeering] - :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 VirtualNetworkPeering or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure_databricks_management_client.models.VirtualNetworkPeering] + :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.VirtualNetworkPeering"] lro_delay = kwargs.pop( 'polling_interval', @@ -335,28 +465,21 @@ def begin_create_or_update( workspace_name=workspace_name, peering_name=peering_name, virtual_network_peering_parameters=virtual_network_peering_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('VirtualNetworkPeering', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'peeringName': self._serialize.url("peering_name", peering_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: @@ -368,15 +491,16 @@ 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.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}'} # type: ignore + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VirtualNetworkPeeringList"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualNetworkPeeringList"]: """Lists the workspace vNet Peerings. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -384,8 +508,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualNetworkPeeringList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_databricks_management_client.models.VirtualNetworkPeeringList] + :return: An iterator like instance of either VirtualNetworkPeeringList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure_databricks_management_client.models.VirtualNetworkPeeringList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualNetworkPeeringList"] @@ -393,36 +519,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-04-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_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - '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_by_workspace_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_workspace.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_workspace_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + 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('VirtualNetworkPeeringList', pipeline_response) + deserialized = self._deserialize("VirtualNetworkPeeringList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -435,12 +558,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_workspaces_operations.py b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_workspaces_operations.py index dbfe20ee9e9c..7423a8ecef48 100644 --- a/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_workspaces_operations.py +++ b/sdk/databricks/azure-mgmt-databricks/azure/mgmt/databricks/operations/_workspaces_operations.py @@ -5,25 +5,250 @@ # 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_get_request( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "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 + ) + + +def build_delete_request_initial( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "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="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "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] + 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_update_request_initial( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "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] + 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_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "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 + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Databricks/workspaces') + 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 WorkspacesOperations(object): """WorkspacesOperations operations. @@ -47,13 +272,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Workspace" + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.Workspace": """Gets the workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -70,33 +295,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Workspace', pipeline_response) @@ -105,61 +320,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_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-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + 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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -168,15 +374,17 @@ def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function 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. + :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', @@ -190,21 +398,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -216,54 +417,43 @@ 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.Databricks/workspaces/{workspaceName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - parameters, # type: "_models.Workspace" - **kwargs # type: Any - ): - # type: (...) -> "_models.Workspace" + resource_group_name: str, + workspace_name: str, + parameters: "_models.Workspace", + **kwargs: Any + ) -> "_models.Workspace": cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Workspace') - # 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + 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, 'Workspace') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Workspace', pipeline_response) @@ -275,16 +465,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.Databricks/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - parameters, # type: "_models.Workspace" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Workspace"] + resource_group_name: str, + workspace_name: str, + parameters: "_models.Workspace", + **kwargs: Any + ) -> LROPoller["_models.Workspace"]: """Creates a new workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -295,15 +487,18 @@ def begin_create_or_update( :type parameters: ~azure_databricks_management_client.models.Workspace :keyword callable cls: A custom type or function 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. + :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 Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure_databricks_management_client.models.Workspace] - :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.Workspace"] lro_delay = kwargs.pop( 'polling_interval', @@ -315,27 +510,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_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('Workspace', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -347,54 +536,43 @@ 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.Databricks/workspaces/{workspaceName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - parameters, # type: "_models.WorkspaceUpdate" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Workspace"] + resource_group_name: str, + workspace_name: str, + parameters: "_models.WorkspaceUpdate", + **kwargs: Any + ) -> Optional["_models.Workspace"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Workspace"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'WorkspaceUpdate') - # 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_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._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, 'WorkspaceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -404,16 +582,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - workspace_name, # type: str - parameters, # type: "_models.WorkspaceUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Workspace"] + resource_group_name: str, + workspace_name: str, + parameters: "_models.WorkspaceUpdate", + **kwargs: Any + ) -> LROPoller["_models.Workspace"]: """Updates a workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -424,15 +604,18 @@ def begin_update( :type parameters: ~azure_databricks_management_client.models.WorkspaceUpdate :keyword callable cls: A custom type or function 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. + :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 Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure_databricks_management_client.models.Workspace] - :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.Workspace"] lro_delay = kwargs.pop( 'polling_interval', @@ -444,27 +627,21 @@ def begin_update( resource_group_name=resource_group_name, workspace_name=workspace_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('Workspace', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -476,21 +653,23 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkspaceListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkspaceListResult"]: """Gets all the workspaces within a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. :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 WorkspaceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_databricks_management_client.models.WorkspaceListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure_databricks_management_client.models.WorkspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] @@ -498,35 +677,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - '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_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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( + resource_group_name=resource_group_name, + 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('WorkspaceListResult', pipeline_response) + deserialized = self._deserialize("WorkspaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -539,27 +714,29 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces'} # type: ignore + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkspaceListResult"] + **kwargs: Any + ) -> Iterable["_models.WorkspaceListResult"]: """Gets all the workspaces within a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkspaceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_databricks_management_client.models.WorkspaceListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure_databricks_management_client.models.WorkspaceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceListResult"] @@ -567,34 +744,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + 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, + 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('WorkspaceListResult', pipeline_response) + deserialized = self._deserialize("WorkspaceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -607,12 +779,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data )