Example #1
0
class ConfidentialLedgerIdentityServiceClient(object):
    """The ConfidentialLedgerIdentityServiceClient is used to retrieve the TLS certificate required for connecting to a Confidential Ledger.

    :ivar confidential_ledger_identity_service: ConfidentialLedgerIdentityServiceOperations operations
    :vartype confidential_ledger_identity_service: azure.confidentialledger._generated/_generated_identity.v0_1_preview.operations.ConfidentialLedgerIdentityServiceOperations
    :param identity_service_uri: The Identity Service URL, for example https://identity.accledger.azure.com.
    :type identity_service_uri: str
    """
    def __init__(
            self,
            identity_service_uri,  # type: str
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        base_url = '{identityServiceUri}'
        self._config = ConfidentialLedgerIdentityServiceClientConfiguration(
            identity_service_uri, **kwargs)
        self._client = PipelineClient(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.confidential_ledger_identity_service = ConfidentialLedgerIdentityServiceOperations(
            self._client, self._config, self._serialize, self._deserialize)

    def _send_request(self, http_request, **kwargs):
        # type: (HttpRequest, Any) -> HttpResponse
        """Runs the network request through the client's chained policies.

        :param http_request: The network request you want to make. Required.
        :type http_request: ~azure.core.pipeline.transport.HttpRequest
        :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
        :return: The response of your network call. Does not do error handling on your response.
        :rtype: ~azure.core.pipeline.transport.HttpResponse
        """
        path_format_arguments = {
            'identityServiceUri':
            self._serialize.url("self._config.identity_service_uri",
                                self._config.identity_service_uri,
                                'str',
                                skip_quote=True),
        }
        http_request.url = self._client.format_url(http_request.url,
                                                   **path_format_arguments)
        stream = kwargs.pop("stream", True)
        pipeline_response = self._client._pipeline.run(http_request,
                                                       stream=stream,
                                                       **kwargs)
        return pipeline_response.http_response

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #2
0
class MonitorQueryClient(object):
    """Azure Monitor Query Python Client.

    :ivar query: QueryOperations operations
    :vartype query: monitor_query_client.operations.QueryOperations
    :ivar metadata: MetadataOperations operations
    :vartype metadata: monitor_query_client.operations.MetadataOperations
    :ivar metric_definitions: MetricDefinitionsOperations operations
    :vartype metric_definitions: monitor_query_client.operations.MetricDefinitionsOperations
    :ivar metrics: MetricsOperations operations
    :vartype metrics: monitor_query_client.operations.MetricsOperations
    :ivar metric_namespaces: MetricNamespacesOperations operations
    :vartype metric_namespaces: monitor_query_client.operations.MetricNamespacesOperations
    :param host: server parameter.
    :type host: str
    :param str base_url: Service URL
    """
    def __init__(
            self,
            host="https://management.azure.com",  # type: str
            base_url=None,  # type: Optional[str]
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        if not base_url:
            base_url = 'https://api.loganalytics.io/v1'
        self._config = MonitorQueryClientConfiguration(host, **kwargs)
        self._client = PipelineClient(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.query = QueryOperations(self._client, self._config,
                                     self._serialize, self._deserialize)
        self.metadata = MetadataOperations(self._client, self._config,
                                           self._serialize, self._deserialize)
        self.metric_definitions = MetricDefinitionsOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.metrics = MetricsOperations(self._client, self._config,
                                         self._serialize, self._deserialize)
        self.metric_namespaces = MetricNamespacesOperations(
            self._client, self._config, self._serialize, self._deserialize)

    def _send_request(self, http_request, **kwargs):
        # type: (HttpRequest, Any) -> HttpResponse
        """Runs the network request through the client's chained policies.

        :param http_request: The network request you want to make. Required.
        :type http_request: ~azure.core.pipeline.transport.HttpRequest
        :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
        :return: The response of your network call. Does not do error handling on your response.
        :rtype: ~azure.core.pipeline.transport.HttpResponse
        """
        http_request.url = self._client.format_url(http_request.url)
        stream = kwargs.pop("stream", True)
        pipeline_response = self._client._pipeline.run(http_request,
                                                       stream=stream,
                                                       **kwargs)
        return pipeline_response.http_response

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #3
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.TokenCredential
    :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,  # type: "TokenCredential"
            endpoint,  # type: str
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        base_url = '{Endpoint}/text/analytics/v3.1-preview.5'
        self._config = TextAnalyticsClientConfiguration(
            credential, endpoint, **kwargs)
        self._client = PipelineClient(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)

    def _send_request(self, http_request, **kwargs):
        # type: (HttpRequest, Any) -> HttpResponse
        """Runs the network request through the client's chained policies.

        :param http_request: The network request you want to make. Required.
        :type http_request: ~azure.core.pipeline.transport.HttpRequest
        :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
        :return: The response of your network call. Does not do error handling on your response.
        :rtype: ~azure.core.pipeline.transport.HttpResponse
        """
        path_format_arguments = {
            '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 = self._client._pipeline.run(http_request,
                                                       stream=stream,
                                                       **kwargs)
        return pipeline_response.http_response

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
class DeviceUpdateClient:
    """Device Update for IoT Hub is an Azure service that enables customers to publish update for their IoT devices to the cloud, and then deploy that update to their devices (approve updates to groups of devices managed and provisioned in IoT Hub). It leverages the proven security and reliability of the Windows Update platform, optimized for IoT devices. It works globally and knows when and how to update devices, enabling customers to focus on their business goals and let Device Update for IoT Hub handle the updates.

    :ivar device_update: DeviceUpdateOperations operations
    :vartype device_update: azure.iot.deviceupdate.operations.DeviceUpdateOperations
    :ivar device_management: DeviceManagementOperations operations
    :vartype device_management: azure.iot.deviceupdate.operations.DeviceManagementOperations
    :param endpoint: Account endpoint.
    :type endpoint: str
    :param instance_id: Account instance identifier.
    :type instance_id: str
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials.TokenCredential
    :keyword api_version: Api Version. The default value is "2021-06-01-preview". Note that
     overriding this default value may result in unsupported behavior.
    :paramtype api_version: str
    :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
     Retry-After header is present.
    """
    def __init__(self, endpoint: str, instance_id: str,
                 credential: "TokenCredential", **kwargs: Any) -> None:
        _endpoint = 'https://{endpoint}'
        self._config = DeviceUpdateClientConfiguration(endpoint=endpoint,
                                                       instance_id=instance_id,
                                                       credential=credential,
                                                       **kwargs)
        self._client = PipelineClient(base_url=_endpoint,
                                      config=self._config,
                                      **kwargs)

        self._serialize = Serializer()
        self._deserialize = Deserializer()
        self._serialize.client_side_validation = False
        self.device_update = DeviceUpdateOperations(self._client, self._config,
                                                    self._serialize,
                                                    self._deserialize)
        self.device_management = DeviceManagementOperations(
            self._client, self._config, self._serialize, self._deserialize)

    def send_request(
            self,
            request,  # type: HttpRequest
            **kwargs: Any) -> HttpResponse:
        """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 = client.send_request(request)
        <HttpResponse: 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.HttpResponse
        """

        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)

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #5
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. The default value is "7.1". Note that overriding this
     default value may result in unsupported behavior.
    :paramtype api_version: str
    """
    def __init__(
            self,
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        _base_url = '{vaultBaseUrl}'
        self._config = KeyVaultClientConfiguration(**kwargs)
        self._client = PipelineClient(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,  # type: HttpRequest
            **kwargs  # type: Any
    ):
        # type: (...) -> HttpResponse
        """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 = client._send_request(request)
        <HttpResponse: 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.HttpResponse
        """

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

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #6
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.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,  # type: str
            index_name,  # type: str
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        base_url = '{endpoint}/indexes(\'{indexName}\')'
        self._config = SearchClientConfiguration(endpoint, index_name,
                                                 **kwargs)
        self._client = PipelineClient(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)

    def _send_request(self, http_request, **kwargs):
        # type: (HttpRequest, Any) -> HttpResponse
        """Runs the network request through the client's chained policies.

        :param http_request: The network request you want to make. Required.
        :type http_request: ~azure.core.pipeline.transport.HttpRequest
        :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
        :return: The response of your network call. Does not do error handling on your response.
        :rtype: ~azure.core.pipeline.transport.HttpResponse
        """
        path_format_arguments = {
            '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 = self._client._pipeline.run(http_request,
                                                       stream=stream,
                                                       **kwargs)
        return pipeline_response.http_response

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*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.operations.DataSourcesOperations
    :ivar indexers: IndexersOperations operations
    :vartype indexers: azure.search.documents.indexes.operations.IndexersOperations
    :ivar skillsets: SkillsetsOperations operations
    :vartype skillsets: azure.search.documents.indexes.operations.SkillsetsOperations
    :ivar synonym_maps: SynonymMapsOperations operations
    :vartype synonym_maps: azure.search.documents.indexes.operations.SynonymMapsOperations
    :ivar indexes: IndexesOperations operations
    :vartype indexes: azure.search.documents.indexes.operations.IndexesOperations
    :param endpoint: The endpoint URL of the search service.
    :type endpoint: str
    """

    def __init__(
        self,
        endpoint,  # type: str
        **kwargs  # type: Any
    ):
        # type: (...) -> None
        base_url = '{endpoint}'
        self._config = SearchClientConfiguration(endpoint, **kwargs)
        self._client = PipelineClient(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)

    def _send_request(self, http_request, **kwargs):
        # type: (HttpRequest, Any) -> HttpResponse
        """Runs the network request through the client's chained policies.

        :param http_request: The network request you want to make. Required.
        :type http_request: ~azure.core.pipeline.transport.HttpRequest
        :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
        :return: The response of your network call. Does not do error handling on your response.
        :rtype: ~azure.core.pipeline.transport.HttpResponse
        """
        path_format_arguments = {
            '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 = self._client._pipeline.run(http_request, stream=stream, **kwargs)
        return pipeline_response.http_response

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #8
0
class QuantumClient(object):
    """Azure Quantum REST API client.

    :ivar jobs: JobsOperations operations
    :vartype jobs: azure.quantum._client.operations.JobsOperations
    :ivar providers: ProvidersOperations operations
    :vartype providers: azure.quantum._client.operations.ProvidersOperations
    :ivar storage: StorageOperations operations
    :vartype storage: azure.quantum._client.operations.StorageOperations
    :ivar quotas: QuotasOperations operations
    :vartype quotas: azure.quantum._client.operations.QuotasOperations
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials.TokenCredential
    :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,  # type: "TokenCredential"
        subscription_id,  # type: str
        resource_group_name,  # type: str
        workspace_name,  # type: str
        base_url="https://quantum.azure.com",  # type: str
        **kwargs  # type: Any
    ):
        # type: (...) -> None
        self._config = QuantumClientConfiguration(credential=credential, subscription_id=subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, **kwargs)
        self._client = PipelineClient(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,  # type: HttpRequest
        **kwargs  # type: Any
    ):
        # type: (...) -> HttpResponse
        """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 = client._send_request(request)
        <HttpResponse: 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.HttpResponse
        """

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

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
class AzureDataLakeStorageRESTAPI(object):
    """Azure Data Lake Storage provides storage for Hadoop and other big data workloads.

    :ivar service: ServiceOperations operations
    :vartype service: azure.storage.filedatalake.operations.ServiceOperations
    :ivar file_system: FileSystemOperations operations
    :vartype file_system: azure.storage.filedatalake.operations.FileSystemOperations
    :ivar path: PathOperations operations
    :vartype path: azure.storage.filedatalake.operations.PathOperations
    :param url: The URL of the service account, container, or blob that is the target of the
     desired operation.
    :type url: str
    :param base_url: Service URL. Default value is "".
    :type base_url: str
    :keyword resource: The value must be "filesystem" for all filesystem operations. Default value
     is "filesystem". Note that overriding this default value may result in unsupported behavior.
    :paramtype resource: str
    :keyword version: Specifies the version of the operation to use for this request. Default value
     is "2020-10-02". Note that overriding this default value may result in unsupported behavior.
    :paramtype version: str
    """
    def __init__(
            self,
            url,  # type: str
            base_url="",  # type: str
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        self._config = AzureDataLakeStorageRESTAPIConfiguration(url=url,
                                                                **kwargs)
        self._client = PipelineClient(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.file_system = FileSystemOperations(self._client, self._config,
                                                self._serialize,
                                                self._deserialize)
        self.path = PathOperations(self._client, self._config, self._serialize,
                                   self._deserialize)

    def _send_request(
            self,
            request,  # type: HttpRequest
            **kwargs  # type: Any
    ):
        # type: (...) -> HttpResponse
        """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 = client._send_request(request)
        <HttpResponse: 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.HttpResponse
        """

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

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #10
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.TokenCredential
    :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,  # type: "TokenCredential"
            endpoint,  # type: str
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        _base_url = '{endpoint}/formrecognizer/v2.1'
        self._config = FormRecognizerClientConfiguration(credential=credential,
                                                         endpoint=endpoint,
                                                         **kwargs)
        self._client = PipelineClient(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,  # type: HttpRequest
            **kwargs  # type: Any
    ):
        # type: (...) -> HttpResponse
        """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 = client._send_request(request)
        <HttpResponse: 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.HttpResponse
        """

        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)

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #11
0
class AccessControlClient(object):
    """AccessControlClient.

    :ivar role_assignments: RoleAssignmentsOperations operations
    :vartype role_assignments: azure.synapse.accesscontrol.operations.RoleAssignmentsOperations
    :ivar role_definitions: RoleDefinitionsOperations operations
    :vartype role_definitions: azure.synapse.accesscontrol.operations.RoleDefinitionsOperations
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials.TokenCredential
    :param endpoint: The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net.
    :type endpoint: str
    """
    def __init__(
            self,
            credential,  # type: "TokenCredential"
            endpoint,  # type: str
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        base_url = '{endpoint}'
        self._config = AccessControlClientConfiguration(
            credential, endpoint, **kwargs)
        self._client = PipelineClient(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)

    def _send_request(self, http_request, **kwargs):
        # type: (HttpRequest, Any) -> HttpResponse
        """Runs the network request through the client's chained policies.

        :param http_request: The network request you want to make. Required.
        :type http_request: ~azure.core.pipeline.transport.HttpRequest
        :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
        :return: The response of your network call. Does not do error handling on your response.
        :rtype: ~azure.core.pipeline.transport.HttpResponse
        """
        path_format_arguments = {
            '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 = self._client._pipeline.run(http_request,
                                                       stream=stream,
                                                       **kwargs)
        return pipeline_response.http_response

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
class SparkClient(object):
    """SparkClient.

    :ivar spark_batch: SparkBatchOperations operations
    :vartype spark_batch: azure.synapse.spark.operations.SparkBatchOperations
    :ivar spark_session: SparkSessionOperations operations
    :vartype spark_session: azure.synapse.spark.operations.SparkSessionOperations
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials.TokenCredential
    :param endpoint: The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net.
    :type endpoint: str
    :param spark_pool_name: Name of the spark pool.
    :type spark_pool_name: str
    :param livy_api_version: Valid api-version for the request.
    :type livy_api_version: str
    """

    def __init__(
        self,
        credential,  # type: "TokenCredential"
        endpoint,  # type: str
        spark_pool_name,  # type: str
        livy_api_version="2019-11-01-preview",  # type: str
        **kwargs  # type: Any
    ):
        # type: (...) -> None
        base_url = '{endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}'
        self._config = SparkClientConfiguration(credential, endpoint, spark_pool_name, livy_api_version, **kwargs)
        self._client = PipelineClient(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.spark_batch = SparkBatchOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.spark_session = SparkSessionOperations(
            self._client, self._config, self._serialize, self._deserialize)

    def _send_request(self, http_request, **kwargs):
        # type: (HttpRequest, Any) -> HttpResponse
        """Runs the network request through the client's chained policies.

        :param http_request: The network request you want to make. Required.
        :type http_request: ~azure.core.pipeline.transport.HttpRequest
        :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
        :return: The response of your network call. Does not do error handling on your response.
        :rtype: ~azure.core.pipeline.transport.HttpResponse
        """
        path_format_arguments = {
            'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
            'livyApiVersion': self._serialize.url("self._config.livy_api_version", self._config.livy_api_version, 'str', skip_quote=True),
            'sparkPoolName': self._serialize.url("self._config.spark_pool_name", self._config.spark_pool_name, 'str', skip_quote=True),
        }
        http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
        stream = kwargs.pop("stream", True)
        pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
        return pipeline_response.http_response

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #13
0
class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin,
                     _SDKClient):
    """The key vault client performs cryptographic key operations and vault operations against the Key Vault service.

    This ready contains multiple API versions, to help you deal with all of the Azure clouds
    (Azure Stack, Azure Government, Azure China, etc.).
    By default, it uses the latest API version available on public Azure.
    For production, you should stick to a particular api-version and/or profile.
    The profile sets a mapping between an operation group and its API version.
    The api-version parameter sets the default API version if the operation
    group is not described in the profile.
    :param api_version: API version to use if no profile is provided, or if missing in profile.
    :type api_version: str
    :param profile: A profile definition, from KnownProfiles to dict.
    :type profile: azure.profiles.KnownProfiles
    :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
    """

    DEFAULT_API_VERSION = '7.2'
    _PROFILE_TAG = "azure.keyvault.KeyVaultClient"
    LATEST_PROFILE = ProfileDefinition(
        {_PROFILE_TAG: {
            None: DEFAULT_API_VERSION,
        }}, _PROFILE_TAG + " latest")

    def __init__(
            self,
            api_version=None,  # type: Optional[str]
            profile=KnownProfiles.default,  # type: KnownProfiles
            **kwargs  # type: Any
    ):
        if api_version == '7.2':
            base_url = '{vaultBaseUrl}'
        else:
            raise ValueError(
                "API version {} is not available".format(api_version))
        self._config = KeyVaultClientConfiguration(**kwargs)
        self._client = PipelineClient(base_url=base_url,
                                      config=self._config,
                                      **kwargs)
        super(KeyVaultClient, self).__init__(api_version=api_version,
                                             profile=profile)

    @classmethod
    def _models_dict(cls, api_version):
        return {
            k: v
            for k, v in cls.models(api_version).__dict__.items()
            if isinstance(v, type)
        }

    @classmethod
    def models(cls, api_version=DEFAULT_API_VERSION):
        """Module depends on the API version:

           * 7.2: :mod:`v7_2.models<azure.keyvault.v7_2.models>`
        """
        if api_version == '7.2':
            from .v7_2 import models
            return models
        raise ValueError("API version {} is not available".format(api_version))

    @property
    def role_assignments(self):
        """Instance depends on the API version:

           * 7.2: :class:`RoleAssignmentsOperations<azure.keyvault.v7_2.operations.RoleAssignmentsOperations>`
        """
        api_version = self._get_api_version('role_assignments')
        if api_version == '7.2':
            from .v7_2.operations import RoleAssignmentsOperations as OperationClass
        else:
            raise ValueError(
                "API version {} does not have operation group 'role_assignments'"
                .format(api_version))
        return OperationClass(self._client, self._config,
                              Serializer(self._models_dict(api_version)),
                              Deserializer(self._models_dict(api_version)))

    @property
    def role_definitions(self):
        """Instance depends on the API version:

           * 7.2: :class:`RoleDefinitionsOperations<azure.keyvault.v7_2.operations.RoleDefinitionsOperations>`
        """
        api_version = self._get_api_version('role_definitions')
        if api_version == '7.2':
            from .v7_2.operations import RoleDefinitionsOperations as OperationClass
        else:
            raise ValueError(
                "API version {} does not have operation group 'role_definitions'"
                .format(api_version))
        return OperationClass(self._client, self._config,
                              Serializer(self._models_dict(api_version)),
                              Deserializer(self._models_dict(api_version)))

    def close(self):
        self._client.close()

    def __enter__(self):
        self._client.__enter__()
        return self

    def __exit__(self, *exc_details):
        self._client.__exit__(*exc_details)
class FormRecognizerClient(FormRecognizerClientOperationsMixin,
                           MultiApiClientMixin, _SDKClient):
    """Extracts information from forms and images into structured data.

    This ready contains multiple API versions, to help you deal with all of the Azure clouds
    (Azure Stack, Azure Government, Azure China, etc.).
    By default, it uses the latest API version available on public Azure.
    For production, you should stick to a particular api-version and/or profile.
    The profile sets a mapping between an operation group and its API version.
    The api-version parameter sets the default API version if the operation
    group is not described in the profile.

    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials.TokenCredential
    :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).
    :type endpoint: str
    :param str api_version: API version to use if no profile is provided, or if
     missing in profile.
    :param profile: A profile definition, from KnownProfiles to dict.
    :type profile: azure.profiles.KnownProfiles
    :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
    """

    DEFAULT_API_VERSION = '2.1-preview.2'
    _PROFILE_TAG = "azure.ai.formrecognizer.FormRecognizerClient"
    LATEST_PROFILE = ProfileDefinition(
        {_PROFILE_TAG: {
            None: DEFAULT_API_VERSION,
        }}, _PROFILE_TAG + " latest")

    def __init__(
            self,
            credential,  # type: "TokenCredential"
            endpoint,  # type: str
            api_version=None,
            profile=KnownProfiles.default,
            **kwargs  # type: Any
    ):
        if api_version == '2.0':
            base_url = '{endpoint}/formrecognizer/v2.0'
        elif api_version == '2.1-preview.2':
            base_url = '{endpoint}/formrecognizer/v2.1-preview.2'
        else:
            raise ValueError(
                "API version {} is not available".format(api_version))
        self._config = FormRecognizerClientConfiguration(
            credential, endpoint, **kwargs)
        self._client = PipelineClient(base_url=base_url,
                                      config=self._config,
                                      **kwargs)
        super(FormRecognizerClient, self).__init__(api_version=api_version,
                                                   profile=profile)

    @classmethod
    def _models_dict(cls, api_version):
        return {
            k: v
            for k, v in cls.models(api_version).__dict__.items()
            if isinstance(v, type)
        }

    @classmethod
    def models(cls, api_version=DEFAULT_API_VERSION):
        """Module depends on the API version:

           * 2.0: :mod:`v2_0.models<azure.ai.formrecognizer.v2_0.models>`
           * 2.1-preview.2: :mod:`v2_1_preview_2.models<azure.ai.formrecognizer.v2_1_preview_2.models>`
        """
        if api_version == '2.0':
            from .v2_0 import models
            return models
        elif api_version == '2.1-preview.2':
            from .v2_1_preview_2 import models
            return models
        raise ValueError("API version {} is not available".format(api_version))

    def close(self):
        self._client.close()

    def __enter__(self):
        self._client.__enter__()
        return self

    def __exit__(self, *exc_details):
        self._client.__exit__(*exc_details)
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.TokenCredential
    :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,  # type: "TokenCredential"
            endpoint,  # type: str
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        base_url = '{endpoint}/formrecognizer/v2.0'
        self._config = FormRecognizerClientConfiguration(
            credential, endpoint, **kwargs)
        self._client = PipelineClient(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)

    def _send_request(self, http_request, **kwargs):
        # type: (HttpRequest, Any) -> HttpResponse
        """Runs the network request through the client's chained policies.

        :param http_request: The network request you want to make. Required.
        :type http_request: ~azure.core.pipeline.transport.HttpRequest
        :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
        :return: The response of your network call. Does not do error handling on your response.
        :rtype: ~azure.core.pipeline.transport.HttpResponse
        """
        path_format_arguments = {
            '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 = self._client._pipeline.run(http_request,
                                                       stream=stream,
                                                       **kwargs)
        return pipeline_response.http_response

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #16
0
class PurviewScanningClient(object):
    """Creates a Microsoft.Scanning management client.

    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials.TokenCredential
    :param endpoint: The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com.
    :type endpoint: str
    """
    def __init__(
            self,
            credential,  # type: "TokenCredential"
            endpoint,  # type: str
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        base_url = '{Endpoint}'
        self._config = PurviewScanningClientConfiguration(
            credential, endpoint, **kwargs)
        self._client = PipelineClient(base_url=base_url,
                                      config=self._config,
                                      **kwargs)

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

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

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

        >>> from azure.purview.scanning.rest import build_get_request
        >>> request = build_get_request(key_vault_name)
        <HttpRequest [GET], url: '/azureKeyVaults/{keyVaultName}'>
        >>> response = client.send_request(request)
        <HttpResponse: 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.scanning.core.rest.HttpRequest`
        and pass it in.

        :param http_request: The network request you want to make. Required.
        :type http_request: ~azure.purview.scanning.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.scanning.core.rest.HttpResponse
        """
        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 _StreamContextManager(
                client=self._client._pipeline,
                request=request_copy,
            )
        pipeline_response = self._client._pipeline.run(
            request_copy._internal_request, **kwargs)
        response = HttpResponse(
            status_code=pipeline_response.http_response.status_code,
            request=request_copy,
            _internal_response=pipeline_response.http_response)
        response.read()
        return response

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #17
0
class AzureSchemaRegistry(object):
    """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.TokenCredential
    :param endpoint: The Schema Registry service endpoint, for example
         my-namespace.servicebus.windows.net.
    :type endpoint: str
    """

    def __init__(
        self,
        credential,  # type: "TokenCredential"
        endpoint,  # type: str
        **kwargs  # type: Any
    ):
        # type: (...) -> None
        base_url = 'https://{endpoint}'
        self._config = AzureSchemaRegistryConfiguration(credential, endpoint, **kwargs)
        self._client = PipelineClient(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,  # type: HttpRequest
        **kwargs  # type: Any
    ):
        # type: (...) -> HttpResponse
        """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 = client.send_request(request)
        <HttpResponse: 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.HttpResponse
        """

        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)

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #18
0
class PurviewCatalogClient:  # pylint: disable=too-many-instance-attributes
    """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.

    :ivar entity: EntityOperations operations
    :vartype entity: azure.purview.catalog.operations.EntityOperations
    :ivar glossary: GlossaryOperations operations
    :vartype glossary: azure.purview.catalog.operations.GlossaryOperations
    :ivar discovery: DiscoveryOperations operations
    :vartype discovery: azure.purview.catalog.operations.DiscoveryOperations
    :ivar lineage: LineageOperations operations
    :vartype lineage: azure.purview.catalog.operations.LineageOperations
    :ivar relationship: RelationshipOperations operations
    :vartype relationship: azure.purview.catalog.operations.RelationshipOperations
    :ivar types: TypesOperations operations
    :vartype types: azure.purview.catalog.operations.TypesOperations
    :ivar collection: CollectionOperations operations
    :vartype collection: azure.purview.catalog.operations.CollectionOperations
    :param endpoint: The catalog endpoint of your Purview account. Example:
     https://{accountName}.purview.azure.com.
    :type endpoint: str
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials.TokenCredential
    :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding
     this default value may result in unsupported behavior.
    :paramtype api_version: str
    :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
     Retry-After header is present.
    """
    def __init__(self, endpoint: str, credential: "TokenCredential",
                 **kwargs: Any) -> None:
        _endpoint = '{Endpoint}/catalog/api'
        self._config = PurviewCatalogClientConfiguration(endpoint=endpoint,
                                                         credential=credential,
                                                         **kwargs)
        self._client = PipelineClient(base_url=_endpoint,
                                      config=self._config,
                                      **kwargs)

        self._serialize = Serializer()
        self._deserialize = Deserializer()
        self._serialize.client_side_validation = False
        self.entity = EntityOperations(self._client, self._config,
                                       self._serialize, self._deserialize)
        self.glossary = GlossaryOperations(self._client, self._config,
                                           self._serialize, self._deserialize)
        self.discovery = DiscoveryOperations(self._client, self._config,
                                             self._serialize,
                                             self._deserialize)
        self.lineage = LineageOperations(self._client, self._config,
                                         self._serialize, self._deserialize)
        self.relationship = RelationshipOperations(self._client, self._config,
                                                   self._serialize,
                                                   self._deserialize)
        self.types = TypesOperations(self._client, self._config,
                                     self._serialize, self._deserialize)
        self.collection = CollectionOperations(self._client, self._config,
                                               self._serialize,
                                               self._deserialize)

    def send_request(self, request: HttpRequest,
                     **kwargs: Any) -> HttpResponse:
        """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 = client.send_request(request)
        <HttpResponse: 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.HttpResponse
        """

        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)

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #19
0
class DataShareManagementClient(object):
    """Creates a Microsoft.DataShare management client.

    :ivar account: AccountOperations operations
    :vartype account: data_share_management_client.operations.AccountOperations
    :ivar consumer_invitation: ConsumerInvitationOperations operations
    :vartype consumer_invitation: data_share_management_client.operations.ConsumerInvitationOperations
    :ivar data_set: DataSetOperations operations
    :vartype data_set: data_share_management_client.operations.DataSetOperations
    :ivar data_set_mapping: DataSetMappingOperations operations
    :vartype data_set_mapping: data_share_management_client.operations.DataSetMappingOperations
    :ivar invitation: InvitationOperations operations
    :vartype invitation: data_share_management_client.operations.InvitationOperations
    :ivar operation: OperationOperations operations
    :vartype operation: data_share_management_client.operations.OperationOperations
    :ivar share: ShareOperations operations
    :vartype share: data_share_management_client.operations.ShareOperations
    :ivar provider_share_subscription: ProviderShareSubscriptionOperations operations
    :vartype provider_share_subscription: data_share_management_client.operations.ProviderShareSubscriptionOperations
    :ivar share_subscription: ShareSubscriptionOperations operations
    :vartype share_subscription: data_share_management_client.operations.ShareSubscriptionOperations
    :ivar consumer_source_data_set: ConsumerSourceDataSetOperations operations
    :vartype consumer_source_data_set: data_share_management_client.operations.ConsumerSourceDataSetOperations
    :ivar synchronization_setting: SynchronizationSettingOperations operations
    :vartype synchronization_setting: data_share_management_client.operations.SynchronizationSettingOperations
    :ivar trigger: TriggerOperations operations
    :vartype trigger: data_share_management_client.operations.TriggerOperations
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: azure.core.credentials.TokenCredential
    :param subscription_id: The subscription identifier.
    :type subscription_id: str
    :param str base_url: Service URL
    """
    def __init__(
            self,
            credential,  # type: "TokenCredential"
            subscription_id,  # type: str
            base_url=None,  # type: Optional[str]
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        if not base_url:
            base_url = 'https://management.azure.com'
        self._config = DataShareManagementClientConfiguration(
            credential, subscription_id, **kwargs)
        self._client = PipelineClient(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.account = AccountOperations(self._client, self._config,
                                         self._serialize, self._deserialize)
        self.consumer_invitation = ConsumerInvitationOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.data_set = DataSetOperations(self._client, self._config,
                                          self._serialize, self._deserialize)
        self.data_set_mapping = DataSetMappingOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.invitation = InvitationOperations(self._client, self._config,
                                               self._serialize,
                                               self._deserialize)
        self.operation = OperationOperations(self._client, self._config,
                                             self._serialize,
                                             self._deserialize)
        self.share = ShareOperations(self._client, self._config,
                                     self._serialize, self._deserialize)
        self.provider_share_subscription = ProviderShareSubscriptionOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.share_subscription = ShareSubscriptionOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.consumer_source_data_set = ConsumerSourceDataSetOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.synchronization_setting = SynchronizationSettingOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.trigger = TriggerOperations(self._client, self._config,
                                         self._serialize, self._deserialize)

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #20
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.TokenCredential
    :param base_url: Service URL. Default value is ''.
    :type base_url: str
    """
    def __init__(
            self,
            credential,  # type: "TokenCredential"
            base_url="",  # type: str
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        self._config = TeamCloudClientConfiguration(credential=credential,
                                                    **kwargs)
        self._client = PipelineClient(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,  # type: HttpRequest
            **kwargs  # type: Any
    ):
        # type: (...) -> HttpResponse
        """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 = client._send_request(request)
        <HttpResponse: 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.HttpResponse
        """

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

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #21
0
class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin,
                     _SDKClient):
    """The key vault client performs cryptographic key operations and vault operations against the Key Vault service.

    This ready contains multiple API versions, to help you deal with all of the Azure clouds
    (Azure Stack, Azure Government, Azure China, etc.).
    By default, it uses the latest API version available on public Azure.
    For production, you should stick to a particular api-version and/or profile.
    The profile sets a mapping between an operation group and its API version.
    The api-version parameter sets the default API version if the operation
    group is not described in the profile.
    :param api_version: API version to use if no profile is provided, or if missing in profile.
    :type api_version: str
    :param profile: A profile definition, from KnownProfiles to dict.
    :type profile: azure.profiles.KnownProfiles
    """

    DEFAULT_API_VERSION = '2016-10-01'
    _PROFILE_TAG = "azure.keyvault.KeyVaultClient"
    LATEST_PROFILE = ProfileDefinition(
        {_PROFILE_TAG: {
            None: DEFAULT_API_VERSION,
        }}, _PROFILE_TAG + " latest")

    def __init__(
            self,
            api_version=None,  # type: Optional[str]
            profile=KnownProfiles.default,  # type: KnownProfiles
            **kwargs  # type: Any
    ):
        if api_version == '2016-10-01' or api_version == '7.0' or api_version == '7.1' or api_version == '7.2' or api_version == '7.3':
            base_url = '{vaultBaseUrl}'
        else:
            raise ValueError(
                "API version {} is not available".format(api_version))
        self._config = KeyVaultClientConfiguration(**kwargs)
        self._client = PipelineClient(base_url=base_url,
                                      config=self._config,
                                      **kwargs)
        super(KeyVaultClient, self).__init__(api_version=api_version,
                                             profile=profile)

    @classmethod
    def _models_dict(cls, api_version):
        return {
            k: v
            for k, v in cls.models(api_version).__dict__.items()
            if isinstance(v, type)
        }

    @classmethod
    def models(cls, api_version=DEFAULT_API_VERSION):
        """Module depends on the API version:

           * 2016-10-01: :mod:`v2016_10_01.models<azure.keyvault.v2016_10_01.models>`
           * 7.0: :mod:`v7_0.models<azure.keyvault.v7_0.models>`
           * 7.1: :mod:`v7_1.models<azure.keyvault.v7_1.models>`
           * 7.2: :mod:`v7_2.models<azure.keyvault.v7_2.models>`
           * 7.3: :mod:`v7_3.models<azure.keyvault.v7_3.models>`
        """
        if api_version == '2016-10-01':
            from .v2016_10_01 import models
            return models
        elif api_version == '7.0':
            from .v7_0 import models
            return models
        elif api_version == '7.1':
            from .v7_1 import models
            return models
        elif api_version == '7.2':
            from .v7_2 import models
            return models
        elif api_version == '7.3':
            from .v7_3 import models
            return models
        raise ValueError("API version {} is not available".format(api_version))

    def close(self):
        self._client.close()

    def __enter__(self):
        self._client.__enter__()
        return self

    def __exit__(self, *exc_details):
        self._client.__exit__(*exc_details)
class AzureSchemaRegistry(object):
    """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.TokenCredential
    :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,  # type: str
            credential,  # type: "TokenCredential"
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        _endpoint = 'https://{endpoint}'
        self._config = AzureSchemaRegistryConfiguration(endpoint=endpoint,
                                                        credential=credential,
                                                        **kwargs)
        self._client = PipelineClient(base_url=_endpoint,
                                      config=self._config,
                                      **kwargs)

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

    def send_request(
            self,
            request,  # type: HttpRequest
            **kwargs  # type: Any
    ):
        # type: (...) -> HttpResponse
        """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 = client.send_request(request)
        <HttpResponse: 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.HttpResponse
        """

        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)

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
class AzureBlobStorage(object):
    """AzureBlobStorage.

    :ivar service: ServiceOperations operations
    :vartype service: azure.storage.blob.operations.ServiceOperations
    :ivar container: ContainerOperations operations
    :vartype container: azure.storage.blob.operations.ContainerOperations
    :ivar directory: DirectoryOperations operations
    :vartype directory: azure.storage.blob.operations.DirectoryOperations
    :ivar blob: BlobOperations operations
    :vartype blob: azure.storage.blob.operations.BlobOperations
    :ivar page_blob: PageBlobOperations operations
    :vartype page_blob: azure.storage.blob.operations.PageBlobOperations
    :ivar append_blob: AppendBlobOperations operations
    :vartype append_blob: azure.storage.blob.operations.AppendBlobOperations
    :ivar block_blob: BlockBlobOperations operations
    :vartype block_blob: azure.storage.blob.operations.BlockBlobOperations
    :param url: The URL of the service account, container, or blob that is the targe of the desired operation.
    :type url: str
    """

    def __init__(
        self,
        url,  # type: str
        **kwargs  # type: Any
    ):
        # type: (...) -> None
        base_url = '{url}'
        self._config = AzureBlobStorageConfiguration(url, **kwargs)
        self._client = PipelineClient(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.container = ContainerOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.directory = DirectoryOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.blob = BlobOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.page_blob = PageBlobOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.append_blob = AppendBlobOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.block_blob = BlockBlobOperations(
            self._client, self._config, self._serialize, self._deserialize)

    def _send_request(self, http_request, **kwargs):
        # type: (HttpRequest, Any) -> HttpResponse
        """Runs the network request through the client's chained policies.

        :param http_request: The network request you want to make. Required.
        :type http_request: ~azure.core.pipeline.transport.HttpRequest
        :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
        :return: The response of your network call. Does not do error handling on your response.
        :rtype: ~azure.core.pipeline.transport.HttpResponse
        """
        path_format_arguments = {
            '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 = self._client._pipeline.run(http_request, stream=stream, **kwargs)
        return pipeline_response.http_response

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #24
0
class TextAnalyticsClient(TextAnalyticsClientOperationsMixin,
                          MultiApiClientMixin, _SDKClient):
    """The Text Analytics API is a suite of text analytics web 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. No training data is needed to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview.

    This ready contains multiple API versions, to help you deal with all of the Azure clouds
    (Azure Stack, Azure Government, Azure China, etc.).
    By default, it uses the latest API version available on public Azure.
    For production, you should stick to a particular api-version and/or profile.
    The profile sets a mapping between an operation group and its API version.
    The api-version parameter sets the default API version if the operation
    group is not described in the profile.

    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials.TokenCredential
    :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
    :type endpoint: str
    :param api_version: API version to use if no profile is provided, or if missing in profile.
    :type api_version: str
    :param profile: A profile definition, from KnownProfiles to dict.
    :type profile: azure.profiles.KnownProfiles
    :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
    """

    DEFAULT_API_VERSION = 'v3.0'
    _PROFILE_TAG = "azure.ai.textanalytics.TextAnalyticsClient"
    LATEST_PROFILE = ProfileDefinition(
        {_PROFILE_TAG: {
            None: DEFAULT_API_VERSION,
        }}, _PROFILE_TAG + " latest")

    def __init__(
            self,
            credential,  # type: "TokenCredential"
            endpoint,  # type: str
            api_version=None,  # type: Optional[str]
            profile=KnownProfiles.default,  # type: KnownProfiles
            **kwargs  # type: Any
    ):
        if api_version == 'v3.0':
            base_url = '{Endpoint}/text/analytics/v3.0'
        elif api_version == 'v3.1-preview.4':
            base_url = '{Endpoint}/text/analytics/v3.1-preview.4'
        else:
            raise ValueError(
                "API version {} is not available".format(api_version))
        self._config = TextAnalyticsClientConfiguration(
            credential, endpoint, **kwargs)
        self._client = PipelineClient(base_url=base_url,
                                      config=self._config,
                                      **kwargs)
        super(TextAnalyticsClient, self).__init__(api_version=api_version,
                                                  profile=profile)

    @classmethod
    def _models_dict(cls, api_version):
        return {
            k: v
            for k, v in cls.models(api_version).__dict__.items()
            if isinstance(v, type)
        }

    @classmethod
    def models(cls, api_version=DEFAULT_API_VERSION):
        """Module depends on the API version:

           * v3.0: :mod:`v3_0.models<azure.ai.textanalytics.v3_0.models>`
           * v3.1-preview.4: :mod:`v3_1_preview_4.models<azure.ai.textanalytics.v3_1_preview_4.models>`
        """
        if api_version == 'v3.0':
            from .v3_0 import models
            return models
        elif api_version == 'v3.1-preview.4':
            from .v3_1_preview_4 import models
            return models
        raise ValueError("API version {} is not available".format(api_version))

    def close(self):
        self._client.close()

    def __enter__(self):
        self._client.__enter__()
        return self

    def __exit__(self, *exc_details):
        self._client.__exit__(*exc_details)
Example #25
0
class PurviewAccountClient(object):
    """Creates a Microsoft.Purview data plane account client.

    :ivar accounts: AccountsOperations operations
    :vartype accounts: azure.purview.account.operations.AccountsOperations
    :ivar collections: CollectionsOperations operations
    :vartype collections: azure.purview.account.operations.CollectionsOperations
    :ivar resource_set_rules: ResourceSetRulesOperations operations
    :vartype resource_set_rules: azure.purview.account.operations.ResourceSetRulesOperations
    :param endpoint: The account endpoint of your Purview account. Example:
     https://{accountName}.purview.azure.com/account/.
    :type endpoint: str
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials.TokenCredential
    """

    def __init__(
        self,
        endpoint,  # type: str
        credential,  # type: "TokenCredential"
        **kwargs  # type: Any
    ):
        # type: (...) -> None
        _endpoint = '{endpoint}'
        self._config = PurviewAccountClientConfiguration(endpoint, credential, **kwargs)
        self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)

        self._serialize = Serializer()
        self._deserialize = Deserializer()
        self._serialize.client_side_validation = False
        self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize)
        self.collections = CollectionsOperations(self._client, self._config, self._serialize, self._deserialize)
        self.resource_set_rules = ResourceSetRulesOperations(self._client, self._config, self._serialize, self._deserialize)


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

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


        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.HttpResponse
        """

        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)

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
class AzureBlobStorage(object):
    """AzureBlobStorage


    :ivar service: Service operations
    :vartype service: .operations.ServiceOperations
    :ivar container: Container operations
    :vartype container: .operations.ContainerOperations
    :ivar directory: Directory operations
    :vartype directory: .operations.DirectoryOperations
    :ivar blob: Blob operations
    :vartype blob: .operations.BlobOperations
    :ivar page_blob: PageBlob operations
    :vartype page_blob: .operations.PageBlobOperations
    :ivar append_blob: AppendBlob operations
    :vartype append_blob: .operations.AppendBlobOperations
    :ivar block_blob: BlockBlob operations
    :vartype block_blob: .operations.BlockBlobOperations

    :param url: The URL of the service account, container, or blob that is the
     targe of the desired operation.
    :type url: str
    """
    def __init__(self, url, **kwargs):

        base_url = '{url}'
        self._config = AzureBlobStorageConfiguration(url, **kwargs)
        self._client = PipelineClient(base_url=base_url,
                                      config=self._config,
                                      **kwargs)

        client_models = {
            k: v
            for k, v in models.__dict__.items() if isinstance(v, type)
        }
        self.api_version = '2020-02-10'
        self._serialize = Serializer(client_models)
        self._deserialize = Deserializer(client_models)

        self.service = ServiceOperations(self._client, self._config,
                                         self._serialize, self._deserialize)
        self.container = ContainerOperations(self._client, self._config,
                                             self._serialize,
                                             self._deserialize)
        self.directory = DirectoryOperations(self._client, self._config,
                                             self._serialize,
                                             self._deserialize)
        self.blob = BlobOperations(self._client, self._config, self._serialize,
                                   self._deserialize)
        self.page_blob = PageBlobOperations(self._client, self._config,
                                            self._serialize, self._deserialize)
        self.append_blob = AppendBlobOperations(self._client, self._config,
                                                self._serialize,
                                                self._deserialize)
        self.block_blob = BlockBlobOperations(self._client, self._config,
                                              self._serialize,
                                              self._deserialize)

    def close(self):
        self._client.close()

    def __enter__(self):
        self._client.__enter__()
        return self

    def __exit__(self, *exc_details):
        self._client.__exit__(*exc_details)
class SearchServiceClient(SearchServiceClientOperationsMixin):
    """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: search_service_client.operations.DataSourcesOperations
    :ivar indexers: IndexersOperations operations
    :vartype indexers: search_service_client.operations.IndexersOperations
    :ivar skillsets: SkillsetsOperations operations
    :vartype skillsets: search_service_client.operations.SkillsetsOperations
    :ivar synonym_maps: SynonymMapsOperations operations
    :vartype synonym_maps: search_service_client.operations.SynonymMapsOperations
    :ivar indexes: IndexesOperations operations
    :vartype indexes: search_service_client.operations.IndexesOperations
    :param endpoint: The endpoint URL of the search service.
    :type endpoint: str
    """
    def __init__(
            self,
            endpoint,  # type: str
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        base_url = '{endpoint}'
        self._config = SearchServiceClientConfiguration(endpoint, **kwargs)
        self._client = PipelineClient(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.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 close(self):
        # type: () -> None
        self._client.close()

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)
Example #28
0
class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin,
                     _SDKClient):
    """The key vault client performs cryptographic key operations and vault operations against the Key Vault service.

    This ready contains multiple API versions, to help you deal with all of the Azure clouds
    (Azure Stack, Azure Government, Azure China, etc.).
    By default, it uses the latest API version available on public Azure.
    For production, you should stick to a particular api-version and/or profile.
    The profile sets a mapping between an operation group and its API version.
    The api-version parameter sets the default API version if the operation
    group is not described in the profile.
    :param str api_version: API version to use if no profile is provided, or if
     missing in profile.
    :param profile: A profile definition, from KnownProfiles to dict.
    :type profile: azure.profiles.KnownProfiles
    :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
    """

    DEFAULT_API_VERSION = '7.1'
    _PROFILE_TAG = "azure.keyvault.KeyVaultClient"
    LATEST_PROFILE = ProfileDefinition(
        {
            _PROFILE_TAG: {
                None: DEFAULT_API_VERSION,
                'backup_key': '7.0',
                'backup_secret': '7.0',
                'backup_storage_account': '7.0',
                'create_key': '7.0',
                'decrypt': '7.0',
                'delete_key': '7.0',
                'delete_sas_definition': '7.0',
                'delete_secret': '7.0',
                'delete_storage_account': '7.0',
                'encrypt': '7.0',
                'get_deleted_key': '7.0',
                'get_deleted_keys': '7.0',
                'get_deleted_sas_definition': '7.0',
                'get_deleted_sas_definitions': '7.0',
                'get_deleted_secret': '7.0',
                'get_deleted_secrets': '7.0',
                'get_deleted_storage_account': '7.0',
                'get_deleted_storage_accounts': '7.0',
                'get_key': '7.0',
                'get_key_versions': '7.0',
                'get_keys': '7.0',
                'get_sas_definition': '7.0',
                'get_sas_definitions': '7.0',
                'get_secret': '7.0',
                'get_secret_versions': '7.0',
                'get_secrets': '7.0',
                'get_storage_account': '7.0',
                'get_storage_accounts': '7.0',
                'import_key': '7.0',
                'purge_deleted_key': '7.0',
                'purge_deleted_secret': '7.0',
                'purge_deleted_storage_account': '7.0',
                'recover_deleted_key': '7.0',
                'recover_deleted_sas_definition': '7.0',
                'recover_deleted_secret': '7.0',
                'recover_deleted_storage_account': '7.0',
                'regenerate_storage_account_key': '7.0',
                'restore_key': '7.0',
                'restore_secret': '7.0',
                'restore_storage_account': '7.0',
                'set_sas_definition': '7.0',
                'set_secret': '7.0',
                'set_storage_account': '7.0',
                'sign': '7.0',
                'unwrap_key': '7.0',
                'update_key': '7.0',
                'update_sas_definition': '7.0',
                'update_secret': '7.0',
                'update_storage_account': '7.0',
                'verify': '7.0',
                'wrap_key': '7.0',
            }
        }, _PROFILE_TAG + " latest")

    def __init__(
            self,
            api_version=None,
            profile=KnownProfiles.default,
            **kwargs  # type: Any
    ):
        if api_version == '2016-10-01' or api_version == '7.0' or api_version == '7.1':
            base_url = '{vaultBaseUrl}'
        else:
            raise NotImplementedError(
                "APIVersion {} is not available".format(api_version))
        self._config = KeyVaultClientConfiguration(**kwargs)
        self._client = PipelineClient(base_url=base_url,
                                      config=self._config,
                                      **kwargs)
        super(KeyVaultClient, self).__init__(api_version=api_version,
                                             profile=profile)

    @classmethod
    def _models_dict(cls, api_version):
        return {
            k: v
            for k, v in cls.models(api_version).__dict__.items()
            if isinstance(v, type)
        }

    @classmethod
    def models(cls, api_version=DEFAULT_API_VERSION):
        """Module depends on the API version:

           * 2016-10-01: :mod:`v2016_10_01.models<azure.keyvault.v2016_10_01.models>`
           * 7.0: :mod:`v7_0.models<azure.keyvault.v7_0.models>`
           * 7.1: :mod:`v7_1.models<azure.keyvault.v7_1.models>`
        """
        if api_version == '2016-10-01':
            from .v2016_10_01 import models
            return models
        elif api_version == '7.0':
            from .v7_0 import models
            return models
        elif api_version == '7.1':
            from .v7_1 import models
            return models
        raise NotImplementedError(
            "APIVersion {} is not available".format(api_version))

    def close(self):
        self._client.close()

    def __enter__(self):
        self._client.__enter__()
        return self

    def __exit__(self, *exc_details):
        self._client.__exit__(*exc_details)
Example #29
0
class SearchClient(SearchClientOperationsMixin, MultiApiClientMixin,
                   _SDKClient):
    """Client that can be used to manage and query indexes and documents, as well as manage other resources, on a search service.

    This ready contains multiple API versions, to help you deal with all of the Azure clouds
    (Azure Stack, Azure Government, Azure China, etc.).
    By default, it uses the latest API version available on public Azure.
    For production, you should stick to a particular api-version and/or profile.
    The profile sets a mapping between an operation group and its API version.
    The api-version parameter sets the default API version if the operation
    group is not described in the profile.

    :param endpoint: The endpoint URL of the search service.
    :type endpoint: str
    :param api_version: API version to use if no profile is provided, or if missing in profile.
    :type api_version: str
    :param profile: A profile definition, from KnownProfiles to dict.
    :type profile: azure.profiles.KnownProfiles
    """

    DEFAULT_API_VERSION = '2020-06-30-Preview'
    _PROFILE_TAG = "azure.search.documents.SearchClient"
    LATEST_PROFILE = ProfileDefinition(
        {_PROFILE_TAG: {
            None: DEFAULT_API_VERSION,
        }}, _PROFILE_TAG + " latest")

    def __init__(
            self,
            endpoint,  # type: str
            api_version=None,  # type: Optional[str]
            profile=KnownProfiles.default,  # type: KnownProfiles
            **kwargs  # type: Any
    ):
        if api_version == '2020-06-30' or api_version == '2020-06-30-Preview':
            base_url = '{endpoint}'
        else:
            raise ValueError(
                "API version {} is not available".format(api_version))
        self._config = SearchClientConfiguration(endpoint, **kwargs)
        self._client = PipelineClient(base_url=base_url,
                                      config=self._config,
                                      **kwargs)
        super(SearchClient, self).__init__(api_version=api_version,
                                           profile=profile)

    @classmethod
    def _models_dict(cls, api_version):
        return {
            k: v
            for k, v in cls.models(api_version).__dict__.items()
            if isinstance(v, type)
        }

    @classmethod
    def models(cls, api_version=DEFAULT_API_VERSION):
        """Module depends on the API version:

           * 2020-06-30: :mod:`v2020_06.models<azure.search.documents.v2020_06.models>`
           * 2020-06-30-Preview: :mod:`v2020_06_preview.models<azure.search.documents.v2020_06_preview.models>`
        """
        if api_version == '2020-06-30':
            from .v2020_06 import models
            return models
        elif api_version == '2020-06-30-Preview':
            from .v2020_06_preview import models
            return models
        raise ValueError("API version {} is not available".format(api_version))

    @property
    def data_sources(self):
        """Instance depends on the API version:

           * 2020-06-30: :class:`DataSourcesOperations<azure.search.documents.v2020_06.operations.DataSourcesOperations>`
           * 2020-06-30-Preview: :class:`DataSourcesOperations<azure.search.documents.v2020_06_preview.operations.DataSourcesOperations>`
        """
        api_version = self._get_api_version('data_sources')
        if api_version == '2020-06-30':
            from .v2020_06.operations import DataSourcesOperations as OperationClass
        elif api_version == '2020-06-30-Preview':
            from .v2020_06_preview.operations import DataSourcesOperations as OperationClass
        else:
            raise ValueError(
                "API version {} does not have operation group 'data_sources'".
                format(api_version))
        return OperationClass(self._client, self._config,
                              Serializer(self._models_dict(api_version)),
                              Deserializer(self._models_dict(api_version)))

    @property
    def indexers(self):
        """Instance depends on the API version:

           * 2020-06-30: :class:`IndexersOperations<azure.search.documents.v2020_06.operations.IndexersOperations>`
           * 2020-06-30-Preview: :class:`IndexersOperations<azure.search.documents.v2020_06_preview.operations.IndexersOperations>`
        """
        api_version = self._get_api_version('indexers')
        if api_version == '2020-06-30':
            from .v2020_06.operations import IndexersOperations as OperationClass
        elif api_version == '2020-06-30-Preview':
            from .v2020_06_preview.operations import IndexersOperations as OperationClass
        else:
            raise ValueError(
                "API version {} does not have operation group 'indexers'".
                format(api_version))
        return OperationClass(self._client, self._config,
                              Serializer(self._models_dict(api_version)),
                              Deserializer(self._models_dict(api_version)))

    @property
    def indexes(self):
        """Instance depends on the API version:

           * 2020-06-30: :class:`IndexesOperations<azure.search.documents.v2020_06.operations.IndexesOperations>`
           * 2020-06-30-Preview: :class:`IndexesOperations<azure.search.documents.v2020_06_preview.operations.IndexesOperations>`
        """
        api_version = self._get_api_version('indexes')
        if api_version == '2020-06-30':
            from .v2020_06.operations import IndexesOperations as OperationClass
        elif api_version == '2020-06-30-Preview':
            from .v2020_06_preview.operations import IndexesOperations as OperationClass
        else:
            raise ValueError(
                "API version {} does not have operation group 'indexes'".
                format(api_version))
        return OperationClass(self._client, self._config,
                              Serializer(self._models_dict(api_version)),
                              Deserializer(self._models_dict(api_version)))

    @property
    def skillsets(self):
        """Instance depends on the API version:

           * 2020-06-30: :class:`SkillsetsOperations<azure.search.documents.v2020_06.operations.SkillsetsOperations>`
           * 2020-06-30-Preview: :class:`SkillsetsOperations<azure.search.documents.v2020_06_preview.operations.SkillsetsOperations>`
        """
        api_version = self._get_api_version('skillsets')
        if api_version == '2020-06-30':
            from .v2020_06.operations import SkillsetsOperations as OperationClass
        elif api_version == '2020-06-30-Preview':
            from .v2020_06_preview.operations import SkillsetsOperations as OperationClass
        else:
            raise ValueError(
                "API version {} does not have operation group 'skillsets'".
                format(api_version))
        return OperationClass(self._client, self._config,
                              Serializer(self._models_dict(api_version)),
                              Deserializer(self._models_dict(api_version)))

    @property
    def synonym_maps(self):
        """Instance depends on the API version:

           * 2020-06-30: :class:`SynonymMapsOperations<azure.search.documents.v2020_06.operations.SynonymMapsOperations>`
           * 2020-06-30-Preview: :class:`SynonymMapsOperations<azure.search.documents.v2020_06_preview.operations.SynonymMapsOperations>`
        """
        api_version = self._get_api_version('synonym_maps')
        if api_version == '2020-06-30':
            from .v2020_06.operations import SynonymMapsOperations as OperationClass
        elif api_version == '2020-06-30-Preview':
            from .v2020_06_preview.operations import SynonymMapsOperations as OperationClass
        else:
            raise ValueError(
                "API version {} does not have operation group 'synonym_maps'".
                format(api_version))
        return OperationClass(self._client, self._config,
                              Serializer(self._models_dict(api_version)),
                              Deserializer(self._models_dict(api_version)))

    def close(self):
        self._client.close()

    def __enter__(self):
        self._client.__enter__()
        return self

    def __exit__(self, *exc_details):
        self._client.__exit__(*exc_details)
Example #30
0
class CommunicationNetworkTraversalClient(object):
    """Azure Communication Network Traversal Service.

    :ivar communication_network_traversal: CommunicationNetworkTraversalOperations operations
    :vartype communication_network_traversal:
     azure.communication.networktraversal.operations.CommunicationNetworkTraversalOperations
    :param endpoint: The communication resource, for example
     https://my-resource.communication.azure.com.
    :type endpoint: str
    :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,  # type: str
            **kwargs  # type: Any
    ):
        # type: (...) -> None
        _base_url = '{endpoint}'
        self._config = CommunicationNetworkTraversalClientConfiguration(
            endpoint=endpoint, **kwargs)
        self._client = PipelineClient(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.communication_network_traversal = CommunicationNetworkTraversalOperations(
            self._client, self._config, self._serialize, self._deserialize)

    def _send_request(
            self,
            request,  # type: HttpRequest
            **kwargs  # type: Any
    ):
        # type: (...) -> HttpResponse
        """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 = client._send_request(request)
        <HttpResponse: 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.HttpResponse
        """

        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)

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

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

    def __exit__(self, *exc_details):
        # type: (Any) -> None
        self._client.__exit__(*exc_details)