# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from typing import TYPE_CHECKING
from azure.core import PipelineClient
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from msrest import Deserializer, Serializer
from ._configuration import ArtifactsClientConfiguration
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
class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Will be removed in final version of multiapi azure-core based client
"""
pass
[docs]class ArtifactsClient(MultiApiClientMixin, _SDKClient):
"""ArtifactsClient.
This ready contains multiple API versions, to help you deal with all of the Azure clouds
(Azure Stack, Azure Government, Azure China, etc.).
By default, it uses the latest API version available on public Azure.
For production, you should stick to a particular api-version and/or profile.
The profile sets a mapping between an operation group and its API version.
The api-version parameter sets the default API version if the operation
group is not described in the profile.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param endpoint: The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net.
:type endpoint: str
:param api_version: API version to use if no profile is provided, or if missing in profile.
:type api_version: str
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
DEFAULT_API_VERSION = '2020-12-01'
_PROFILE_TAG = "azure.synapse.artifacts.ArtifactsClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
}},
_PROFILE_TAG + " latest"
)
def __init__(
self,
credential, # type: "TokenCredential"
endpoint, # type: str
api_version=DEFAULT_API_VERSION, # type: Optional[str]
profile=KnownProfiles.default, # type: KnownProfiles
**kwargs # type: Any
):
if api_version == '2020-12-01' or api_version == '2021-06-01-preview':
base_url = '{endpoint}'
else:
raise ValueError("API version {} is not available".format(api_version))
self._config = ArtifactsClientConfiguration(credential, endpoint, **kwargs)
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)
super(ArtifactsClient, self).__init__(
api_version=api_version,
profile=profile
)
@classmethod
def _models_dict(cls, api_version):
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
[docs] @classmethod
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2020-12-01: :mod:`v2020_12_01.models<azure.synapse.artifacts.v2020_12_01.models>`
* 2021-06-01-preview: :mod:`v2021_06_01_preview.models<azure.synapse.artifacts.v2021_06_01_preview.models>`
"""
if api_version == '2020-12-01':
from .v2020_12_01 import models
return models
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))
@property
def big_data_pools(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`BigDataPoolsOperations<azure.synapse.artifacts.v2020_12_01.operations.BigDataPoolsOperations>`
* 2021-06-01-preview: :class:`BigDataPoolsOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.BigDataPoolsOperations>`
"""
api_version = self._get_api_version('big_data_pools')
if api_version == '2020-12-01':
from .v2020_12_01.operations import BigDataPoolsOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import BigDataPoolsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'big_data_pools'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def data_flow(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`DataFlowOperations<azure.synapse.artifacts.v2020_12_01.operations.DataFlowOperations>`
* 2021-06-01-preview: :class:`DataFlowOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.DataFlowOperations>`
"""
api_version = self._get_api_version('data_flow')
if api_version == '2020-12-01':
from .v2020_12_01.operations import DataFlowOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import DataFlowOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'data_flow'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def data_flow_debug_session(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`DataFlowDebugSessionOperations<azure.synapse.artifacts.v2020_12_01.operations.DataFlowDebugSessionOperations>`
* 2021-06-01-preview: :class:`DataFlowDebugSessionOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.DataFlowDebugSessionOperations>`
"""
api_version = self._get_api_version('data_flow_debug_session')
if api_version == '2020-12-01':
from .v2020_12_01.operations import DataFlowDebugSessionOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import DataFlowDebugSessionOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'data_flow_debug_session'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def dataset(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`DatasetOperations<azure.synapse.artifacts.v2020_12_01.operations.DatasetOperations>`
* 2021-06-01-preview: :class:`DatasetOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.DatasetOperations>`
"""
api_version = self._get_api_version('dataset')
if api_version == '2020-12-01':
from .v2020_12_01.operations import DatasetOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import DatasetOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'dataset'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def integration_runtimes(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`IntegrationRuntimesOperations<azure.synapse.artifacts.v2020_12_01.operations.IntegrationRuntimesOperations>`
* 2021-06-01-preview: :class:`IntegrationRuntimesOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.IntegrationRuntimesOperations>`
"""
api_version = self._get_api_version('integration_runtimes')
if api_version == '2020-12-01':
from .v2020_12_01.operations import IntegrationRuntimesOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import IntegrationRuntimesOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'integration_runtimes'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def library(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`LibraryOperations<azure.synapse.artifacts.v2020_12_01.operations.LibraryOperations>`
* 2021-06-01-preview: :class:`LibraryOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.LibraryOperations>`
"""
api_version = self._get_api_version('library')
if api_version == '2020-12-01':
from .v2020_12_01.operations import LibraryOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import LibraryOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'library'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def linked_service(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`LinkedServiceOperations<azure.synapse.artifacts.v2020_12_01.operations.LinkedServiceOperations>`
* 2021-06-01-preview: :class:`LinkedServiceOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.LinkedServiceOperations>`
"""
api_version = self._get_api_version('linked_service')
if api_version == '2020-12-01':
from .v2020_12_01.operations import LinkedServiceOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import LinkedServiceOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'linked_service'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def notebook(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`NotebookOperations<azure.synapse.artifacts.v2020_12_01.operations.NotebookOperations>`
* 2021-06-01-preview: :class:`NotebookOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.NotebookOperations>`
"""
api_version = self._get_api_version('notebook')
if api_version == '2020-12-01':
from .v2020_12_01.operations import NotebookOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import NotebookOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'notebook'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def notebook_operation_result(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`NotebookOperationResultOperations<azure.synapse.artifacts.v2020_12_01.operations.NotebookOperationResultOperations>`
* 2021-06-01-preview: :class:`NotebookOperationResultOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.NotebookOperationResultOperations>`
"""
api_version = self._get_api_version('notebook_operation_result')
if api_version == '2020-12-01':
from .v2020_12_01.operations import NotebookOperationResultOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import NotebookOperationResultOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'notebook_operation_result'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def operation_result(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`OperationResultOperations<azure.synapse.artifacts.v2020_12_01.operations.OperationResultOperations>`
* 2021-06-01-preview: :class:`OperationResultOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.OperationResultOperations>`
"""
api_version = self._get_api_version('operation_result')
if api_version == '2020-12-01':
from .v2020_12_01.operations import OperationResultOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import OperationResultOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operation_result'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def operation_status(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`OperationStatusOperations<azure.synapse.artifacts.v2020_12_01.operations.OperationStatusOperations>`
* 2021-06-01-preview: :class:`OperationStatusOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.OperationStatusOperations>`
"""
api_version = self._get_api_version('operation_status')
if api_version == '2020-12-01':
from .v2020_12_01.operations import OperationStatusOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import OperationStatusOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operation_status'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def pipeline(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`PipelineOperations<azure.synapse.artifacts.v2020_12_01.operations.PipelineOperations>`
* 2021-06-01-preview: :class:`PipelineOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.PipelineOperations>`
"""
api_version = self._get_api_version('pipeline')
if api_version == '2020-12-01':
from .v2020_12_01.operations import PipelineOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import PipelineOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'pipeline'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def pipeline_run(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`PipelineRunOperations<azure.synapse.artifacts.v2020_12_01.operations.PipelineRunOperations>`
* 2021-06-01-preview: :class:`PipelineRunOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.PipelineRunOperations>`
"""
api_version = self._get_api_version('pipeline_run')
if api_version == '2020-12-01':
from .v2020_12_01.operations import PipelineRunOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import PipelineRunOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'pipeline_run'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def spark_configuration(self):
"""Instance depends on the API version:
* 2021-06-01-preview: :class:`SparkConfigurationOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.SparkConfigurationOperations>`
"""
api_version = self._get_api_version('spark_configuration')
if api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import SparkConfigurationOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'spark_configuration'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def spark_job_definition(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`SparkJobDefinitionOperations<azure.synapse.artifacts.v2020_12_01.operations.SparkJobDefinitionOperations>`
* 2021-06-01-preview: :class:`SparkJobDefinitionOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.SparkJobDefinitionOperations>`
"""
api_version = self._get_api_version('spark_job_definition')
if api_version == '2020-12-01':
from .v2020_12_01.operations import SparkJobDefinitionOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import SparkJobDefinitionOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'spark_job_definition'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def sql_pools(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`SqlPoolsOperations<azure.synapse.artifacts.v2020_12_01.operations.SqlPoolsOperations>`
* 2021-06-01-preview: :class:`SqlPoolsOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.SqlPoolsOperations>`
"""
api_version = self._get_api_version('sql_pools')
if api_version == '2020-12-01':
from .v2020_12_01.operations import SqlPoolsOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import SqlPoolsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'sql_pools'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def sql_script(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`SqlScriptOperations<azure.synapse.artifacts.v2020_12_01.operations.SqlScriptOperations>`
* 2021-06-01-preview: :class:`SqlScriptOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.SqlScriptOperations>`
"""
api_version = self._get_api_version('sql_script')
if api_version == '2020-12-01':
from .v2020_12_01.operations import SqlScriptOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import SqlScriptOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'sql_script'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def trigger(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`TriggerOperations<azure.synapse.artifacts.v2020_12_01.operations.TriggerOperations>`
* 2021-06-01-preview: :class:`TriggerOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.TriggerOperations>`
"""
api_version = self._get_api_version('trigger')
if api_version == '2020-12-01':
from .v2020_12_01.operations import TriggerOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import TriggerOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'trigger'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def trigger_run(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`TriggerRunOperations<azure.synapse.artifacts.v2020_12_01.operations.TriggerRunOperations>`
* 2021-06-01-preview: :class:`TriggerRunOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.TriggerRunOperations>`
"""
api_version = self._get_api_version('trigger_run')
if api_version == '2020-12-01':
from .v2020_12_01.operations import TriggerRunOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import TriggerRunOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'trigger_run'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def workspace(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`WorkspaceOperations<azure.synapse.artifacts.v2020_12_01.operations.WorkspaceOperations>`
* 2021-06-01-preview: :class:`WorkspaceOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.WorkspaceOperations>`
"""
api_version = self._get_api_version('workspace')
if api_version == '2020-12-01':
from .v2020_12_01.operations import WorkspaceOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import WorkspaceOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'workspace'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def workspace_git_repo_management(self):
"""Instance depends on the API version:
* 2020-12-01: :class:`WorkspaceGitRepoManagementOperations<azure.synapse.artifacts.v2020_12_01.operations.WorkspaceGitRepoManagementOperations>`
* 2021-06-01-preview: :class:`WorkspaceGitRepoManagementOperations<azure.synapse.artifacts.v2021_06_01_preview.operations.WorkspaceGitRepoManagementOperations>`
"""
api_version = self._get_api_version('workspace_git_repo_management')
if api_version == '2020-12-01':
from .v2020_12_01.operations import WorkspaceGitRepoManagementOperations as OperationClass
elif api_version == '2021-06-01-preview':
from .v2021_06_01_preview.operations import WorkspaceGitRepoManagementOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'workspace_git_repo_management'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
[docs] def close(self):
self._client.close()
def __enter__(self):
self._client.__enter__()
return self
def __exit__(self, *exc_details):
self._client.__exit__(*exc_details)