|
| 1 | +# coding=utf-8 |
| 2 | +# -------------------------------------------------------------------------- |
| 3 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 | +# Licensed under the MIT License. See License.txt in the project root for license information. |
| 5 | +# Code generated by Microsoft (R) AutoRest Code Generator. |
| 6 | +# Changes may cause incorrect behavior and will be lost if the code is regenerated. |
| 7 | +# -------------------------------------------------------------------------- |
| 8 | + |
| 9 | +from copy import deepcopy |
| 10 | +from typing import TYPE_CHECKING |
| 11 | + |
| 12 | +from azure.core import PipelineClient |
| 13 | +from msrest import Deserializer, Serializer |
| 14 | + |
| 15 | +from ._configuration import PurviewScanningClientConfiguration |
| 16 | +from .operations import ClassificationRulesOperations, DataSourcesOperations, FiltersOperations, KeyVaultConnectionsOperations, ScanResultOperations, ScanRulesetsOperations, ScansOperations, SystemScanRulesetsOperations, TriggersOperations |
| 17 | + |
| 18 | +if TYPE_CHECKING: |
| 19 | + # pylint: disable=unused-import,ungrouped-imports |
| 20 | + from typing import Any, Dict, Optional |
| 21 | + |
| 22 | + from azure.core.credentials import TokenCredential |
| 23 | + from azure.core.rest import HttpRequest, HttpResponse |
| 24 | + |
| 25 | +class PurviewScanningClient(object): |
| 26 | + """Creates a Microsoft.Scanning management client. |
| 27 | +
|
| 28 | + :ivar key_vault_connections: KeyVaultConnectionsOperations operations |
| 29 | + :vartype key_vault_connections: azure.purview.scanning.operations.KeyVaultConnectionsOperations |
| 30 | + :ivar classification_rules: ClassificationRulesOperations operations |
| 31 | + :vartype classification_rules: azure.purview.scanning.operations.ClassificationRulesOperations |
| 32 | + :ivar data_sources: DataSourcesOperations operations |
| 33 | + :vartype data_sources: azure.purview.scanning.operations.DataSourcesOperations |
| 34 | + :ivar filters: FiltersOperations operations |
| 35 | + :vartype filters: azure.purview.scanning.operations.FiltersOperations |
| 36 | + :ivar scans: ScansOperations operations |
| 37 | + :vartype scans: azure.purview.scanning.operations.ScansOperations |
| 38 | + :ivar scan_result: ScanResultOperations operations |
| 39 | + :vartype scan_result: azure.purview.scanning.operations.ScanResultOperations |
| 40 | + :ivar scan_rulesets: ScanRulesetsOperations operations |
| 41 | + :vartype scan_rulesets: azure.purview.scanning.operations.ScanRulesetsOperations |
| 42 | + :ivar system_scan_rulesets: SystemScanRulesetsOperations operations |
| 43 | + :vartype system_scan_rulesets: azure.purview.scanning.operations.SystemScanRulesetsOperations |
| 44 | + :ivar triggers: TriggersOperations operations |
| 45 | + :vartype triggers: azure.purview.scanning.operations.TriggersOperations |
| 46 | + :param endpoint: The scanning endpoint of your purview account. Example: |
| 47 | + https://{accountName}.scan.purview.azure.com. |
| 48 | + :type endpoint: str |
| 49 | + :param credential: Credential needed for the client to connect to Azure. |
| 50 | + :type credential: ~azure.core.credentials.TokenCredential |
| 51 | + """ |
| 52 | + |
| 53 | + def __init__( |
| 54 | + self, |
| 55 | + endpoint, # type: str |
| 56 | + credential, # type: "TokenCredential" |
| 57 | + **kwargs # type: Any |
| 58 | + ): |
| 59 | + # type: (...) -> None |
| 60 | + _endpoint = '{Endpoint}' |
| 61 | + self._config = PurviewScanningClientConfiguration(endpoint, credential, **kwargs) |
| 62 | + self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) |
| 63 | + |
| 64 | + self._serialize = Serializer() |
| 65 | + self._deserialize = Deserializer() |
| 66 | + self._serialize.client_side_validation = False |
| 67 | + self.key_vault_connections = KeyVaultConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 68 | + self.classification_rules = ClassificationRulesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 69 | + self.data_sources = DataSourcesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 70 | + self.filters = FiltersOperations(self._client, self._config, self._serialize, self._deserialize) |
| 71 | + self.scans = ScansOperations(self._client, self._config, self._serialize, self._deserialize) |
| 72 | + self.scan_result = ScanResultOperations(self._client, self._config, self._serialize, self._deserialize) |
| 73 | + self.scan_rulesets = ScanRulesetsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 74 | + self.system_scan_rulesets = SystemScanRulesetsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 75 | + self.triggers = TriggersOperations(self._client, self._config, self._serialize, self._deserialize) |
| 76 | + |
| 77 | + |
| 78 | + def send_request( |
| 79 | + self, |
| 80 | + request, # type: HttpRequest |
| 81 | + **kwargs # type: Any |
| 82 | + ): |
| 83 | + # type: (...) -> HttpResponse |
| 84 | + """Runs the network request through the client's chained policies. |
| 85 | +
|
| 86 | + >>> from azure.core.rest import HttpRequest |
| 87 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 88 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 89 | + >>> response = client.send_request(request) |
| 90 | + <HttpResponse: 200 OK> |
| 91 | +
|
| 92 | + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart |
| 93 | +
|
| 94 | + :param request: The network request you want to make. Required. |
| 95 | + :type request: ~azure.core.rest.HttpRequest |
| 96 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
| 97 | + :return: The response of your network call. Does not do error handling on your response. |
| 98 | + :rtype: ~azure.core.rest.HttpResponse |
| 99 | + """ |
| 100 | + |
| 101 | + request_copy = deepcopy(request) |
| 102 | + path_format_arguments = { |
| 103 | + "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), |
| 104 | + } |
| 105 | + |
| 106 | + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) |
| 107 | + return self._client.send_request(request_copy, **kwargs) |
| 108 | + |
| 109 | + def close(self): |
| 110 | + # type: () -> None |
| 111 | + self._client.close() |
| 112 | + |
| 113 | + def __enter__(self): |
| 114 | + # type: () -> PurviewScanningClient |
| 115 | + self._client.__enter__() |
| 116 | + return self |
| 117 | + |
| 118 | + def __exit__(self, *exc_details): |
| 119 | + # type: (Any) -> None |
| 120 | + self._client.__exit__(*exc_details) |
0 commit comments