Source code for azure.synapse.artifacts.aio.operations._link_connection_operations

# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar

from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict

from ... import models as _models
from ..._vendor import _convert_request
from ...operations._link_connection_operations import build_create_or_update_link_connection_request, build_delete_link_connection_request, build_edit_tables_request, build_get_detailed_status_request, build_get_link_connection_request, build_list_link_connections_by_workspace_request, build_list_link_tables_request, build_query_table_status_request, build_start_request, build_stop_request, build_update_landing_zone_credential_request
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

[docs]class LinkConnectionOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.synapse.artifacts.aio.ArtifactsClient`'s :attr:`link_connection` attribute. """ models = _models def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client = input_args.pop(0) if input_args else kwargs.pop("client") self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") list_link_connections_by_workspace.metadata = {'url': "/linkconnections"} # type: ignore create_or_update_link_connection.metadata = {'url': "/linkconnections/{linkConnectionName}"} # type: ignore get_link_connection.metadata = {'url': "/linkconnections/{linkConnectionName}"} # type: ignore delete_link_connection.metadata = {'url': "/linkconnections/{linkConnectionName}"} # type: ignore
[docs] @distributed_trace_async async def edit_tables( # pylint: disable=inconsistent-return-statements self, link_connection_name: str, link_tables: Optional[List[_models.LinkTableRequest]] = None, **kwargs: Any ) -> None: """Edit tables for a link connection. :param link_connection_name: The link connection name. :type link_connection_name: str :param link_tables: Edit link tables request. Default value is None. :type link_tables: list[~azure.synapse.artifacts.models.LinkTableRequest] :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] _edit_tables_request = _models.EditTablesRequest(link_tables=link_tables) _json = self._serialize.body(_edit_tables_request, 'EditTablesRequest') request = build_edit_tables_request( link_connection_name=link_connection_name, api_version=api_version, content_type=content_type, json=_json, template_url=self.edit_tables.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access 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.CloudError, pipeline_response) raise HttpResponseError(response=response, model=error) if cls: return cls(pipeline_response, None, {})
edit_tables.metadata = {'url': "/linkconnections/{linkConnectionName}/edittables"} # type: ignore
[docs] @distributed_trace_async async def start( # pylint: disable=inconsistent-return-statements self, link_connection_name: str, **kwargs: Any ) -> None: """Start a link connection. :param link_connection_name: The link connection name. :type link_connection_name: str :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request( link_connection_name=link_connection_name, api_version=api_version, template_url=self.start.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access 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.CloudError, pipeline_response) raise HttpResponseError(response=response, model=error) if cls: return cls(pipeline_response, None, {})
start.metadata = {'url': "/linkconnections/{linkConnectionName}/start"} # type: ignore
[docs] @distributed_trace_async async def stop( # pylint: disable=inconsistent-return-statements self, link_connection_name: str, **kwargs: Any ) -> None: """Stop a link connection. :param link_connection_name: The link connection name. :type link_connection_name: str :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request( link_connection_name=link_connection_name, api_version=api_version, template_url=self.stop.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access 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.CloudError, pipeline_response) raise HttpResponseError(response=response, model=error) if cls: return cls(pipeline_response, None, {})
stop.metadata = {'url': "/linkconnections/{linkConnectionName}/stop"} # type: ignore
[docs] @distributed_trace_async async def get_detailed_status( self, link_connection_name: str, **kwargs: Any ) -> _models.LinkConnectionDetailedStatus: """Get the detailed status of a link connection. :param link_connection_name: The link connection name. :type link_connection_name: str :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: LinkConnectionDetailedStatus, or the result of cls(response) :rtype: ~azure.synapse.artifacts.models.LinkConnectionDetailedStatus :raises: ~azure.core.exceptions.HttpResponseError """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.LinkConnectionDetailedStatus] request = build_get_detailed_status_request( link_connection_name=link_connection_name, api_version=api_version, template_url=self.get_detailed_status.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access 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.CloudError, pipeline_response) raise HttpResponseError(response=response, model=error) deserialized = self._deserialize('LinkConnectionDetailedStatus', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
get_detailed_status.metadata = {'url': "/linkconnections/{linkConnectionName}/detailedstatus"} # type: ignore list_link_tables.metadata = {'url': "/linkconnections/{linkConnectionName}/linktables"} # type: ignore
[docs] @distributed_trace_async async def query_table_status( self, link_connection_name: str, query_table_status_request: _models.QueryTableStatusRequest, **kwargs: Any ) -> _models.LinkConnectionQueryTableStatus: """Query the link table status of a link connection. :param link_connection_name: The link connection name. :type link_connection_name: str :param query_table_status_request: Query table status request. :type query_table_status_request: ~azure.synapse.artifacts.models.QueryTableStatusRequest :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: LinkConnectionQueryTableStatus, or the result of cls(response) :rtype: ~azure.synapse.artifacts.models.LinkConnectionQueryTableStatus :raises: ~azure.core.exceptions.HttpResponseError """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[_models.LinkConnectionQueryTableStatus] _json = self._serialize.body(query_table_status_request, 'QueryTableStatusRequest') request = build_query_table_status_request( link_connection_name=link_connection_name, api_version=api_version, content_type=content_type, json=_json, template_url=self.query_table_status.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access 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.CloudError, pipeline_response) raise HttpResponseError(response=response, model=error) deserialized = self._deserialize('LinkConnectionQueryTableStatus', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
query_table_status.metadata = {'url': "/linkconnections/{linkConnectionName}/querytablestatus"} # type: ignore
[docs] @distributed_trace_async async def update_landing_zone_credential( # pylint: disable=inconsistent-return-statements self, link_connection_name: str, sas_token: Optional[_models.SecureString] = None, **kwargs: Any ) -> None: """Update landing zone credential of a link connection. :param link_connection_name: The link connection name. :type link_connection_name: str :param sas_token: Landing zone's sas token. Default value is None. :type sas_token: ~azure.synapse.artifacts.models.SecureString :keyword api_version: Api Version. Default value is "2021-12-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-12-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] _update_landing_zone_credential_request = _models.UpdateLandingZoneCredential(sas_token=sas_token) _json = self._serialize.body(_update_landing_zone_credential_request, 'UpdateLandingZoneCredential') request = build_update_landing_zone_credential_request( link_connection_name=link_connection_name, api_version=api_version, content_type=content_type, json=_json, template_url=self.update_landing_zone_credential.metadata['url'], headers=_headers, params=_params, ) request = _convert_request(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access 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.CloudError, pipeline_response) raise HttpResponseError(response=response, model=error) if cls: return cls(pipeline_response, None, {})
update_landing_zone_credential.metadata = {'url': "/linkconnections/{linkConnectionName}/updateLandingZoneCredential"} # type: ignore