# 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 TYPE_CHECKING
import warnings

from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.mgmt.core.exceptions import ARMErrorFormat

from .. import models as _models

if TYPE_CHECKING:
    # pylint: disable=unused-import,ungrouped-imports
    from typing import Any, Callable, Dict, Generic, Optional, TypeVar

    T = TypeVar('T')
    ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]

class SqlVulnerabilityAssessmentBaselineRulesOperations(object):
    """SqlVulnerabilityAssessmentBaselineRulesOperations operations.

    You should not instantiate this class directly. Instead, you should create a Client instance that
    instantiates it for you and attaches it as an attribute.

    :ivar models: Alias to model classes used in this operation group.
    :type models: ~azure.mgmt.security.models
    :param client: Client for service requests.
    :param config: Configuration of service client.
    :param serializer: An object model serializer.
    :param deserializer: An object model deserializer.
    """

    models = _models

    def __init__(self, client, config, serializer, deserializer):
        self._client = client
        self._serialize = serializer
        self._deserialize = deserializer
        self._config = config

    def create_or_update(
        self,
        rule_id,  # type: str
        workspace_id,  # type: str
        resource_id,  # type: str
        body=None,  # type: Optional["_models.RuleResultsInput"]
        **kwargs  # type: Any
    ):
        # type: (...) -> "_models.RuleResults"
        """Creates a Baseline for a rule in a database. Will overwrite any previously existing results.

        Creates a Baseline for a rule in a database. Will overwrite any previously existing results.

        :param rule_id: The rule Id.
        :type rule_id: str
        :param workspace_id: The workspace Id.
        :type workspace_id: str
        :param resource_id: The identifier of the resource.
        :type resource_id: str
        :param body: The baseline results for this rule.
        :type body: ~azure.mgmt.security.models.RuleResultsInput
        :keyword callable cls: A custom type or function that will be passed the direct response
        :return: RuleResults, or the result of cls(response)
        :rtype: ~azure.mgmt.security.models.RuleResults
        :raises: ~azure.core.exceptions.HttpResponseError
        """