Source code for azure.purview.scanning.rest.system_scan_rulesets._request_builders_py3

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

from azure.core.pipeline.transport._base import _format_url_section
from azure.purview.scanning.core.rest import HttpRequest
from msrest import Serializer

if TYPE_CHECKING:
    # pylint: disable=unused-import,ungrouped-imports
    from typing import Any

_SERIALIZER = Serializer()


[docs]def build_list_all_request( **kwargs: Any ) -> HttpRequest: """List all system scan rulesets for an account. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. :return: Returns an :class:`~azure.purview.scanning.core.rest.HttpRequest` that you will pass to the client's `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. :rtype: ~azure.purview.scanning.core.rest.HttpRequest Example: .. code-block:: python # response body for status code(s): 200 response_body == { "count": "long (optional)", "nextLink": "str (optional)", "value": [ { "kind": "SystemScanRuleset" } ] } """ api_version = "2018-12-01-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/systemScanRulesets') # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
[docs]def build_get_request( data_source_type: Union[str, "_models.DataSourceType"], **kwargs: Any ) -> HttpRequest: """Get a system scan ruleset for a data source. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. :param data_source_type: :type data_source_type: str or ~azure.purview.scanning.models.DataSourceType :return: Returns an :class:`~azure.purview.scanning.core.rest.HttpRequest` that you will pass to the client's `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. :rtype: ~azure.purview.scanning.core.rest.HttpRequest Example: .. code-block:: python # response body for status code(s): 200 response_body == { "kind": "SystemScanRuleset" } """ api_version = "2018-12-01-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/systemScanRulesets/datasources/{dataSourceType}') path_format_arguments = { 'dataSourceType': _SERIALIZER.url("data_source_type", data_source_type, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
[docs]def build_get_by_version_request( version: int, *, data_source_type: Optional[Union[str, "_models.DataSourceType"]] = None, **kwargs: Any ) -> HttpRequest: """Get a scan ruleset by version. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. :param version: :type version: int :keyword data_source_type: :paramtype data_source_type: str or ~azure.purview.scanning.models.DataSourceType :return: Returns an :class:`~azure.purview.scanning.core.rest.HttpRequest` that you will pass to the client's `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. :rtype: ~azure.purview.scanning.core.rest.HttpRequest Example: .. code-block:: python # response body for status code(s): 200 response_body == { "kind": "SystemScanRuleset" } """ api_version = "2018-12-01-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/systemScanRulesets/versions/{version}') path_format_arguments = { 'version': _SERIALIZER.url("version", version, 'int'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if data_source_type is not None: query_parameters['dataSourceType'] = _SERIALIZER.query("data_source_type", data_source_type, 'str') query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
[docs]def build_get_latest_request( *, data_source_type: Optional[Union[str, "_models.DataSourceType"]] = None, **kwargs: Any ) -> HttpRequest: """Get the latest version of a system scan ruleset. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. :keyword data_source_type: :paramtype data_source_type: str or ~azure.purview.scanning.models.DataSourceType :return: Returns an :class:`~azure.purview.scanning.core.rest.HttpRequest` that you will pass to the client's `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. :rtype: ~azure.purview.scanning.core.rest.HttpRequest Example: .. code-block:: python # response body for status code(s): 200 response_body == { "kind": "SystemScanRuleset" } """ api_version = "2018-12-01-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/systemScanRulesets/versions/latest') # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if data_source_type is not None: query_parameters['dataSourceType'] = _SERIALIZER.query("data_source_type", data_source_type, 'str') query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )
[docs]def build_list_versions_by_data_source_request( *, data_source_type: Optional[Union[str, "_models.DataSourceType"]] = None, **kwargs: Any ) -> HttpRequest: """List system scan ruleset versions in Data catalog. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. :keyword data_source_type: :paramtype data_source_type: str or ~azure.purview.scanning.models.DataSourceType :return: Returns an :class:`~azure.purview.scanning.core.rest.HttpRequest` that you will pass to the client's `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this response into your code flow. :rtype: ~azure.purview.scanning.core.rest.HttpRequest Example: .. code-block:: python # response body for status code(s): 200 response_body == { "count": "long (optional)", "nextLink": "str (optional)", "value": [ { "kind": "SystemScanRuleset" } ] } """ api_version = "2018-12-01-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/systemScanRulesets/versions') # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if data_source_type is not None: query_parameters['dataSourceType'] = _SERIALIZER.query("data_source_type", data_source_type, 'str') query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs )