Skip to content

Commit

Permalink
CodeGen from PR 15090 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Removing duplicate package ID-2021-04-01-preview (Azure#15090)
  • Loading branch information
SDKAuto committed Jul 7, 2021
1 parent a3c1af9 commit 0de1b83
Show file tree
Hide file tree
Showing 26 changed files with 2,836 additions and 239 deletions.
1 change: 1 addition & 0 deletions sdk/databricks/azure-mgmt-databricks/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include _meta.json
recursive-include tests *.py *.yaml
include *.md
include azure/__init__.py
Expand Down
11 changes: 11 additions & 0 deletions sdk/databricks/azure-mgmt-databricks/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"autorest": "3.4.2",
"use": [
"@autorest/python@5.8.1",
"@autorest/modelerfour@4.19.2"
],
"commit": "fa3ba1acdd45ddad8950133befc5b0a6f1ee5163",
"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",
"readme": "specification/databricks/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._databricks_client import DatabricksClient
from ._azure_databricks_management_client import AzureDatabricksManagementClient
from ._version import VERSION

__version__ = VERSION
__all__ = ['DatabricksClient']
__all__ = ['AzureDatabricksManagementClient']

try:
from ._patch import patch_sdk # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,30 @@
from typing import Any, Optional

from azure.core.credentials import TokenCredential
from azure.core.pipeline.transport import HttpRequest, HttpResponse

from ._configuration import DatabricksClientConfiguration
from ._configuration import AzureDatabricksManagementClientConfiguration
from .operations import WorkspacesOperations
from .operations import VNetPeeringOperations
from .operations import Operations
from .operations import PrivateLinkResourcesOperations
from .operations import PrivateEndpointConnectionsOperations
from .operations import VNetPeeringOperations
from . import models


class DatabricksClient(object):
"""ARM Databricks.
class AzureDatabricksManagementClient(object):
"""The Microsoft Azure management APIs allow end users to operate on Azure Databricks Workspace resources.
:ivar workspaces: WorkspacesOperations operations
:vartype workspaces: azure.mgmt.databricks.operations.WorkspacesOperations
:ivar vnet_peering: VNetPeeringOperations operations
:vartype vnet_peering: azure.mgmt.databricks.operations.VNetPeeringOperations
:vartype workspaces: azure_databricks_management_client.operations.WorkspacesOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.databricks.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
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
:vartype private_endpoint_connections: azure_databricks_management_client.operations.PrivateEndpointConnectionsOperations
: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.
Expand All @@ -51,7 +58,7 @@ def __init__(
# type: (...) -> None
if not base_url:
base_url = 'https://management.azure.com'
self._config = DatabricksClientConfiguration(credential, subscription_id, **kwargs)
self._config = AzureDatabricksManagementClientConfiguration(credential, 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)}
Expand All @@ -61,17 +68,39 @@ def __init__(

self.workspaces = WorkspacesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.vnet_peering = VNetPeeringOperations(
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
"""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.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.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

def close(self):
# type: () -> None
self._client.close()

def __enter__(self):
# type: () -> DatabricksClient
# type: () -> AzureDatabricksManagementClient
self._client.__enter__()
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from azure.core.credentials import TokenCredential


class DatabricksClientConfiguration(Configuration):
"""Configuration for DatabricksClient.
class AzureDatabricksManagementClientConfiguration(Configuration):
"""Configuration for AzureDatabricksManagementClient.
Note that all parameters used to create this instance are saved as instance
attributes.
Expand All @@ -44,11 +44,10 @@ def __init__(
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(DatabricksClientConfiguration, self).__init__(**kwargs)
super(AzureDatabricksManagementClientConfiguration, self).__init__(**kwargs)

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2018-04-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-databricks/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"chosen_version": "",
"total_api_version_list": ["2018-04-01", "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,
"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\"]}}}"
},
"global_parameters": {
"sync": {
"credential": {
"signature": "credential, # type: \"TokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials.TokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id, # type: str",
"description": "The ID of the target subscription.",
"docstring_type": "str",
"required": true
}
},
"async": {
"credential": {
"signature": "credential: \"AsyncTokenCredential\",",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id: str,",
"description": "The ID of the target subscription.",
"docstring_type": "str",
"required": true
}
},
"constant": {
},
"call": "credential, subscription_id",
"service_client_specific": {
"sync": {
"api_version": {
"signature": "api_version=None, # type: Optional[str]",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url=None, # type: Optional[str]",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile=KnownProfiles.default, # type: KnownProfiles",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
}
},
"async": {
"api_version": {
"signature": "api_version: Optional[str] = None,",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url: Optional[str] = None,",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile: KnownProfiles = KnownProfiles.default,",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
}
}
}
},
"config": {
"credential": true,
"credential_scopes": ["https://management.azure.com/.default"],
"credential_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\"]}}}"
},
"operation_groups": {
"workspaces": "WorkspacesOperations",
"operations": "Operations",
"private_link_resources": "PrivateLinkResourcesOperations",
"private_endpoint_connections": "PrivateEndpointConnectionsOperations",
"vnet_peering": "VNetPeeringOperations"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "1.0.0"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._databricks_client import DatabricksClient
__all__ = ['DatabricksClient']
from ._azure_databricks_management_client import AzureDatabricksManagementClient
__all__ = ['AzureDatabricksManagementClient']
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,36 @@

from typing import Any, Optional, TYPE_CHECKING

from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

from ._configuration import DatabricksClientConfiguration
from ._configuration import AzureDatabricksManagementClientConfiguration
from .operations import WorkspacesOperations
from .operations import VNetPeeringOperations
from .operations import Operations
from .operations import PrivateLinkResourcesOperations
from .operations import PrivateEndpointConnectionsOperations
from .operations import VNetPeeringOperations
from .. import models


class DatabricksClient(object):
"""ARM Databricks.
class AzureDatabricksManagementClient(object):
"""The Microsoft Azure management APIs allow end users to operate on Azure Databricks Workspace resources.
:ivar workspaces: WorkspacesOperations operations
:vartype workspaces: azure.mgmt.databricks.aio.operations.WorkspacesOperations
:ivar vnet_peering: VNetPeeringOperations operations
:vartype vnet_peering: azure.mgmt.databricks.aio.operations.VNetPeeringOperations
:vartype workspaces: azure_databricks_management_client.aio.operations.WorkspacesOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.databricks.aio.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
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
:vartype private_endpoint_connections: azure_databricks_management_client.aio.operations.PrivateEndpointConnectionsOperations
: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.
Expand All @@ -48,7 +55,7 @@ def __init__(
) -> None:
if not base_url:
base_url = 'https://management.azure.com'
self._config = DatabricksClientConfiguration(credential, subscription_id, **kwargs)
self._config = AzureDatabricksManagementClientConfiguration(credential, 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)}
Expand All @@ -58,15 +65,36 @@ def __init__(

self.workspaces = WorkspacesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.vnet_peering = VNetPeeringOperations(
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:
"""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.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.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

async def close(self) -> None:
await self._client.close()

async def __aenter__(self) -> "DatabricksClient":
async def __aenter__(self) -> "AzureDatabricksManagementClient":
await self._client.__aenter__()
return self

Expand Down
Loading

0 comments on commit 0de1b83

Please sign in to comment.