Exemplo n.º 1
0
class FormRecognizerClient(FormRecognizerClientOperationsMixin):
    """Extracts information from forms and images into structured data.

    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).
    :type endpoint: 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", endpoint: str,
                 **kwargs: Any) -> None:
        base_url = '{endpoint}/formrecognizer/v2.1-preview.3'
        self._config = FormRecognizerClientConfiguration(
            credential, endpoint, **kwargs)
        self._client = AsyncPipelineClient(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)

    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 = {
            'endpoint':
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }
        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) -> "FormRecognizerClient":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 2
0
class TextAnalyticsClient(TextAnalyticsClientOperationsMixin):
    """The Text Analytics API is a suite of natural language processing (NLP)  services built with best-in-class Microsoft machine learning algorithms.  The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. Functionality for analysis of text specific to the healthcare domain and personal information are also available in the API. Further documentation can be found in :code:`<a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview">https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview</a>`.

    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
    :type endpoint: 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", endpoint: str,
                 **kwargs: Any) -> None:
        base_url = '{Endpoint}/text/analytics/v3.1-preview.4'
        self._config = TextAnalyticsClientConfiguration(
            credential, endpoint, **kwargs)
        self._client = AsyncPipelineClient(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)

    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 = {
            'Endpoint':
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }
        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) -> "TextAnalyticsClient":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 3
0
class AnomalyDetectorClient(AnomalyDetectorClientOperationsMixin):
    """The Anomaly Detector API detects anomalies automatically in time series data. It supports two kinds of mode, one is for stateless using, another is for stateful using. In stateless mode, there are three functionalities. Entire Detect is for detecting the whole series with model trained by the time series, Last Detect is detecting last point with model trained by points before. ChangePoint Detect is for detecting trend changes in time series. In stateful mode, user can store time series, the stored time series will be used for detection anomalies. Under this mode, user can still use the above three functionalities by only giving a time range without preparing time series in client side. Besides the above three functionalities, stateful model also provide group based detection and labeling service. By leveraging labeling service user can provide labels for each detection result, these labels will be used for retuning or regenerating detection models. Inconsistency detection is a kind of group based detection, this detection will find inconsistency ones in a set of time series. By using anomaly detector service, business customers can discover incidents and establish a logic flow for root cause analysis.

    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials.AzureKeyCredential
    :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).
    :type endpoint: str
    """
    def __init__(self, credential: AzureKeyCredential, endpoint: str,
                 **kwargs: Any) -> None:
        base_url = '{Endpoint}/anomalydetector/v1.1-preview'
        self._config = AnomalyDetectorClientConfiguration(
            credential, endpoint, **kwargs)
        self._client = AsyncPipelineClient(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)

    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 = {
            'Endpoint':
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }
        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) -> "AnomalyDetectorClient":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class WebPubSubServiceClient(WebPubSubServiceClientOperationsMixin):
    """WebPubSubServiceClient.

    :param hub: Target hub name, which should start with alphabetic characters and only contain
     alpha-numeric characters or underscore.
    :type hub: str
    :param endpoint: HTTP or HTTPS endpoint for the Web PubSub service instance.
    :type endpoint: str
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    :keyword api_version: Api Version. Default value is "2021-10-01". Note that overriding this
     default value may result in unsupported behavior.
    :paramtype api_version: str
    """

    def __init__(self, hub: str, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
        _endpoint = "{Endpoint}"
        self._config = WebPubSubServiceClientConfiguration(hub=hub, endpoint=endpoint, credential=credential, **kwargs)
        self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs)

        self._serialize = Serializer()
        self._deserialize = Deserializer()
        self._serialize.client_side_validation = False

    def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        >>> from azure.core.rest import HttpRequest
        >>> request = HttpRequest("GET", "https://www.example.org/")
        <HttpRequest [GET], url: 'https://www.example.org/'>
        >>> response = await client.send_request(request)
        <AsyncHttpResponse: 200 OK>

        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.rest.AsyncHttpResponse
        """

        request_copy = deepcopy(request)
        path_format_arguments = {
            "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
        }

        request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
        return self._client.send_request(request_copy, **kwargs)

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

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 5
0
class AccessControlClient(object):
    """AccessControlClient.

    :ivar role_assignments: RoleAssignmentsOperations operations
    :vartype role_assignments: azure.synapse.accesscontrol.aio.operations.RoleAssignmentsOperations
    :ivar role_definitions: RoleDefinitionsOperations operations
    :vartype role_definitions: azure.synapse.accesscontrol.aio.operations.RoleDefinitionsOperations
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    :param endpoint: The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net.
    :type endpoint: str
    """

    def __init__(
        self,
        credential: "AsyncTokenCredential",
        endpoint: str,
        **kwargs: Any
    ) -> None:
        base_url = '{endpoint}'
        self._config = AccessControlClientConfiguration(credential, endpoint, **kwargs)
        self._client = AsyncPipelineClient(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.role_assignments = RoleAssignmentsOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.role_definitions = RoleDefinitionsOperations(
            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 = {
            'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
        }
        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) -> "AccessControlClient":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 6
0
class QuestionAnsweringClient(QuestionAnsweringClientOperationsMixin):
    """The language service API is a suite of natural language processing (NLP) skills built with best-in-class Microsoft machine learning algorithms.  The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction, language detection and question answering. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview.

    :param endpoint: Supported Cognitive Services endpoint (e.g.,
         https://<resource-name>.api.cognitiveservices.azure.com).
    :type endpoint: str
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials.AzureKeyCredential
    """
    def __init__(self, endpoint: str, credential: AzureKeyCredential,
                 **kwargs: Any) -> None:
        base_url = "{Endpoint}/language"
        self._config = QuestionAnsweringClientConfiguration(
            credential, endpoint, **kwargs)
        self._client = AsyncPipelineClient(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._deserialize = Deserializer(client_models)
        self._serialize.client_side_validation = False

    def send_request(self, request: HttpRequest,
                     **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.
        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.rest.AsyncHttpResponse
        """

        request_copy = deepcopy(request)
        path_format_arguments = {
            "Endpoint":
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                "str",
                                skip_quote=True),
        }
        request_copy.url = self._client.format_url(request_copy.url,
                                                   **path_format_arguments)
        return self._client.send_request(request_copy, **kwargs)

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

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 7
0
class MetricsAdvisor(MetricsAdvisorOperationsMixin):
    """Microsoft Azure Metrics Advisor REST API (OpenAPI v2).

    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://:code:`<resource-name>`.cognitiveservices.azure.com).
    :type endpoint: str
    """
    def __init__(self, credential: "AsyncTokenCredential", endpoint: str,
                 **kwargs: Any) -> None:
        base_url = '{endpoint}/metricsadvisor/v1.0'
        self._config = MetricsAdvisorConfiguration(credential, endpoint,
                                                   **kwargs)
        self._client = AsyncPipelineClient(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)

    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 = {
            'endpoint':
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }
        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) -> "MetricsAdvisor":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 8
0
class TeamCloudClient(TeamCloudClientOperationsMixin):
    """API for working with a TeamCloud instance.

    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    :param base_url: Service URL. Default value is ''.
    :type base_url: str
    """
    def __init__(self,
                 credential: "AsyncTokenCredential",
                 base_url: str = "",
                 **kwargs: Any) -> None:
        self._config = TeamCloudClientConfiguration(credential=credential,
                                                    **kwargs)
        self._client = AsyncPipelineClient(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._deserialize = Deserializer(client_models)
        self._serialize.client_side_validation = False

    def _send_request(self, request: HttpRequest,
                      **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        >>> from azure.core.rest import HttpRequest
        >>> request = HttpRequest("GET", "https://www.example.org/")
        <HttpRequest [GET], url: 'https://www.example.org/'>
        >>> response = await client._send_request(request)
        <AsyncHttpResponse: 200 OK>

        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.rest.AsyncHttpResponse
        """

        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()

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 9
0
class KeyVaultClient(KeyVaultClientOperationsMixin):
    """The key vault client performs cryptographic key operations and vault operations against the Key
    Vault service.

    :keyword api_version: Api Version. Default value is "7.3". Note that overriding this default
     value may result in unsupported behavior.
    :paramtype api_version: str
    """

    def __init__(
        self,
        **kwargs: Any
    ) -> None:
        _base_url = '{vaultBaseUrl}'
        self._config = KeyVaultClientConfiguration(**kwargs)
        self._client = AsyncPipelineClient(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._deserialize = Deserializer(client_models)
        self._serialize.client_side_validation = False


    def _send_request(
        self,
        request: HttpRequest,
        **kwargs: Any
    ) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        >>> from azure.core.rest import HttpRequest
        >>> request = HttpRequest("GET", "https://www.example.org/")
        <HttpRequest [GET], url: 'https://www.example.org/'>
        >>> response = await client._send_request(request)
        <AsyncHttpResponse: 200 OK>

        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.rest.AsyncHttpResponse
        """

        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()

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 10
0
class SearchClient(object):
    """Client that can be used to query an index and upload, merge, or delete documents.

    :ivar documents: DocumentsOperations operations
    :vartype documents: azure.search.documents.v2020_06.aio.operations.DocumentsOperations
    :param endpoint: The endpoint URL of the search service.
    :type endpoint: str
    :param index_name: The name of the index.
    :type index_name: str
    """

    def __init__(
        self,
        endpoint: str,
        index_name: str,
        **kwargs: Any
    ) -> None:
        base_url = '{endpoint}/indexes(\'{indexName}\')'
        self._config = SearchClientConfiguration(endpoint, index_name, **kwargs)
        self._client = AsyncPipelineClient(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.documents = DocumentsOperations(
            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 = {
            'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
            'indexName': self._serialize.url("self._config.index_name", self._config.index_name, '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) -> "SearchClient":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 11
0
class KeyVaultClient(KeyVaultClientOperationsMixin):
    """The key vault client performs cryptographic key operations and vault operations against the Key Vault service.

    :ivar role_definitions: RoleDefinitionsOperations operations
    :vartype role_definitions: azure.keyvault.v7_2.aio.operations.RoleDefinitionsOperations
    :ivar role_assignments: RoleAssignmentsOperations operations
    :vartype role_assignments: azure.keyvault.v7_2.aio.operations.RoleAssignmentsOperations
    :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
    """
    def __init__(self, **kwargs: Any) -> None:
        base_url = '{vaultBaseUrl}'
        self._config = KeyVaultClientConfiguration(**kwargs)
        self._client = AsyncPipelineClient(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.role_definitions = RoleDefinitionsOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.role_assignments = RoleAssignmentsOperations(
            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
        """
        http_request.url = self._client.format_url(http_request.url)
        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) -> "KeyVaultClient":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class EventGridPublisherClient:
    """EventGrid Python Publisher Client.

    """
    def __init__(self, **kwargs: Any) -> None:
        base_url = 'https://{topicHostname}'
        self._config = EventGridPublisherClientConfiguration(**kwargs)
        self._client = AsyncPipelineClient(base_url=base_url,
                                           config=self._config,
                                           **kwargs)

        client_models = {}  # type: Dict[str, Any]
        self._serialize = Serializer(client_models)
        self._deserialize = Deserializer(client_models)
        self._serialize.client_side_validation = False

    def send_request(self, request: HttpRequest,
                     **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        We have helper methods to create requests specific to this service in `event_grid_publisher_client.rest`.
        Use these helper methods to create the request you pass to this method.

        >>> from event_grid_publisher_client.rest import build_publish_events_request
        >>> request = build_publish_events_request(json=json, content=content, **kwargs)
        <HttpRequest [POST], url: '/api/events'>
        >>> response = await client.send_request(request)
        <AsyncHttpResponse: 200 OK>

        For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart

        For advanced cases, you can also create your own :class:`~azure.core.rest.HttpRequest`
        and pass it in.

        :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.rest.AsyncHttpResponse
        """

        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()

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 13
0
class CommunicationNetworkTraversalClient(object):
    """Azure Communication Networking Service.

    :ivar communication_network_traversal: CommunicationNetworkTraversalOperations operations
    :vartype communication_network_traversal: azure.communication.networktraversal.aio.operations.CommunicationNetworkTraversalOperations
    :param endpoint: The communication resource, for example https://my-resource.communication.azure.com.
    :type endpoint: str
    """

    def __init__(
        self,
        endpoint: str,
        **kwargs: Any
    ) -> None:
        base_url = '{endpoint}'
        self._config = CommunicationNetworkTraversalClientConfiguration(endpoint, **kwargs)
        self._client = AsyncPipelineClient(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.communication_network_traversal = CommunicationNetworkTraversalOperations(
            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 = {
            'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
        }
        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) -> "CommunicationNetworkTraversalClient":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class LayersManager(object):
    """Layers Manager server.

    :ivar layers: LayersOperations operations
    :vartype layers: layers_manager.aio.operations.LayersOperations
    :param str base_url: Service URL
    """

    def __init__(
        self,
        base_url: Optional[str] = None,
        **kwargs: Any
    ) -> None:
        if not base_url:
            base_url = 'http://localhost:3000/api/v1'
        self._config = LayersManagerConfiguration(**kwargs)
        self._client = AsyncPipelineClient(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.layers = LayersOperations(
            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
        """
        http_request.url = self._client.format_url(http_request.url)
        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) -> "LayersManager":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class EventGridPublisherClient(EventGridPublisherClientOperationsMixin):
    """EventGrid Python Publisher Client.

    """
    def __init__(self, **kwargs: Any) -> None:
        base_url = '{topicHostname}'
        self._config = EventGridPublisherClientConfiguration(**kwargs)
        self._client = AsyncPipelineClient(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)

    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
        """
        http_request.url = self._client.format_url(http_request.url)
        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) -> "EventGridPublisherClient":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class AsyncTestRestClient(object):

    def __init__(self, port, **kwargs):
        self._config = TestRestClientConfiguration(**kwargs)

        self._client = AsyncPipelineClient(
            base_url="http://localhost:{}".format(port),
            config=self._config,
            **kwargs
        )

    def send_request(self, request, **kwargs):
        """Runs the network request through the client's chained policies.
        >>> from azure.core.rest import HttpRequest
        >>> request = HttpRequest("GET", "http://localhost:3000/helloWorld")
        <HttpRequest [GET], url: 'http://localhost:3000/helloWorld'>
        >>> response = await client.send_request(request)
        <AsyncHttpResponse: 200 OK>
        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.rest.AsyncHttpResponse
        """
        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()

    async def __aenter__(self):
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 17
0
class PurviewCatalogClient(object):
    """Purview Catalog Service is a fully managed cloud service whose users can discover the data sources they need and understand the data sources they find. At the same time, Data Catalog helps organizations get more value from their existing investments. This spec defines REST API of Purview Catalog Service.

    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    :param endpoint: The catalog endpoint of your Purview account. Example: https://{accountName}.catalog.purview.azure.com.
    :type endpoint: str
    """
    def __init__(self, credential: "AsyncTokenCredential", endpoint: str,
                 **kwargs: Any) -> None:
        base_url = '{Endpoint}/api'
        self._config = PurviewCatalogClientConfiguration(
            credential, endpoint, **kwargs)
        self._client = AsyncPipelineClient(base_url=base_url,
                                           config=self._config,
                                           **kwargs)

        self._serialize = Serializer()
        self._deserialize = Deserializer()
        self._serialize.client_side_validation = False

    async def send_request(self, http_request: HttpRequest,
                           **kwargs: Any) -> AsyncHttpResponse:
        """Runs the network request through the client's chained policies.

        We have helper methods to create requests specific to this service in `azure.purview.catalog.rest`.
        Use these helper methods to create the request you pass to this method. See our example below:

        >>> from azure.purview.catalog.rest import build_create_or_update_request
        >>> request = build_create_or_update_request(json, content)
        <HttpRequest [POST], url: '/atlas/v2/entity'>
        >>> response = await client.send_request(request)
        <AsyncHttpResponse: 200 OK>

        For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart

        For advanced cases, you can also create your own :class:`~azure.purview.catalog.core.rest.HttpRequest`
        and pass it in.

        :param http_request: The network request you want to make. Required.
        :type http_request: ~azure.purview.catalog.core.rest.HttpRequest
        :keyword bool stream_response: 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.purview.catalog.core.rest.AsyncHttpResponse
        """
        request_copy = deepcopy(http_request)
        path_format_arguments = {
            'Endpoint':
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }
        request_copy.url = self._client.format_url(request_copy.url,
                                                   **path_format_arguments)
        if kwargs.pop("stream_response", False):
            return _AsyncStreamContextManager(
                client=self._client._pipeline,
                request=request_copy,
            )
        pipeline_response = await self._client._pipeline.run(
            request_copy._internal_request, **kwargs)
        response = AsyncHttpResponse(
            status_code=pipeline_response.http_response.status_code,
            request=request_copy,
            _internal_response=pipeline_response.http_response)
        await response.read()
        return response

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

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class ConversationAnalysisClient(ConversationAnalysisClientOperationsMixin):
    """This API accepts a request and mediates among multiple language projects, such as LUIS
    Generally Available, Question Answering, Conversational Language Understanding, and then calls
    the best candidate service to handle the request. At last, it returns a response with the
    candidate service's response as a payload.

     In some cases, this API needs to forward requests and responses between the caller and an
    upstream service.

    :param endpoint: Supported Cognitive Services endpoint (e.g.,
     https://:code:`<resource-name>`.api.cognitiveservices.azure.com).
    :type endpoint: str
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials.AzureKeyCredential
    :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding
     this default value may result in unsupported behavior.
    :paramtype api_version: str
    """
    def __init__(self, endpoint: str, credential: AzureKeyCredential,
                 **kwargs: Any) -> None:
        _endpoint = '{Endpoint}/language'
        self._config = ConversationAnalysisClientConfiguration(
            endpoint=endpoint, credential=credential, **kwargs)
        self._client = AsyncPipelineClient(base_url=_endpoint,
                                           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._deserialize = Deserializer(client_models)
        self._serialize.client_side_validation = False

    def send_request(self, request: HttpRequest,
                     **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        >>> from azure.core.rest import HttpRequest
        >>> request = HttpRequest("GET", "https://www.example.org/")
        <HttpRequest [GET], url: 'https://www.example.org/'>
        >>> response = await client.send_request(request)
        <AsyncHttpResponse: 200 OK>

        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.rest.AsyncHttpResponse
        """

        request_copy = deepcopy(request)
        path_format_arguments = {
            "Endpoint":
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }

        request_copy.url = self._client.format_url(request_copy.url,
                                                   **path_format_arguments)
        return self._client.send_request(request_copy, **kwargs)

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

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class ContainerRegistry(object):
    """Metadata API definition for the Azure Container Registry runtime.

    :ivar container_registry: ContainerRegistryOperations operations
    :vartype container_registry: container_registry.aio.operations.ContainerRegistryOperations
    :ivar container_registry_blob: ContainerRegistryBlobOperations operations
    :vartype container_registry_blob: container_registry.aio.operations.ContainerRegistryBlobOperations
    :ivar authentication: AuthenticationOperations operations
    :vartype authentication: container_registry.aio.operations.AuthenticationOperations
    :param url: Registry login URL.
    :type url: str
    """
    def __init__(self, url: str, **kwargs: Any) -> None:
        base_url = '{url}'
        self._config = ContainerRegistryConfiguration(url, **kwargs)
        self._client = AsyncPipelineClient(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.container_registry = ContainerRegistryOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.container_registry_blob = ContainerRegistryBlobOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.authentication = AuthenticationOperations(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 = {
            'url':
            self._serialize.url("self._config.url",
                                self._config.url,
                                'str',
                                skip_quote=True),
        }
        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) -> "ContainerRegistry":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class AzureFileStorage(object):
    """AzureFileStorage.

    :ivar service: ServiceOperations operations
    :vartype service: azure.storage.fileshare.aio.operations.ServiceOperations
    :ivar share: ShareOperations operations
    :vartype share: azure.storage.fileshare.aio.operations.ShareOperations
    :ivar directory: DirectoryOperations operations
    :vartype directory: azure.storage.fileshare.aio.operations.DirectoryOperations
    :ivar file: FileOperations operations
    :vartype file: azure.storage.fileshare.aio.operations.FileOperations
    :param url: The URL of the service account, share, directory or file that is the target of the desired operation.
    :type url: str
    """
    def __init__(self, url: str, **kwargs: Any) -> None:
        base_url = '{url}'
        self._config = AzureFileStorageConfiguration(url, **kwargs)
        self._client = AsyncPipelineClient(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.service = ServiceOperations(self._client, self._config,
                                         self._serialize, self._deserialize)
        self.share = ShareOperations(self._client, self._config,
                                     self._serialize, self._deserialize)
        self.directory = DirectoryOperations(self._client, self._config,
                                             self._serialize,
                                             self._deserialize)
        self.file = FileOperations(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 = {
            'url':
            self._serialize.url("self._config.url",
                                self._config.url,
                                'str',
                                skip_quote=True),
        }
        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) -> "AzureFileStorage":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class AzureFileStorage:
    """AzureFileStorage.

    :ivar service: ServiceOperations operations
    :vartype service: azure.storage.fileshare.aio.operations.ServiceOperations
    :ivar share: ShareOperations operations
    :vartype share: azure.storage.fileshare.aio.operations.ShareOperations
    :ivar directory: DirectoryOperations operations
    :vartype directory: azure.storage.fileshare.aio.operations.DirectoryOperations
    :ivar file: FileOperations operations
    :vartype file: azure.storage.fileshare.aio.operations.FileOperations
    :param url: The URL of the service account, share, directory or file that is the target of the
     desired operation.
    :type url: str
    :param base_url: Service URL. Default value is "".
    :type base_url: str
    :keyword version: Specifies the version of the operation to use for this request. Default value
     is "2021-04-10". Note that overriding this default value may result in unsupported behavior.
    :paramtype version: str
    :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes
     downloaded from the source url into the specified range. Default value is "update". Note that
     overriding this default value may result in unsupported behavior.
    :paramtype file_range_write_from_url: str
    """
    def __init__(self, url: str, base_url: str = "", **kwargs: Any) -> None:
        self._config = AzureFileStorageConfiguration(url=url, **kwargs)
        self._client = AsyncPipelineClient(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._deserialize = Deserializer(client_models)
        self._serialize.client_side_validation = False
        self.service = ServiceOperations(self._client, self._config,
                                         self._serialize, self._deserialize)
        self.share = ShareOperations(self._client, self._config,
                                     self._serialize, self._deserialize)
        self.directory = DirectoryOperations(self._client, self._config,
                                             self._serialize,
                                             self._deserialize)
        self.file = FileOperations(self._client, self._config, self._serialize,
                                   self._deserialize)

    def _send_request(self, request: HttpRequest,
                      **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        >>> from azure.core.rest import HttpRequest
        >>> request = HttpRequest("GET", "https://www.example.org/")
        <HttpRequest [GET], url: 'https://www.example.org/'>
        >>> response = await client._send_request(request)
        <AsyncHttpResponse: 200 OK>

        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.rest.AsyncHttpResponse
        """

        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()

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 22
0
class SearchClient(SearchClientOperationsMixin):
    """Client that can be used to manage and query indexes and documents, as well as manage other resources, on a search service.

    :ivar data_sources: DataSourcesOperations operations
    :vartype data_sources: azure.search.documents.indexes.v2020_06_preview.aio.operations.DataSourcesOperations
    :ivar indexers: IndexersOperations operations
    :vartype indexers: azure.search.documents.indexes.v2020_06_preview.aio.operations.IndexersOperations
    :ivar skillsets: SkillsetsOperations operations
    :vartype skillsets: azure.search.documents.indexes.v2020_06_preview.aio.operations.SkillsetsOperations
    :ivar synonym_maps: SynonymMapsOperations operations
    :vartype synonym_maps: azure.search.documents.indexes.v2020_06_preview.aio.operations.SynonymMapsOperations
    :ivar indexes: IndexesOperations operations
    :vartype indexes: azure.search.documents.indexes.v2020_06_preview.aio.operations.IndexesOperations
    :param endpoint: The endpoint URL of the search service.
    :type endpoint: str
    """
    def __init__(self, endpoint: str, **kwargs: Any) -> None:
        base_url = '{endpoint}'
        self._config = SearchClientConfiguration(endpoint, **kwargs)
        self._client = AsyncPipelineClient(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.data_sources = DataSourcesOperations(self._client, self._config,
                                                  self._serialize,
                                                  self._deserialize)
        self.indexers = IndexersOperations(self._client, self._config,
                                           self._serialize, self._deserialize)
        self.skillsets = SkillsetsOperations(self._client, self._config,
                                             self._serialize,
                                             self._deserialize)
        self.synonym_maps = SynonymMapsOperations(self._client, self._config,
                                                  self._serialize,
                                                  self._deserialize)
        self.indexes = IndexesOperations(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 = {
            'endpoint':
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }
        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) -> "SearchClient":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 23
0
class AzureMonitorClient(AzureMonitorClientOperationsMixin):
    """OpenTelemetry Exporter for Azure Monitor.

    :param host: Breeze endpoint: https://dc.services.visualstudio.com. Default value is
     "https://dc.services.visualstudio.com".
    :type host: str
    """
    def __init__(self,
                 host: str = "https://dc.services.visualstudio.com",
                 **kwargs: Any) -> None:
        _base_url = '{Host}/v2.1'
        self._config = AzureMonitorClientConfiguration(host=host, **kwargs)
        self._client = AsyncPipelineClient(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._deserialize = Deserializer(client_models)
        self._serialize.client_side_validation = False

    def _send_request(self, request: HttpRequest,
                      **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        >>> from azure.core.rest import HttpRequest
        >>> request = HttpRequest("GET", "https://www.example.org/")
        <HttpRequest [GET], url: 'https://www.example.org/'>
        >>> response = await client._send_request(request)
        <AsyncHttpResponse: 200 OK>

        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.rest.AsyncHttpResponse
        """

        request_copy = deepcopy(request)
        path_format_arguments = {
            "Host":
            self._serialize.url("self._config.host",
                                self._config.host,
                                'str',
                                skip_quote=True),
        }

        request_copy.url = self._client.format_url(request_copy.url,
                                                   **path_format_arguments)
        return self._client.send_request(request_copy, **kwargs)

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

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 24
0
class AzureSchemaRegistry:
    """Azure Schema Registry is as a central schema repository, complete with support for versioning, management, compatibility checking, and RBAC.

    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    :param endpoint: The Schema Registry service endpoint, for example
         my-namespace.servicebus.windows.net.
    :type endpoint: str
    """

    def __init__(
        self,
        credential: "AsyncTokenCredential",
        endpoint: str,
        **kwargs: Any
    ) -> None:
        base_url = 'https://{endpoint}'
        self._config = AzureSchemaRegistryConfiguration(credential, endpoint, **kwargs)
        self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)

        client_models = {}  # type: Dict[str, Any]
        self._serialize = Serializer(client_models)
        self._deserialize = Deserializer(client_models)
        self._serialize.client_side_validation = False


    def send_request(
        self,
        request: HttpRequest,
        **kwargs: Any
    ) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        We have helper methods to create requests specific to this service in `azure.schemaregistry._generated.rest`.
        Use these helper methods to create the request you pass to this method.

        >>> from azure.schemaregistry._generated.rest import schema
        >>> request = schema.build_get_by_id_request(schema_id, **kwargs)
        <HttpRequest [GET], url: '/$schemagroups/getSchemaById/{schema-id}'>
        >>> response = await client.send_request(request)
        <AsyncHttpResponse: 200 OK>

        For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart

        For advanced cases, you can also create your own :class:`~azure.core.rest.HttpRequest`
        and pass it in.

        :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.rest.AsyncHttpResponse
        """

        request_copy = deepcopy(request)
        path_format_arguments = {
            'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
        }
        request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
        return self._client.send_request(request_copy, **kwargs)

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

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class AzureSchemaRegistry:
    """Azure Schema Registry is as a central schema repository, with support for versioning, management, compatibility checking, and RBAC.

    :param endpoint: The Schema Registry service endpoint, for example
     my-namespace.servicebus.windows.net.
    :type endpoint: str
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    :keyword api_version: Api Version. The default value is "2021-10". Note that overriding this
     default value may result in unsupported behavior.
    :paramtype api_version: str
    """
    def __init__(self, endpoint: str, credential: "AsyncTokenCredential",
                 **kwargs: Any) -> None:
        _endpoint = 'https://{endpoint}'
        self._config = AzureSchemaRegistryConfiguration(endpoint=endpoint,
                                                        credential=credential,
                                                        **kwargs)
        self._client = AsyncPipelineClient(base_url=_endpoint,
                                           config=self._config,
                                           **kwargs)

        self._serialize = Serializer()
        self._deserialize = Deserializer()
        self._serialize.client_side_validation = False

    def send_request(self, request: HttpRequest,
                     **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        We have helper methods to create requests specific to this service in `azure.schemaregistry._generated.rest`.
        Use these helper methods to create the request you pass to this method.

        >>> from azure.schemaregistry._generated.rest import schema_groups
        >>> request = schema_groups.build_list_request(**kwargs)
        <HttpRequest [GET], url: '/$schemaGroups'>
        >>> response = await client.send_request(request)
        <AsyncHttpResponse: 200 OK>

        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.rest.AsyncHttpResponse
        """

        request_copy = deepcopy(request)
        path_format_arguments = {
            "endpoint":
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }

        request_copy.url = self._client.format_url(request_copy.url,
                                                   **path_format_arguments)
        return self._client.send_request(request_copy, **kwargs)

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

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 26
0
class ContainerRegistry:
    """Metadata API definition for the Azure Container Registry runtime.

    :ivar container_registry: ContainerRegistryOperations operations
    :vartype container_registry: container_registry.aio.operations.ContainerRegistryOperations
    :ivar container_registry_blob: ContainerRegistryBlobOperations operations
    :vartype container_registry_blob:
     container_registry.aio.operations.ContainerRegistryBlobOperations
    :ivar authentication: AuthenticationOperations operations
    :vartype authentication: container_registry.aio.operations.AuthenticationOperations
    :param url: Registry login URL.
    :type url: str
    :keyword api_version: Api Version. The default value is "2021-07-01". Note that overriding this
     default value may result in unsupported behavior.
    :paramtype api_version: str
    """
    def __init__(self, url: str, **kwargs: Any) -> None:
        _base_url = '{url}'
        self._config = ContainerRegistryConfiguration(url=url, **kwargs)
        self._client = AsyncPipelineClient(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._deserialize = Deserializer(client_models)
        self._serialize.client_side_validation = False
        self.container_registry = ContainerRegistryOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.container_registry_blob = ContainerRegistryBlobOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.authentication = AuthenticationOperations(self._client,
                                                       self._config,
                                                       self._serialize,
                                                       self._deserialize)

    def _send_request(self, request: HttpRequest,
                      **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        >>> from azure.core.rest import HttpRequest
        >>> request = HttpRequest("GET", "https://www.example.org/")
        <HttpRequest [GET], url: 'https://www.example.org/'>
        >>> response = await client._send_request(request)
        <AsyncHttpResponse: 200 OK>

        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.rest.AsyncHttpResponse
        """

        request_copy = deepcopy(request)
        path_format_arguments = {
            "url":
            self._serialize.url("self._config.url",
                                self._config.url,
                                'str',
                                skip_quote=True),
        }

        request_copy.url = self._client.format_url(request_copy.url,
                                                   **path_format_arguments)
        return self._client.send_request(request_copy, **kwargs)

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

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class QuantumClient:
    """Azure Quantum REST API client.

    :ivar jobs: JobsOperations operations
    :vartype jobs: azure.quantum._client.aio.operations.JobsOperations
    :ivar providers: ProvidersOperations operations
    :vartype providers: azure.quantum._client.aio.operations.ProvidersOperations
    :ivar storage: StorageOperations operations
    :vartype storage: azure.quantum._client.aio.operations.StorageOperations
    :ivar quotas: QuotasOperations operations
    :vartype quotas: azure.quantum._client.aio.operations.QuotasOperations
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
     00000000-0000-0000-0000-000000000000).
    :type subscription_id: str
    :param resource_group_name: Name of an Azure resource group.
    :type resource_group_name: str
    :param workspace_name: Name of the workspace.
    :type workspace_name: str
    :param base_url: Service URL. Default value is "https://quantum.azure.com".
    :type base_url: str
    """
    def __init__(self,
                 credential: "AsyncTokenCredential",
                 subscription_id: str,
                 resource_group_name: str,
                 workspace_name: str,
                 base_url: str = "https://quantum.azure.com",
                 **kwargs: Any) -> None:
        self._config = QuantumClientConfiguration(
            credential=credential,
            subscription_id=subscription_id,
            resource_group_name=resource_group_name,
            workspace_name=workspace_name,
            **kwargs)
        self._client = AsyncPipelineClient(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._deserialize = Deserializer(client_models)
        self._serialize.client_side_validation = False
        self.jobs = JobsOperations(self._client, self._config, self._serialize,
                                   self._deserialize)
        self.providers = ProvidersOperations(self._client, self._config,
                                             self._serialize,
                                             self._deserialize)
        self.storage = StorageOperations(self._client, self._config,
                                         self._serialize, self._deserialize)
        self.quotas = QuotasOperations(self._client, self._config,
                                       self._serialize, self._deserialize)

    def _send_request(self, request: HttpRequest,
                      **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        >>> from azure.core.rest import HttpRequest
        >>> request = HttpRequest("GET", "https://www.example.org/")
        <HttpRequest [GET], url: 'https://www.example.org/'>
        >>> response = await client._send_request(request)
        <AsyncHttpResponse: 200 OK>

        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.rest.AsyncHttpResponse
        """

        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()

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class FarmBeatsClient(object):
    """APIs documentation for Azure AgPlatform DataPlane Service.

    :ivar application_data: ApplicationDataOperations operations
    :vartype application_data: azure.agrifood.farming.aio.operations.ApplicationDataOperations
    :ivar attachments: AttachmentsOperations operations
    :vartype attachments: azure.agrifood.farming.aio.operations.AttachmentsOperations
    :ivar boundaries: BoundariesOperations operations
    :vartype boundaries: azure.agrifood.farming.aio.operations.BoundariesOperations
    :ivar crops: CropsOperations operations
    :vartype crops: azure.agrifood.farming.aio.operations.CropsOperations
    :ivar crop_varieties: CropVarietiesOperations operations
    :vartype crop_varieties: azure.agrifood.farming.aio.operations.CropVarietiesOperations
    :ivar farmers: FarmersOperations operations
    :vartype farmers: azure.agrifood.farming.aio.operations.FarmersOperations
    :ivar farm_operations: FarmOperationsOperations operations
    :vartype farm_operations: azure.agrifood.farming.aio.operations.FarmOperationsOperations
    :ivar farms: FarmsOperations operations
    :vartype farms: azure.agrifood.farming.aio.operations.FarmsOperations
    :ivar fields: FieldsOperations operations
    :vartype fields: azure.agrifood.farming.aio.operations.FieldsOperations
    :ivar harvest_data: HarvestDataOperations operations
    :vartype harvest_data: azure.agrifood.farming.aio.operations.HarvestDataOperations
    :ivar image_processing: ImageProcessingOperations operations
    :vartype image_processing: azure.agrifood.farming.aio.operations.ImageProcessingOperations
    :ivar oauth_providers: OAuthProvidersOperations operations
    :vartype oauth_providers: azure.agrifood.farming.aio.operations.OAuthProvidersOperations
    :ivar oauth_tokens: OAuthTokensOperations operations
    :vartype oauth_tokens: azure.agrifood.farming.aio.operations.OAuthTokensOperations
    :ivar planting_data: PlantingDataOperations operations
    :vartype planting_data: azure.agrifood.farming.aio.operations.PlantingDataOperations
    :ivar scenes: ScenesOperations operations
    :vartype scenes: azure.agrifood.farming.aio.operations.ScenesOperations
    :ivar seasonal_fields: SeasonalFieldsOperations operations
    :vartype seasonal_fields: azure.agrifood.farming.aio.operations.SeasonalFieldsOperations
    :ivar seasons: SeasonsOperations operations
    :vartype seasons: azure.agrifood.farming.aio.operations.SeasonsOperations
    :ivar tillage_data: TillageDataOperations operations
    :vartype tillage_data: azure.agrifood.farming.aio.operations.TillageDataOperations
    :ivar weather: WeatherOperations operations
    :vartype weather: azure.agrifood.farming.aio.operations.WeatherOperations
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    :param endpoint: The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net).
    :type endpoint: 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", endpoint: str,
                 **kwargs: Any) -> None:
        base_url = '{Endpoint}'
        self._config = FarmBeatsClientConfiguration(credential, endpoint,
                                                    **kwargs)
        self._client = AsyncPipelineClient(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.application_data = ApplicationDataOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.attachments = AttachmentsOperations(self._client, self._config,
                                                 self._serialize,
                                                 self._deserialize)
        self.boundaries = BoundariesOperations(self._client, self._config,
                                               self._serialize,
                                               self._deserialize)
        self.crops = CropsOperations(self._client, self._config,
                                     self._serialize, self._deserialize)
        self.crop_varieties = CropVarietiesOperations(self._client,
                                                      self._config,
                                                      self._serialize,
                                                      self._deserialize)
        self.farmers = FarmersOperations(self._client, self._config,
                                         self._serialize, self._deserialize)
        self.farm_operations = FarmOperationsOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.farms = FarmsOperations(self._client, self._config,
                                     self._serialize, self._deserialize)
        self.fields = FieldsOperations(self._client, self._config,
                                       self._serialize, self._deserialize)
        self.harvest_data = HarvestDataOperations(self._client, self._config,
                                                  self._serialize,
                                                  self._deserialize)
        self.image_processing = ImageProcessingOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.oauth_providers = OAuthProvidersOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.oauth_tokens = OAuthTokensOperations(self._client, self._config,
                                                  self._serialize,
                                                  self._deserialize)
        self.planting_data = PlantingDataOperations(self._client, self._config,
                                                    self._serialize,
                                                    self._deserialize)
        self.scenes = ScenesOperations(self._client, self._config,
                                       self._serialize, self._deserialize)
        self.seasonal_fields = SeasonalFieldsOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.seasons = SeasonsOperations(self._client, self._config,
                                         self._serialize, self._deserialize)
        self.tillage_data = TillageDataOperations(self._client, self._config,
                                                  self._serialize,
                                                  self._deserialize)
        self.weather = WeatherOperations(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 = {
            'Endpoint':
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }
        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) -> "FarmBeatsClient":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
class SearchClient(SearchClientOperationsMixin):
    """Client that can be used to manage and query indexes and documents, as well as manage other resources, on a search service.

    :ivar data_sources: DataSourcesOperations operations
    :vartype data_sources: azure.search.documents.indexes.aio.operations.DataSourcesOperations
    :ivar indexers: IndexersOperations operations
    :vartype indexers: azure.search.documents.indexes.aio.operations.IndexersOperations
    :ivar skillsets: SkillsetsOperations operations
    :vartype skillsets: azure.search.documents.indexes.aio.operations.SkillsetsOperations
    :ivar synonym_maps: SynonymMapsOperations operations
    :vartype synonym_maps: azure.search.documents.indexes.aio.operations.SynonymMapsOperations
    :ivar indexes: IndexesOperations operations
    :vartype indexes: azure.search.documents.indexes.aio.operations.IndexesOperations
    :param endpoint: The endpoint URL of the search service.
    :type endpoint: str
    :keyword api_version: Api Version. The default value is "2021-04-30-Preview". Note that
     overriding this default value may result in unsupported behavior.
    :paramtype api_version: str
    """
    def __init__(self, endpoint: str, **kwargs: Any) -> None:
        _base_url = '{endpoint}'
        self._config = SearchClientConfiguration(endpoint=endpoint, **kwargs)
        self._client = AsyncPipelineClient(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._deserialize = Deserializer(client_models)
        self._serialize.client_side_validation = False
        self.data_sources = DataSourcesOperations(self._client, self._config,
                                                  self._serialize,
                                                  self._deserialize)
        self.indexers = IndexersOperations(self._client, self._config,
                                           self._serialize, self._deserialize)
        self.skillsets = SkillsetsOperations(self._client, self._config,
                                             self._serialize,
                                             self._deserialize)
        self.synonym_maps = SynonymMapsOperations(self._client, self._config,
                                                  self._serialize,
                                                  self._deserialize)
        self.indexes = IndexesOperations(self._client, self._config,
                                         self._serialize, self._deserialize)

    def _send_request(self, request: HttpRequest,
                      **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        >>> from azure.core.rest import HttpRequest
        >>> request = HttpRequest("GET", "https://www.example.org/")
        <HttpRequest [GET], url: 'https://www.example.org/'>
        >>> response = await client._send_request(request)
        <AsyncHttpResponse: 200 OK>

        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.rest.AsyncHttpResponse
        """

        request_copy = deepcopy(request)
        path_format_arguments = {
            "endpoint":
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }

        request_copy.url = self._client.format_url(request_copy.url,
                                                   **path_format_arguments)
        return self._client.send_request(request_copy, **kwargs)

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

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
Exemplo n.º 30
0
class PurviewScanningClient:
    """Creates a Microsoft.Scanning management client.

    :ivar key_vault_connections: KeyVaultConnectionsOperations operations
    :vartype key_vault_connections:
     azure.purview.scanning.aio.operations.KeyVaultConnectionsOperations
    :ivar classification_rules: ClassificationRulesOperations operations
    :vartype classification_rules:
     azure.purview.scanning.aio.operations.ClassificationRulesOperations
    :ivar data_sources: DataSourcesOperations operations
    :vartype data_sources: azure.purview.scanning.aio.operations.DataSourcesOperations
    :ivar filters: FiltersOperations operations
    :vartype filters: azure.purview.scanning.aio.operations.FiltersOperations
    :ivar scans: ScansOperations operations
    :vartype scans: azure.purview.scanning.aio.operations.ScansOperations
    :ivar scan_result: ScanResultOperations operations
    :vartype scan_result: azure.purview.scanning.aio.operations.ScanResultOperations
    :ivar scan_rulesets: ScanRulesetsOperations operations
    :vartype scan_rulesets: azure.purview.scanning.aio.operations.ScanRulesetsOperations
    :ivar system_scan_rulesets: SystemScanRulesetsOperations operations
    :vartype system_scan_rulesets:
     azure.purview.scanning.aio.operations.SystemScanRulesetsOperations
    :ivar triggers: TriggersOperations operations
    :vartype triggers: azure.purview.scanning.aio.operations.TriggersOperations
    :param endpoint: The scanning endpoint of your purview account. Example:
     https://{accountName}.scan.purview.azure.com.
    :type endpoint: str
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    """
    def __init__(self, endpoint: str, credential: "AsyncTokenCredential",
                 **kwargs: Any) -> None:
        _endpoint = '{Endpoint}'
        self._config = PurviewScanningClientConfiguration(
            endpoint, credential, **kwargs)
        self._client = AsyncPipelineClient(base_url=_endpoint,
                                           config=self._config,
                                           **kwargs)

        self._serialize = Serializer()
        self._deserialize = Deserializer()
        self._serialize.client_side_validation = False
        self.key_vault_connections = KeyVaultConnectionsOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.classification_rules = ClassificationRulesOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.data_sources = DataSourcesOperations(self._client, self._config,
                                                  self._serialize,
                                                  self._deserialize)
        self.filters = FiltersOperations(self._client, self._config,
                                         self._serialize, self._deserialize)
        self.scans = ScansOperations(self._client, self._config,
                                     self._serialize, self._deserialize)
        self.scan_result = ScanResultOperations(self._client, self._config,
                                                self._serialize,
                                                self._deserialize)
        self.scan_rulesets = ScanRulesetsOperations(self._client, self._config,
                                                    self._serialize,
                                                    self._deserialize)
        self.system_scan_rulesets = SystemScanRulesetsOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.triggers = TriggersOperations(self._client, self._config,
                                           self._serialize, self._deserialize)

    def send_request(self, request: HttpRequest,
                     **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
        """Runs the network request through the client's chained policies.

        >>> from azure.core.rest import HttpRequest
        >>> request = HttpRequest("GET", "https://www.example.org/")
        <HttpRequest [GET], url: 'https://www.example.org/'>
        >>> response = await client.send_request(request)
        <AsyncHttpResponse: 200 OK>

        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.rest.AsyncHttpResponse
        """

        request_copy = deepcopy(request)
        path_format_arguments = {
            "Endpoint":
            self._serialize.url("self._config.endpoint",
                                self._config.endpoint,
                                'str',
                                skip_quote=True),
        }

        request_copy.url = self._client.format_url(request_copy.url,
                                                   **path_format_arguments)
        return self._client.send_request(request_copy, **kwargs)

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

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

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)