# 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, IO, List, Optional, TypeVar, Union, overload
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
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")
[docs] @distributed_trace
def list_link_connections_by_workspace(self, **kwargs: Any) -> AsyncIterable["_models.LinkConnectionResource"]:
"""List link connections.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either LinkConnectionResource or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.synapse.artifacts.models.LinkConnectionResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.LinkConnectionListResponse]
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_link_connections_by_workspace_request(
api_version=api_version,
template_url=self.list_link_connections_by_workspace.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
else:
request = HttpRequest("GET", next_link)
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
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("LinkConnectionListResponse", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # 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)
raise HttpResponseError(response=response)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_link_connections_by_workspace.metadata = {"url": "/linkconnections"} # type: ignore
@overload
async def create_or_update_link_connection(
self,
link_connection_name: str,
link_connection: _models.LinkConnectionResource,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.LinkConnectionResource:
"""Creates or updates a link connection.
:param link_connection_name: The link connection name. Required.
:type link_connection_name: str
:param link_connection: Link connection resource definition. Required.
:type link_connection: ~azure.synapse.artifacts.models.LinkConnectionResource
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: LinkConnectionResource or the result of cls(response)
:rtype: ~azure.synapse.artifacts.models.LinkConnectionResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def create_or_update_link_connection(
self, link_connection_name: str, link_connection: IO, *, content_type: str = "application/json", **kwargs: Any
) -> _models.LinkConnectionResource:
"""Creates or updates a link connection.
:param link_connection_name: The link connection name. Required.
:type link_connection_name: str
:param link_connection: Link connection resource definition. Required.
:type link_connection: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: LinkConnectionResource or the result of cls(response)
:rtype: ~azure.synapse.artifacts.models.LinkConnectionResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
[docs] @distributed_trace_async
async def create_or_update_link_connection(
self, link_connection_name: str, link_connection: Union[_models.LinkConnectionResource, IO], **kwargs: Any
) -> _models.LinkConnectionResource:
"""Creates or updates a link connection.
:param link_connection_name: The link connection name. Required.
:type link_connection_name: str
:param link_connection: Link connection resource definition. Is either a model type or a IO
type. Required.
:type link_connection: ~azure.synapse.artifacts.models.LinkConnectionResource or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: LinkConnectionResource or the result of cls(response)
:rtype: ~azure.synapse.artifacts.models.LinkConnectionResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
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", "2022-08-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.LinkConnectionResource]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(link_connection, (IO, bytes)):
_content = link_connection
else:
_json = self._serialize.body(link_connection, "LinkConnectionResource")
request = build_create_or_update_link_connection_request(
link_connection_name=link_connection_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update_link_connection.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)
raise HttpResponseError(response=response)
deserialized = self._deserialize("LinkConnectionResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update_link_connection.metadata = {"url": "/linkconnections/{linkConnectionName}"} # type: ignore
[docs] @distributed_trace_async
async def get_link_connection(self, link_connection_name: str, **kwargs: Any) -> _models.LinkConnectionResource:
"""Get a link connection.
:param link_connection_name: The link connection name. Required.
:type link_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: LinkConnectionResource or the result of cls(response)
:rtype: ~azure.synapse.artifacts.models.LinkConnectionResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
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", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.LinkConnectionResource]
request = build_get_link_connection_request(
link_connection_name=link_connection_name,
api_version=api_version,
template_url=self.get_link_connection.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)
raise HttpResponseError(response=response)
deserialized = self._deserialize("LinkConnectionResource", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_link_connection.metadata = {"url": "/linkconnections/{linkConnectionName}"} # type: ignore
[docs] @distributed_trace_async
async def delete_link_connection( # pylint: disable=inconsistent-return-statements
self, link_connection_name: str, **kwargs: Any
) -> None:
"""Delete a link connection.
:param link_connection_name: The link connection name. Required.
:type link_connection_name: 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,
304: ResourceNotModifiedError,
}
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", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]
request = build_delete_link_connection_request(
link_connection_name=link_connection_name,
api_version=api_version,
template_url=self.delete_link_connection.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, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response)
if cls:
return cls(pipeline_response, None, {})
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. Required.
: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 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,
304: ResourceNotModifiedError,
}
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", "2022-08-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: 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)
raise HttpResponseError(response=response)
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. Required.
:type link_connection_name: 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,
304: ResourceNotModifiedError,
}
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", "2022-08-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)
raise HttpResponseError(response=response)
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. Required.
:type link_connection_name: 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,
304: ResourceNotModifiedError,
}
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", "2022-08-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)
raise HttpResponseError(response=response)
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. Required.
:type link_connection_name: 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,
304: ResourceNotModifiedError,
}
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", "2022-08-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)
raise HttpResponseError(response=response)
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
[docs] @distributed_trace_async
async def list_link_tables(self, link_connection_name: str, **kwargs: Any) -> _models.LinkTableListResponse:
"""List the link tables of a link connection.
:param link_connection_name: The link connection name. Required.
:type link_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: LinkTableListResponse or the result of cls(response)
:rtype: ~azure.synapse.artifacts.models.LinkTableListResponse
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
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", "2022-08-01-preview")) # type: str
cls = kwargs.pop("cls", None) # type: ClsType[_models.LinkTableListResponse]
request = build_list_link_tables_request(
link_connection_name=link_connection_name,
api_version=api_version,
template_url=self.list_link_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)
raise HttpResponseError(response=response)
deserialized = self._deserialize("LinkTableListResponse", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_link_tables.metadata = {"url": "/linkconnections/{linkConnectionName}/linktables"} # type: ignore
@overload
async def query_table_status(
self,
link_connection_name: str,
query_table_status_request: _models.QueryTableStatusRequest,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.LinkConnectionQueryTableStatus:
"""Query the link table status of a link connection.
:param link_connection_name: The link connection name. Required.
:type link_connection_name: str
:param query_table_status_request: Query table status request. Required.
:type query_table_status_request: ~azure.synapse.artifacts.models.QueryTableStatusRequest
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: 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:
"""
@overload
async def query_table_status(
self,
link_connection_name: str,
query_table_status_request: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.LinkConnectionQueryTableStatus:
"""Query the link table status of a link connection.
:param link_connection_name: The link connection name. Required.
:type link_connection_name: str
:param query_table_status_request: Query table status request. Required.
:type query_table_status_request: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: 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:
"""
[docs] @distributed_trace_async
async def query_table_status(
self,
link_connection_name: str,
query_table_status_request: Union[_models.QueryTableStatusRequest, IO],
**kwargs: Any
) -> _models.LinkConnectionQueryTableStatus:
"""Query the link table status of a link connection.
:param link_connection_name: The link connection name. Required.
:type link_connection_name: str
:param query_table_status_request: Query table status request. Is either a model type or a IO
type. Required.
:type query_table_status_request: ~azure.synapse.artifacts.models.QueryTableStatusRequest or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: 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,
304: ResourceNotModifiedError,
}
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", "2022-08-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str]
cls = kwargs.pop("cls", None) # type: ClsType[_models.LinkConnectionQueryTableStatus]
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(query_table_status_request, (IO, bytes)):
_content = query_table_status_request
else:
_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,
content=_content,
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)
raise HttpResponseError(response=response)
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. Required.
: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 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,
304: ResourceNotModifiedError,
}
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", "2022-08-01-preview")) # type: str
content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: 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)
raise HttpResponseError(response=response)
if cls:
return cls(pipeline_response, None, {})
update_landing_zone_credential.metadata = {"url": "/linkconnections/{linkConnectionName}/updateLandingZoneCredential"} # type: ignore