# coding=utf-8
# pylint: disable=too-many-lines
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------

import datetime
from typing import Dict, List, Optional, TYPE_CHECKING, Union

from .. import _serialization

if TYPE_CHECKING:
    # pylint: disable=unused-import,ungrouped-imports
    from .. import models as _models


class AdministratorListResult(_serialization.Model):
    """A list of active directory administrators.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerAzureADAdministrator]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerAzureADAdministrator]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class Resource(_serialization.Model):
    """ARM resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.id = None
        self.name = None
        self.type = None


class ProxyResource(Resource):
    """ARM proxy resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)


class Advisor(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """Database, Server or Elastic Pool Advisor.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar kind: Resource kind.
    :vartype kind: str
    :ivar location: Resource location.
    :vartype location: str
    :ivar advisor_status: Gets the status of availability of this advisor to customers. Possible
     values are 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. Known values
     are: "GA", "PublicPreview", "LimitedPublicPreview", and "PrivatePreview".
    :vartype advisor_status: str or ~azure.mgmt.sql.models.AdvisorStatus
    :ivar auto_execute_status: Gets the auto-execute status (whether to let the system execute the
     recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Known values
     are: "Enabled", "Disabled", and "Default".
    :vartype auto_execute_status: str or ~azure.mgmt.sql.models.AutoExecuteStatus
    :ivar auto_execute_status_inherited_from: Gets the resource from which current value of
     auto-execute status is inherited. Auto-execute status can be set on (and inherited from)
     different levels in the resource hierarchy. Possible values are 'Subscription', 'Server',
     'ElasticPool', 'Database' and 'Default' (when status is not explicitly set on any level). Known
     values are: "Default", "Subscription", "Server", "ElasticPool", and "Database".
    :vartype auto_execute_status_inherited_from: str or
     ~azure.mgmt.sql.models.AutoExecuteStatusInheritedFrom
    :ivar recommendations_status: Gets that status of recommendations for this advisor and reason
     for not having any recommendations. Possible values include, but are not limited to, 'Ok'
     (Recommendations available),LowActivity (not enough workload to analyze), 'DbSeemsTuned'
     (Database is doing well), etc.
    :vartype recommendations_status: str
    :ivar last_checked: Gets the time when the current resource was analyzed for recommendations by
     this advisor.
    :vartype last_checked: ~datetime.datetime
    :ivar recommended_actions: Gets the recommended actions for this advisor.
    :vartype recommended_actions: list[~azure.mgmt.sql.models.RecommendedAction]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "kind": {"readonly": True},
        "location": {"readonly": True},
        "advisor_status": {"readonly": True},
        "auto_execute_status_inherited_from": {"readonly": True},
        "recommendations_status": {"readonly": True},
        "last_checked": {"readonly": True},
        "recommended_actions": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "kind": {"key": "kind", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "advisor_status": {"key": "properties.advisorStatus", "type": "str"},
        "auto_execute_status": {"key": "properties.autoExecuteStatus", "type": "str"},
        "auto_execute_status_inherited_from": {"key": "properties.autoExecuteStatusInheritedFrom", "type": "str"},
        "recommendations_status": {"key": "properties.recommendationsStatus", "type": "str"},
        "last_checked": {"key": "properties.lastChecked", "type": "iso-8601"},
        "recommended_actions": {"key": "properties.recommendedActions", "type": "[RecommendedAction]"},
    }

    def __init__(self, *, auto_execute_status: Optional[Union[str, "_models.AutoExecuteStatus"]] = None, **kwargs):
        """
        :keyword auto_execute_status: Gets the auto-execute status (whether to let the system execute
         the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Known
         values are: "Enabled", "Disabled", and "Default".
        :paramtype auto_execute_status: str or ~azure.mgmt.sql.models.AutoExecuteStatus
        """
        super().__init__(**kwargs)
        self.kind = None
        self.location = None
        self.advisor_status = None
        self.auto_execute_status = auto_execute_status
        self.auto_execute_status_inherited_from = None
        self.recommendations_status = None
        self.last_checked = None
        self.recommended_actions = None


class AutomaticTuningOptions(_serialization.Model):
    """Automatic tuning properties for individual advisors.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar desired_state: Automatic tuning option desired state. Known values are: "Off", "On", and
     "Default".
    :vartype desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningOptionModeDesired
    :ivar actual_state: Automatic tuning option actual state. Known values are: "Off" and "On".
    :vartype actual_state: str or ~azure.mgmt.sql.models.AutomaticTuningOptionModeActual
    :ivar reason_code: Reason code if desired and actual state are different.
    :vartype reason_code: int
    :ivar reason_desc: Reason description if desired and actual state are different. Known values
     are: "Default", "Disabled", "AutoConfigured", "InheritedFromServer", "QueryStoreOff",
     "QueryStoreReadOnly", and "NotSupported".
    :vartype reason_desc: str or ~azure.mgmt.sql.models.AutomaticTuningDisabledReason
    """

    _validation = {
        "actual_state": {"readonly": True},
        "reason_code": {"readonly": True},
        "reason_desc": {"readonly": True},
    }

    _attribute_map = {
        "desired_state": {"key": "desiredState", "type": "str"},
        "actual_state": {"key": "actualState", "type": "str"},
        "reason_code": {"key": "reasonCode", "type": "int"},
        "reason_desc": {"key": "reasonDesc", "type": "str"},
    }

    def __init__(
        self, *, desired_state: Optional[Union[str, "_models.AutomaticTuningOptionModeDesired"]] = None, **kwargs
    ):
        """
        :keyword desired_state: Automatic tuning option desired state. Known values are: "Off", "On",
         and "Default".
        :paramtype desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningOptionModeDesired
        """
        super().__init__(**kwargs)
        self.desired_state = desired_state
        self.actual_state = None
        self.reason_code = None
        self.reason_desc = None


class AutomaticTuningServerOptions(_serialization.Model):
    """Automatic tuning properties for individual advisors.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar desired_state: Automatic tuning option desired state. Known values are: "Off", "On", and
     "Default".
    :vartype desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningOptionModeDesired
    :ivar actual_state: Automatic tuning option actual state. Known values are: "Off" and "On".
    :vartype actual_state: str or ~azure.mgmt.sql.models.AutomaticTuningOptionModeActual
    :ivar reason_code: Reason code if desired and actual state are different.
    :vartype reason_code: int
    :ivar reason_desc: Reason description if desired and actual state are different. Known values
     are: "Default", "Disabled", and "AutoConfigured".
    :vartype reason_desc: str or ~azure.mgmt.sql.models.AutomaticTuningServerReason
    """

    _validation = {
        "actual_state": {"readonly": True},
        "reason_code": {"readonly": True},
        "reason_desc": {"readonly": True},
    }

    _attribute_map = {
        "desired_state": {"key": "desiredState", "type": "str"},
        "actual_state": {"key": "actualState", "type": "str"},
        "reason_code": {"key": "reasonCode", "type": "int"},
        "reason_desc": {"key": "reasonDesc", "type": "str"},
    }

    def __init__(
        self, *, desired_state: Optional[Union[str, "_models.AutomaticTuningOptionModeDesired"]] = None, **kwargs
    ):
        """
        :keyword desired_state: Automatic tuning option desired state. Known values are: "Off", "On",
         and "Default".
        :paramtype desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningOptionModeDesired
        """
        super().__init__(**kwargs)
        self.desired_state = desired_state
        self.actual_state = None
        self.reason_code = None
        self.reason_desc = None


class AutoPauseDelayTimeRange(_serialization.Model):
    """Supported auto pause delay time range.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar min_value: Minimum value.
    :vartype min_value: int
    :ivar max_value: Maximum value.
    :vartype max_value: int
    :ivar step_size: Step value for discrete values between the minimum value and the maximum
     value.
    :vartype step_size: int
    :ivar default: Default value is no value is provided.
    :vartype default: int
    :ivar unit: Unit of time that delay is expressed in. "Minutes"
    :vartype unit: str or ~azure.mgmt.sql.models.PauseDelayTimeUnit
    :ivar do_not_pause_value: Value that is used to not pause (infinite delay before pause).
    :vartype do_not_pause_value: int
    """

    _validation = {
        "min_value": {"readonly": True},
        "max_value": {"readonly": True},
        "step_size": {"readonly": True},
        "default": {"readonly": True},
        "unit": {"readonly": True},
        "do_not_pause_value": {"readonly": True},
    }

    _attribute_map = {
        "min_value": {"key": "minValue", "type": "int"},
        "max_value": {"key": "maxValue", "type": "int"},
        "step_size": {"key": "stepSize", "type": "int"},
        "default": {"key": "default", "type": "int"},
        "unit": {"key": "unit", "type": "str"},
        "do_not_pause_value": {"key": "doNotPauseValue", "type": "int"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.min_value = None
        self.max_value = None
        self.step_size = None
        self.default = None
        self.unit = None
        self.do_not_pause_value = None


class AzureADOnlyAuthListResult(_serialization.Model):
    """A list of active directory only authentications.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerAzureADOnlyAuthentication]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerAzureADOnlyAuthentication]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class BackupShortTermRetentionPolicy(ProxyResource):
    """A short term retention policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar retention_days: The backup retention period in days. This is how many days Point-in-Time
     Restore will be supported.
    :vartype retention_days: int
    :ivar diff_backup_interval_in_hours: The differential backup interval in hours. This is how
     many interval hours between each differential backup will be supported. This is only applicable
     to live databases but not dropped databases. Known values are: 12 and 24.
    :vartype diff_backup_interval_in_hours: int or ~azure.mgmt.sql.models.DiffBackupIntervalInHours
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "retention_days": {"key": "properties.retentionDays", "type": "int"},
        "diff_backup_interval_in_hours": {"key": "properties.diffBackupIntervalInHours", "type": "int"},
    }

    def __init__(
        self,
        *,
        retention_days: Optional[int] = None,
        diff_backup_interval_in_hours: Optional[Union[int, "_models.DiffBackupIntervalInHours"]] = None,
        **kwargs
    ):
        """
        :keyword retention_days: The backup retention period in days. This is how many days
         Point-in-Time Restore will be supported.
        :paramtype retention_days: int
        :keyword diff_backup_interval_in_hours: The differential backup interval in hours. This is how
         many interval hours between each differential backup will be supported. This is only applicable
         to live databases but not dropped databases. Known values are: 12 and 24.
        :paramtype diff_backup_interval_in_hours: int or
         ~azure.mgmt.sql.models.DiffBackupIntervalInHours
        """
        super().__init__(**kwargs)
        self.retention_days = retention_days
        self.diff_backup_interval_in_hours = diff_backup_interval_in_hours


class BackupShortTermRetentionPolicyListResult(_serialization.Model):
    """A list of short term retention policies.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.BackupShortTermRetentionPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[BackupShortTermRetentionPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class Baseline(_serialization.Model):
    """SQL Vulnerability Assessment baseline Details.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar expected_results: SQL Vulnerability Assessment baseline expected results.
    :vartype expected_results: list[list[str]]
    :ivar updated_time: SQL Vulnerability Assessment baseline update time (UTC).
    :vartype updated_time: ~datetime.datetime
    """

    _validation = {
        "expected_results": {"readonly": True},
        "updated_time": {"readonly": True},
    }

    _attribute_map = {
        "expected_results": {"key": "expectedResults", "type": "[[str]]"},
        "updated_time": {"key": "updatedTime", "type": "iso-8601"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.expected_results = None
        self.updated_time = None


class BaselineAdjustedResult(_serialization.Model):
    """SQL Vulnerability Assessment baseline adjusted results.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar baseline: SQL Vulnerability Assessment baseline details.
    :vartype baseline: ~azure.mgmt.sql.models.Baseline
    :ivar status: SQL Vulnerability Assessment baseline status. Known values are: "NonFinding",
     "Finding", and "InternalError".
    :vartype status: str or ~azure.mgmt.sql.models.RuleStatus
    :ivar results_not_in_baseline: SQL Vulnerability Assessment results that are not in baseline.
    :vartype results_not_in_baseline: list[list[str]]
    :ivar results_only_in_baseline: SQL Vulnerability Assessment results that are in baseline.
    :vartype results_only_in_baseline: list[list[str]]
    """

    _validation = {
        "baseline": {"readonly": True},
        "status": {"readonly": True},
        "results_not_in_baseline": {"readonly": True},
        "results_only_in_baseline": {"readonly": True},
    }

    _attribute_map = {
        "baseline": {"key": "baseline", "type": "Baseline"},
        "status": {"key": "status", "type": "str"},
        "results_not_in_baseline": {"key": "resultsNotInBaseline", "type": "[[str]]"},
        "results_only_in_baseline": {"key": "resultsOnlyInBaseline", "type": "[[str]]"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.baseline = None
        self.status = None
        self.results_not_in_baseline = None
        self.results_only_in_baseline = None


class BenchmarkReference(_serialization.Model):
    """SQL Vulnerability Assessment benchmark reference.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar benchmark: SQL Vulnerability Assessment benchmark name.
    :vartype benchmark: str
    :ivar reference: SQL Vulnerability Assessment benchmark reference.
    :vartype reference: str
    """

    _validation = {
        "benchmark": {"readonly": True},
        "reference": {"readonly": True},
    }

    _attribute_map = {
        "benchmark": {"key": "benchmark", "type": "str"},
        "reference": {"key": "reference", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.benchmark = None
        self.reference = None


class CheckNameAvailabilityRequest(_serialization.Model):
    """A request to check whether the specified name for a resource is available.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar name: Required.
    :vartype name: str
    :ivar type: Required. Default value is "Microsoft.Sql/servers".
    :vartype type: str
    """

    _validation = {
        "name": {"required": True},
        "type": {"required": True, "constant": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
    }

    type = "Microsoft.Sql/servers"

    def __init__(self, *, name: str, **kwargs):
        """
        :keyword name: Required.
        :paramtype name: str
        """
        super().__init__(**kwargs)
        self.name = name


class CheckNameAvailabilityResponse(_serialization.Model):
    """The result of a name availability check.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The name whose availability was checked.
    :vartype name: str
    :ivar available: True if the name is available, otherwise false.
    :vartype available: bool
    :ivar reason: The reason code explaining why the name is unavailable. Will be undefined if the
     name is available. Known values are: "Invalid" and "AlreadyExists".
    :vartype reason: str or ~azure.mgmt.sql.models.CheckNameAvailabilityReason
    :ivar message: A message explaining why the name is unavailable. Will be undefined if the name
     is available.
    :vartype message: str
    """

    _validation = {
        "name": {"readonly": True},
        "available": {"readonly": True},
        "reason": {"readonly": True},
        "message": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "available": {"key": "available", "type": "bool"},
        "reason": {"key": "reason", "type": "str"},
        "message": {"key": "message", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.name = None
        self.available = None
        self.reason = None
        self.message = None


class CompleteDatabaseRestoreDefinition(_serialization.Model):
    """Contains the information necessary to perform a complete database restore operation.

    All required parameters must be populated in order to send to Azure.

    :ivar last_backup_name: The last backup name to apply. Required.
    :vartype last_backup_name: str
    """

    _validation = {
        "last_backup_name": {"required": True},
    }

    _attribute_map = {
        "last_backup_name": {"key": "lastBackupName", "type": "str"},
    }

    def __init__(self, *, last_backup_name: str, **kwargs):
        """
        :keyword last_backup_name: The last backup name to apply. Required.
        :paramtype last_backup_name: str
        """
        super().__init__(**kwargs)
        self.last_backup_name = last_backup_name


class CopyLongTermRetentionBackupParameters(_serialization.Model):
    """Contains the information necessary to perform long term retention backup copy operation.

    :ivar target_subscription_id: The subscription that owns the target server.
    :vartype target_subscription_id: str
    :ivar target_resource_group: The resource group that owns the target server.
    :vartype target_resource_group: str
    :ivar target_server_resource_id: The resource Id of the target server that owns the database.
    :vartype target_server_resource_id: str
    :ivar target_server_fully_qualified_domain_name: The fully qualified domain name of the target
     server.
    :vartype target_server_fully_qualified_domain_name: str
    :ivar target_database_name: The name of the database owns the copied backup.
    :vartype target_database_name: str
    :ivar target_backup_storage_redundancy: The storage redundancy type of the copied backup. Known
     values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype target_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    """

    _attribute_map = {
        "target_subscription_id": {"key": "properties.targetSubscriptionId", "type": "str"},
        "target_resource_group": {"key": "properties.targetResourceGroup", "type": "str"},
        "target_server_resource_id": {"key": "properties.targetServerResourceId", "type": "str"},
        "target_server_fully_qualified_domain_name": {
            "key": "properties.targetServerFullyQualifiedDomainName",
            "type": "str",
        },
        "target_database_name": {"key": "properties.targetDatabaseName", "type": "str"},
        "target_backup_storage_redundancy": {"key": "properties.targetBackupStorageRedundancy", "type": "str"},
    }

    def __init__(
        self,
        *,
        target_subscription_id: Optional[str] = None,
        target_resource_group: Optional[str] = None,
        target_server_resource_id: Optional[str] = None,
        target_server_fully_qualified_domain_name: Optional[str] = None,
        target_database_name: Optional[str] = None,
        target_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None,
        **kwargs
    ):
        """
        :keyword target_subscription_id: The subscription that owns the target server.
        :paramtype target_subscription_id: str
        :keyword target_resource_group: The resource group that owns the target server.
        :paramtype target_resource_group: str
        :keyword target_server_resource_id: The resource Id of the target server that owns the
         database.
        :paramtype target_server_resource_id: str
        :keyword target_server_fully_qualified_domain_name: The fully qualified domain name of the
         target server.
        :paramtype target_server_fully_qualified_domain_name: str
        :keyword target_database_name: The name of the database owns the copied backup.
        :paramtype target_database_name: str
        :keyword target_backup_storage_redundancy: The storage redundancy type of the copied backup.
         Known values are: "Geo", "Local", "Zone", and "GeoZone".
        :paramtype target_backup_storage_redundancy: str or
         ~azure.mgmt.sql.models.BackupStorageRedundancy
        """
        super().__init__(**kwargs)
        self.target_subscription_id = target_subscription_id
        self.target_resource_group = target_resource_group
        self.target_server_resource_id = target_server_resource_id
        self.target_server_fully_qualified_domain_name = target_server_fully_qualified_domain_name
        self.target_database_name = target_database_name
        self.target_backup_storage_redundancy = target_backup_storage_redundancy


class CreateDatabaseRestorePointDefinition(_serialization.Model):
    """Contains the information necessary to perform a create database restore point operation.

    All required parameters must be populated in order to send to Azure.

    :ivar restore_point_label: The restore point label to apply. Required.
    :vartype restore_point_label: str
    """

    _validation = {
        "restore_point_label": {"required": True},
    }

    _attribute_map = {
        "restore_point_label": {"key": "restorePointLabel", "type": "str"},
    }

    def __init__(self, *, restore_point_label: str, **kwargs):
        """
        :keyword restore_point_label: The restore point label to apply. Required.
        :paramtype restore_point_label: str
        """
        super().__init__(**kwargs)
        self.restore_point_label = restore_point_label


class TrackedResource(Resource):
    """ARM tracked top level resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location. Required.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"required": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "tags": {"key": "tags", "type": "{str}"},
    }

    def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs):
        """
        :keyword location: Resource location. Required.
        :paramtype location: str
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        """
        super().__init__(**kwargs)
        self.location = location
        self.tags = tags


class Database(TrackedResource):  # pylint: disable=too-many-instance-attributes
    """A database resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location. Required.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar sku: The database SKU.

     The list of SKUs may vary by region and support offer. To determine the SKUs (including the
     SKU name, tier/edition, family, and capacity) that are available to your subscription in an
     Azure region, use the ``Capabilities_ListByLocation`` REST API or one of the following
     commands:

     .. code-block:: azurecli

        az sql db list-editions -l <location> -o table
        `

     .. code-block:: powershell

        Get-AzSqlServerServiceObjective -Location <location>
        `.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar kind: Kind of database. This is metadata used for the Azure portal experience.
    :vartype kind: str
    :ivar managed_by: Resource that manages the database.
    :vartype managed_by: str
    :ivar identity: The Azure Active Directory identity of the database.
    :vartype identity: ~azure.mgmt.sql.models.DatabaseIdentity
    :ivar create_mode: Specifies the mode of database creation.

     Default: regular database creation.

     Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified
     as the resource ID of the source database.

     Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId
     must be specified as the resource ID of the existing primary database.

     PointInTimeRestore: Creates a database by restoring a point in time backup of an existing
     database. sourceDatabaseId must be specified as the resource ID of the existing database, and
     restorePointInTime must be specified.

     Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be
     specified as the recoverable database resource ID to restore.

     Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must
     be specified. If sourceDatabaseId is the database's original resource ID, then
     sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable
     dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may
     also be specified to restore from an earlier point in time.

     RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention
     vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource
     ID.

     Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse
     edition. Known values are: "Default", "Copy", "Secondary", "PointInTimeRestore", "Restore",
     "Recovery", "RestoreExternalBackup", "RestoreExternalBackupSecondary",
     "RestoreLongTermRetentionBackup", and "OnlineSecondary".
    :vartype create_mode: str or ~azure.mgmt.sql.models.CreateMode
    :ivar collation: The collation of the database.
    :vartype collation: str
    :ivar max_size_bytes: The max size of the database expressed in bytes.
    :vartype max_size_bytes: int
    :ivar sample_name: The name of the sample schema to apply when creating this database. Known
     values are: "AdventureWorksLT", "WideWorldImportersStd", and "WideWorldImportersFull".
    :vartype sample_name: str or ~azure.mgmt.sql.models.SampleName
    :ivar elastic_pool_id: The resource identifier of the elastic pool containing this database.
    :vartype elastic_pool_id: str
    :ivar source_database_id: The resource identifier of the source database associated with create
     operation of this database.
    :vartype source_database_id: str
    :ivar status: The status of the database. Known values are: "Online", "Restoring",
     "RecoveryPending", "Recovering", "Suspect", "Offline", "Standby", "Shutdown", "EmergencyMode",
     "AutoClosed", "Copying", "Creating", "Inaccessible", "OfflineSecondary", "Pausing", "Paused",
     "Resuming", "Scaling", "OfflineChangingDwPerformanceTiers", "OnlineChangingDwPerformanceTiers",
     "Disabled", "Stopping", "Stopped", and "Starting".
    :vartype status: str or ~azure.mgmt.sql.models.DatabaseStatus
    :ivar database_id: The ID of the database.
    :vartype database_id: str
    :ivar creation_date: The creation date of the database (ISO8601 format).
    :vartype creation_date: ~datetime.datetime
    :ivar current_service_objective_name: The current service level objective name of the database.
    :vartype current_service_objective_name: str
    :ivar requested_service_objective_name: The requested service level objective name of the
     database.
    :vartype requested_service_objective_name: str
    :ivar default_secondary_location: The default secondary region for this database.
    :vartype default_secondary_location: str
    :ivar failover_group_id: Failover Group resource identifier that this database belongs to.
    :vartype failover_group_id: str
    :ivar restore_point_in_time: Specifies the point in time (ISO8601 format) of the source
     database that will be restored to create the new database.
    :vartype restore_point_in_time: ~datetime.datetime
    :ivar source_database_deletion_date: Specifies the time that the database was deleted.
    :vartype source_database_deletion_date: ~datetime.datetime
    :ivar recovery_services_recovery_point_id: The resource identifier of the recovery point
     associated with create operation of this database.
    :vartype recovery_services_recovery_point_id: str
    :ivar long_term_retention_backup_resource_id: The resource identifier of the long term
     retention backup associated with create operation of this database.
    :vartype long_term_retention_backup_resource_id: str
    :ivar recoverable_database_id: The resource identifier of the recoverable database associated
     with create operation of this database.
    :vartype recoverable_database_id: str
    :ivar restorable_dropped_database_id: The resource identifier of the restorable dropped
     database associated with create operation of this database.
    :vartype restorable_dropped_database_id: str
    :ivar catalog_collation: Collation of the metadata catalog. Known values are:
     "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS".
    :vartype catalog_collation: str or ~azure.mgmt.sql.models.CatalogCollationType
    :ivar zone_redundant: Whether or not this database is zone redundant, which means the replicas
     of this database will be spread across multiple availability zones.
    :vartype zone_redundant: bool
    :ivar license_type: The license type to apply for this database. ``LicenseIncluded`` if you
     need a license, or ``BasePrice`` if you have a license and are eligible for the Azure Hybrid
     Benefit. Known values are: "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.DatabaseLicenseType
    :ivar max_log_size_bytes: The max log size for this database.
    :vartype max_log_size_bytes: int
    :ivar earliest_restore_date: This records the earliest start date and time that restore is
     available for this database (ISO8601 format).
    :vartype earliest_restore_date: ~datetime.datetime
    :ivar read_scale: The state of read-only routing. If enabled, connections that have application
     intent set to readonly in their connection string may be routed to a readonly secondary replica
     in the same region. Not applicable to a Hyperscale database within an elastic pool. Known
     values are: "Enabled" and "Disabled".
    :vartype read_scale: str or ~azure.mgmt.sql.models.DatabaseReadScale
    :ivar high_availability_replica_count: The number of secondary replicas associated with the
     database that are used to provide high availability. Not applicable to a Hyperscale database
     within an elastic pool.
    :vartype high_availability_replica_count: int
    :ivar secondary_type: The secondary type of the database if it is a secondary.  Valid values
     are Geo, Named and Standby. Known values are: "Geo", "Named", and "Standby".
    :vartype secondary_type: str or ~azure.mgmt.sql.models.SecondaryType
    :ivar current_sku: The name and tier of the SKU.
    :vartype current_sku: ~azure.mgmt.sql.models.Sku
    :ivar auto_pause_delay: Time in minutes after which database is automatically paused. A value
     of -1 means that automatic pause is disabled.
    :vartype auto_pause_delay: int
    :ivar current_backup_storage_redundancy: The storage account type used to store backups for
     this database. Known values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype current_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar requested_backup_storage_redundancy: The storage account type to be used to store backups
     for this database. Known values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype requested_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar min_capacity: Minimal capacity that database will always have allocated, if not paused.
    :vartype min_capacity: float
    :ivar paused_date: The date when database was paused by user configuration or action(ISO8601
     format). Null if the database is ready.
    :vartype paused_date: ~datetime.datetime
    :ivar resumed_date: The date when database was resumed by user action or database login
     (ISO8601 format). Null if the database is paused.
    :vartype resumed_date: ~datetime.datetime
    :ivar maintenance_configuration_id: Maintenance configuration id assigned to the database. This
     configuration defines the period when the maintenance updates will occur.
    :vartype maintenance_configuration_id: str
    :ivar is_ledger_on: Whether or not this database is a ledger database, which means all tables
     in the database are ledger tables. Note: the value of this property cannot be changed after the
     database has been created.
    :vartype is_ledger_on: bool
    :ivar is_infra_encryption_enabled: Infra encryption is enabled for this database.
    :vartype is_infra_encryption_enabled: bool
    :ivar federated_client_id: The Client id used for cross tenant per database CMK scenario.
    :vartype federated_client_id: str
    :ivar source_resource_id: The resource identifier of the source associated with the create
     operation of this database.

     This property is only supported for DataWarehouse edition and allows to restore across
     subscriptions.

     When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId,
     restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode
     must be PointInTimeRestore, Restore or Recover.

     When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the
     existing database or existing sql pool, and restorePointInTime must be specified.

     When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped
     database or restorable dropped sql pool.

     When createMode is Recover, sourceResourceId must be the resource ID of recoverable database
     or recoverable sql pool.

     When source subscription belongs to a different tenant than target subscription,
     “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant.
     For more details about “x-ms-authorization-auxiliary” header see
     https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant.
    :vartype source_resource_id: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"required": True},
        "kind": {"readonly": True},
        "managed_by": {"readonly": True},
        "status": {"readonly": True},
        "database_id": {"readonly": True},
        "creation_date": {"readonly": True},
        "current_service_objective_name": {"readonly": True},
        "requested_service_objective_name": {"readonly": True},
        "default_secondary_location": {"readonly": True},
        "failover_group_id": {"readonly": True},
        "max_log_size_bytes": {"readonly": True},
        "earliest_restore_date": {"readonly": True},
        "current_sku": {"readonly": True},
        "current_backup_storage_redundancy": {"readonly": True},
        "paused_date": {"readonly": True},
        "resumed_date": {"readonly": True},
        "is_infra_encryption_enabled": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "tags": {"key": "tags", "type": "{str}"},
        "sku": {"key": "sku", "type": "Sku"},
        "kind": {"key": "kind", "type": "str"},
        "managed_by": {"key": "managedBy", "type": "str"},
        "identity": {"key": "identity", "type": "DatabaseIdentity"},
        "create_mode": {"key": "properties.createMode", "type": "str"},
        "collation": {"key": "properties.collation", "type": "str"},
        "max_size_bytes": {"key": "properties.maxSizeBytes", "type": "int"},
        "sample_name": {"key": "properties.sampleName", "type": "str"},
        "elastic_pool_id": {"key": "properties.elasticPoolId", "type": "str"},
        "source_database_id": {"key": "properties.sourceDatabaseId", "type": "str"},
        "status": {"key": "properties.status", "type": "str"},
        "database_id": {"key": "properties.databaseId", "type": "str"},
        "creation_date": {"key": "properties.creationDate", "type": "iso-8601"},
        "current_service_objective_name": {"key": "properties.currentServiceObjectiveName", "type": "str"},
        "requested_service_objective_name": {"key": "properties.requestedServiceObjectiveName", "type": "str"},
        "default_secondary_location": {"key": "properties.defaultSecondaryLocation", "type": "str"},
        "failover_group_id": {"key": "properties.failoverGroupId", "type": "str"},
        "restore_point_in_time": {"key": "properties.restorePointInTime", "type": "iso-8601"},
        "source_database_deletion_date": {"key": "properties.sourceDatabaseDeletionDate", "type": "iso-8601"},
        "recovery_services_recovery_point_id": {"key": "properties.recoveryServicesRecoveryPointId", "type": "str"},
        "long_term_retention_backup_resource_id": {
            "key": "properties.longTermRetentionBackupResourceId",
            "type": "str",
        },
        "recoverable_database_id": {"key": "properties.recoverableDatabaseId", "type": "str"},
        "restorable_dropped_database_id": {"key": "properties.restorableDroppedDatabaseId", "type": "str"},
        "catalog_collation": {"key": "properties.catalogCollation", "type": "str"},
        "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"},
        "license_type": {"key": "properties.licenseType", "type": "str"},
        "max_log_size_bytes": {"key": "properties.maxLogSizeBytes", "type": "int"},
        "earliest_restore_date": {"key": "properties.earliestRestoreDate", "type": "iso-8601"},
        "read_scale": {"key": "properties.readScale", "type": "str"},
        "high_availability_replica_count": {"key": "properties.highAvailabilityReplicaCount", "type": "int"},
        "secondary_type": {"key": "properties.secondaryType", "type": "str"},
        "current_sku": {"key": "properties.currentSku", "type": "Sku"},
        "auto_pause_delay": {"key": "properties.autoPauseDelay", "type": "int"},
        "current_backup_storage_redundancy": {"key": "properties.currentBackupStorageRedundancy", "type": "str"},
        "requested_backup_storage_redundancy": {"key": "properties.requestedBackupStorageRedundancy", "type": "str"},
        "min_capacity": {"key": "properties.minCapacity", "type": "float"},
        "paused_date": {"key": "properties.pausedDate", "type": "iso-8601"},
        "resumed_date": {"key": "properties.resumedDate", "type": "iso-8601"},
        "maintenance_configuration_id": {"key": "properties.maintenanceConfigurationId", "type": "str"},
        "is_ledger_on": {"key": "properties.isLedgerOn", "type": "bool"},
        "is_infra_encryption_enabled": {"key": "properties.isInfraEncryptionEnabled", "type": "bool"},
        "federated_client_id": {"key": "properties.federatedClientId", "type": "str"},
        "source_resource_id": {"key": "properties.sourceResourceId", "type": "str"},
    }

    def __init__(  # pylint: disable=too-many-locals
        self,
        *,
        location: str,
        tags: Optional[Dict[str, str]] = None,
        sku: Optional["_models.Sku"] = None,
        identity: Optional["_models.DatabaseIdentity"] = None,
        create_mode: Optional[Union[str, "_models.CreateMode"]] = None,
        collation: Optional[str] = None,
        max_size_bytes: Optional[int] = None,
        sample_name: Optional[Union[str, "_models.SampleName"]] = None,
        elastic_pool_id: Optional[str] = None,
        source_database_id: Optional[str] = None,
        restore_point_in_time: Optional[datetime.datetime] = None,
        source_database_deletion_date: Optional[datetime.datetime] = None,
        recovery_services_recovery_point_id: Optional[str] = None,
        long_term_retention_backup_resource_id: Optional[str] = None,
        recoverable_database_id: Optional[str] = None,
        restorable_dropped_database_id: Optional[str] = None,
        catalog_collation: Optional[Union[str, "_models.CatalogCollationType"]] = None,
        zone_redundant: Optional[bool] = None,
        license_type: Optional[Union[str, "_models.DatabaseLicenseType"]] = None,
        read_scale: Optional[Union[str, "_models.DatabaseReadScale"]] = None,
        high_availability_replica_count: Optional[int] = None,
        secondary_type: Optional[Union[str, "_models.SecondaryType"]] = None,
        auto_pause_delay: Optional[int] = None,
        requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None,
        min_capacity: Optional[float] = None,
        maintenance_configuration_id: Optional[str] = None,
        is_ledger_on: Optional[bool] = None,
        federated_client_id: Optional[str] = None,
        source_resource_id: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword location: Resource location. Required.
        :paramtype location: str
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword sku: The database SKU.

         The list of SKUs may vary by region and support offer. To determine the SKUs (including the
         SKU name, tier/edition, family, and capacity) that are available to your subscription in an
         Azure region, use the ``Capabilities_ListByLocation`` REST API or one of the following
         commands:

         .. code-block:: azurecli

            az sql db list-editions -l <location> -o table
            `

         .. code-block:: powershell

            Get-AzSqlServerServiceObjective -Location <location>
            `.
        :paramtype sku: ~azure.mgmt.sql.models.Sku
        :keyword identity: The Azure Active Directory identity of the database.
        :paramtype identity: ~azure.mgmt.sql.models.DatabaseIdentity
        :keyword create_mode: Specifies the mode of database creation.

         Default: regular database creation.

         Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified
         as the resource ID of the source database.

         Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId
         must be specified as the resource ID of the existing primary database.

         PointInTimeRestore: Creates a database by restoring a point in time backup of an existing
         database. sourceDatabaseId must be specified as the resource ID of the existing database, and
         restorePointInTime must be specified.

         Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be
         specified as the recoverable database resource ID to restore.

         Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must
         be specified. If sourceDatabaseId is the database's original resource ID, then
         sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable
         dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may
         also be specified to restore from an earlier point in time.

         RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention
         vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource
         ID.

         Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse
         edition. Known values are: "Default", "Copy", "Secondary", "PointInTimeRestore", "Restore",
         "Recovery", "RestoreExternalBackup", "RestoreExternalBackupSecondary",
         "RestoreLongTermRetentionBackup", and "OnlineSecondary".
        :paramtype create_mode: str or ~azure.mgmt.sql.models.CreateMode
        :keyword collation: The collation of the database.
        :paramtype collation: str
        :keyword max_size_bytes: The max size of the database expressed in bytes.
        :paramtype max_size_bytes: int
        :keyword sample_name: The name of the sample schema to apply when creating this database. Known
         values are: "AdventureWorksLT", "WideWorldImportersStd", and "WideWorldImportersFull".
        :paramtype sample_name: str or ~azure.mgmt.sql.models.SampleName
        :keyword elastic_pool_id: The resource identifier of the elastic pool containing this database.
        :paramtype elastic_pool_id: str
        :keyword source_database_id: The resource identifier of the source database associated with
         create operation of this database.
        :paramtype source_database_id: str
        :keyword restore_point_in_time: Specifies the point in time (ISO8601 format) of the source
         database that will be restored to create the new database.
        :paramtype restore_point_in_time: ~datetime.datetime
        :keyword source_database_deletion_date: Specifies the time that the database was deleted.
        :paramtype source_database_deletion_date: ~datetime.datetime
        :keyword recovery_services_recovery_point_id: The resource identifier of the recovery point
         associated with create operation of this database.
        :paramtype recovery_services_recovery_point_id: str
        :keyword long_term_retention_backup_resource_id: The resource identifier of the long term
         retention backup associated with create operation of this database.
        :paramtype long_term_retention_backup_resource_id: str
        :keyword recoverable_database_id: The resource identifier of the recoverable database
         associated with create operation of this database.
        :paramtype recoverable_database_id: str
        :keyword restorable_dropped_database_id: The resource identifier of the restorable dropped
         database associated with create operation of this database.
        :paramtype restorable_dropped_database_id: str
        :keyword catalog_collation: Collation of the metadata catalog. Known values are:
         "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS".
        :paramtype catalog_collation: str or ~azure.mgmt.sql.models.CatalogCollationType
        :keyword zone_redundant: Whether or not this database is zone redundant, which means the
         replicas of this database will be spread across multiple availability zones.
        :paramtype zone_redundant: bool
        :keyword license_type: The license type to apply for this database. ``LicenseIncluded`` if you
         need a license, or ``BasePrice`` if you have a license and are eligible for the Azure Hybrid
         Benefit. Known values are: "LicenseIncluded" and "BasePrice".
        :paramtype license_type: str or ~azure.mgmt.sql.models.DatabaseLicenseType
        :keyword read_scale: The state of read-only routing. If enabled, connections that have
         application intent set to readonly in their connection string may be routed to a readonly
         secondary replica in the same region. Not applicable to a Hyperscale database within an elastic
         pool. Known values are: "Enabled" and "Disabled".
        :paramtype read_scale: str or ~azure.mgmt.sql.models.DatabaseReadScale
        :keyword high_availability_replica_count: The number of secondary replicas associated with the
         database that are used to provide high availability. Not applicable to a Hyperscale database
         within an elastic pool.
        :paramtype high_availability_replica_count: int
        :keyword secondary_type: The secondary type of the database if it is a secondary.  Valid values
         are Geo, Named and Standby. Known values are: "Geo", "Named", and "Standby".
        :paramtype secondary_type: str or ~azure.mgmt.sql.models.SecondaryType
        :keyword auto_pause_delay: Time in minutes after which database is automatically paused. A
         value of -1 means that automatic pause is disabled.
        :paramtype auto_pause_delay: int
        :keyword requested_backup_storage_redundancy: The storage account type to be used to store
         backups for this database. Known values are: "Geo", "Local", "Zone", and "GeoZone".
        :paramtype requested_backup_storage_redundancy: str or
         ~azure.mgmt.sql.models.BackupStorageRedundancy
        :keyword min_capacity: Minimal capacity that database will always have allocated, if not
         paused.
        :paramtype min_capacity: float
        :keyword maintenance_configuration_id: Maintenance configuration id assigned to the database.
         This configuration defines the period when the maintenance updates will occur.
        :paramtype maintenance_configuration_id: str
        :keyword is_ledger_on: Whether or not this database is a ledger database, which means all
         tables in the database are ledger tables. Note: the value of this property cannot be changed
         after the database has been created.
        :paramtype is_ledger_on: bool
        :keyword federated_client_id: The Client id used for cross tenant per database CMK scenario.
        :paramtype federated_client_id: str
        :keyword source_resource_id: The resource identifier of the source associated with the create
         operation of this database.

         This property is only supported for DataWarehouse edition and allows to restore across
         subscriptions.

         When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId,
         restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode
         must be PointInTimeRestore, Restore or Recover.

         When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the
         existing database or existing sql pool, and restorePointInTime must be specified.

         When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped
         database or restorable dropped sql pool.

         When createMode is Recover, sourceResourceId must be the resource ID of recoverable database
         or recoverable sql pool.

         When source subscription belongs to a different tenant than target subscription,
         “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant.
         For more details about “x-ms-authorization-auxiliary” header see
         https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant.
        :paramtype source_resource_id: str
        """
        super().__init__(location=location, tags=tags, **kwargs)
        self.sku = sku
        self.kind = None
        self.managed_by = None
        self.identity = identity
        self.create_mode = create_mode
        self.collation = collation
        self.max_size_bytes = max_size_bytes
        self.sample_name = sample_name
        self.elastic_pool_id = elastic_pool_id
        self.source_database_id = source_database_id
        self.status = None
        self.database_id = None
        self.creation_date = None
        self.current_service_objective_name = None
        self.requested_service_objective_name = None
        self.default_secondary_location = None
        self.failover_group_id = None
        self.restore_point_in_time = restore_point_in_time
        self.source_database_deletion_date = source_database_deletion_date
        self.recovery_services_recovery_point_id = recovery_services_recovery_point_id
        self.long_term_retention_backup_resource_id = long_term_retention_backup_resource_id
        self.recoverable_database_id = recoverable_database_id
        self.restorable_dropped_database_id = restorable_dropped_database_id
        self.catalog_collation = catalog_collation
        self.zone_redundant = zone_redundant
        self.license_type = license_type
        self.max_log_size_bytes = None
        self.earliest_restore_date = None
        self.read_scale = read_scale
        self.high_availability_replica_count = high_availability_replica_count
        self.secondary_type = secondary_type
        self.current_sku = None
        self.auto_pause_delay = auto_pause_delay
        self.current_backup_storage_redundancy = None
        self.requested_backup_storage_redundancy = requested_backup_storage_redundancy
        self.min_capacity = min_capacity
        self.paused_date = None
        self.resumed_date = None
        self.maintenance_configuration_id = maintenance_configuration_id
        self.is_ledger_on = is_ledger_on
        self.is_infra_encryption_enabled = None
        self.federated_client_id = federated_client_id
        self.source_resource_id = source_resource_id


class DatabaseAdvancedThreatProtection(ProxyResource):
    """A database Advanced Threat Protection.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of AdvancedThreatProtectionResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar state: Specifies the state of the Advanced Threat Protection, whether it is enabled or
     disabled or a state has not been applied yet on the specific database or server. Known values
     are: "New", "Enabled", and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState
    :ivar creation_time: Specifies the UTC creation time of the policy.
    :vartype creation_time: ~datetime.datetime
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
        "creation_time": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "state": {"key": "properties.state", "type": "str"},
        "creation_time": {"key": "properties.creationTime", "type": "iso-8601"},
    }

    def __init__(self, *, state: Optional[Union[str, "_models.AdvancedThreatProtectionState"]] = None, **kwargs):
        """
        :keyword state: Specifies the state of the Advanced Threat Protection, whether it is enabled or
         disabled or a state has not been applied yet on the specific database or server. Known values
         are: "New", "Enabled", and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.state = state
        self.creation_time = None


class DatabaseAdvancedThreatProtectionListResult(_serialization.Model):
    """A list of the database's Advanced Threat Protection configurations.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DatabaseAdvancedThreatProtection]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DatabaseAdvancedThreatProtection]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DatabaseAutomaticTuning(ProxyResource):
    """Database-level Automatic Tuning.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar desired_state: Automatic tuning desired state. Known values are: "Inherit", "Custom",
     "Auto", and "Unspecified".
    :vartype desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningMode
    :ivar actual_state: Automatic tuning actual state. Known values are: "Inherit", "Custom",
     "Auto", and "Unspecified".
    :vartype actual_state: str or ~azure.mgmt.sql.models.AutomaticTuningMode
    :ivar options: Automatic tuning options definition.
    :vartype options: dict[str, ~azure.mgmt.sql.models.AutomaticTuningOptions]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "actual_state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "desired_state": {"key": "properties.desiredState", "type": "str"},
        "actual_state": {"key": "properties.actualState", "type": "str"},
        "options": {"key": "properties.options", "type": "{AutomaticTuningOptions}"},
    }

    def __init__(
        self,
        *,
        desired_state: Optional[Union[str, "_models.AutomaticTuningMode"]] = None,
        options: Optional[Dict[str, "_models.AutomaticTuningOptions"]] = None,
        **kwargs
    ):
        """
        :keyword desired_state: Automatic tuning desired state. Known values are: "Inherit", "Custom",
         "Auto", and "Unspecified".
        :paramtype desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningMode
        :keyword options: Automatic tuning options definition.
        :paramtype options: dict[str, ~azure.mgmt.sql.models.AutomaticTuningOptions]
        """
        super().__init__(**kwargs)
        self.desired_state = desired_state
        self.actual_state = None
        self.options = options


class DatabaseBlobAuditingPolicy(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A database blob auditing policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar kind: Resource kind.
    :vartype kind: str
    :ivar retention_days: Specifies the number of days to keep in the audit logs in the storage
     account.
    :vartype retention_days: int
    :ivar audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit.

     The recommended set of action groups to use is the following combination - this will audit all
     the queries and stored procedures executed against the database, as well as successful and
     failed logins:

     BATCH_COMPLETED_GROUP,
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
     FAILED_DATABASE_AUTHENTICATION_GROUP.

     This above combination is also the set that is configured by default when enabling auditing
     from the Azure portal.

     The supported action groups to audit are (note: choose only specific groups that cover your
     auditing needs. Using unnecessary groups could lead to very large quantities of audit records):

     APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
     BACKUP_RESTORE_GROUP
     DATABASE_LOGOUT_GROUP
     DATABASE_OBJECT_CHANGE_GROUP
     DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
     DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
     DATABASE_OPERATION_GROUP
     DATABASE_PERMISSION_CHANGE_GROUP
     DATABASE_PRINCIPAL_CHANGE_GROUP
     DATABASE_PRINCIPAL_IMPERSONATION_GROUP
     DATABASE_ROLE_MEMBER_CHANGE_GROUP
     FAILED_DATABASE_AUTHENTICATION_GROUP
     SCHEMA_OBJECT_ACCESS_GROUP
     SCHEMA_OBJECT_CHANGE_GROUP
     SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
     SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
     USER_CHANGE_PASSWORD_GROUP
     BATCH_STARTED_GROUP
     BATCH_COMPLETED_GROUP
     DBCC_GROUP
     DATABASE_OWNERSHIP_CHANGE_GROUP
     DATABASE_CHANGE_GROUP
     LEDGER_OPERATION_GROUP

     These are groups that cover all sql statements and stored procedures executed against the
     database, and should not be used in combination with other groups as this will result in
     duplicate audit logs.

     For more information, see `Database-Level Audit Action Groups
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.

     For Database auditing policy, specific Actions can also be specified (note that Actions cannot
     be specified for Server auditing policy). The supported actions to audit are:
     SELECT
     UPDATE
     INSERT
     DELETE
     EXECUTE
     RECEIVE
     REFERENCES

     The general form for defining an action to be audited is:
     {action} ON {object} BY {principal}

     Note that :code:`<object>` in the above format can refer to an object like a table, view, or
     stored procedure, or an entire database or schema. For the latter cases, the forms
     DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively.

     For example:
     SELECT on dbo.myTable by public
     SELECT on DATABASE::myDatabase by public
     SELECT on SCHEMA::mySchema by public

     For more information, see `Database-Level Audit Actions
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_.
    :vartype audit_actions_and_groups: list[str]
    :ivar is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the
     storage's secondary key.
    :vartype is_storage_secondary_key_in_use: bool
    :ivar is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure
     Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.

     When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
     diagnostic logs category on the database should be also created.
     Note that for server level audit you should use the 'master' database as {databaseName}.

     Diagnostic Settings URI format:
     PUT
     https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_azure_monitor_target_enabled: bool
    :ivar queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before audit
     actions are forced to be processed.
     The default minimum value is 1000 (1 second). The maximum is 2,147,483,647.
    :vartype queue_delay_ms: int
    :ivar is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
     storage.
    :vartype is_managed_identity_in_use: bool
    :ivar state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled is required.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:


     #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
        For more information, see `Auditing to storage using Managed Identity authentication
     <https://go.microsoft.com/fwlink/?linkid=2114355>`_.
    :vartype storage_account_access_key: str
    :ivar storage_account_subscription_id: Specifies the blob storage subscription Id.
    :vartype storage_account_subscription_id: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "kind": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "kind": {"key": "kind", "type": "str"},
        "retention_days": {"key": "properties.retentionDays", "type": "int"},
        "audit_actions_and_groups": {"key": "properties.auditActionsAndGroups", "type": "[str]"},
        "is_storage_secondary_key_in_use": {"key": "properties.isStorageSecondaryKeyInUse", "type": "bool"},
        "is_azure_monitor_target_enabled": {"key": "properties.isAzureMonitorTargetEnabled", "type": "bool"},
        "queue_delay_ms": {"key": "properties.queueDelayMs", "type": "int"},
        "is_managed_identity_in_use": {"key": "properties.isManagedIdentityInUse", "type": "bool"},
        "state": {"key": "properties.state", "type": "str"},
        "storage_endpoint": {"key": "properties.storageEndpoint", "type": "str"},
        "storage_account_access_key": {"key": "properties.storageAccountAccessKey", "type": "str"},
        "storage_account_subscription_id": {"key": "properties.storageAccountSubscriptionId", "type": "str"},
    }

    def __init__(
        self,
        *,
        retention_days: Optional[int] = None,
        audit_actions_and_groups: Optional[List[str]] = None,
        is_storage_secondary_key_in_use: Optional[bool] = None,
        is_azure_monitor_target_enabled: Optional[bool] = None,
        queue_delay_ms: Optional[int] = None,
        is_managed_identity_in_use: Optional[bool] = None,
        state: Optional[Union[str, "_models.BlobAuditingPolicyState"]] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        storage_account_subscription_id: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword retention_days: Specifies the number of days to keep in the audit logs in the storage
         account.
        :paramtype retention_days: int
        :keyword audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit.

         The recommended set of action groups to use is the following combination - this will audit all
         the queries and stored procedures executed against the database, as well as successful and
         failed logins:

         BATCH_COMPLETED_GROUP,
         SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
         FAILED_DATABASE_AUTHENTICATION_GROUP.

         This above combination is also the set that is configured by default when enabling auditing
         from the Azure portal.

         The supported action groups to audit are (note: choose only specific groups that cover your
         auditing needs. Using unnecessary groups could lead to very large quantities of audit records):

         APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
         BACKUP_RESTORE_GROUP
         DATABASE_LOGOUT_GROUP
         DATABASE_OBJECT_CHANGE_GROUP
         DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
         DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
         DATABASE_OPERATION_GROUP
         DATABASE_PERMISSION_CHANGE_GROUP
         DATABASE_PRINCIPAL_CHANGE_GROUP
         DATABASE_PRINCIPAL_IMPERSONATION_GROUP
         DATABASE_ROLE_MEMBER_CHANGE_GROUP
         FAILED_DATABASE_AUTHENTICATION_GROUP
         SCHEMA_OBJECT_ACCESS_GROUP
         SCHEMA_OBJECT_CHANGE_GROUP
         SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
         SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
         SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
         USER_CHANGE_PASSWORD_GROUP
         BATCH_STARTED_GROUP
         BATCH_COMPLETED_GROUP
         DBCC_GROUP
         DATABASE_OWNERSHIP_CHANGE_GROUP
         DATABASE_CHANGE_GROUP
         LEDGER_OPERATION_GROUP

         These are groups that cover all sql statements and stored procedures executed against the
         database, and should not be used in combination with other groups as this will result in
         duplicate audit logs.

         For more information, see `Database-Level Audit Action Groups
         <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.

         For Database auditing policy, specific Actions can also be specified (note that Actions cannot
         be specified for Server auditing policy). The supported actions to audit are:
         SELECT
         UPDATE
         INSERT
         DELETE
         EXECUTE
         RECEIVE
         REFERENCES

         The general form for defining an action to be audited is:
         {action} ON {object} BY {principal}

         Note that :code:`<object>` in the above format can refer to an object like a table, view, or
         stored procedure, or an entire database or schema. For the latter cases, the forms
         DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively.

         For example:
         SELECT on dbo.myTable by public
         SELECT on DATABASE::myDatabase by public
         SELECT on SCHEMA::mySchema by public

         For more information, see `Database-Level Audit Actions
         <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_.
        :paramtype audit_actions_and_groups: list[str]
        :keyword is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is
         the storage's secondary key.
        :paramtype is_storage_secondary_key_in_use: bool
        :keyword is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure
         Monitor.
         In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
         'IsAzureMonitorTargetEnabled' as true.

         When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
         diagnostic logs category on the database should be also created.
         Note that for server level audit you should use the 'master' database as {databaseName}.

         Diagnostic Settings URI format:
         PUT
         https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

         For more information, see `Diagnostic Settings REST API
         <https://go.microsoft.com/fwlink/?linkid=2033207>`_
         or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
        :paramtype is_azure_monitor_target_enabled: bool
        :keyword queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before
         audit actions are forced to be processed.
         The default minimum value is 1000 (1 second). The maximum is 2,147,483,647.
        :paramtype queue_delay_ms: int
        :keyword is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
         storage.
        :paramtype is_managed_identity_in_use: bool
        :keyword state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
         isAzureMonitorTargetEnabled are required. Known values are: "Enabled" and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
        :keyword storage_endpoint: Specifies the blob storage endpoint (e.g.
         https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or
         isAzureMonitorTargetEnabled is required.
        :paramtype storage_endpoint: str
        :keyword storage_account_access_key: Specifies the identifier key of the auditing storage
         account.
         If state is Enabled and storageEndpoint is specified, not specifying the
         storageAccountAccessKey will use SQL server system-assigned managed identity to access the
         storage.
         Prerequisites for using managed identity authentication:


         #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
         #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
         Contributor' RBAC role to the server identity.
            For more information, see `Auditing to storage using Managed Identity authentication
         <https://go.microsoft.com/fwlink/?linkid=2114355>`_.
        :paramtype storage_account_access_key: str
        :keyword storage_account_subscription_id: Specifies the blob storage subscription Id.
        :paramtype storage_account_subscription_id: str
        """
        super().__init__(**kwargs)
        self.kind = None
        self.retention_days = retention_days
        self.audit_actions_and_groups = audit_actions_and_groups
        self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use
        self.is_azure_monitor_target_enabled = is_azure_monitor_target_enabled
        self.queue_delay_ms = queue_delay_ms
        self.is_managed_identity_in_use = is_managed_identity_in_use
        self.state = state
        self.storage_endpoint = storage_endpoint
        self.storage_account_access_key = storage_account_access_key
        self.storage_account_subscription_id = storage_account_subscription_id


class DatabaseBlobAuditingPolicyListResult(_serialization.Model):
    """A list of database auditing settings.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DatabaseBlobAuditingPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DatabaseBlobAuditingPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DatabaseColumn(ProxyResource):
    """A database column resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar column_type: The column data type. Known values are: "image", "text", "uniqueidentifier",
     "date", "time", "datetime2", "datetimeoffset", "tinyint", "smallint", "int", "smalldatetime",
     "real", "money", "datetime", "float", "sql_variant", "ntext", "bit", "decimal", "numeric",
     "smallmoney", "bigint", "hierarchyid", "geometry", "geography", "varbinary", "varchar",
     "binary", "char", "timestamp", "nvarchar", "nchar", "xml", and "sysname".
    :vartype column_type: str or ~azure.mgmt.sql.models.ColumnDataType
    :ivar temporal_type: The table temporal type. Known values are: "NonTemporalTable",
     "HistoryTable", and "SystemVersionedTemporalTable".
    :vartype temporal_type: str or ~azure.mgmt.sql.models.TableTemporalType
    :ivar memory_optimized: Whether or not the column belongs to a memory optimized table.
    :vartype memory_optimized: bool
    :ivar is_computed: Whether or not the column is computed.
    :vartype is_computed: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "column_type": {"key": "properties.columnType", "type": "str"},
        "temporal_type": {"key": "properties.temporalType", "type": "str"},
        "memory_optimized": {"key": "properties.memoryOptimized", "type": "bool"},
        "is_computed": {"key": "properties.isComputed", "type": "bool"},
    }

    def __init__(
        self,
        *,
        column_type: Optional[Union[str, "_models.ColumnDataType"]] = None,
        temporal_type: Optional[Union[str, "_models.TableTemporalType"]] = None,
        memory_optimized: Optional[bool] = None,
        is_computed: Optional[bool] = None,
        **kwargs
    ):
        """
        :keyword column_type: The column data type. Known values are: "image", "text",
         "uniqueidentifier", "date", "time", "datetime2", "datetimeoffset", "tinyint", "smallint",
         "int", "smalldatetime", "real", "money", "datetime", "float", "sql_variant", "ntext", "bit",
         "decimal", "numeric", "smallmoney", "bigint", "hierarchyid", "geometry", "geography",
         "varbinary", "varchar", "binary", "char", "timestamp", "nvarchar", "nchar", "xml", and
         "sysname".
        :paramtype column_type: str or ~azure.mgmt.sql.models.ColumnDataType
        :keyword temporal_type: The table temporal type. Known values are: "NonTemporalTable",
         "HistoryTable", and "SystemVersionedTemporalTable".
        :paramtype temporal_type: str or ~azure.mgmt.sql.models.TableTemporalType
        :keyword memory_optimized: Whether or not the column belongs to a memory optimized table.
        :paramtype memory_optimized: bool
        :keyword is_computed: Whether or not the column is computed.
        :paramtype is_computed: bool
        """
        super().__init__(**kwargs)
        self.column_type = column_type
        self.temporal_type = temporal_type
        self.memory_optimized = memory_optimized
        self.is_computed = is_computed


class DatabaseColumnListResult(_serialization.Model):
    """A list of database columns.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DatabaseColumn]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DatabaseColumn]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DatabaseExtensions(ProxyResource):
    """An export managed database operation result resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar operation_mode: Operation Mode. "PolybaseImport"
    :vartype operation_mode: str or ~azure.mgmt.sql.models.OperationMode
    :ivar storage_key_type: Storage key type. Known values are: "SharedAccessKey" and
     "StorageAccessKey".
    :vartype storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType
    :ivar storage_key: Storage key.
    :vartype storage_key: str
    :ivar storage_uri: Storage Uri.
    :vartype storage_uri: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "operation_mode": {"key": "properties.operationMode", "type": "str"},
        "storage_key_type": {"key": "properties.storageKeyType", "type": "str"},
        "storage_key": {"key": "properties.storageKey", "type": "str"},
        "storage_uri": {"key": "properties.storageUri", "type": "str"},
    }

    def __init__(
        self,
        *,
        operation_mode: Optional[Union[str, "_models.OperationMode"]] = None,
        storage_key_type: Optional[Union[str, "_models.StorageKeyType"]] = None,
        storage_key: Optional[str] = None,
        storage_uri: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword operation_mode: Operation Mode. "PolybaseImport"
        :paramtype operation_mode: str or ~azure.mgmt.sql.models.OperationMode
        :keyword storage_key_type: Storage key type. Known values are: "SharedAccessKey" and
         "StorageAccessKey".
        :paramtype storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType
        :keyword storage_key: Storage key.
        :paramtype storage_key: str
        :keyword storage_uri: Storage Uri.
        :paramtype storage_uri: str
        """
        super().__init__(**kwargs)
        self.operation_mode = operation_mode
        self.storage_key_type = storage_key_type
        self.storage_key = storage_key
        self.storage_uri = storage_uri


class DatabaseIdentity(_serialization.Model):
    """Azure Active Directory identity configuration for a resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar type: The identity type. Known values are: "None" and "UserAssigned".
    :vartype type: str or ~azure.mgmt.sql.models.DatabaseIdentityType
    :ivar tenant_id: The Azure Active Directory tenant id.
    :vartype tenant_id: str
    :ivar user_assigned_identities: The resource ids of the user assigned identities to use.
    :vartype user_assigned_identities: dict[str, ~azure.mgmt.sql.models.DatabaseUserIdentity]
    """

    _validation = {
        "tenant_id": {"readonly": True},
    }

    _attribute_map = {
        "type": {"key": "type", "type": "str"},
        "tenant_id": {"key": "tenantId", "type": "str"},
        "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{DatabaseUserIdentity}"},
    }

    def __init__(
        self,
        *,
        type: Optional[Union[str, "_models.DatabaseIdentityType"]] = None,
        user_assigned_identities: Optional[Dict[str, "_models.DatabaseUserIdentity"]] = None,
        **kwargs
    ):
        """
        :keyword type: The identity type. Known values are: "None" and "UserAssigned".
        :paramtype type: str or ~azure.mgmt.sql.models.DatabaseIdentityType
        :keyword user_assigned_identities: The resource ids of the user assigned identities to use.
        :paramtype user_assigned_identities: dict[str, ~azure.mgmt.sql.models.DatabaseUserIdentity]
        """
        super().__init__(**kwargs)
        self.type = type
        self.tenant_id = None
        self.user_assigned_identities = user_assigned_identities


class DatabaseListResult(_serialization.Model):
    """A list of databases.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.Database]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[Database]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DatabaseOperation(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A database operation.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar database_name: The name of the database the operation is being performed on.
    :vartype database_name: str
    :ivar operation: The name of operation.
    :vartype operation: str
    :ivar operation_friendly_name: The friendly name of operation.
    :vartype operation_friendly_name: str
    :ivar percent_complete: The percentage of the operation completed.
    :vartype percent_complete: int
    :ivar server_name: The name of the server.
    :vartype server_name: str
    :ivar start_time: The operation start time.
    :vartype start_time: ~datetime.datetime
    :ivar state: The operation state. Known values are: "Pending", "InProgress", "Succeeded",
     "Failed", "CancelInProgress", and "Cancelled".
    :vartype state: str or ~azure.mgmt.sql.models.ManagementOperationState
    :ivar error_code: The operation error code.
    :vartype error_code: int
    :ivar error_description: The operation error description.
    :vartype error_description: str
    :ivar error_severity: The operation error severity.
    :vartype error_severity: int
    :ivar is_user_error: Whether or not the error is a user error.
    :vartype is_user_error: bool
    :ivar estimated_completion_time: The estimated completion time of the operation.
    :vartype estimated_completion_time: ~datetime.datetime
    :ivar description: The operation description.
    :vartype description: str
    :ivar is_cancellable: Whether the operation can be cancelled.
    :vartype is_cancellable: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "database_name": {"readonly": True},
        "operation": {"readonly": True},
        "operation_friendly_name": {"readonly": True},
        "percent_complete": {"readonly": True},
        "server_name": {"readonly": True},
        "start_time": {"readonly": True},
        "state": {"readonly": True},
        "error_code": {"readonly": True},
        "error_description": {"readonly": True},
        "error_severity": {"readonly": True},
        "is_user_error": {"readonly": True},
        "estimated_completion_time": {"readonly": True},
        "description": {"readonly": True},
        "is_cancellable": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "database_name": {"key": "properties.databaseName", "type": "str"},
        "operation": {"key": "properties.operation", "type": "str"},
        "operation_friendly_name": {"key": "properties.operationFriendlyName", "type": "str"},
        "percent_complete": {"key": "properties.percentComplete", "type": "int"},
        "server_name": {"key": "properties.serverName", "type": "str"},
        "start_time": {"key": "properties.startTime", "type": "iso-8601"},
        "state": {"key": "properties.state", "type": "str"},
        "error_code": {"key": "properties.errorCode", "type": "int"},
        "error_description": {"key": "properties.errorDescription", "type": "str"},
        "error_severity": {"key": "properties.errorSeverity", "type": "int"},
        "is_user_error": {"key": "properties.isUserError", "type": "bool"},
        "estimated_completion_time": {"key": "properties.estimatedCompletionTime", "type": "iso-8601"},
        "description": {"key": "properties.description", "type": "str"},
        "is_cancellable": {"key": "properties.isCancellable", "type": "bool"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.database_name = None
        self.operation = None
        self.operation_friendly_name = None
        self.percent_complete = None
        self.server_name = None
        self.start_time = None
        self.state = None
        self.error_code = None
        self.error_description = None
        self.error_severity = None
        self.is_user_error = None
        self.estimated_completion_time = None
        self.description = None
        self.is_cancellable = None


class DatabaseOperationListResult(_serialization.Model):
    """The response to a list database operations request.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DatabaseOperation]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DatabaseOperation]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DatabaseSchema(ProxyResource):
    """A database schema resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)


class DatabaseSchemaListResult(_serialization.Model):
    """A list of database schemas.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DatabaseSchema]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DatabaseSchema]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DatabaseSecurityAlertListResult(_serialization.Model):
    """A list of the database's security alert policies.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DatabaseSecurityAlertPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DatabaseSecurityAlertPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DatabaseSecurityAlertPolicy(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A database security alert policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of SecurityAlertPolicyResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar state: Specifies the state of the policy, whether it is enabled or disabled or a policy
     has not been applied yet on the specific database. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.SecurityAlertsPolicyState
    :ivar disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are:
     Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action,
     Brute_Force.
    :vartype disabled_alerts: list[str]
    :ivar email_addresses: Specifies an array of e-mail addresses to which the alert is sent.
    :vartype email_addresses: list[str]
    :ivar email_account_admins: Specifies that the alert is sent to the account administrators.
    :vartype email_account_admins: bool
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection
     audit logs.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the Threat Detection audit
     storage account.
    :vartype storage_account_access_key: str
    :ivar retention_days: Specifies the number of days to keep in the Threat Detection audit logs.
    :vartype retention_days: int
    :ivar creation_time: Specifies the UTC creation time of the policy.
    :vartype creation_time: ~datetime.datetime
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
        "creation_time": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "state": {"key": "properties.state", "type": "str"},
        "disabled_alerts": {"key": "properties.disabledAlerts", "type": "[str]"},
        "email_addresses": {"key": "properties.emailAddresses", "type": "[str]"},
        "email_account_admins": {"key": "properties.emailAccountAdmins", "type": "bool"},
        "storage_endpoint": {"key": "properties.storageEndpoint", "type": "str"},
        "storage_account_access_key": {"key": "properties.storageAccountAccessKey", "type": "str"},
        "retention_days": {"key": "properties.retentionDays", "type": "int"},
        "creation_time": {"key": "properties.creationTime", "type": "iso-8601"},
    }

    def __init__(
        self,
        *,
        state: Optional[Union[str, "_models.SecurityAlertsPolicyState"]] = None,
        disabled_alerts: Optional[List[str]] = None,
        email_addresses: Optional[List[str]] = None,
        email_account_admins: Optional[bool] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        retention_days: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword state: Specifies the state of the policy, whether it is enabled or disabled or a
         policy has not been applied yet on the specific database. Known values are: "Enabled" and
         "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.SecurityAlertsPolicyState
        :keyword disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are:
         Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action,
         Brute_Force.
        :paramtype disabled_alerts: list[str]
        :keyword email_addresses: Specifies an array of e-mail addresses to which the alert is sent.
        :paramtype email_addresses: list[str]
        :keyword email_account_admins: Specifies that the alert is sent to the account administrators.
        :paramtype email_account_admins: bool
        :keyword storage_endpoint: Specifies the blob storage endpoint (e.g.
         https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection
         audit logs.
        :paramtype storage_endpoint: str
        :keyword storage_account_access_key: Specifies the identifier key of the Threat Detection audit
         storage account.
        :paramtype storage_account_access_key: str
        :keyword retention_days: Specifies the number of days to keep in the Threat Detection audit
         logs.
        :paramtype retention_days: int
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.state = state
        self.disabled_alerts = disabled_alerts
        self.email_addresses = email_addresses
        self.email_account_admins = email_account_admins
        self.storage_endpoint = storage_endpoint
        self.storage_account_access_key = storage_account_access_key
        self.retention_days = retention_days
        self.creation_time = None


class DatabaseSqlVulnerabilityAssessmentBaselineSet(ProxyResource):
    """A database sql vulnerability assessment baseline set.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of DatabaseSqlVulnerabilityAssessmentBaselineSetResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar results: The baseline set result.
    :vartype results: dict[str, list[list[str]]]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "results": {"key": "properties.results", "type": "{[[str]]}"},
    }

    def __init__(self, *, results: Optional[Dict[str, List[List[str]]]] = None, **kwargs):
        """
        :keyword results: The baseline set result.
        :paramtype results: dict[str, list[list[str]]]
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.results = results


class DatabaseSqlVulnerabilityAssessmentBaselineSetListResult(_serialization.Model):
    """A list of SQL Vulnerability Assessments baseline set.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentBaselineSet]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DatabaseSqlVulnerabilityAssessmentBaselineSet]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DatabaseSqlVulnerabilityAssessmentRuleBaseline(ProxyResource):
    """A database sql vulnerability assessment rule baseline.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of DatabaseSqlVulnerabilityAssessmentRuleBaselineResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar results: The rule baseline result.
    :vartype results: list[list[str]]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "results": {"key": "properties.results", "type": "[[str]]"},
    }

    def __init__(self, *, results: Optional[List[List[str]]] = None, **kwargs):
        """
        :keyword results: The rule baseline result.
        :paramtype results: list[list[str]]
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.results = results


class DatabaseSqlVulnerabilityAssessmentRuleBaselineInput(ProxyResource):
    """A database sql vulnerability assessment rule baseline input.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of DatabaseSqlVulnerabilityAssessmentRuleBaselineInputResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar latest_scan: The latest scan flag.
    :vartype latest_scan: bool
    :ivar results: The rule baseline result.
    :vartype results: list[list[str]]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "latest_scan": {"key": "properties.latestScan", "type": "bool"},
        "results": {"key": "properties.results", "type": "[[str]]"},
    }

    def __init__(self, *, latest_scan: Optional[bool] = None, results: Optional[List[List[str]]] = None, **kwargs):
        """
        :keyword latest_scan: The latest scan flag.
        :paramtype latest_scan: bool
        :keyword results: The rule baseline result.
        :paramtype results: list[list[str]]
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.latest_scan = latest_scan
        self.results = results


class DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput(ProxyResource):
    """A database sql vulnerability assessment rule baseline list input.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of
     DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar latest_scan: The latest scan flag.
    :vartype latest_scan: bool
    :ivar results: The rule baseline result list.
    :vartype results: dict[str, list[list[str]]]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "latest_scan": {"key": "properties.latestScan", "type": "bool"},
        "results": {"key": "properties.results", "type": "{[[str]]}"},
    }

    def __init__(
        self, *, latest_scan: Optional[bool] = None, results: Optional[Dict[str, List[List[str]]]] = None, **kwargs
    ):
        """
        :keyword latest_scan: The latest scan flag.
        :paramtype latest_scan: bool
        :keyword results: The rule baseline result list.
        :paramtype results: dict[str, list[list[str]]]
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.latest_scan = latest_scan
        self.results = results


class DatabaseSqlVulnerabilityAssessmentRuleBaselineListResult(_serialization.Model):
    """A list of SQL Vulnerability Assessments rule baseline.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentRuleBaseline]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DatabaseSqlVulnerabilityAssessmentRuleBaseline]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DatabaseTable(ProxyResource):
    """A database table resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar temporal_type: The table temporal type. Known values are: "NonTemporalTable",
     "HistoryTable", and "SystemVersionedTemporalTable".
    :vartype temporal_type: str or ~azure.mgmt.sql.models.TableTemporalType
    :ivar memory_optimized: Whether or not the table is memory optimized.
    :vartype memory_optimized: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "temporal_type": {"key": "properties.temporalType", "type": "str"},
        "memory_optimized": {"key": "properties.memoryOptimized", "type": "bool"},
    }

    def __init__(
        self,
        *,
        temporal_type: Optional[Union[str, "_models.TableTemporalType"]] = None,
        memory_optimized: Optional[bool] = None,
        **kwargs
    ):
        """
        :keyword temporal_type: The table temporal type. Known values are: "NonTemporalTable",
         "HistoryTable", and "SystemVersionedTemporalTable".
        :paramtype temporal_type: str or ~azure.mgmt.sql.models.TableTemporalType
        :keyword memory_optimized: Whether or not the table is memory optimized.
        :paramtype memory_optimized: bool
        """
        super().__init__(**kwargs)
        self.temporal_type = temporal_type
        self.memory_optimized = memory_optimized


class DatabaseTableListResult(_serialization.Model):
    """A list of database tables.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DatabaseTable]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DatabaseTable]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DatabaseUpdate(_serialization.Model):  # pylint: disable=too-many-instance-attributes
    """A database update resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar sku: The name and tier of the SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar identity: Database identity.
    :vartype identity: ~azure.mgmt.sql.models.DatabaseIdentity
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar create_mode: Specifies the mode of database creation.

     Default: regular database creation.

     Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified
     as the resource ID of the source database.

     Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId
     must be specified as the resource ID of the existing primary database.

     PointInTimeRestore: Creates a database by restoring a point in time backup of an existing
     database. sourceDatabaseId must be specified as the resource ID of the existing database, and
     restorePointInTime must be specified.

     Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be
     specified as the recoverable database resource ID to restore.

     Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must
     be specified. If sourceDatabaseId is the database's original resource ID, then
     sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable
     dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may
     also be specified to restore from an earlier point in time.

     RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention
     vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource
     ID.

     Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse
     edition. Known values are: "Default", "Copy", "Secondary", "PointInTimeRestore", "Restore",
     "Recovery", "RestoreExternalBackup", "RestoreExternalBackupSecondary",
     "RestoreLongTermRetentionBackup", and "OnlineSecondary".
    :vartype create_mode: str or ~azure.mgmt.sql.models.CreateMode
    :ivar collation: The collation of the database.
    :vartype collation: str
    :ivar max_size_bytes: The max size of the database expressed in bytes.
    :vartype max_size_bytes: int
    :ivar sample_name: The name of the sample schema to apply when creating this database. Known
     values are: "AdventureWorksLT", "WideWorldImportersStd", and "WideWorldImportersFull".
    :vartype sample_name: str or ~azure.mgmt.sql.models.SampleName
    :ivar elastic_pool_id: The resource identifier of the elastic pool containing this database.
    :vartype elastic_pool_id: str
    :ivar source_database_id: The resource identifier of the source database associated with create
     operation of this database.
    :vartype source_database_id: str
    :ivar status: The status of the database. Known values are: "Online", "Restoring",
     "RecoveryPending", "Recovering", "Suspect", "Offline", "Standby", "Shutdown", "EmergencyMode",
     "AutoClosed", "Copying", "Creating", "Inaccessible", "OfflineSecondary", "Pausing", "Paused",
     "Resuming", "Scaling", "OfflineChangingDwPerformanceTiers", "OnlineChangingDwPerformanceTiers",
     "Disabled", "Stopping", "Stopped", and "Starting".
    :vartype status: str or ~azure.mgmt.sql.models.DatabaseStatus
    :ivar database_id: The ID of the database.
    :vartype database_id: str
    :ivar creation_date: The creation date of the database (ISO8601 format).
    :vartype creation_date: ~datetime.datetime
    :ivar current_service_objective_name: The current service level objective name of the database.
    :vartype current_service_objective_name: str
    :ivar requested_service_objective_name: The requested service level objective name of the
     database.
    :vartype requested_service_objective_name: str
    :ivar default_secondary_location: The default secondary region for this database.
    :vartype default_secondary_location: str
    :ivar failover_group_id: Failover Group resource identifier that this database belongs to.
    :vartype failover_group_id: str
    :ivar restore_point_in_time: Specifies the point in time (ISO8601 format) of the source
     database that will be restored to create the new database.
    :vartype restore_point_in_time: ~datetime.datetime
    :ivar source_database_deletion_date: Specifies the time that the database was deleted.
    :vartype source_database_deletion_date: ~datetime.datetime
    :ivar recovery_services_recovery_point_id: The resource identifier of the recovery point
     associated with create operation of this database.
    :vartype recovery_services_recovery_point_id: str
    :ivar long_term_retention_backup_resource_id: The resource identifier of the long term
     retention backup associated with create operation of this database.
    :vartype long_term_retention_backup_resource_id: str
    :ivar recoverable_database_id: The resource identifier of the recoverable database associated
     with create operation of this database.
    :vartype recoverable_database_id: str
    :ivar restorable_dropped_database_id: The resource identifier of the restorable dropped
     database associated with create operation of this database.
    :vartype restorable_dropped_database_id: str
    :ivar catalog_collation: Collation of the metadata catalog. Known values are:
     "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS".
    :vartype catalog_collation: str or ~azure.mgmt.sql.models.CatalogCollationType
    :ivar zone_redundant: Whether or not this database is zone redundant, which means the replicas
     of this database will be spread across multiple availability zones.
    :vartype zone_redundant: bool
    :ivar license_type: The license type to apply for this database. ``LicenseIncluded`` if you
     need a license, or ``BasePrice`` if you have a license and are eligible for the Azure Hybrid
     Benefit. Known values are: "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.DatabaseLicenseType
    :ivar max_log_size_bytes: The max log size for this database.
    :vartype max_log_size_bytes: int
    :ivar earliest_restore_date: This records the earliest start date and time that restore is
     available for this database (ISO8601 format).
    :vartype earliest_restore_date: ~datetime.datetime
    :ivar read_scale: The state of read-only routing. If enabled, connections that have application
     intent set to readonly in their connection string may be routed to a readonly secondary replica
     in the same region. Not applicable to a Hyperscale database within an elastic pool. Known
     values are: "Enabled" and "Disabled".
    :vartype read_scale: str or ~azure.mgmt.sql.models.DatabaseReadScale
    :ivar high_availability_replica_count: The number of secondary replicas associated with the
     database that are used to provide high availability. Not applicable to a Hyperscale database
     within an elastic pool.
    :vartype high_availability_replica_count: int
    :ivar secondary_type: The secondary type of the database if it is a secondary.  Valid values
     are Geo, Named and Standby. Known values are: "Geo", "Named", and "Standby".
    :vartype secondary_type: str or ~azure.mgmt.sql.models.SecondaryType
    :ivar current_sku: The name and tier of the SKU.
    :vartype current_sku: ~azure.mgmt.sql.models.Sku
    :ivar auto_pause_delay: Time in minutes after which database is automatically paused. A value
     of -1 means that automatic pause is disabled.
    :vartype auto_pause_delay: int
    :ivar current_backup_storage_redundancy: The storage account type used to store backups for
     this database. Known values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype current_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar requested_backup_storage_redundancy: The storage account type to be used to store backups
     for this database. Known values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype requested_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar min_capacity: Minimal capacity that database will always have allocated, if not paused.
    :vartype min_capacity: float
    :ivar paused_date: The date when database was paused by user configuration or action(ISO8601
     format). Null if the database is ready.
    :vartype paused_date: ~datetime.datetime
    :ivar resumed_date: The date when database was resumed by user action or database login
     (ISO8601 format). Null if the database is paused.
    :vartype resumed_date: ~datetime.datetime
    :ivar maintenance_configuration_id: Maintenance configuration id assigned to the database. This
     configuration defines the period when the maintenance updates will occur.
    :vartype maintenance_configuration_id: str
    :ivar is_ledger_on: Whether or not this database is a ledger database, which means all tables
     in the database are ledger tables. Note: the value of this property cannot be changed after the
     database has been created.
    :vartype is_ledger_on: bool
    :ivar is_infra_encryption_enabled: Infra encryption is enabled for this database.
    :vartype is_infra_encryption_enabled: bool
    :ivar federated_client_id: The Client id used for cross tenant per database CMK scenario.
    :vartype federated_client_id: str
    """

    _validation = {
        "status": {"readonly": True},
        "database_id": {"readonly": True},
        "creation_date": {"readonly": True},
        "current_service_objective_name": {"readonly": True},
        "requested_service_objective_name": {"readonly": True},
        "default_secondary_location": {"readonly": True},
        "failover_group_id": {"readonly": True},
        "max_log_size_bytes": {"readonly": True},
        "earliest_restore_date": {"readonly": True},
        "current_sku": {"readonly": True},
        "current_backup_storage_redundancy": {"readonly": True},
        "paused_date": {"readonly": True},
        "resumed_date": {"readonly": True},
        "is_infra_encryption_enabled": {"readonly": True},
    }

    _attribute_map = {
        "sku": {"key": "sku", "type": "Sku"},
        "identity": {"key": "identity", "type": "DatabaseIdentity"},
        "tags": {"key": "tags", "type": "{str}"},
        "create_mode": {"key": "properties.createMode", "type": "str"},
        "collation": {"key": "properties.collation", "type": "str"},
        "max_size_bytes": {"key": "properties.maxSizeBytes", "type": "int"},
        "sample_name": {"key": "properties.sampleName", "type": "str"},
        "elastic_pool_id": {"key": "properties.elasticPoolId", "type": "str"},
        "source_database_id": {"key": "properties.sourceDatabaseId", "type": "str"},
        "status": {"key": "properties.status", "type": "str"},
        "database_id": {"key": "properties.databaseId", "type": "str"},
        "creation_date": {"key": "properties.creationDate", "type": "iso-8601"},
        "current_service_objective_name": {"key": "properties.currentServiceObjectiveName", "type": "str"},
        "requested_service_objective_name": {"key": "properties.requestedServiceObjectiveName", "type": "str"},
        "default_secondary_location": {"key": "properties.defaultSecondaryLocation", "type": "str"},
        "failover_group_id": {"key": "properties.failoverGroupId", "type": "str"},
        "restore_point_in_time": {"key": "properties.restorePointInTime", "type": "iso-8601"},
        "source_database_deletion_date": {"key": "properties.sourceDatabaseDeletionDate", "type": "iso-8601"},
        "recovery_services_recovery_point_id": {"key": "properties.recoveryServicesRecoveryPointId", "type": "str"},
        "long_term_retention_backup_resource_id": {
            "key": "properties.longTermRetentionBackupResourceId",
            "type": "str",
        },
        "recoverable_database_id": {"key": "properties.recoverableDatabaseId", "type": "str"},
        "restorable_dropped_database_id": {"key": "properties.restorableDroppedDatabaseId", "type": "str"},
        "catalog_collation": {"key": "properties.catalogCollation", "type": "str"},
        "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"},
        "license_type": {"key": "properties.licenseType", "type": "str"},
        "max_log_size_bytes": {"key": "properties.maxLogSizeBytes", "type": "int"},
        "earliest_restore_date": {"key": "properties.earliestRestoreDate", "type": "iso-8601"},
        "read_scale": {"key": "properties.readScale", "type": "str"},
        "high_availability_replica_count": {"key": "properties.highAvailabilityReplicaCount", "type": "int"},
        "secondary_type": {"key": "properties.secondaryType", "type": "str"},
        "current_sku": {"key": "properties.currentSku", "type": "Sku"},
        "auto_pause_delay": {"key": "properties.autoPauseDelay", "type": "int"},
        "current_backup_storage_redundancy": {"key": "properties.currentBackupStorageRedundancy", "type": "str"},
        "requested_backup_storage_redundancy": {"key": "properties.requestedBackupStorageRedundancy", "type": "str"},
        "min_capacity": {"key": "properties.minCapacity", "type": "float"},
        "paused_date": {"key": "properties.pausedDate", "type": "iso-8601"},
        "resumed_date": {"key": "properties.resumedDate", "type": "iso-8601"},
        "maintenance_configuration_id": {"key": "properties.maintenanceConfigurationId", "type": "str"},
        "is_ledger_on": {"key": "properties.isLedgerOn", "type": "bool"},
        "is_infra_encryption_enabled": {"key": "properties.isInfraEncryptionEnabled", "type": "bool"},
        "federated_client_id": {"key": "properties.federatedClientId", "type": "str"},
    }

    def __init__(  # pylint: disable=too-many-locals
        self,
        *,
        sku: Optional["_models.Sku"] = None,
        identity: Optional["_models.DatabaseIdentity"] = None,
        tags: Optional[Dict[str, str]] = None,
        create_mode: Optional[Union[str, "_models.CreateMode"]] = None,
        collation: Optional[str] = None,
        max_size_bytes: Optional[int] = None,
        sample_name: Optional[Union[str, "_models.SampleName"]] = None,
        elastic_pool_id: Optional[str] = None,
        source_database_id: Optional[str] = None,
        restore_point_in_time: Optional[datetime.datetime] = None,
        source_database_deletion_date: Optional[datetime.datetime] = None,
        recovery_services_recovery_point_id: Optional[str] = None,
        long_term_retention_backup_resource_id: Optional[str] = None,
        recoverable_database_id: Optional[str] = None,
        restorable_dropped_database_id: Optional[str] = None,
        catalog_collation: Optional[Union[str, "_models.CatalogCollationType"]] = None,
        zone_redundant: Optional[bool] = None,
        license_type: Optional[Union[str, "_models.DatabaseLicenseType"]] = None,
        read_scale: Optional[Union[str, "_models.DatabaseReadScale"]] = None,
        high_availability_replica_count: Optional[int] = None,
        secondary_type: Optional[Union[str, "_models.SecondaryType"]] = None,
        auto_pause_delay: Optional[int] = None,
        requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None,
        min_capacity: Optional[float] = None,
        maintenance_configuration_id: Optional[str] = None,
        is_ledger_on: Optional[bool] = None,
        federated_client_id: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword sku: The name and tier of the SKU.
        :paramtype sku: ~azure.mgmt.sql.models.Sku
        :keyword identity: Database identity.
        :paramtype identity: ~azure.mgmt.sql.models.DatabaseIdentity
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword create_mode: Specifies the mode of database creation.

         Default: regular database creation.

         Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified
         as the resource ID of the source database.

         Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId
         must be specified as the resource ID of the existing primary database.

         PointInTimeRestore: Creates a database by restoring a point in time backup of an existing
         database. sourceDatabaseId must be specified as the resource ID of the existing database, and
         restorePointInTime must be specified.

         Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be
         specified as the recoverable database resource ID to restore.

         Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must
         be specified. If sourceDatabaseId is the database's original resource ID, then
         sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable
         dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may
         also be specified to restore from an earlier point in time.

         RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention
         vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource
         ID.

         Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse
         edition. Known values are: "Default", "Copy", "Secondary", "PointInTimeRestore", "Restore",
         "Recovery", "RestoreExternalBackup", "RestoreExternalBackupSecondary",
         "RestoreLongTermRetentionBackup", and "OnlineSecondary".
        :paramtype create_mode: str or ~azure.mgmt.sql.models.CreateMode
        :keyword collation: The collation of the database.
        :paramtype collation: str
        :keyword max_size_bytes: The max size of the database expressed in bytes.
        :paramtype max_size_bytes: int
        :keyword sample_name: The name of the sample schema to apply when creating this database. Known
         values are: "AdventureWorksLT", "WideWorldImportersStd", and "WideWorldImportersFull".
        :paramtype sample_name: str or ~azure.mgmt.sql.models.SampleName
        :keyword elastic_pool_id: The resource identifier of the elastic pool containing this database.
        :paramtype elastic_pool_id: str
        :keyword source_database_id: The resource identifier of the source database associated with
         create operation of this database.
        :paramtype source_database_id: str
        :keyword restore_point_in_time: Specifies the point in time (ISO8601 format) of the source
         database that will be restored to create the new database.
        :paramtype restore_point_in_time: ~datetime.datetime
        :keyword source_database_deletion_date: Specifies the time that the database was deleted.
        :paramtype source_database_deletion_date: ~datetime.datetime
        :keyword recovery_services_recovery_point_id: The resource identifier of the recovery point
         associated with create operation of this database.
        :paramtype recovery_services_recovery_point_id: str
        :keyword long_term_retention_backup_resource_id: The resource identifier of the long term
         retention backup associated with create operation of this database.
        :paramtype long_term_retention_backup_resource_id: str
        :keyword recoverable_database_id: The resource identifier of the recoverable database
         associated with create operation of this database.
        :paramtype recoverable_database_id: str
        :keyword restorable_dropped_database_id: The resource identifier of the restorable dropped
         database associated with create operation of this database.
        :paramtype restorable_dropped_database_id: str
        :keyword catalog_collation: Collation of the metadata catalog. Known values are:
         "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS".
        :paramtype catalog_collation: str or ~azure.mgmt.sql.models.CatalogCollationType
        :keyword zone_redundant: Whether or not this database is zone redundant, which means the
         replicas of this database will be spread across multiple availability zones.
        :paramtype zone_redundant: bool
        :keyword license_type: The license type to apply for this database. ``LicenseIncluded`` if you
         need a license, or ``BasePrice`` if you have a license and are eligible for the Azure Hybrid
         Benefit. Known values are: "LicenseIncluded" and "BasePrice".
        :paramtype license_type: str or ~azure.mgmt.sql.models.DatabaseLicenseType
        :keyword read_scale: The state of read-only routing. If enabled, connections that have
         application intent set to readonly in their connection string may be routed to a readonly
         secondary replica in the same region. Not applicable to a Hyperscale database within an elastic
         pool. Known values are: "Enabled" and "Disabled".
        :paramtype read_scale: str or ~azure.mgmt.sql.models.DatabaseReadScale
        :keyword high_availability_replica_count: The number of secondary replicas associated with the
         database that are used to provide high availability. Not applicable to a Hyperscale database
         within an elastic pool.
        :paramtype high_availability_replica_count: int
        :keyword secondary_type: The secondary type of the database if it is a secondary.  Valid values
         are Geo, Named and Standby. Known values are: "Geo", "Named", and "Standby".
        :paramtype secondary_type: str or ~azure.mgmt.sql.models.SecondaryType
        :keyword auto_pause_delay: Time in minutes after which database is automatically paused. A
         value of -1 means that automatic pause is disabled.
        :paramtype auto_pause_delay: int
        :keyword requested_backup_storage_redundancy: The storage account type to be used to store
         backups for this database. Known values are: "Geo", "Local", "Zone", and "GeoZone".
        :paramtype requested_backup_storage_redundancy: str or
         ~azure.mgmt.sql.models.BackupStorageRedundancy
        :keyword min_capacity: Minimal capacity that database will always have allocated, if not
         paused.
        :paramtype min_capacity: float
        :keyword maintenance_configuration_id: Maintenance configuration id assigned to the database.
         This configuration defines the period when the maintenance updates will occur.
        :paramtype maintenance_configuration_id: str
        :keyword is_ledger_on: Whether or not this database is a ledger database, which means all
         tables in the database are ledger tables. Note: the value of this property cannot be changed
         after the database has been created.
        :paramtype is_ledger_on: bool
        :keyword federated_client_id: The Client id used for cross tenant per database CMK scenario.
        :paramtype federated_client_id: str
        """
        super().__init__(**kwargs)
        self.sku = sku
        self.identity = identity
        self.tags = tags
        self.create_mode = create_mode
        self.collation = collation
        self.max_size_bytes = max_size_bytes
        self.sample_name = sample_name
        self.elastic_pool_id = elastic_pool_id
        self.source_database_id = source_database_id
        self.status = None
        self.database_id = None
        self.creation_date = None
        self.current_service_objective_name = None
        self.requested_service_objective_name = None
        self.default_secondary_location = None
        self.failover_group_id = None
        self.restore_point_in_time = restore_point_in_time
        self.source_database_deletion_date = source_database_deletion_date
        self.recovery_services_recovery_point_id = recovery_services_recovery_point_id
        self.long_term_retention_backup_resource_id = long_term_retention_backup_resource_id
        self.recoverable_database_id = recoverable_database_id
        self.restorable_dropped_database_id = restorable_dropped_database_id
        self.catalog_collation = catalog_collation
        self.zone_redundant = zone_redundant
        self.license_type = license_type
        self.max_log_size_bytes = None
        self.earliest_restore_date = None
        self.read_scale = read_scale
        self.high_availability_replica_count = high_availability_replica_count
        self.secondary_type = secondary_type
        self.current_sku = None
        self.auto_pause_delay = auto_pause_delay
        self.current_backup_storage_redundancy = None
        self.requested_backup_storage_redundancy = requested_backup_storage_redundancy
        self.min_capacity = min_capacity
        self.paused_date = None
        self.resumed_date = None
        self.maintenance_configuration_id = maintenance_configuration_id
        self.is_ledger_on = is_ledger_on
        self.is_infra_encryption_enabled = None
        self.federated_client_id = federated_client_id


class DatabaseUsage(ProxyResource):
    """Usage metric of a database.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar display_name: User-readable name of the metric.
    :vartype display_name: str
    :ivar current_value: Current value of the metric.
    :vartype current_value: float
    :ivar limit: Boundary value of the metric.
    :vartype limit: float
    :ivar unit: Unit of the metric.
    :vartype unit: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "display_name": {"readonly": True},
        "current_value": {"readonly": True},
        "limit": {"readonly": True},
        "unit": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "display_name": {"key": "properties.displayName", "type": "str"},
        "current_value": {"key": "properties.currentValue", "type": "float"},
        "limit": {"key": "properties.limit", "type": "float"},
        "unit": {"key": "properties.unit", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.display_name = None
        self.current_value = None
        self.limit = None
        self.unit = None


class DatabaseUsageListResult(_serialization.Model):
    """A list of database usage metrics.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DatabaseUsage]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DatabaseUsage]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DatabaseUserIdentity(_serialization.Model):
    """Azure Active Directory identity configuration for a resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar principal_id: The Azure Active Directory principal id.
    :vartype principal_id: str
    :ivar client_id: The Azure Active Directory client id.
    :vartype client_id: str
    """

    _validation = {
        "principal_id": {"readonly": True},
        "client_id": {"readonly": True},
    }

    _attribute_map = {
        "principal_id": {"key": "principalId", "type": "str"},
        "client_id": {"key": "clientId", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.principal_id = None
        self.client_id = None


class DatabaseVulnerabilityAssessment(ProxyResource):
    """A database vulnerability assessment.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar storage_container_path: A blob storage container path to hold the scan results (e.g.
     https://myStorage.blob.core.windows.net/VaScans/).  It is required if server level
     vulnerability assessment policy doesn't set.
    :vartype storage_container_path: str
    :ivar storage_container_sas_key: A shared access signature (SAS Key) that has write access to
     the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey'
     isn't specified, StorageContainerSasKey is required.
    :vartype storage_container_sas_key: str
    :ivar storage_account_access_key: Specifies the identifier key of the storage account for
     vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified,
     storageAccountAccessKey is required.
    :vartype storage_account_access_key: str
    :ivar recurring_scans: The recurring scans settings.
    :vartype recurring_scans:
     ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "storage_container_path": {"key": "properties.storageContainerPath", "type": "str"},
        "storage_container_sas_key": {"key": "properties.storageContainerSasKey", "type": "str"},
        "storage_account_access_key": {"key": "properties.storageAccountAccessKey", "type": "str"},
        "recurring_scans": {
            "key": "properties.recurringScans",
            "type": "VulnerabilityAssessmentRecurringScansProperties",
        },
    }

    def __init__(
        self,
        *,
        storage_container_path: Optional[str] = None,
        storage_container_sas_key: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        recurring_scans: Optional["_models.VulnerabilityAssessmentRecurringScansProperties"] = None,
        **kwargs
    ):
        """
        :keyword storage_container_path: A blob storage container path to hold the scan results (e.g.
         https://myStorage.blob.core.windows.net/VaScans/).  It is required if server level
         vulnerability assessment policy doesn't set.
        :paramtype storage_container_path: str
        :keyword storage_container_sas_key: A shared access signature (SAS Key) that has write access
         to the blob container specified in 'storageContainerPath' parameter. If
         'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required.
        :paramtype storage_container_sas_key: str
        :keyword storage_account_access_key: Specifies the identifier key of the storage account for
         vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified,
         storageAccountAccessKey is required.
        :paramtype storage_account_access_key: str
        :keyword recurring_scans: The recurring scans settings.
        :paramtype recurring_scans:
         ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties
        """
        super().__init__(**kwargs)
        self.storage_container_path = storage_container_path
        self.storage_container_sas_key = storage_container_sas_key
        self.storage_account_access_key = storage_account_access_key
        self.recurring_scans = recurring_scans


class DatabaseVulnerabilityAssessmentListResult(_serialization.Model):
    """A list of the database's vulnerability assessments.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DatabaseVulnerabilityAssessment]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DatabaseVulnerabilityAssessment]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DatabaseVulnerabilityAssessmentRuleBaseline(ProxyResource):
    """A database vulnerability assessment rule baseline.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar baseline_results: The rule baseline result.
    :vartype baseline_results:
     list[~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaselineItem]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "baseline_results": {
            "key": "properties.baselineResults",
            "type": "[DatabaseVulnerabilityAssessmentRuleBaselineItem]",
        },
    }

    def __init__(
        self,
        *,
        baseline_results: Optional[List["_models.DatabaseVulnerabilityAssessmentRuleBaselineItem"]] = None,
        **kwargs
    ):
        """
        :keyword baseline_results: The rule baseline result.
        :paramtype baseline_results:
         list[~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaselineItem]
        """
        super().__init__(**kwargs)
        self.baseline_results = baseline_results


class DatabaseVulnerabilityAssessmentRuleBaselineItem(_serialization.Model):
    """Properties for an Azure SQL Database Vulnerability Assessment rule baseline's result.

    All required parameters must be populated in order to send to Azure.

    :ivar result: The rule baseline result. Required.
    :vartype result: list[str]
    """

    _validation = {
        "result": {"required": True},
    }

    _attribute_map = {
        "result": {"key": "result", "type": "[str]"},
    }

    def __init__(self, *, result: List[str], **kwargs):
        """
        :keyword result: The rule baseline result. Required.
        :paramtype result: list[str]
        """
        super().__init__(**kwargs)
        self.result = result


class DatabaseVulnerabilityAssessmentScansExport(ProxyResource):
    """A database Vulnerability Assessment scan export resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar exported_report_location: Location of the exported report (e.g.
     https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx).
    :vartype exported_report_location: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "exported_report_location": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "exported_report_location": {"key": "properties.exportedReportLocation", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.exported_report_location = None


class DataMaskingPolicy(ProxyResource):
    """Represents a database data masking policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: The location of the data masking policy.
    :vartype location: str
    :ivar kind: The kind of data masking policy. Metadata, used for Azure portal.
    :vartype kind: str
    :ivar data_masking_state: The state of the data masking policy. Known values are: "Disabled"
     and "Enabled".
    :vartype data_masking_state: str or ~azure.mgmt.sql.models.DataMaskingState
    :ivar exempt_principals: The list of the exempt principals. Specifies the semicolon-separated
     list of database users for which the data masking policy does not apply. The specified users
     receive data results without masking for all of the database queries.
    :vartype exempt_principals: str
    :ivar application_principals: The list of the application principals. This is a legacy
     parameter and is no longer used.
    :vartype application_principals: str
    :ivar masking_level: The masking level. This is a legacy parameter and is no longer used.
    :vartype masking_level: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"readonly": True},
        "kind": {"readonly": True},
        "application_principals": {"readonly": True},
        "masking_level": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "kind": {"key": "kind", "type": "str"},
        "data_masking_state": {"key": "properties.dataMaskingState", "type": "str"},
        "exempt_principals": {"key": "properties.exemptPrincipals", "type": "str"},
        "application_principals": {"key": "properties.applicationPrincipals", "type": "str"},
        "masking_level": {"key": "properties.maskingLevel", "type": "str"},
    }

    def __init__(
        self,
        *,
        data_masking_state: Optional[Union[str, "_models.DataMaskingState"]] = None,
        exempt_principals: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword data_masking_state: The state of the data masking policy. Known values are: "Disabled"
         and "Enabled".
        :paramtype data_masking_state: str or ~azure.mgmt.sql.models.DataMaskingState
        :keyword exempt_principals: The list of the exempt principals. Specifies the
         semicolon-separated list of database users for which the data masking policy does not apply.
         The specified users receive data results without masking for all of the database queries.
        :paramtype exempt_principals: str
        """
        super().__init__(**kwargs)
        self.location = None
        self.kind = None
        self.data_masking_state = data_masking_state
        self.exempt_principals = exempt_principals
        self.application_principals = None
        self.masking_level = None


class DataMaskingRule(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """Represents a database data masking rule.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: The location of the data masking rule.
    :vartype location: str
    :ivar kind: The kind of Data Masking Rule. Metadata, used for Azure portal.
    :vartype kind: str
    :ivar id_properties_id: The rule Id.
    :vartype id_properties_id: str
    :ivar alias_name: The alias name. This is a legacy parameter and is no longer used.
    :vartype alias_name: str
    :ivar rule_state: The rule state. Used to delete a rule. To delete an existing rule, specify
     the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled.
     However, if the rule doesn't already exist, the rule will be created with ruleState set to
     enabled, regardless of the provided value of ruleState. Known values are: "Disabled" and
     "Enabled".
    :vartype rule_state: str or ~azure.mgmt.sql.models.DataMaskingRuleState
    :ivar schema_name: The schema name on which the data masking rule is applied.
    :vartype schema_name: str
    :ivar table_name: The table name on which the data masking rule is applied.
    :vartype table_name: str
    :ivar column_name: The column name on which the data masking rule is applied.
    :vartype column_name: str
    :ivar masking_function: The masking function that is used for the data masking rule. Known
     values are: "Default", "CCN", "Email", "Number", "SSN", and "Text".
    :vartype masking_function: str or ~azure.mgmt.sql.models.DataMaskingFunction
    :ivar number_from: The numberFrom property of the masking rule. Required if maskingFunction is
     set to Number, otherwise this parameter will be ignored.
    :vartype number_from: str
    :ivar number_to: The numberTo property of the data masking rule. Required if maskingFunction is
     set to Number, otherwise this parameter will be ignored.
    :vartype number_to: str
    :ivar prefix_size: If maskingFunction is set to Text, the number of characters to show unmasked
     in the beginning of the string. Otherwise, this parameter will be ignored.
    :vartype prefix_size: str
    :ivar suffix_size: If maskingFunction is set to Text, the number of characters to show unmasked
     at the end of the string. Otherwise, this parameter will be ignored.
    :vartype suffix_size: str
    :ivar replacement_string: If maskingFunction is set to Text, the character to use for masking
     the unexposed part of the string. Otherwise, this parameter will be ignored.
    :vartype replacement_string: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"readonly": True},
        "kind": {"readonly": True},
        "id_properties_id": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "kind": {"key": "kind", "type": "str"},
        "id_properties_id": {"key": "properties.id", "type": "str"},
        "alias_name": {"key": "properties.aliasName", "type": "str"},
        "rule_state": {"key": "properties.ruleState", "type": "str"},
        "schema_name": {"key": "properties.schemaName", "type": "str"},
        "table_name": {"key": "properties.tableName", "type": "str"},
        "column_name": {"key": "properties.columnName", "type": "str"},
        "masking_function": {"key": "properties.maskingFunction", "type": "str"},
        "number_from": {"key": "properties.numberFrom", "type": "str"},
        "number_to": {"key": "properties.numberTo", "type": "str"},
        "prefix_size": {"key": "properties.prefixSize", "type": "str"},
        "suffix_size": {"key": "properties.suffixSize", "type": "str"},
        "replacement_string": {"key": "properties.replacementString", "type": "str"},
    }

    def __init__(
        self,
        *,
        alias_name: Optional[str] = None,
        rule_state: Optional[Union[str, "_models.DataMaskingRuleState"]] = None,
        schema_name: Optional[str] = None,
        table_name: Optional[str] = None,
        column_name: Optional[str] = None,
        masking_function: Optional[Union[str, "_models.DataMaskingFunction"]] = None,
        number_from: Optional[str] = None,
        number_to: Optional[str] = None,
        prefix_size: Optional[str] = None,
        suffix_size: Optional[str] = None,
        replacement_string: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword alias_name: The alias name. This is a legacy parameter and is no longer used.
        :paramtype alias_name: str
        :keyword rule_state: The rule state. Used to delete a rule. To delete an existing rule, specify
         the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled.
         However, if the rule doesn't already exist, the rule will be created with ruleState set to
         enabled, regardless of the provided value of ruleState. Known values are: "Disabled" and
         "Enabled".
        :paramtype rule_state: str or ~azure.mgmt.sql.models.DataMaskingRuleState
        :keyword schema_name: The schema name on which the data masking rule is applied.
        :paramtype schema_name: str
        :keyword table_name: The table name on which the data masking rule is applied.
        :paramtype table_name: str
        :keyword column_name: The column name on which the data masking rule is applied.
        :paramtype column_name: str
        :keyword masking_function: The masking function that is used for the data masking rule. Known
         values are: "Default", "CCN", "Email", "Number", "SSN", and "Text".
        :paramtype masking_function: str or ~azure.mgmt.sql.models.DataMaskingFunction
        :keyword number_from: The numberFrom property of the masking rule. Required if maskingFunction
         is set to Number, otherwise this parameter will be ignored.
        :paramtype number_from: str
        :keyword number_to: The numberTo property of the data masking rule. Required if maskingFunction
         is set to Number, otherwise this parameter will be ignored.
        :paramtype number_to: str
        :keyword prefix_size: If maskingFunction is set to Text, the number of characters to show
         unmasked in the beginning of the string. Otherwise, this parameter will be ignored.
        :paramtype prefix_size: str
        :keyword suffix_size: If maskingFunction is set to Text, the number of characters to show
         unmasked at the end of the string. Otherwise, this parameter will be ignored.
        :paramtype suffix_size: str
        :keyword replacement_string: If maskingFunction is set to Text, the character to use for
         masking the unexposed part of the string. Otherwise, this parameter will be ignored.
        :paramtype replacement_string: str
        """
        super().__init__(**kwargs)
        self.location = None
        self.kind = None
        self.id_properties_id = None
        self.alias_name = alias_name
        self.rule_state = rule_state
        self.schema_name = schema_name
        self.table_name = table_name
        self.column_name = column_name
        self.masking_function = masking_function
        self.number_from = number_from
        self.number_to = number_to
        self.prefix_size = prefix_size
        self.suffix_size = suffix_size
        self.replacement_string = replacement_string


class DataMaskingRuleListResult(_serialization.Model):
    """The response to a list data masking rules request.

    :ivar value: The list of database data masking rules.
    :vartype value: list[~azure.mgmt.sql.models.DataMaskingRule]
    """

    _attribute_map = {
        "value": {"key": "value", "type": "[DataMaskingRule]"},
    }

    def __init__(self, *, value: Optional[List["_models.DataMaskingRule"]] = None, **kwargs):
        """
        :keyword value: The list of database data masking rules.
        :paramtype value: list[~azure.mgmt.sql.models.DataMaskingRule]
        """
        super().__init__(**kwargs)
        self.value = value


class DataWarehouseUserActivities(ProxyResource):
    """User activities of a data warehouse.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar active_queries_count: Count of running and suspended queries.
    :vartype active_queries_count: int
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "active_queries_count": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "active_queries_count": {"key": "properties.activeQueriesCount", "type": "int"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.active_queries_count = None


class DataWarehouseUserActivitiesListResult(_serialization.Model):
    """User activities of a data warehouse.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DataWarehouseUserActivities]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DataWarehouseUserActivities]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DeletedServer(ProxyResource):
    """A deleted server.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar version: The version of the deleted server.
    :vartype version: str
    :ivar deletion_time: The deletion time of the deleted server.
    :vartype deletion_time: ~datetime.datetime
    :ivar original_id: The original ID of the server before deletion.
    :vartype original_id: str
    :ivar fully_qualified_domain_name: The fully qualified domain name of the server.
    :vartype fully_qualified_domain_name: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "version": {"readonly": True},
        "deletion_time": {"readonly": True},
        "original_id": {"readonly": True},
        "fully_qualified_domain_name": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "version": {"key": "properties.version", "type": "str"},
        "deletion_time": {"key": "properties.deletionTime", "type": "iso-8601"},
        "original_id": {"key": "properties.originalId", "type": "str"},
        "fully_qualified_domain_name": {"key": "properties.fullyQualifiedDomainName", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.version = None
        self.deletion_time = None
        self.original_id = None
        self.fully_qualified_domain_name = None


class DeletedServerListResult(_serialization.Model):
    """A list of deleted servers.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DeletedServer]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DeletedServer]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class DistributedAvailabilityGroup(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """Distributed availability group between box and Sql Managed Instance.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar target_database: The name of the target database.
    :vartype target_database: str
    :ivar source_endpoint: The source endpoint.
    :vartype source_endpoint: str
    :ivar primary_availability_group_name: The primary availability group name.
    :vartype primary_availability_group_name: str
    :ivar secondary_availability_group_name: The secondary availability group name.
    :vartype secondary_availability_group_name: str
    :ivar replication_mode: The replication mode of a distributed availability group. Parameter
     will be ignored during link creation. Known values are: "Async" and "Sync".
    :vartype replication_mode: str or ~azure.mgmt.sql.models.ReplicationMode
    :ivar distributed_availability_group_id: The distributed availability group id.
    :vartype distributed_availability_group_id: str
    :ivar source_replica_id: The source replica id.
    :vartype source_replica_id: str
    :ivar target_replica_id: The target replica id.
    :vartype target_replica_id: str
    :ivar link_state: The link state.
    :vartype link_state: str
    :ivar last_hardened_lsn: The last hardened lsn.
    :vartype last_hardened_lsn: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "distributed_availability_group_id": {"readonly": True},
        "source_replica_id": {"readonly": True},
        "target_replica_id": {"readonly": True},
        "link_state": {"readonly": True},
        "last_hardened_lsn": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "target_database": {"key": "properties.targetDatabase", "type": "str"},
        "source_endpoint": {"key": "properties.sourceEndpoint", "type": "str"},
        "primary_availability_group_name": {"key": "properties.primaryAvailabilityGroupName", "type": "str"},
        "secondary_availability_group_name": {"key": "properties.secondaryAvailabilityGroupName", "type": "str"},
        "replication_mode": {"key": "properties.replicationMode", "type": "str"},
        "distributed_availability_group_id": {"key": "properties.distributedAvailabilityGroupId", "type": "str"},
        "source_replica_id": {"key": "properties.sourceReplicaId", "type": "str"},
        "target_replica_id": {"key": "properties.targetReplicaId", "type": "str"},
        "link_state": {"key": "properties.linkState", "type": "str"},
        "last_hardened_lsn": {"key": "properties.lastHardenedLsn", "type": "str"},
    }

    def __init__(
        self,
        *,
        target_database: Optional[str] = None,
        source_endpoint: Optional[str] = None,
        primary_availability_group_name: Optional[str] = None,
        secondary_availability_group_name: Optional[str] = None,
        replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = None,
        **kwargs
    ):
        """
        :keyword target_database: The name of the target database.
        :paramtype target_database: str
        :keyword source_endpoint: The source endpoint.
        :paramtype source_endpoint: str
        :keyword primary_availability_group_name: The primary availability group name.
        :paramtype primary_availability_group_name: str
        :keyword secondary_availability_group_name: The secondary availability group name.
        :paramtype secondary_availability_group_name: str
        :keyword replication_mode: The replication mode of a distributed availability group. Parameter
         will be ignored during link creation. Known values are: "Async" and "Sync".
        :paramtype replication_mode: str or ~azure.mgmt.sql.models.ReplicationMode
        """
        super().__init__(**kwargs)
        self.target_database = target_database
        self.source_endpoint = source_endpoint
        self.primary_availability_group_name = primary_availability_group_name
        self.secondary_availability_group_name = secondary_availability_group_name
        self.replication_mode = replication_mode
        self.distributed_availability_group_id = None
        self.source_replica_id = None
        self.target_replica_id = None
        self.link_state = None
        self.last_hardened_lsn = None


class DistributedAvailabilityGroupsListResult(_serialization.Model):
    """A list of distributed availability groups in instance.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.DistributedAvailabilityGroup]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[DistributedAvailabilityGroup]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class EditionCapability(_serialization.Model):
    """The edition capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The database edition name.
    :vartype name: str
    :ivar supported_service_level_objectives: The list of supported service objectives for the
     edition.
    :vartype supported_service_level_objectives:
     list[~azure.mgmt.sql.models.ServiceObjectiveCapability]
    :ivar zone_redundant: Whether or not zone redundancy is supported for the edition.
    :vartype zone_redundant: bool
    :ivar read_scale: The read scale capability for the edition.
    :vartype read_scale: ~azure.mgmt.sql.models.ReadScaleCapability
    :ivar supported_storage_capabilities: The list of supported storage capabilities for this
     edition.
    :vartype supported_storage_capabilities: list[~azure.mgmt.sql.models.StorageCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "supported_service_level_objectives": {"readonly": True},
        "zone_redundant": {"readonly": True},
        "read_scale": {"readonly": True},
        "supported_storage_capabilities": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "supported_service_level_objectives": {
            "key": "supportedServiceLevelObjectives",
            "type": "[ServiceObjectiveCapability]",
        },
        "zone_redundant": {"key": "zoneRedundant", "type": "bool"},
        "read_scale": {"key": "readScale", "type": "ReadScaleCapability"},
        "supported_storage_capabilities": {"key": "supportedStorageCapabilities", "type": "[StorageCapability]"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.supported_service_level_objectives = None
        self.zone_redundant = None
        self.read_scale = None
        self.supported_storage_capabilities = None
        self.status = None
        self.reason = reason


class ElasticPool(TrackedResource):  # pylint: disable=too-many-instance-attributes
    """An elastic pool.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location. Required.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar sku: The elastic pool SKU.

     The list of SKUs may vary by region and support offer. To determine the SKUs (including the
     SKU name, tier/edition, family, and capacity) that are available to your subscription in an
     Azure region, use the ``Capabilities_ListByLocation`` REST API or the following command:

     .. code-block:: azurecli

        az sql elastic-pool list-editions -l <location> -o table
        `.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar kind: Kind of elastic pool. This is metadata used for the Azure portal experience.
    :vartype kind: str
    :ivar state: The state of the elastic pool. Known values are: "Creating", "Ready", and
     "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.ElasticPoolState
    :ivar creation_date: The creation date of the elastic pool (ISO8601 format).
    :vartype creation_date: ~datetime.datetime
    :ivar max_size_bytes: The storage limit for the database elastic pool in bytes.
    :vartype max_size_bytes: int
    :ivar per_database_settings: The per database settings for the elastic pool.
    :vartype per_database_settings: ~azure.mgmt.sql.models.ElasticPoolPerDatabaseSettings
    :ivar zone_redundant: Whether or not this elastic pool is zone redundant, which means the
     replicas of this elastic pool will be spread across multiple availability zones.
    :vartype zone_redundant: bool
    :ivar license_type: The license type to apply for this elastic pool. Known values are:
     "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.ElasticPoolLicenseType
    :ivar maintenance_configuration_id: Maintenance configuration id assigned to the elastic pool.
     This configuration defines the period when the maintenance updates will will occur.
    :vartype maintenance_configuration_id: str
    :ivar high_availability_replica_count: The number of secondary replicas associated with the
     elastic pool that are used to provide high availability.
    :vartype high_availability_replica_count: int
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"required": True},
        "kind": {"readonly": True},
        "state": {"readonly": True},
        "creation_date": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "tags": {"key": "tags", "type": "{str}"},
        "sku": {"key": "sku", "type": "Sku"},
        "kind": {"key": "kind", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
        "creation_date": {"key": "properties.creationDate", "type": "iso-8601"},
        "max_size_bytes": {"key": "properties.maxSizeBytes", "type": "int"},
        "per_database_settings": {"key": "properties.perDatabaseSettings", "type": "ElasticPoolPerDatabaseSettings"},
        "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"},
        "license_type": {"key": "properties.licenseType", "type": "str"},
        "maintenance_configuration_id": {"key": "properties.maintenanceConfigurationId", "type": "str"},
        "high_availability_replica_count": {"key": "properties.highAvailabilityReplicaCount", "type": "int"},
    }

    def __init__(
        self,
        *,
        location: str,
        tags: Optional[Dict[str, str]] = None,
        sku: Optional["_models.Sku"] = None,
        max_size_bytes: Optional[int] = None,
        per_database_settings: Optional["_models.ElasticPoolPerDatabaseSettings"] = None,
        zone_redundant: Optional[bool] = None,
        license_type: Optional[Union[str, "_models.ElasticPoolLicenseType"]] = None,
        maintenance_configuration_id: Optional[str] = None,
        high_availability_replica_count: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword location: Resource location. Required.
        :paramtype location: str
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword sku: The elastic pool SKU.

         The list of SKUs may vary by region and support offer. To determine the SKUs (including the
         SKU name, tier/edition, family, and capacity) that are available to your subscription in an
         Azure region, use the ``Capabilities_ListByLocation`` REST API or the following command:

         .. code-block:: azurecli

            az sql elastic-pool list-editions -l <location> -o table
            `.
        :paramtype sku: ~azure.mgmt.sql.models.Sku
        :keyword max_size_bytes: The storage limit for the database elastic pool in bytes.
        :paramtype max_size_bytes: int
        :keyword per_database_settings: The per database settings for the elastic pool.
        :paramtype per_database_settings: ~azure.mgmt.sql.models.ElasticPoolPerDatabaseSettings
        :keyword zone_redundant: Whether or not this elastic pool is zone redundant, which means the
         replicas of this elastic pool will be spread across multiple availability zones.
        :paramtype zone_redundant: bool
        :keyword license_type: The license type to apply for this elastic pool. Known values are:
         "LicenseIncluded" and "BasePrice".
        :paramtype license_type: str or ~azure.mgmt.sql.models.ElasticPoolLicenseType
        :keyword maintenance_configuration_id: Maintenance configuration id assigned to the elastic
         pool. This configuration defines the period when the maintenance updates will will occur.
        :paramtype maintenance_configuration_id: str
        :keyword high_availability_replica_count: The number of secondary replicas associated with the
         elastic pool that are used to provide high availability.
        :paramtype high_availability_replica_count: int
        """
        super().__init__(location=location, tags=tags, **kwargs)
        self.sku = sku
        self.kind = None
        self.state = None
        self.creation_date = None
        self.max_size_bytes = max_size_bytes
        self.per_database_settings = per_database_settings
        self.zone_redundant = zone_redundant
        self.license_type = license_type
        self.maintenance_configuration_id = maintenance_configuration_id
        self.high_availability_replica_count = high_availability_replica_count


class ElasticPoolActivity(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """Represents the activity on an elastic pool.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: The geo-location where the resource lives.
    :vartype location: str
    :ivar end_time: The time the operation finished (ISO8601 format).
    :vartype end_time: ~datetime.datetime
    :ivar error_code: The error code if available.
    :vartype error_code: int
    :ivar error_message: The error message if available.
    :vartype error_message: str
    :ivar error_severity: The error severity if available.
    :vartype error_severity: int
    :ivar operation: The operation name.
    :vartype operation: str
    :ivar operation_id: The unique operation ID.
    :vartype operation_id: str
    :ivar percent_complete: The percentage complete if available.
    :vartype percent_complete: int
    :ivar requested_database_dtu_max: The requested max DTU per database if available.
    :vartype requested_database_dtu_max: int
    :ivar requested_database_dtu_min: The requested min DTU per database if available.
    :vartype requested_database_dtu_min: int
    :ivar requested_dtu: The requested DTU for the pool if available.
    :vartype requested_dtu: int
    :ivar requested_elastic_pool_name: The requested name for the elastic pool if available.
    :vartype requested_elastic_pool_name: str
    :ivar requested_storage_limit_in_gb: The requested storage limit for the pool in GB if
     available.
    :vartype requested_storage_limit_in_gb: int
    :ivar elastic_pool_name: The name of the elastic pool.
    :vartype elastic_pool_name: str
    :ivar server_name: The name of the server the elastic pool is in.
    :vartype server_name: str
    :ivar start_time: The time the operation started (ISO8601 format).
    :vartype start_time: ~datetime.datetime
    :ivar state: The current state of the operation.
    :vartype state: str
    :ivar requested_storage_limit_in_mb: The requested storage limit in MB.
    :vartype requested_storage_limit_in_mb: int
    :ivar requested_database_dtu_guarantee: The requested per database DTU guarantee.
    :vartype requested_database_dtu_guarantee: int
    :ivar requested_database_dtu_cap: The requested per database DTU cap.
    :vartype requested_database_dtu_cap: int
    :ivar requested_dtu_guarantee: The requested DTU guarantee.
    :vartype requested_dtu_guarantee: int
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "end_time": {"readonly": True},
        "error_code": {"readonly": True},
        "error_message": {"readonly": True},
        "error_severity": {"readonly": True},
        "operation": {"readonly": True},
        "operation_id": {"readonly": True},
        "percent_complete": {"readonly": True},
        "requested_database_dtu_max": {"readonly": True},
        "requested_database_dtu_min": {"readonly": True},
        "requested_dtu": {"readonly": True},
        "requested_elastic_pool_name": {"readonly": True},
        "requested_storage_limit_in_gb": {"readonly": True},
        "elastic_pool_name": {"readonly": True},
        "server_name": {"readonly": True},
        "start_time": {"readonly": True},
        "state": {"readonly": True},
        "requested_storage_limit_in_mb": {"readonly": True},
        "requested_database_dtu_guarantee": {"readonly": True},
        "requested_database_dtu_cap": {"readonly": True},
        "requested_dtu_guarantee": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "end_time": {"key": "properties.endTime", "type": "iso-8601"},
        "error_code": {"key": "properties.errorCode", "type": "int"},
        "error_message": {"key": "properties.errorMessage", "type": "str"},
        "error_severity": {"key": "properties.errorSeverity", "type": "int"},
        "operation": {"key": "properties.operation", "type": "str"},
        "operation_id": {"key": "properties.operationId", "type": "str"},
        "percent_complete": {"key": "properties.percentComplete", "type": "int"},
        "requested_database_dtu_max": {"key": "properties.requestedDatabaseDtuMax", "type": "int"},
        "requested_database_dtu_min": {"key": "properties.requestedDatabaseDtuMin", "type": "int"},
        "requested_dtu": {"key": "properties.requestedDtu", "type": "int"},
        "requested_elastic_pool_name": {"key": "properties.requestedElasticPoolName", "type": "str"},
        "requested_storage_limit_in_gb": {"key": "properties.requestedStorageLimitInGB", "type": "int"},
        "elastic_pool_name": {"key": "properties.elasticPoolName", "type": "str"},
        "server_name": {"key": "properties.serverName", "type": "str"},
        "start_time": {"key": "properties.startTime", "type": "iso-8601"},
        "state": {"key": "properties.state", "type": "str"},
        "requested_storage_limit_in_mb": {"key": "properties.requestedStorageLimitInMB", "type": "int"},
        "requested_database_dtu_guarantee": {"key": "properties.requestedDatabaseDtuGuarantee", "type": "int"},
        "requested_database_dtu_cap": {"key": "properties.requestedDatabaseDtuCap", "type": "int"},
        "requested_dtu_guarantee": {"key": "properties.requestedDtuGuarantee", "type": "int"},
    }

    def __init__(self, *, location: Optional[str] = None, **kwargs):  # pylint: disable=too-many-locals
        """
        :keyword location: The geo-location where the resource lives.
        :paramtype location: str
        """
        super().__init__(**kwargs)
        self.location = location
        self.end_time = None
        self.error_code = None
        self.error_message = None
        self.error_severity = None
        self.operation = None
        self.operation_id = None
        self.percent_complete = None
        self.requested_database_dtu_max = None
        self.requested_database_dtu_min = None
        self.requested_dtu = None
        self.requested_elastic_pool_name = None
        self.requested_storage_limit_in_gb = None
        self.elastic_pool_name = None
        self.server_name = None
        self.start_time = None
        self.state = None
        self.requested_storage_limit_in_mb = None
        self.requested_database_dtu_guarantee = None
        self.requested_database_dtu_cap = None
        self.requested_dtu_guarantee = None


class ElasticPoolActivityListResult(_serialization.Model):
    """Represents the response to a list elastic pool activity request.

    All required parameters must be populated in order to send to Azure.

    :ivar value: The list of elastic pool activities. Required.
    :vartype value: list[~azure.mgmt.sql.models.ElasticPoolActivity]
    """

    _validation = {
        "value": {"required": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ElasticPoolActivity]"},
    }

    def __init__(self, *, value: List["_models.ElasticPoolActivity"], **kwargs):
        """
        :keyword value: The list of elastic pool activities. Required.
        :paramtype value: list[~azure.mgmt.sql.models.ElasticPoolActivity]
        """
        super().__init__(**kwargs)
        self.value = value


class ElasticPoolDatabaseActivity(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """Represents the activity on an elastic pool.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: The geo-location where the resource lives.
    :vartype location: str
    :ivar database_name: The database name.
    :vartype database_name: str
    :ivar end_time: The time the operation finished (ISO8601 format).
    :vartype end_time: ~datetime.datetime
    :ivar error_code: The error code if available.
    :vartype error_code: int
    :ivar error_message: The error message if available.
    :vartype error_message: str
    :ivar error_severity: The error severity if available.
    :vartype error_severity: int
    :ivar operation: The operation name.
    :vartype operation: str
    :ivar operation_id: The unique operation ID.
    :vartype operation_id: str
    :ivar percent_complete: The percentage complete if available.
    :vartype percent_complete: int
    :ivar requested_elastic_pool_name: The name for the elastic pool the database is moving into if
     available.
    :vartype requested_elastic_pool_name: str
    :ivar current_elastic_pool_name: The name of the current elastic pool the database is in if
     available.
    :vartype current_elastic_pool_name: str
    :ivar current_service_objective: The name of the current service objective if available.
    :vartype current_service_objective: str
    :ivar requested_service_objective: The name of the requested service objective if available.
    :vartype requested_service_objective: str
    :ivar server_name: The name of the server the elastic pool is in.
    :vartype server_name: str
    :ivar start_time: The time the operation started (ISO8601 format).
    :vartype start_time: ~datetime.datetime
    :ivar state: The current state of the operation.
    :vartype state: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "database_name": {"readonly": True},
        "end_time": {"readonly": True},
        "error_code": {"readonly": True},
        "error_message": {"readonly": True},
        "error_severity": {"readonly": True},
        "operation": {"readonly": True},
        "operation_id": {"readonly": True},
        "percent_complete": {"readonly": True},
        "requested_elastic_pool_name": {"readonly": True},
        "current_elastic_pool_name": {"readonly": True},
        "current_service_objective": {"readonly": True},
        "requested_service_objective": {"readonly": True},
        "server_name": {"readonly": True},
        "start_time": {"readonly": True},
        "state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "database_name": {"key": "properties.databaseName", "type": "str"},
        "end_time": {"key": "properties.endTime", "type": "iso-8601"},
        "error_code": {"key": "properties.errorCode", "type": "int"},
        "error_message": {"key": "properties.errorMessage", "type": "str"},
        "error_severity": {"key": "properties.errorSeverity", "type": "int"},
        "operation": {"key": "properties.operation", "type": "str"},
        "operation_id": {"key": "properties.operationId", "type": "str"},
        "percent_complete": {"key": "properties.percentComplete", "type": "int"},
        "requested_elastic_pool_name": {"key": "properties.requestedElasticPoolName", "type": "str"},
        "current_elastic_pool_name": {"key": "properties.currentElasticPoolName", "type": "str"},
        "current_service_objective": {"key": "properties.currentServiceObjective", "type": "str"},
        "requested_service_objective": {"key": "properties.requestedServiceObjective", "type": "str"},
        "server_name": {"key": "properties.serverName", "type": "str"},
        "start_time": {"key": "properties.startTime", "type": "iso-8601"},
        "state": {"key": "properties.state", "type": "str"},
    }

    def __init__(self, *, location: Optional[str] = None, **kwargs):
        """
        :keyword location: The geo-location where the resource lives.
        :paramtype location: str
        """
        super().__init__(**kwargs)
        self.location = location
        self.database_name = None
        self.end_time = None
        self.error_code = None
        self.error_message = None
        self.error_severity = None
        self.operation = None
        self.operation_id = None
        self.percent_complete = None
        self.requested_elastic_pool_name = None
        self.current_elastic_pool_name = None
        self.current_service_objective = None
        self.requested_service_objective = None
        self.server_name = None
        self.start_time = None
        self.state = None


class ElasticPoolDatabaseActivityListResult(_serialization.Model):
    """Represents the response to a list elastic pool database activity request.

    All required parameters must be populated in order to send to Azure.

    :ivar value: The list of elastic pool database activities. Required.
    :vartype value: list[~azure.mgmt.sql.models.ElasticPoolDatabaseActivity]
    """

    _validation = {
        "value": {"required": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ElasticPoolDatabaseActivity]"},
    }

    def __init__(self, *, value: List["_models.ElasticPoolDatabaseActivity"], **kwargs):
        """
        :keyword value: The list of elastic pool database activities. Required.
        :paramtype value: list[~azure.mgmt.sql.models.ElasticPoolDatabaseActivity]
        """
        super().__init__(**kwargs)
        self.value = value


class ElasticPoolEditionCapability(_serialization.Model):
    """The elastic pool edition capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The elastic pool edition name.
    :vartype name: str
    :ivar supported_elastic_pool_performance_levels: The list of supported elastic pool DTU levels
     for the edition.
    :vartype supported_elastic_pool_performance_levels:
     list[~azure.mgmt.sql.models.ElasticPoolPerformanceLevelCapability]
    :ivar zone_redundant: Whether or not zone redundancy is supported for the edition.
    :vartype zone_redundant: bool
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "supported_elastic_pool_performance_levels": {"readonly": True},
        "zone_redundant": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "supported_elastic_pool_performance_levels": {
            "key": "supportedElasticPoolPerformanceLevels",
            "type": "[ElasticPoolPerformanceLevelCapability]",
        },
        "zone_redundant": {"key": "zoneRedundant", "type": "bool"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.supported_elastic_pool_performance_levels = None
        self.zone_redundant = None
        self.status = None
        self.reason = reason


class ElasticPoolListResult(_serialization.Model):
    """The result of an elastic pool list request.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ElasticPool]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ElasticPool]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ElasticPoolOperation(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A elastic pool operation.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar elastic_pool_name: The name of the elastic pool the operation is being performed on.
    :vartype elastic_pool_name: str
    :ivar operation: The name of operation.
    :vartype operation: str
    :ivar operation_friendly_name: The friendly name of operation.
    :vartype operation_friendly_name: str
    :ivar percent_complete: The percentage of the operation completed.
    :vartype percent_complete: int
    :ivar server_name: The name of the server.
    :vartype server_name: str
    :ivar start_time: The operation start time.
    :vartype start_time: ~datetime.datetime
    :ivar state: The operation state.
    :vartype state: str
    :ivar error_code: The operation error code.
    :vartype error_code: int
    :ivar error_description: The operation error description.
    :vartype error_description: str
    :ivar error_severity: The operation error severity.
    :vartype error_severity: int
    :ivar is_user_error: Whether or not the error is a user error.
    :vartype is_user_error: bool
    :ivar estimated_completion_time: The estimated completion time of the operation.
    :vartype estimated_completion_time: ~datetime.datetime
    :ivar description: The operation description.
    :vartype description: str
    :ivar is_cancellable: Whether the operation can be cancelled.
    :vartype is_cancellable: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "elastic_pool_name": {"readonly": True},
        "operation": {"readonly": True},
        "operation_friendly_name": {"readonly": True},
        "percent_complete": {"readonly": True},
        "server_name": {"readonly": True},
        "start_time": {"readonly": True},
        "state": {"readonly": True},
        "error_code": {"readonly": True},
        "error_description": {"readonly": True},
        "error_severity": {"readonly": True},
        "is_user_error": {"readonly": True},
        "estimated_completion_time": {"readonly": True},
        "description": {"readonly": True},
        "is_cancellable": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "elastic_pool_name": {"key": "properties.elasticPoolName", "type": "str"},
        "operation": {"key": "properties.operation", "type": "str"},
        "operation_friendly_name": {"key": "properties.operationFriendlyName", "type": "str"},
        "percent_complete": {"key": "properties.percentComplete", "type": "int"},
        "server_name": {"key": "properties.serverName", "type": "str"},
        "start_time": {"key": "properties.startTime", "type": "iso-8601"},
        "state": {"key": "properties.state", "type": "str"},
        "error_code": {"key": "properties.errorCode", "type": "int"},
        "error_description": {"key": "properties.errorDescription", "type": "str"},
        "error_severity": {"key": "properties.errorSeverity", "type": "int"},
        "is_user_error": {"key": "properties.isUserError", "type": "bool"},
        "estimated_completion_time": {"key": "properties.estimatedCompletionTime", "type": "iso-8601"},
        "description": {"key": "properties.description", "type": "str"},
        "is_cancellable": {"key": "properties.isCancellable", "type": "bool"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.elastic_pool_name = None
        self.operation = None
        self.operation_friendly_name = None
        self.percent_complete = None
        self.server_name = None
        self.start_time = None
        self.state = None
        self.error_code = None
        self.error_description = None
        self.error_severity = None
        self.is_user_error = None
        self.estimated_completion_time = None
        self.description = None
        self.is_cancellable = None


class ElasticPoolOperationListResult(_serialization.Model):
    """The response to a list elastic pool operations request.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ElasticPoolOperation]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ElasticPoolOperation]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ElasticPoolPerDatabaseMaxPerformanceLevelCapability(_serialization.Model):
    """The max per-database performance level capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar limit: The maximum performance level per database.
    :vartype limit: float
    :ivar unit: Unit type used to measure performance level. Known values are: "DTU" and "VCores".
    :vartype unit: str or ~azure.mgmt.sql.models.PerformanceLevelUnit
    :ivar supported_per_database_min_performance_levels: The list of supported min database
     performance levels.
    :vartype supported_per_database_min_performance_levels:
     list[~azure.mgmt.sql.models.ElasticPoolPerDatabaseMinPerformanceLevelCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "limit": {"readonly": True},
        "unit": {"readonly": True},
        "supported_per_database_min_performance_levels": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "limit": {"key": "limit", "type": "float"},
        "unit": {"key": "unit", "type": "str"},
        "supported_per_database_min_performance_levels": {
            "key": "supportedPerDatabaseMinPerformanceLevels",
            "type": "[ElasticPoolPerDatabaseMinPerformanceLevelCapability]",
        },
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.limit = None
        self.unit = None
        self.supported_per_database_min_performance_levels = None
        self.status = None
        self.reason = reason


class ElasticPoolPerDatabaseMinPerformanceLevelCapability(_serialization.Model):
    """The minimum per-database performance level capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar limit: The minimum performance level per database.
    :vartype limit: float
    :ivar unit: Unit type used to measure performance level. Known values are: "DTU" and "VCores".
    :vartype unit: str or ~azure.mgmt.sql.models.PerformanceLevelUnit
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "limit": {"readonly": True},
        "unit": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "limit": {"key": "limit", "type": "float"},
        "unit": {"key": "unit", "type": "str"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.limit = None
        self.unit = None
        self.status = None
        self.reason = reason


class ElasticPoolPerDatabaseSettings(_serialization.Model):
    """Per database settings of an elastic pool.

    :ivar min_capacity: The minimum capacity all databases are guaranteed.
    :vartype min_capacity: float
    :ivar max_capacity: The maximum capacity any one database can consume.
    :vartype max_capacity: float
    """

    _attribute_map = {
        "min_capacity": {"key": "minCapacity", "type": "float"},
        "max_capacity": {"key": "maxCapacity", "type": "float"},
    }

    def __init__(self, *, min_capacity: Optional[float] = None, max_capacity: Optional[float] = None, **kwargs):
        """
        :keyword min_capacity: The minimum capacity all databases are guaranteed.
        :paramtype min_capacity: float
        :keyword max_capacity: The maximum capacity any one database can consume.
        :paramtype max_capacity: float
        """
        super().__init__(**kwargs)
        self.min_capacity = min_capacity
        self.max_capacity = max_capacity


class ElasticPoolPerformanceLevelCapability(_serialization.Model):  # pylint: disable=too-many-instance-attributes
    """The Elastic Pool performance level capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar performance_level: The performance level for the pool.
    :vartype performance_level: ~azure.mgmt.sql.models.PerformanceLevelCapability
    :ivar sku: The sku.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar supported_license_types: List of supported license types.
    :vartype supported_license_types: list[~azure.mgmt.sql.models.LicenseTypeCapability]
    :ivar max_database_count: The maximum number of databases supported.
    :vartype max_database_count: int
    :ivar included_max_size: The included (free) max size for this performance level.
    :vartype included_max_size: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar supported_max_sizes: The list of supported max sizes.
    :vartype supported_max_sizes: list[~azure.mgmt.sql.models.MaxSizeRangeCapability]
    :ivar supported_per_database_max_sizes: The list of supported per database max sizes.
    :vartype supported_per_database_max_sizes: list[~azure.mgmt.sql.models.MaxSizeRangeCapability]
    :ivar supported_per_database_max_performance_levels: The list of supported per database max
     performance levels.
    :vartype supported_per_database_max_performance_levels:
     list[~azure.mgmt.sql.models.ElasticPoolPerDatabaseMaxPerformanceLevelCapability]
    :ivar zone_redundant: Whether or not zone redundancy is supported for the performance level.
    :vartype zone_redundant: bool
    :ivar supported_maintenance_configurations: List of supported maintenance configurations.
    :vartype supported_maintenance_configurations:
     list[~azure.mgmt.sql.models.MaintenanceConfigurationCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "performance_level": {"readonly": True},
        "sku": {"readonly": True},
        "supported_license_types": {"readonly": True},
        "max_database_count": {"readonly": True},
        "included_max_size": {"readonly": True},
        "supported_max_sizes": {"readonly": True},
        "supported_per_database_max_sizes": {"readonly": True},
        "supported_per_database_max_performance_levels": {"readonly": True},
        "zone_redundant": {"readonly": True},
        "supported_maintenance_configurations": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "performance_level": {"key": "performanceLevel", "type": "PerformanceLevelCapability"},
        "sku": {"key": "sku", "type": "Sku"},
        "supported_license_types": {"key": "supportedLicenseTypes", "type": "[LicenseTypeCapability]"},
        "max_database_count": {"key": "maxDatabaseCount", "type": "int"},
        "included_max_size": {"key": "includedMaxSize", "type": "MaxSizeCapability"},
        "supported_max_sizes": {"key": "supportedMaxSizes", "type": "[MaxSizeRangeCapability]"},
        "supported_per_database_max_sizes": {"key": "supportedPerDatabaseMaxSizes", "type": "[MaxSizeRangeCapability]"},
        "supported_per_database_max_performance_levels": {
            "key": "supportedPerDatabaseMaxPerformanceLevels",
            "type": "[ElasticPoolPerDatabaseMaxPerformanceLevelCapability]",
        },
        "zone_redundant": {"key": "zoneRedundant", "type": "bool"},
        "supported_maintenance_configurations": {
            "key": "supportedMaintenanceConfigurations",
            "type": "[MaintenanceConfigurationCapability]",
        },
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.performance_level = None
        self.sku = None
        self.supported_license_types = None
        self.max_database_count = None
        self.included_max_size = None
        self.supported_max_sizes = None
        self.supported_per_database_max_sizes = None
        self.supported_per_database_max_performance_levels = None
        self.zone_redundant = None
        self.supported_maintenance_configurations = None
        self.status = None
        self.reason = reason


class ElasticPoolUpdate(_serialization.Model):
    """An elastic pool update.

    :ivar sku: An ARM Resource SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar max_size_bytes: The storage limit for the database elastic pool in bytes.
    :vartype max_size_bytes: int
    :ivar per_database_settings: The per database settings for the elastic pool.
    :vartype per_database_settings: ~azure.mgmt.sql.models.ElasticPoolPerDatabaseSettings
    :ivar zone_redundant: Whether or not this elastic pool is zone redundant, which means the
     replicas of this elastic pool will be spread across multiple availability zones.
    :vartype zone_redundant: bool
    :ivar license_type: The license type to apply for this elastic pool. Known values are:
     "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.ElasticPoolLicenseType
    :ivar maintenance_configuration_id: Maintenance configuration id assigned to the elastic pool.
     This configuration defines the period when the maintenance updates will will occur.
    :vartype maintenance_configuration_id: str
    :ivar high_availability_replica_count: The number of secondary replicas associated with the
     elastic pool that are used to provide high availability. Applicable only to Hyperscale elastic
     pools.
    :vartype high_availability_replica_count: int
    """

    _attribute_map = {
        "sku": {"key": "sku", "type": "Sku"},
        "tags": {"key": "tags", "type": "{str}"},
        "max_size_bytes": {"key": "properties.maxSizeBytes", "type": "int"},
        "per_database_settings": {"key": "properties.perDatabaseSettings", "type": "ElasticPoolPerDatabaseSettings"},
        "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"},
        "license_type": {"key": "properties.licenseType", "type": "str"},
        "maintenance_configuration_id": {"key": "properties.maintenanceConfigurationId", "type": "str"},
        "high_availability_replica_count": {"key": "properties.highAvailabilityReplicaCount", "type": "int"},
    }

    def __init__(
        self,
        *,
        sku: Optional["_models.Sku"] = None,
        tags: Optional[Dict[str, str]] = None,
        max_size_bytes: Optional[int] = None,
        per_database_settings: Optional["_models.ElasticPoolPerDatabaseSettings"] = None,
        zone_redundant: Optional[bool] = None,
        license_type: Optional[Union[str, "_models.ElasticPoolLicenseType"]] = None,
        maintenance_configuration_id: Optional[str] = None,
        high_availability_replica_count: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword sku: An ARM Resource SKU.
        :paramtype sku: ~azure.mgmt.sql.models.Sku
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword max_size_bytes: The storage limit for the database elastic pool in bytes.
        :paramtype max_size_bytes: int
        :keyword per_database_settings: The per database settings for the elastic pool.
        :paramtype per_database_settings: ~azure.mgmt.sql.models.ElasticPoolPerDatabaseSettings
        :keyword zone_redundant: Whether or not this elastic pool is zone redundant, which means the
         replicas of this elastic pool will be spread across multiple availability zones.
        :paramtype zone_redundant: bool
        :keyword license_type: The license type to apply for this elastic pool. Known values are:
         "LicenseIncluded" and "BasePrice".
        :paramtype license_type: str or ~azure.mgmt.sql.models.ElasticPoolLicenseType
        :keyword maintenance_configuration_id: Maintenance configuration id assigned to the elastic
         pool. This configuration defines the period when the maintenance updates will will occur.
        :paramtype maintenance_configuration_id: str
        :keyword high_availability_replica_count: The number of secondary replicas associated with the
         elastic pool that are used to provide high availability. Applicable only to Hyperscale elastic
         pools.
        :paramtype high_availability_replica_count: int
        """
        super().__init__(**kwargs)
        self.sku = sku
        self.tags = tags
        self.max_size_bytes = max_size_bytes
        self.per_database_settings = per_database_settings
        self.zone_redundant = zone_redundant
        self.license_type = license_type
        self.maintenance_configuration_id = maintenance_configuration_id
        self.high_availability_replica_count = high_availability_replica_count


class EncryptionProtector(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """The server encryption protector.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar kind: Kind of encryption protector. This is metadata used for the Azure portal
     experience.
    :vartype kind: str
    :ivar location: Resource location.
    :vartype location: str
    :ivar subregion: Subregion of the encryption protector.
    :vartype subregion: str
    :ivar server_key_name: The name of the server key.
    :vartype server_key_name: str
    :ivar server_key_type: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'.
     Known values are: "ServiceManaged" and "AzureKeyVault".
    :vartype server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType
    :ivar uri: The URI of the server key.
    :vartype uri: str
    :ivar thumbprint: Thumbprint of the server key.
    :vartype thumbprint: str
    :ivar auto_rotation_enabled: Key auto rotation opt-in flag. Either true or false.
    :vartype auto_rotation_enabled: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "kind": {"readonly": True},
        "location": {"readonly": True},
        "subregion": {"readonly": True},
        "uri": {"readonly": True},
        "thumbprint": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "kind": {"key": "kind", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "subregion": {"key": "properties.subregion", "type": "str"},
        "server_key_name": {"key": "properties.serverKeyName", "type": "str"},
        "server_key_type": {"key": "properties.serverKeyType", "type": "str"},
        "uri": {"key": "properties.uri", "type": "str"},
        "thumbprint": {"key": "properties.thumbprint", "type": "str"},
        "auto_rotation_enabled": {"key": "properties.autoRotationEnabled", "type": "bool"},
    }

    def __init__(
        self,
        *,
        server_key_name: Optional[str] = None,
        server_key_type: Optional[Union[str, "_models.ServerKeyType"]] = None,
        auto_rotation_enabled: Optional[bool] = None,
        **kwargs
    ):
        """
        :keyword server_key_name: The name of the server key.
        :paramtype server_key_name: str
        :keyword server_key_type: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'.
         Known values are: "ServiceManaged" and "AzureKeyVault".
        :paramtype server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType
        :keyword auto_rotation_enabled: Key auto rotation opt-in flag. Either true or false.
        :paramtype auto_rotation_enabled: bool
        """
        super().__init__(**kwargs)
        self.kind = None
        self.location = None
        self.subregion = None
        self.server_key_name = server_key_name
        self.server_key_type = server_key_type
        self.uri = None
        self.thumbprint = None
        self.auto_rotation_enabled = auto_rotation_enabled


class EncryptionProtectorListResult(_serialization.Model):
    """A list of server encryption protectors.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.EncryptionProtector]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[EncryptionProtector]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class EndpointCertificate(ProxyResource):
    """Certificate used on an endpoint on the Managed Instance.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar public_blob: The certificate public blob.
    :vartype public_blob: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "public_blob": {"key": "properties.publicBlob", "type": "str"},
    }

    def __init__(self, *, public_blob: Optional[str] = None, **kwargs):
        """
        :keyword public_blob: The certificate public blob.
        :paramtype public_blob: str
        """
        super().__init__(**kwargs)
        self.public_blob = public_blob


class EndpointCertificateListResult(_serialization.Model):
    """A list of endpoint certificates on the target instance.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.EndpointCertificate]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[EndpointCertificate]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ExportDatabaseDefinition(_serialization.Model):
    """Contains the information necessary to perform export database operation.

    All required parameters must be populated in order to send to Azure.

    :ivar storage_key_type: Storage key type. Required. Known values are: "SharedAccessKey" and
     "StorageAccessKey".
    :vartype storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType
    :ivar storage_key: Storage key. Required.
    :vartype storage_key: str
    :ivar storage_uri: Storage Uri. Required.
    :vartype storage_uri: str
    :ivar administrator_login: Administrator login name. Required.
    :vartype administrator_login: str
    :ivar administrator_login_password: Administrator login password. Required.
    :vartype administrator_login_password: str
    :ivar authentication_type: Authentication type.
    :vartype authentication_type: str
    :ivar network_isolation: Optional resource information to enable network isolation for request.
    :vartype network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings
    """

    _validation = {
        "storage_key_type": {"required": True},
        "storage_key": {"required": True},
        "storage_uri": {"required": True},
        "administrator_login": {"required": True},
        "administrator_login_password": {"required": True},
    }

    _attribute_map = {
        "storage_key_type": {"key": "storageKeyType", "type": "str"},
        "storage_key": {"key": "storageKey", "type": "str"},
        "storage_uri": {"key": "storageUri", "type": "str"},
        "administrator_login": {"key": "administratorLogin", "type": "str"},
        "administrator_login_password": {"key": "administratorLoginPassword", "type": "str"},
        "authentication_type": {"key": "authenticationType", "type": "str"},
        "network_isolation": {"key": "networkIsolation", "type": "NetworkIsolationSettings"},
    }

    def __init__(
        self,
        *,
        storage_key_type: Union[str, "_models.StorageKeyType"],
        storage_key: str,
        storage_uri: str,
        administrator_login: str,
        administrator_login_password: str,
        authentication_type: Optional[str] = None,
        network_isolation: Optional["_models.NetworkIsolationSettings"] = None,
        **kwargs
    ):
        """
        :keyword storage_key_type: Storage key type. Required. Known values are: "SharedAccessKey" and
         "StorageAccessKey".
        :paramtype storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType
        :keyword storage_key: Storage key. Required.
        :paramtype storage_key: str
        :keyword storage_uri: Storage Uri. Required.
        :paramtype storage_uri: str
        :keyword administrator_login: Administrator login name. Required.
        :paramtype administrator_login: str
        :keyword administrator_login_password: Administrator login password. Required.
        :paramtype administrator_login_password: str
        :keyword authentication_type: Authentication type.
        :paramtype authentication_type: str
        :keyword network_isolation: Optional resource information to enable network isolation for
         request.
        :paramtype network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings
        """
        super().__init__(**kwargs)
        self.storage_key_type = storage_key_type
        self.storage_key = storage_key
        self.storage_uri = storage_uri
        self.administrator_login = administrator_login
        self.administrator_login_password = administrator_login_password
        self.authentication_type = authentication_type
        self.network_isolation = network_isolation


class ExtendedDatabaseBlobAuditingPolicy(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """An extended database blob auditing policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar predicate_expression: Specifies condition of where clause when creating an audit.
    :vartype predicate_expression: str
    :ivar retention_days: Specifies the number of days to keep in the audit logs in the storage
     account.
    :vartype retention_days: int
    :ivar audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit.

     The recommended set of action groups to use is the following combination - this will audit all
     the queries and stored procedures executed against the database, as well as successful and
     failed logins:

     BATCH_COMPLETED_GROUP,
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
     FAILED_DATABASE_AUTHENTICATION_GROUP.

     This above combination is also the set that is configured by default when enabling auditing
     from the Azure portal.

     The supported action groups to audit are (note: choose only specific groups that cover your
     auditing needs. Using unnecessary groups could lead to very large quantities of audit records):

     APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
     BACKUP_RESTORE_GROUP
     DATABASE_LOGOUT_GROUP
     DATABASE_OBJECT_CHANGE_GROUP
     DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
     DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
     DATABASE_OPERATION_GROUP
     DATABASE_PERMISSION_CHANGE_GROUP
     DATABASE_PRINCIPAL_CHANGE_GROUP
     DATABASE_PRINCIPAL_IMPERSONATION_GROUP
     DATABASE_ROLE_MEMBER_CHANGE_GROUP
     FAILED_DATABASE_AUTHENTICATION_GROUP
     SCHEMA_OBJECT_ACCESS_GROUP
     SCHEMA_OBJECT_CHANGE_GROUP
     SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
     SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
     USER_CHANGE_PASSWORD_GROUP
     BATCH_STARTED_GROUP
     BATCH_COMPLETED_GROUP
     DBCC_GROUP
     DATABASE_OWNERSHIP_CHANGE_GROUP
     DATABASE_CHANGE_GROUP
     LEDGER_OPERATION_GROUP

     These are groups that cover all sql statements and stored procedures executed against the
     database, and should not be used in combination with other groups as this will result in
     duplicate audit logs.

     For more information, see `Database-Level Audit Action Groups
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.

     For Database auditing policy, specific Actions can also be specified (note that Actions cannot
     be specified for Server auditing policy). The supported actions to audit are:
     SELECT
     UPDATE
     INSERT
     DELETE
     EXECUTE
     RECEIVE
     REFERENCES

     The general form for defining an action to be audited is:
     {action} ON {object} BY {principal}

     Note that :code:`<object>` in the above format can refer to an object like a table, view, or
     stored procedure, or an entire database or schema. For the latter cases, the forms
     DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively.

     For example:
     SELECT on dbo.myTable by public
     SELECT on DATABASE::myDatabase by public
     SELECT on SCHEMA::mySchema by public

     For more information, see `Database-Level Audit Actions
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_.
    :vartype audit_actions_and_groups: list[str]
    :ivar is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the
     storage's secondary key.
    :vartype is_storage_secondary_key_in_use: bool
    :ivar is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure
     Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.

     When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
     diagnostic logs category on the database should be also created.
     Note that for server level audit you should use the 'master' database as {databaseName}.

     Diagnostic Settings URI format:
     PUT
     https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_azure_monitor_target_enabled: bool
    :ivar queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before audit
     actions are forced to be processed.
     The default minimum value is 1000 (1 second). The maximum is 2,147,483,647.
    :vartype queue_delay_ms: int
    :ivar is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
     storage.
    :vartype is_managed_identity_in_use: bool
    :ivar state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled is required.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:


     #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
        For more information, see `Auditing to storage using Managed Identity authentication
     <https://go.microsoft.com/fwlink/?linkid=2114355>`_.
    :vartype storage_account_access_key: str
    :ivar storage_account_subscription_id: Specifies the blob storage subscription Id.
    :vartype storage_account_subscription_id: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "predicate_expression": {"key": "properties.predicateExpression", "type": "str"},
        "retention_days": {"key": "properties.retentionDays", "type": "int"},
        "audit_actions_and_groups": {"key": "properties.auditActionsAndGroups", "type": "[str]"},
        "is_storage_secondary_key_in_use": {"key": "properties.isStorageSecondaryKeyInUse", "type": "bool"},
        "is_azure_monitor_target_enabled": {"key": "properties.isAzureMonitorTargetEnabled", "type": "bool"},
        "queue_delay_ms": {"key": "properties.queueDelayMs", "type": "int"},
        "is_managed_identity_in_use": {"key": "properties.isManagedIdentityInUse", "type": "bool"},
        "state": {"key": "properties.state", "type": "str"},
        "storage_endpoint": {"key": "properties.storageEndpoint", "type": "str"},
        "storage_account_access_key": {"key": "properties.storageAccountAccessKey", "type": "str"},
        "storage_account_subscription_id": {"key": "properties.storageAccountSubscriptionId", "type": "str"},
    }

    def __init__(
        self,
        *,
        predicate_expression: Optional[str] = None,
        retention_days: Optional[int] = None,
        audit_actions_and_groups: Optional[List[str]] = None,
        is_storage_secondary_key_in_use: Optional[bool] = None,
        is_azure_monitor_target_enabled: Optional[bool] = None,
        queue_delay_ms: Optional[int] = None,
        is_managed_identity_in_use: Optional[bool] = None,
        state: Optional[Union[str, "_models.BlobAuditingPolicyState"]] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        storage_account_subscription_id: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword predicate_expression: Specifies condition of where clause when creating an audit.
        :paramtype predicate_expression: str
        :keyword retention_days: Specifies the number of days to keep in the audit logs in the storage
         account.
        :paramtype retention_days: int
        :keyword audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit.

         The recommended set of action groups to use is the following combination - this will audit all
         the queries and stored procedures executed against the database, as well as successful and
         failed logins:

         BATCH_COMPLETED_GROUP,
         SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
         FAILED_DATABASE_AUTHENTICATION_GROUP.

         This above combination is also the set that is configured by default when enabling auditing
         from the Azure portal.

         The supported action groups to audit are (note: choose only specific groups that cover your
         auditing needs. Using unnecessary groups could lead to very large quantities of audit records):

         APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
         BACKUP_RESTORE_GROUP
         DATABASE_LOGOUT_GROUP
         DATABASE_OBJECT_CHANGE_GROUP
         DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
         DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
         DATABASE_OPERATION_GROUP
         DATABASE_PERMISSION_CHANGE_GROUP
         DATABASE_PRINCIPAL_CHANGE_GROUP
         DATABASE_PRINCIPAL_IMPERSONATION_GROUP
         DATABASE_ROLE_MEMBER_CHANGE_GROUP
         FAILED_DATABASE_AUTHENTICATION_GROUP
         SCHEMA_OBJECT_ACCESS_GROUP
         SCHEMA_OBJECT_CHANGE_GROUP
         SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
         SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
         SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
         USER_CHANGE_PASSWORD_GROUP
         BATCH_STARTED_GROUP
         BATCH_COMPLETED_GROUP
         DBCC_GROUP
         DATABASE_OWNERSHIP_CHANGE_GROUP
         DATABASE_CHANGE_GROUP
         LEDGER_OPERATION_GROUP

         These are groups that cover all sql statements and stored procedures executed against the
         database, and should not be used in combination with other groups as this will result in
         duplicate audit logs.

         For more information, see `Database-Level Audit Action Groups
         <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.

         For Database auditing policy, specific Actions can also be specified (note that Actions cannot
         be specified for Server auditing policy). The supported actions to audit are:
         SELECT
         UPDATE
         INSERT
         DELETE
         EXECUTE
         RECEIVE
         REFERENCES

         The general form for defining an action to be audited is:
         {action} ON {object} BY {principal}

         Note that :code:`<object>` in the above format can refer to an object like a table, view, or
         stored procedure, or an entire database or schema. For the latter cases, the forms
         DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively.

         For example:
         SELECT on dbo.myTable by public
         SELECT on DATABASE::myDatabase by public
         SELECT on SCHEMA::mySchema by public

         For more information, see `Database-Level Audit Actions
         <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_.
        :paramtype audit_actions_and_groups: list[str]
        :keyword is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is
         the storage's secondary key.
        :paramtype is_storage_secondary_key_in_use: bool
        :keyword is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure
         Monitor.
         In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
         'IsAzureMonitorTargetEnabled' as true.

         When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
         diagnostic logs category on the database should be also created.
         Note that for server level audit you should use the 'master' database as {databaseName}.

         Diagnostic Settings URI format:
         PUT
         https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

         For more information, see `Diagnostic Settings REST API
         <https://go.microsoft.com/fwlink/?linkid=2033207>`_
         or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
        :paramtype is_azure_monitor_target_enabled: bool
        :keyword queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before
         audit actions are forced to be processed.
         The default minimum value is 1000 (1 second). The maximum is 2,147,483,647.
        :paramtype queue_delay_ms: int
        :keyword is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
         storage.
        :paramtype is_managed_identity_in_use: bool
        :keyword state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
         isAzureMonitorTargetEnabled are required. Known values are: "Enabled" and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
        :keyword storage_endpoint: Specifies the blob storage endpoint (e.g.
         https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or
         isAzureMonitorTargetEnabled is required.
        :paramtype storage_endpoint: str
        :keyword storage_account_access_key: Specifies the identifier key of the auditing storage
         account.
         If state is Enabled and storageEndpoint is specified, not specifying the
         storageAccountAccessKey will use SQL server system-assigned managed identity to access the
         storage.
         Prerequisites for using managed identity authentication:


         #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
         #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
         Contributor' RBAC role to the server identity.
            For more information, see `Auditing to storage using Managed Identity authentication
         <https://go.microsoft.com/fwlink/?linkid=2114355>`_.
        :paramtype storage_account_access_key: str
        :keyword storage_account_subscription_id: Specifies the blob storage subscription Id.
        :paramtype storage_account_subscription_id: str
        """
        super().__init__(**kwargs)
        self.predicate_expression = predicate_expression
        self.retention_days = retention_days
        self.audit_actions_and_groups = audit_actions_and_groups
        self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use
        self.is_azure_monitor_target_enabled = is_azure_monitor_target_enabled
        self.queue_delay_ms = queue_delay_ms
        self.is_managed_identity_in_use = is_managed_identity_in_use
        self.state = state
        self.storage_endpoint = storage_endpoint
        self.storage_account_access_key = storage_account_access_key
        self.storage_account_subscription_id = storage_account_subscription_id


class ExtendedDatabaseBlobAuditingPolicyListResult(_serialization.Model):
    """A list of database extended auditing settings.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ExtendedDatabaseBlobAuditingPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ExtendedServerBlobAuditingPolicy(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """An extended server blob auditing policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar is_devops_audit_enabled: Specifies the state of devops audit. If state is Enabled, devops
     logs will be sent to Azure Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled',
     'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true

     When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit'
     diagnostic logs category on the master database should also be created.

     Diagnostic Settings URI format:
     PUT
     https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_devops_audit_enabled: bool
    :ivar predicate_expression: Specifies condition of where clause when creating an audit.
    :vartype predicate_expression: str
    :ivar retention_days: Specifies the number of days to keep in the audit logs in the storage
     account.
    :vartype retention_days: int
    :ivar audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit.

     The recommended set of action groups to use is the following combination - this will audit all
     the queries and stored procedures executed against the database, as well as successful and
     failed logins:

     BATCH_COMPLETED_GROUP,
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
     FAILED_DATABASE_AUTHENTICATION_GROUP.

     This above combination is also the set that is configured by default when enabling auditing
     from the Azure portal.

     The supported action groups to audit are (note: choose only specific groups that cover your
     auditing needs. Using unnecessary groups could lead to very large quantities of audit records):

     APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
     BACKUP_RESTORE_GROUP
     DATABASE_LOGOUT_GROUP
     DATABASE_OBJECT_CHANGE_GROUP
     DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
     DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
     DATABASE_OPERATION_GROUP
     DATABASE_PERMISSION_CHANGE_GROUP
     DATABASE_PRINCIPAL_CHANGE_GROUP
     DATABASE_PRINCIPAL_IMPERSONATION_GROUP
     DATABASE_ROLE_MEMBER_CHANGE_GROUP
     FAILED_DATABASE_AUTHENTICATION_GROUP
     SCHEMA_OBJECT_ACCESS_GROUP
     SCHEMA_OBJECT_CHANGE_GROUP
     SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
     SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
     USER_CHANGE_PASSWORD_GROUP
     BATCH_STARTED_GROUP
     BATCH_COMPLETED_GROUP
     DBCC_GROUP
     DATABASE_OWNERSHIP_CHANGE_GROUP
     DATABASE_CHANGE_GROUP
     LEDGER_OPERATION_GROUP

     These are groups that cover all sql statements and stored procedures executed against the
     database, and should not be used in combination with other groups as this will result in
     duplicate audit logs.

     For more information, see `Database-Level Audit Action Groups
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.

     For Database auditing policy, specific Actions can also be specified (note that Actions cannot
     be specified for Server auditing policy). The supported actions to audit are:
     SELECT
     UPDATE
     INSERT
     DELETE
     EXECUTE
     RECEIVE
     REFERENCES

     The general form for defining an action to be audited is:
     {action} ON {object} BY {principal}

     Note that :code:`<object>` in the above format can refer to an object like a table, view, or
     stored procedure, or an entire database or schema. For the latter cases, the forms
     DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively.

     For example:
     SELECT on dbo.myTable by public
     SELECT on DATABASE::myDatabase by public
     SELECT on SCHEMA::mySchema by public

     For more information, see `Database-Level Audit Actions
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_.
    :vartype audit_actions_and_groups: list[str]
    :ivar is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the
     storage's secondary key.
    :vartype is_storage_secondary_key_in_use: bool
    :ivar is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure
     Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.

     When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
     diagnostic logs category on the database should be also created.
     Note that for server level audit you should use the 'master' database as {databaseName}.

     Diagnostic Settings URI format:
     PUT
     https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_azure_monitor_target_enabled: bool
    :ivar queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before audit
     actions are forced to be processed.
     The default minimum value is 1000 (1 second). The maximum is 2,147,483,647.
    :vartype queue_delay_ms: int
    :ivar is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
     storage.
    :vartype is_managed_identity_in_use: bool
    :ivar state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled is required.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:


     #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
        For more information, see `Auditing to storage using Managed Identity authentication
     <https://go.microsoft.com/fwlink/?linkid=2114355>`_.
    :vartype storage_account_access_key: str
    :ivar storage_account_subscription_id: Specifies the blob storage subscription Id.
    :vartype storage_account_subscription_id: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "is_devops_audit_enabled": {"key": "properties.isDevopsAuditEnabled", "type": "bool"},
        "predicate_expression": {"key": "properties.predicateExpression", "type": "str"},
        "retention_days": {"key": "properties.retentionDays", "type": "int"},
        "audit_actions_and_groups": {"key": "properties.auditActionsAndGroups", "type": "[str]"},
        "is_storage_secondary_key_in_use": {"key": "properties.isStorageSecondaryKeyInUse", "type": "bool"},
        "is_azure_monitor_target_enabled": {"key": "properties.isAzureMonitorTargetEnabled", "type": "bool"},
        "queue_delay_ms": {"key": "properties.queueDelayMs", "type": "int"},
        "is_managed_identity_in_use": {"key": "properties.isManagedIdentityInUse", "type": "bool"},
        "state": {"key": "properties.state", "type": "str"},
        "storage_endpoint": {"key": "properties.storageEndpoint", "type": "str"},
        "storage_account_access_key": {"key": "properties.storageAccountAccessKey", "type": "str"},
        "storage_account_subscription_id": {"key": "properties.storageAccountSubscriptionId", "type": "str"},
    }

    def __init__(
        self,
        *,
        is_devops_audit_enabled: Optional[bool] = None,
        predicate_expression: Optional[str] = None,
        retention_days: Optional[int] = None,
        audit_actions_and_groups: Optional[List[str]] = None,
        is_storage_secondary_key_in_use: Optional[bool] = None,
        is_azure_monitor_target_enabled: Optional[bool] = None,
        queue_delay_ms: Optional[int] = None,
        is_managed_identity_in_use: Optional[bool] = None,
        state: Optional[Union[str, "_models.BlobAuditingPolicyState"]] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        storage_account_subscription_id: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword is_devops_audit_enabled: Specifies the state of devops audit. If state is Enabled,
         devops logs will be sent to Azure Monitor.
         In order to send the events to Azure Monitor, specify 'State' as 'Enabled',
         'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true

         When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit'
         diagnostic logs category on the master database should also be created.

         Diagnostic Settings URI format:
         PUT
         https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

         For more information, see `Diagnostic Settings REST API
         <https://go.microsoft.com/fwlink/?linkid=2033207>`_
         or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
        :paramtype is_devops_audit_enabled: bool
        :keyword predicate_expression: Specifies condition of where clause when creating an audit.
        :paramtype predicate_expression: str
        :keyword retention_days: Specifies the number of days to keep in the audit logs in the storage
         account.
        :paramtype retention_days: int
        :keyword audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit.

         The recommended set of action groups to use is the following combination - this will audit all
         the queries and stored procedures executed against the database, as well as successful and
         failed logins:

         BATCH_COMPLETED_GROUP,
         SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
         FAILED_DATABASE_AUTHENTICATION_GROUP.

         This above combination is also the set that is configured by default when enabling auditing
         from the Azure portal.

         The supported action groups to audit are (note: choose only specific groups that cover your
         auditing needs. Using unnecessary groups could lead to very large quantities of audit records):

         APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
         BACKUP_RESTORE_GROUP
         DATABASE_LOGOUT_GROUP
         DATABASE_OBJECT_CHANGE_GROUP
         DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
         DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
         DATABASE_OPERATION_GROUP
         DATABASE_PERMISSION_CHANGE_GROUP
         DATABASE_PRINCIPAL_CHANGE_GROUP
         DATABASE_PRINCIPAL_IMPERSONATION_GROUP
         DATABASE_ROLE_MEMBER_CHANGE_GROUP
         FAILED_DATABASE_AUTHENTICATION_GROUP
         SCHEMA_OBJECT_ACCESS_GROUP
         SCHEMA_OBJECT_CHANGE_GROUP
         SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
         SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
         SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
         USER_CHANGE_PASSWORD_GROUP
         BATCH_STARTED_GROUP
         BATCH_COMPLETED_GROUP
         DBCC_GROUP
         DATABASE_OWNERSHIP_CHANGE_GROUP
         DATABASE_CHANGE_GROUP
         LEDGER_OPERATION_GROUP

         These are groups that cover all sql statements and stored procedures executed against the
         database, and should not be used in combination with other groups as this will result in
         duplicate audit logs.

         For more information, see `Database-Level Audit Action Groups
         <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.

         For Database auditing policy, specific Actions can also be specified (note that Actions cannot
         be specified for Server auditing policy). The supported actions to audit are:
         SELECT
         UPDATE
         INSERT
         DELETE
         EXECUTE
         RECEIVE
         REFERENCES

         The general form for defining an action to be audited is:
         {action} ON {object} BY {principal}

         Note that :code:`<object>` in the above format can refer to an object like a table, view, or
         stored procedure, or an entire database or schema. For the latter cases, the forms
         DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively.

         For example:
         SELECT on dbo.myTable by public
         SELECT on DATABASE::myDatabase by public
         SELECT on SCHEMA::mySchema by public

         For more information, see `Database-Level Audit Actions
         <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_.
        :paramtype audit_actions_and_groups: list[str]
        :keyword is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is
         the storage's secondary key.
        :paramtype is_storage_secondary_key_in_use: bool
        :keyword is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure
         Monitor.
         In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
         'IsAzureMonitorTargetEnabled' as true.

         When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
         diagnostic logs category on the database should be also created.
         Note that for server level audit you should use the 'master' database as {databaseName}.

         Diagnostic Settings URI format:
         PUT
         https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

         For more information, see `Diagnostic Settings REST API
         <https://go.microsoft.com/fwlink/?linkid=2033207>`_
         or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
        :paramtype is_azure_monitor_target_enabled: bool
        :keyword queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before
         audit actions are forced to be processed.
         The default minimum value is 1000 (1 second). The maximum is 2,147,483,647.
        :paramtype queue_delay_ms: int
        :keyword is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
         storage.
        :paramtype is_managed_identity_in_use: bool
        :keyword state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
         isAzureMonitorTargetEnabled are required. Known values are: "Enabled" and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
        :keyword storage_endpoint: Specifies the blob storage endpoint (e.g.
         https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or
         isAzureMonitorTargetEnabled is required.
        :paramtype storage_endpoint: str
        :keyword storage_account_access_key: Specifies the identifier key of the auditing storage
         account.
         If state is Enabled and storageEndpoint is specified, not specifying the
         storageAccountAccessKey will use SQL server system-assigned managed identity to access the
         storage.
         Prerequisites for using managed identity authentication:


         #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
         #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
         Contributor' RBAC role to the server identity.
            For more information, see `Auditing to storage using Managed Identity authentication
         <https://go.microsoft.com/fwlink/?linkid=2114355>`_.
        :paramtype storage_account_access_key: str
        :keyword storage_account_subscription_id: Specifies the blob storage subscription Id.
        :paramtype storage_account_subscription_id: str
        """
        super().__init__(**kwargs)
        self.is_devops_audit_enabled = is_devops_audit_enabled
        self.predicate_expression = predicate_expression
        self.retention_days = retention_days
        self.audit_actions_and_groups = audit_actions_and_groups
        self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use
        self.is_azure_monitor_target_enabled = is_azure_monitor_target_enabled
        self.queue_delay_ms = queue_delay_ms
        self.is_managed_identity_in_use = is_managed_identity_in_use
        self.state = state
        self.storage_endpoint = storage_endpoint
        self.storage_account_access_key = storage_account_access_key
        self.storage_account_subscription_id = storage_account_subscription_id


class ExtendedServerBlobAuditingPolicyListResult(_serialization.Model):
    """A list of server extended auditing settings.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ExtendedServerBlobAuditingPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class FailoverGroup(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A failover group.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar read_write_endpoint: Read-write endpoint of the failover group instance.
    :vartype read_write_endpoint: ~azure.mgmt.sql.models.FailoverGroupReadWriteEndpoint
    :ivar read_only_endpoint: Read-only endpoint of the failover group instance.
    :vartype read_only_endpoint: ~azure.mgmt.sql.models.FailoverGroupReadOnlyEndpoint
    :ivar replication_role: Local replication role of the failover group instance. Known values
     are: "Primary" and "Secondary".
    :vartype replication_role: str or ~azure.mgmt.sql.models.FailoverGroupReplicationRole
    :ivar replication_state: Replication state of the failover group instance.
    :vartype replication_state: str
    :ivar partner_servers: List of partner server information for the failover group.
    :vartype partner_servers: list[~azure.mgmt.sql.models.PartnerInfo]
    :ivar databases: List of databases in the failover group.
    :vartype databases: list[str]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"readonly": True},
        "replication_role": {"readonly": True},
        "replication_state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "tags": {"key": "tags", "type": "{str}"},
        "read_write_endpoint": {"key": "properties.readWriteEndpoint", "type": "FailoverGroupReadWriteEndpoint"},
        "read_only_endpoint": {"key": "properties.readOnlyEndpoint", "type": "FailoverGroupReadOnlyEndpoint"},
        "replication_role": {"key": "properties.replicationRole", "type": "str"},
        "replication_state": {"key": "properties.replicationState", "type": "str"},
        "partner_servers": {"key": "properties.partnerServers", "type": "[PartnerInfo]"},
        "databases": {"key": "properties.databases", "type": "[str]"},
    }

    def __init__(
        self,
        *,
        tags: Optional[Dict[str, str]] = None,
        read_write_endpoint: Optional["_models.FailoverGroupReadWriteEndpoint"] = None,
        read_only_endpoint: Optional["_models.FailoverGroupReadOnlyEndpoint"] = None,
        partner_servers: Optional[List["_models.PartnerInfo"]] = None,
        databases: Optional[List[str]] = None,
        **kwargs
    ):
        """
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword read_write_endpoint: Read-write endpoint of the failover group instance.
        :paramtype read_write_endpoint: ~azure.mgmt.sql.models.FailoverGroupReadWriteEndpoint
        :keyword read_only_endpoint: Read-only endpoint of the failover group instance.
        :paramtype read_only_endpoint: ~azure.mgmt.sql.models.FailoverGroupReadOnlyEndpoint
        :keyword partner_servers: List of partner server information for the failover group.
        :paramtype partner_servers: list[~azure.mgmt.sql.models.PartnerInfo]
        :keyword databases: List of databases in the failover group.
        :paramtype databases: list[str]
        """
        super().__init__(**kwargs)
        self.location = None
        self.tags = tags
        self.read_write_endpoint = read_write_endpoint
        self.read_only_endpoint = read_only_endpoint
        self.replication_role = None
        self.replication_state = None
        self.partner_servers = partner_servers
        self.databases = databases


class FailoverGroupListResult(_serialization.Model):
    """A list of failover groups.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.FailoverGroup]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[FailoverGroup]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class FailoverGroupReadOnlyEndpoint(_serialization.Model):
    """Read-only endpoint of the failover group instance.

    :ivar failover_policy: Failover policy of the read-only endpoint for the failover group. Known
     values are: "Disabled" and "Enabled".
    :vartype failover_policy: str or ~azure.mgmt.sql.models.ReadOnlyEndpointFailoverPolicy
    """

    _attribute_map = {
        "failover_policy": {"key": "failoverPolicy", "type": "str"},
    }

    def __init__(
        self, *, failover_policy: Optional[Union[str, "_models.ReadOnlyEndpointFailoverPolicy"]] = None, **kwargs
    ):
        """
        :keyword failover_policy: Failover policy of the read-only endpoint for the failover group.
         Known values are: "Disabled" and "Enabled".
        :paramtype failover_policy: str or ~azure.mgmt.sql.models.ReadOnlyEndpointFailoverPolicy
        """
        super().__init__(**kwargs)
        self.failover_policy = failover_policy


class FailoverGroupReadWriteEndpoint(_serialization.Model):
    """Read-write endpoint of the failover group instance.

    All required parameters must be populated in order to send to Azure.

    :ivar failover_policy: Failover policy of the read-write endpoint for the failover group. If
     failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Required.
     Known values are: "Manual" and "Automatic".
    :vartype failover_policy: str or ~azure.mgmt.sql.models.ReadWriteEndpointFailoverPolicy
    :ivar failover_with_data_loss_grace_period_minutes: Grace period before failover with data loss
     is attempted for the read-write endpoint. If failoverPolicy is Automatic then
     failoverWithDataLossGracePeriodMinutes is required.
    :vartype failover_with_data_loss_grace_period_minutes: int
    """

    _validation = {
        "failover_policy": {"required": True},
    }

    _attribute_map = {
        "failover_policy": {"key": "failoverPolicy", "type": "str"},
        "failover_with_data_loss_grace_period_minutes": {
            "key": "failoverWithDataLossGracePeriodMinutes",
            "type": "int",
        },
    }

    def __init__(
        self,
        *,
        failover_policy: Union[str, "_models.ReadWriteEndpointFailoverPolicy"],
        failover_with_data_loss_grace_period_minutes: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword failover_policy: Failover policy of the read-write endpoint for the failover group. If
         failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Required.
         Known values are: "Manual" and "Automatic".
        :paramtype failover_policy: str or ~azure.mgmt.sql.models.ReadWriteEndpointFailoverPolicy
        :keyword failover_with_data_loss_grace_period_minutes: Grace period before failover with data
         loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then
         failoverWithDataLossGracePeriodMinutes is required.
        :paramtype failover_with_data_loss_grace_period_minutes: int
        """
        super().__init__(**kwargs)
        self.failover_policy = failover_policy
        self.failover_with_data_loss_grace_period_minutes = failover_with_data_loss_grace_period_minutes


class FailoverGroupUpdate(_serialization.Model):
    """A failover group update request.

    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar read_write_endpoint: Read-write endpoint of the failover group instance.
    :vartype read_write_endpoint: ~azure.mgmt.sql.models.FailoverGroupReadWriteEndpoint
    :ivar read_only_endpoint: Read-only endpoint of the failover group instance.
    :vartype read_only_endpoint: ~azure.mgmt.sql.models.FailoverGroupReadOnlyEndpoint
    :ivar databases: List of databases in the failover group.
    :vartype databases: list[str]
    """

    _attribute_map = {
        "tags": {"key": "tags", "type": "{str}"},
        "read_write_endpoint": {"key": "properties.readWriteEndpoint", "type": "FailoverGroupReadWriteEndpoint"},
        "read_only_endpoint": {"key": "properties.readOnlyEndpoint", "type": "FailoverGroupReadOnlyEndpoint"},
        "databases": {"key": "properties.databases", "type": "[str]"},
    }

    def __init__(
        self,
        *,
        tags: Optional[Dict[str, str]] = None,
        read_write_endpoint: Optional["_models.FailoverGroupReadWriteEndpoint"] = None,
        read_only_endpoint: Optional["_models.FailoverGroupReadOnlyEndpoint"] = None,
        databases: Optional[List[str]] = None,
        **kwargs
    ):
        """
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword read_write_endpoint: Read-write endpoint of the failover group instance.
        :paramtype read_write_endpoint: ~azure.mgmt.sql.models.FailoverGroupReadWriteEndpoint
        :keyword read_only_endpoint: Read-only endpoint of the failover group instance.
        :paramtype read_only_endpoint: ~azure.mgmt.sql.models.FailoverGroupReadOnlyEndpoint
        :keyword databases: List of databases in the failover group.
        :paramtype databases: list[str]
        """
        super().__init__(**kwargs)
        self.tags = tags
        self.read_write_endpoint = read_write_endpoint
        self.read_only_endpoint = read_only_endpoint
        self.databases = databases


class ResourceWithWritableName(_serialization.Model):
    """ARM resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    """

    _validation = {
        "id": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
    }

    def __init__(self, *, name: Optional[str] = None, **kwargs):
        """
        :keyword name: Resource name.
        :paramtype name: str
        """
        super().__init__(**kwargs)
        self.id = None
        self.name = name
        self.type = None


class ProxyResourceWithWritableName(ResourceWithWritableName):
    """ARM proxy resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    """

    _validation = {
        "id": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
    }

    def __init__(self, *, name: Optional[str] = None, **kwargs):
        """
        :keyword name: Resource name.
        :paramtype name: str
        """
        super().__init__(name=name, **kwargs)


class FirewallRule(ProxyResourceWithWritableName):
    """A server firewall rule.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar start_ip_address: The start IP address of the firewall rule. Must be IPv4 format. Use
     value '0.0.0.0' for all Azure-internal IP addresses.
    :vartype start_ip_address: str
    :ivar end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be
     greater than or equal to startIpAddress. Use value '0.0.0.0' for all Azure-internal IP
     addresses.
    :vartype end_ip_address: str
    """

    _validation = {
        "id": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "start_ip_address": {"key": "properties.startIpAddress", "type": "str"},
        "end_ip_address": {"key": "properties.endIpAddress", "type": "str"},
    }

    def __init__(
        self,
        *,
        name: Optional[str] = None,
        start_ip_address: Optional[str] = None,
        end_ip_address: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword name: Resource name.
        :paramtype name: str
        :keyword start_ip_address: The start IP address of the firewall rule. Must be IPv4 format. Use
         value '0.0.0.0' for all Azure-internal IP addresses.
        :paramtype start_ip_address: str
        :keyword end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be
         greater than or equal to startIpAddress. Use value '0.0.0.0' for all Azure-internal IP
         addresses.
        :paramtype end_ip_address: str
        """
        super().__init__(name=name, **kwargs)
        self.start_ip_address = start_ip_address
        self.end_ip_address = end_ip_address


class FirewallRuleList(_serialization.Model):
    """A list of server firewall rules.

    :ivar values:
    :vartype values: list[~azure.mgmt.sql.models.FirewallRule]
    """

    _attribute_map = {
        "values": {"key": "values", "type": "[FirewallRule]"},
    }

    def __init__(self, *, values: Optional[List["_models.FirewallRule"]] = None, **kwargs):
        """
        :keyword values:
        :paramtype values: list[~azure.mgmt.sql.models.FirewallRule]
        """
        super().__init__(**kwargs)
        self.values = values


class FirewallRuleListResult(_serialization.Model):
    """The response to a list firewall rules request.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.FirewallRule]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[FirewallRule]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class GeoBackupPolicy(ProxyResource):
    """A database geo backup policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar kind: Kind of geo backup policy.  This is metadata used for the Azure portal experience.
    :vartype kind: str
    :ivar location: Backup policy location.
    :vartype location: str
    :ivar state: The state of the geo backup policy. Required. Known values are: "Disabled" and
     "Enabled".
    :vartype state: str or ~azure.mgmt.sql.models.GeoBackupPolicyState
    :ivar storage_type: The storage type of the geo backup policy.
    :vartype storage_type: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "kind": {"readonly": True},
        "location": {"readonly": True},
        "state": {"required": True},
        "storage_type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "kind": {"key": "kind", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
        "storage_type": {"key": "properties.storageType", "type": "str"},
    }

    def __init__(self, *, state: Union[str, "_models.GeoBackupPolicyState"], **kwargs):
        """
        :keyword state: The state of the geo backup policy. Required. Known values are: "Disabled" and
         "Enabled".
        :paramtype state: str or ~azure.mgmt.sql.models.GeoBackupPolicyState
        """
        super().__init__(**kwargs)
        self.kind = None
        self.location = None
        self.state = state
        self.storage_type = None


class GeoBackupPolicyListResult(_serialization.Model):
    """The response to a list geo backup policies request.

    :ivar value: The list of geo backup policies.
    :vartype value: list[~azure.mgmt.sql.models.GeoBackupPolicy]
    """

    _attribute_map = {
        "value": {"key": "value", "type": "[GeoBackupPolicy]"},
    }

    def __init__(self, *, value: Optional[List["_models.GeoBackupPolicy"]] = None, **kwargs):
        """
        :keyword value: The list of geo backup policies.
        :paramtype value: list[~azure.mgmt.sql.models.GeoBackupPolicy]
        """
        super().__init__(**kwargs)
        self.value = value


class ImportExistingDatabaseDefinition(_serialization.Model):
    """Contains the information necessary to perform import operation for existing database.

    All required parameters must be populated in order to send to Azure.

    :ivar storage_key_type: Storage key type. Required. Known values are: "SharedAccessKey" and
     "StorageAccessKey".
    :vartype storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType
    :ivar storage_key: Storage key. Required.
    :vartype storage_key: str
    :ivar storage_uri: Storage Uri. Required.
    :vartype storage_uri: str
    :ivar administrator_login: Administrator login name. Required.
    :vartype administrator_login: str
    :ivar administrator_login_password: Administrator login password. Required.
    :vartype administrator_login_password: str
    :ivar authentication_type: Authentication type.
    :vartype authentication_type: str
    :ivar network_isolation: Optional resource information to enable network isolation for request.
    :vartype network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings
    """

    _validation = {
        "storage_key_type": {"required": True},
        "storage_key": {"required": True},
        "storage_uri": {"required": True},
        "administrator_login": {"required": True},
        "administrator_login_password": {"required": True},
    }

    _attribute_map = {
        "storage_key_type": {"key": "storageKeyType", "type": "str"},
        "storage_key": {"key": "storageKey", "type": "str"},
        "storage_uri": {"key": "storageUri", "type": "str"},
        "administrator_login": {"key": "administratorLogin", "type": "str"},
        "administrator_login_password": {"key": "administratorLoginPassword", "type": "str"},
        "authentication_type": {"key": "authenticationType", "type": "str"},
        "network_isolation": {"key": "networkIsolation", "type": "NetworkIsolationSettings"},
    }

    def __init__(
        self,
        *,
        storage_key_type: Union[str, "_models.StorageKeyType"],
        storage_key: str,
        storage_uri: str,
        administrator_login: str,
        administrator_login_password: str,
        authentication_type: Optional[str] = None,
        network_isolation: Optional["_models.NetworkIsolationSettings"] = None,
        **kwargs
    ):
        """
        :keyword storage_key_type: Storage key type. Required. Known values are: "SharedAccessKey" and
         "StorageAccessKey".
        :paramtype storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType
        :keyword storage_key: Storage key. Required.
        :paramtype storage_key: str
        :keyword storage_uri: Storage Uri. Required.
        :paramtype storage_uri: str
        :keyword administrator_login: Administrator login name. Required.
        :paramtype administrator_login: str
        :keyword administrator_login_password: Administrator login password. Required.
        :paramtype administrator_login_password: str
        :keyword authentication_type: Authentication type.
        :paramtype authentication_type: str
        :keyword network_isolation: Optional resource information to enable network isolation for
         request.
        :paramtype network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings
        """
        super().__init__(**kwargs)
        self.storage_key_type = storage_key_type
        self.storage_key = storage_key
        self.storage_uri = storage_uri
        self.administrator_login = administrator_login
        self.administrator_login_password = administrator_login_password
        self.authentication_type = authentication_type
        self.network_isolation = network_isolation


class ImportExportExtensionsOperationListResult(_serialization.Model):
    """Import export operation extensions list.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ImportExportExtensionsOperationResult]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ImportExportExtensionsOperationResult]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ImportExportExtensionsOperationResult(ProxyResource):
    """An Extension operation result resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar request_id: Request Id.
    :vartype request_id: str
    :ivar request_type: Request type.
    :vartype request_type: str
    :ivar last_modified_time: Last modified time.
    :vartype last_modified_time: str
    :ivar server_name: Server name.
    :vartype server_name: str
    :ivar database_name: Database name.
    :vartype database_name: str
    :ivar status: Operation status.
    :vartype status: str
    :ivar error_message: Error message.
    :vartype error_message: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "request_id": {"readonly": True},
        "request_type": {"readonly": True},
        "last_modified_time": {"readonly": True},
        "server_name": {"readonly": True},
        "database_name": {"readonly": True},
        "status": {"readonly": True},
        "error_message": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "request_id": {"key": "properties.requestId", "type": "str"},
        "request_type": {"key": "properties.requestType", "type": "str"},
        "last_modified_time": {"key": "properties.lastModifiedTime", "type": "str"},
        "server_name": {"key": "properties.serverName", "type": "str"},
        "database_name": {"key": "properties.databaseName", "type": "str"},
        "status": {"key": "properties.status", "type": "str"},
        "error_message": {"key": "properties.errorMessage", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.request_id = None
        self.request_type = None
        self.last_modified_time = None
        self.server_name = None
        self.database_name = None
        self.status = None
        self.error_message = None


class ImportExportOperationResult(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """An ImportExport operation result resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar request_id: Request Id.
    :vartype request_id: str
    :ivar request_type: Request type.
    :vartype request_type: str
    :ivar queued_time: Queued time.
    :vartype queued_time: str
    :ivar last_modified_time: Last modified time.
    :vartype last_modified_time: str
    :ivar blob_uri: Blob Uri.
    :vartype blob_uri: str
    :ivar server_name: Server name.
    :vartype server_name: str
    :ivar database_name: Database name.
    :vartype database_name: str
    :ivar status: Operation status.
    :vartype status: str
    :ivar error_message: Error message.
    :vartype error_message: str
    :ivar private_endpoint_connections: Gets the status of private endpoints associated with this
     request.
    :vartype private_endpoint_connections:
     list[~azure.mgmt.sql.models.PrivateEndpointConnectionRequestStatus]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "request_id": {"readonly": True},
        "request_type": {"readonly": True},
        "queued_time": {"readonly": True},
        "last_modified_time": {"readonly": True},
        "blob_uri": {"readonly": True},
        "server_name": {"readonly": True},
        "database_name": {"readonly": True},
        "status": {"readonly": True},
        "error_message": {"readonly": True},
        "private_endpoint_connections": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "request_id": {"key": "properties.requestId", "type": "str"},
        "request_type": {"key": "properties.requestType", "type": "str"},
        "queued_time": {"key": "properties.queuedTime", "type": "str"},
        "last_modified_time": {"key": "properties.lastModifiedTime", "type": "str"},
        "blob_uri": {"key": "properties.blobUri", "type": "str"},
        "server_name": {"key": "properties.serverName", "type": "str"},
        "database_name": {"key": "properties.databaseName", "type": "str"},
        "status": {"key": "properties.status", "type": "str"},
        "error_message": {"key": "properties.errorMessage", "type": "str"},
        "private_endpoint_connections": {
            "key": "properties.privateEndpointConnections",
            "type": "[PrivateEndpointConnectionRequestStatus]",
        },
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.request_id = None
        self.request_type = None
        self.queued_time = None
        self.last_modified_time = None
        self.blob_uri = None
        self.server_name = None
        self.database_name = None
        self.status = None
        self.error_message = None
        self.private_endpoint_connections = None


class ImportNewDatabaseDefinition(_serialization.Model):  # pylint: disable=too-many-instance-attributes
    """Contains the information necessary to perform import operation for new database.

    All required parameters must be populated in order to send to Azure.

    :ivar database_name: Name of the import database.
    :vartype database_name: str
    :ivar edition: Edition of the import database.
    :vartype edition: str
    :ivar service_objective_name: Service level objective name of the import database.
    :vartype service_objective_name: str
    :ivar max_size_bytes: Max size in bytes for the import database.
    :vartype max_size_bytes: str
    :ivar storage_key_type: Storage key type. Required. Known values are: "SharedAccessKey" and
     "StorageAccessKey".
    :vartype storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType
    :ivar storage_key: Storage key. Required.
    :vartype storage_key: str
    :ivar storage_uri: Storage Uri. Required.
    :vartype storage_uri: str
    :ivar administrator_login: Administrator login name. Required.
    :vartype administrator_login: str
    :ivar administrator_login_password: Administrator login password. Required.
    :vartype administrator_login_password: str
    :ivar authentication_type: Authentication type.
    :vartype authentication_type: str
    :ivar network_isolation: Optional resource information to enable network isolation for request.
    :vartype network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings
    """

    _validation = {
        "storage_key_type": {"required": True},
        "storage_key": {"required": True},
        "storage_uri": {"required": True},
        "administrator_login": {"required": True},
        "administrator_login_password": {"required": True},
    }

    _attribute_map = {
        "database_name": {"key": "databaseName", "type": "str"},
        "edition": {"key": "edition", "type": "str"},
        "service_objective_name": {"key": "serviceObjectiveName", "type": "str"},
        "max_size_bytes": {"key": "maxSizeBytes", "type": "str"},
        "storage_key_type": {"key": "storageKeyType", "type": "str"},
        "storage_key": {"key": "storageKey", "type": "str"},
        "storage_uri": {"key": "storageUri", "type": "str"},
        "administrator_login": {"key": "administratorLogin", "type": "str"},
        "administrator_login_password": {"key": "administratorLoginPassword", "type": "str"},
        "authentication_type": {"key": "authenticationType", "type": "str"},
        "network_isolation": {"key": "networkIsolation", "type": "NetworkIsolationSettings"},
    }

    def __init__(
        self,
        *,
        storage_key_type: Union[str, "_models.StorageKeyType"],
        storage_key: str,
        storage_uri: str,
        administrator_login: str,
        administrator_login_password: str,
        database_name: Optional[str] = None,
        edition: Optional[str] = None,
        service_objective_name: Optional[str] = None,
        max_size_bytes: Optional[str] = None,
        authentication_type: Optional[str] = None,
        network_isolation: Optional["_models.NetworkIsolationSettings"] = None,
        **kwargs
    ):
        """
        :keyword database_name: Name of the import database.
        :paramtype database_name: str
        :keyword edition: Edition of the import database.
        :paramtype edition: str
        :keyword service_objective_name: Service level objective name of the import database.
        :paramtype service_objective_name: str
        :keyword max_size_bytes: Max size in bytes for the import database.
        :paramtype max_size_bytes: str
        :keyword storage_key_type: Storage key type. Required. Known values are: "SharedAccessKey" and
         "StorageAccessKey".
        :paramtype storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType
        :keyword storage_key: Storage key. Required.
        :paramtype storage_key: str
        :keyword storage_uri: Storage Uri. Required.
        :paramtype storage_uri: str
        :keyword administrator_login: Administrator login name. Required.
        :paramtype administrator_login: str
        :keyword administrator_login_password: Administrator login password. Required.
        :paramtype administrator_login_password: str
        :keyword authentication_type: Authentication type.
        :paramtype authentication_type: str
        :keyword network_isolation: Optional resource information to enable network isolation for
         request.
        :paramtype network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings
        """
        super().__init__(**kwargs)
        self.database_name = database_name
        self.edition = edition
        self.service_objective_name = service_objective_name
        self.max_size_bytes = max_size_bytes
        self.storage_key_type = storage_key_type
        self.storage_key = storage_key
        self.storage_uri = storage_uri
        self.administrator_login = administrator_login
        self.administrator_login_password = administrator_login_password
        self.authentication_type = authentication_type
        self.network_isolation = network_isolation


class InstanceFailoverGroup(ProxyResource):
    """An instance failover group.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar read_write_endpoint: Read-write endpoint of the failover group instance.
    :vartype read_write_endpoint: ~azure.mgmt.sql.models.InstanceFailoverGroupReadWriteEndpoint
    :ivar read_only_endpoint: Read-only endpoint of the failover group instance.
    :vartype read_only_endpoint: ~azure.mgmt.sql.models.InstanceFailoverGroupReadOnlyEndpoint
    :ivar replication_role: Local replication role of the failover group instance. Known values
     are: "Primary" and "Secondary".
    :vartype replication_role: str or ~azure.mgmt.sql.models.InstanceFailoverGroupReplicationRole
    :ivar replication_state: Replication state of the failover group instance.
    :vartype replication_state: str
    :ivar partner_regions: Partner region information for the failover group.
    :vartype partner_regions: list[~azure.mgmt.sql.models.PartnerRegionInfo]
    :ivar managed_instance_pairs: List of managed instance pairs in the failover group.
    :vartype managed_instance_pairs: list[~azure.mgmt.sql.models.ManagedInstancePairInfo]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "replication_role": {"readonly": True},
        "replication_state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "read_write_endpoint": {
            "key": "properties.readWriteEndpoint",
            "type": "InstanceFailoverGroupReadWriteEndpoint",
        },
        "read_only_endpoint": {"key": "properties.readOnlyEndpoint", "type": "InstanceFailoverGroupReadOnlyEndpoint"},
        "replication_role": {"key": "properties.replicationRole", "type": "str"},
        "replication_state": {"key": "properties.replicationState", "type": "str"},
        "partner_regions": {"key": "properties.partnerRegions", "type": "[PartnerRegionInfo]"},
        "managed_instance_pairs": {"key": "properties.managedInstancePairs", "type": "[ManagedInstancePairInfo]"},
    }

    def __init__(
        self,
        *,
        read_write_endpoint: Optional["_models.InstanceFailoverGroupReadWriteEndpoint"] = None,
        read_only_endpoint: Optional["_models.InstanceFailoverGroupReadOnlyEndpoint"] = None,
        partner_regions: Optional[List["_models.PartnerRegionInfo"]] = None,
        managed_instance_pairs: Optional[List["_models.ManagedInstancePairInfo"]] = None,
        **kwargs
    ):
        """
        :keyword read_write_endpoint: Read-write endpoint of the failover group instance.
        :paramtype read_write_endpoint: ~azure.mgmt.sql.models.InstanceFailoverGroupReadWriteEndpoint
        :keyword read_only_endpoint: Read-only endpoint of the failover group instance.
        :paramtype read_only_endpoint: ~azure.mgmt.sql.models.InstanceFailoverGroupReadOnlyEndpoint
        :keyword partner_regions: Partner region information for the failover group.
        :paramtype partner_regions: list[~azure.mgmt.sql.models.PartnerRegionInfo]
        :keyword managed_instance_pairs: List of managed instance pairs in the failover group.
        :paramtype managed_instance_pairs: list[~azure.mgmt.sql.models.ManagedInstancePairInfo]
        """
        super().__init__(**kwargs)
        self.read_write_endpoint = read_write_endpoint
        self.read_only_endpoint = read_only_endpoint
        self.replication_role = None
        self.replication_state = None
        self.partner_regions = partner_regions
        self.managed_instance_pairs = managed_instance_pairs


class InstanceFailoverGroupListResult(_serialization.Model):
    """A list of instance failover groups.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.InstanceFailoverGroup]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[InstanceFailoverGroup]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class InstanceFailoverGroupReadOnlyEndpoint(_serialization.Model):
    """Read-only endpoint of the failover group instance.

    :ivar failover_policy: Failover policy of the read-only endpoint for the failover group. Known
     values are: "Disabled" and "Enabled".
    :vartype failover_policy: str or ~azure.mgmt.sql.models.ReadOnlyEndpointFailoverPolicy
    """

    _attribute_map = {
        "failover_policy": {"key": "failoverPolicy", "type": "str"},
    }

    def __init__(
        self, *, failover_policy: Optional[Union[str, "_models.ReadOnlyEndpointFailoverPolicy"]] = None, **kwargs
    ):
        """
        :keyword failover_policy: Failover policy of the read-only endpoint for the failover group.
         Known values are: "Disabled" and "Enabled".
        :paramtype failover_policy: str or ~azure.mgmt.sql.models.ReadOnlyEndpointFailoverPolicy
        """
        super().__init__(**kwargs)
        self.failover_policy = failover_policy


class InstanceFailoverGroupReadWriteEndpoint(_serialization.Model):
    """Read-write endpoint of the failover group instance.

    All required parameters must be populated in order to send to Azure.

    :ivar failover_policy: Failover policy of the read-write endpoint for the failover group. If
     failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Required.
     Known values are: "Manual" and "Automatic".
    :vartype failover_policy: str or ~azure.mgmt.sql.models.ReadWriteEndpointFailoverPolicy
    :ivar failover_with_data_loss_grace_period_minutes: Grace period before failover with data loss
     is attempted for the read-write endpoint. If failoverPolicy is Automatic then
     failoverWithDataLossGracePeriodMinutes is required.
    :vartype failover_with_data_loss_grace_period_minutes: int
    """

    _validation = {
        "failover_policy": {"required": True},
    }

    _attribute_map = {
        "failover_policy": {"key": "failoverPolicy", "type": "str"},
        "failover_with_data_loss_grace_period_minutes": {
            "key": "failoverWithDataLossGracePeriodMinutes",
            "type": "int",
        },
    }

    def __init__(
        self,
        *,
        failover_policy: Union[str, "_models.ReadWriteEndpointFailoverPolicy"],
        failover_with_data_loss_grace_period_minutes: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword failover_policy: Failover policy of the read-write endpoint for the failover group. If
         failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Required.
         Known values are: "Manual" and "Automatic".
        :paramtype failover_policy: str or ~azure.mgmt.sql.models.ReadWriteEndpointFailoverPolicy
        :keyword failover_with_data_loss_grace_period_minutes: Grace period before failover with data
         loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then
         failoverWithDataLossGracePeriodMinutes is required.
        :paramtype failover_with_data_loss_grace_period_minutes: int
        """
        super().__init__(**kwargs)
        self.failover_policy = failover_policy
        self.failover_with_data_loss_grace_period_minutes = failover_with_data_loss_grace_period_minutes


class InstancePool(TrackedResource):
    """An Azure SQL instance pool.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location. Required.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar sku: The name and tier of the SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar subnet_id: Resource ID of the subnet to place this instance pool in.
    :vartype subnet_id: str
    :ivar v_cores: Count of vCores belonging to this instance pool.
    :vartype v_cores: int
    :ivar license_type: The license type. Possible values are 'LicenseIncluded' (price for SQL
     license is included) and 'BasePrice' (without SQL license price). Known values are:
     "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.InstancePoolLicenseType
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"required": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "tags": {"key": "tags", "type": "{str}"},
        "sku": {"key": "sku", "type": "Sku"},
        "subnet_id": {"key": "properties.subnetId", "type": "str"},
        "v_cores": {"key": "properties.vCores", "type": "int"},
        "license_type": {"key": "properties.licenseType", "type": "str"},
    }

    def __init__(
        self,
        *,
        location: str,
        tags: Optional[Dict[str, str]] = None,
        sku: Optional["_models.Sku"] = None,
        subnet_id: Optional[str] = None,
        v_cores: Optional[int] = None,
        license_type: Optional[Union[str, "_models.InstancePoolLicenseType"]] = None,
        **kwargs
    ):
        """
        :keyword location: Resource location. Required.
        :paramtype location: str
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword sku: The name and tier of the SKU.
        :paramtype sku: ~azure.mgmt.sql.models.Sku
        :keyword subnet_id: Resource ID of the subnet to place this instance pool in.
        :paramtype subnet_id: str
        :keyword v_cores: Count of vCores belonging to this instance pool.
        :paramtype v_cores: int
        :keyword license_type: The license type. Possible values are 'LicenseIncluded' (price for SQL
         license is included) and 'BasePrice' (without SQL license price). Known values are:
         "LicenseIncluded" and "BasePrice".
        :paramtype license_type: str or ~azure.mgmt.sql.models.InstancePoolLicenseType
        """
        super().__init__(location=location, tags=tags, **kwargs)
        self.sku = sku
        self.subnet_id = subnet_id
        self.v_cores = v_cores
        self.license_type = license_type


class InstancePoolEditionCapability(_serialization.Model):
    """The instance pool capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The instance pool version name.
    :vartype name: str
    :ivar supported_families: The supported families.
    :vartype supported_families: list[~azure.mgmt.sql.models.InstancePoolFamilyCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "supported_families": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "supported_families": {"key": "supportedFamilies", "type": "[InstancePoolFamilyCapability]"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.supported_families = None
        self.status = None
        self.reason = reason


class InstancePoolFamilyCapability(_serialization.Model):
    """The instance pool family capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: Family name.
    :vartype name: str
    :ivar supported_license_types: List of supported license types.
    :vartype supported_license_types: list[~azure.mgmt.sql.models.LicenseTypeCapability]
    :ivar supported_vcores_values: List of supported virtual cores values.
    :vartype supported_vcores_values: list[~azure.mgmt.sql.models.InstancePoolVcoresCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "supported_license_types": {"readonly": True},
        "supported_vcores_values": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "supported_license_types": {"key": "supportedLicenseTypes", "type": "[LicenseTypeCapability]"},
        "supported_vcores_values": {"key": "supportedVcoresValues", "type": "[InstancePoolVcoresCapability]"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.supported_license_types = None
        self.supported_vcores_values = None
        self.status = None
        self.reason = reason


class InstancePoolListResult(_serialization.Model):
    """A list of Azure SQL instance pools.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.InstancePool]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[InstancePool]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class InstancePoolUpdate(_serialization.Model):
    """An update to an Instance pool.

    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    _attribute_map = {
        "tags": {"key": "tags", "type": "{str}"},
    }

    def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs):
        """
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        """
        super().__init__(**kwargs)
        self.tags = tags


class InstancePoolVcoresCapability(_serialization.Model):
    """The managed instance virtual cores capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The virtual cores identifier.
    :vartype name: str
    :ivar value: The virtual cores value.
    :vartype value: int
    :ivar storage_limit: Storage limit.
    :vartype storage_limit: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "value": {"readonly": True},
        "storage_limit": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "value": {"key": "value", "type": "int"},
        "storage_limit": {"key": "storageLimit", "type": "MaxSizeCapability"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.value = None
        self.storage_limit = None
        self.status = None
        self.reason = reason


class IPv6FirewallRule(ProxyResourceWithWritableName):
    """An IPv6 server firewall rule.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar start_i_pv6_address: The start IP address of the firewall rule. Must be IPv6 format.
    :vartype start_i_pv6_address: str
    :ivar end_i_pv6_address: The end IP address of the firewall rule. Must be IPv6 format. Must be
     greater than or equal to startIpAddress.
    :vartype end_i_pv6_address: str
    """

    _validation = {
        "id": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "start_i_pv6_address": {"key": "properties.startIPv6Address", "type": "str"},
        "end_i_pv6_address": {"key": "properties.endIPv6Address", "type": "str"},
    }

    def __init__(
        self,
        *,
        name: Optional[str] = None,
        start_i_pv6_address: Optional[str] = None,
        end_i_pv6_address: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword name: Resource name.
        :paramtype name: str
        :keyword start_i_pv6_address: The start IP address of the firewall rule. Must be IPv6 format.
        :paramtype start_i_pv6_address: str
        :keyword end_i_pv6_address: The end IP address of the firewall rule. Must be IPv6 format. Must
         be greater than or equal to startIpAddress.
        :paramtype end_i_pv6_address: str
        """
        super().__init__(name=name, **kwargs)
        self.start_i_pv6_address = start_i_pv6_address
        self.end_i_pv6_address = end_i_pv6_address


class IPv6FirewallRuleListResult(_serialization.Model):
    """The response to a list IPv6 firewall rules request.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.IPv6FirewallRule]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[IPv6FirewallRule]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class Job(ProxyResource):
    """A job.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar description: User-defined description of the job.
    :vartype description: str
    :ivar version: The job version number.
    :vartype version: int
    :ivar schedule: Schedule properties of the job.
    :vartype schedule: ~azure.mgmt.sql.models.JobSchedule
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "version": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "description": {"key": "properties.description", "type": "str"},
        "version": {"key": "properties.version", "type": "int"},
        "schedule": {"key": "properties.schedule", "type": "JobSchedule"},
    }

    def __init__(self, *, description: str = "", schedule: Optional["_models.JobSchedule"] = None, **kwargs):
        """
        :keyword description: User-defined description of the job.
        :paramtype description: str
        :keyword schedule: Schedule properties of the job.
        :paramtype schedule: ~azure.mgmt.sql.models.JobSchedule
        """
        super().__init__(**kwargs)
        self.description = description
        self.version = None
        self.schedule = schedule


class JobAgent(TrackedResource):
    """An Azure SQL job agent.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location. Required.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar sku: The name and tier of the SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar database_id: Resource ID of the database to store job metadata in.
    :vartype database_id: str
    :ivar state: The state of the job agent. Known values are: "Creating", "Ready", "Updating",
     "Deleting", and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.JobAgentState
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"required": True},
        "state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "tags": {"key": "tags", "type": "{str}"},
        "sku": {"key": "sku", "type": "Sku"},
        "database_id": {"key": "properties.databaseId", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
    }

    def __init__(
        self,
        *,
        location: str,
        tags: Optional[Dict[str, str]] = None,
        sku: Optional["_models.Sku"] = None,
        database_id: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword location: Resource location. Required.
        :paramtype location: str
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword sku: The name and tier of the SKU.
        :paramtype sku: ~azure.mgmt.sql.models.Sku
        :keyword database_id: Resource ID of the database to store job metadata in.
        :paramtype database_id: str
        """
        super().__init__(location=location, tags=tags, **kwargs)
        self.sku = sku
        self.database_id = database_id
        self.state = None


class JobAgentListResult(_serialization.Model):
    """A list of Azure SQL job agents.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.JobAgent]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[JobAgent]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class JobAgentUpdate(_serialization.Model):
    """An update to an Azure SQL job agent.

    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    """

    _attribute_map = {
        "tags": {"key": "tags", "type": "{str}"},
    }

    def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs):
        """
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        """
        super().__init__(**kwargs)
        self.tags = tags


class JobCredential(ProxyResource):
    """A stored credential that can be used by a job to connect to target databases.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar username: The credential user name.
    :vartype username: str
    :ivar password: The credential password.
    :vartype password: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "username": {"key": "properties.username", "type": "str"},
        "password": {"key": "properties.password", "type": "str"},
    }

    def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs):
        """
        :keyword username: The credential user name.
        :paramtype username: str
        :keyword password: The credential password.
        :paramtype password: str
        """
        super().__init__(**kwargs)
        self.username = username
        self.password = password


class JobCredentialListResult(_serialization.Model):
    """A list of job credentials.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.JobCredential]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[JobCredential]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class JobExecution(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """An execution of a job.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar job_version: The job version number.
    :vartype job_version: int
    :ivar step_name: The job step name.
    :vartype step_name: str
    :ivar step_id: The job step id.
    :vartype step_id: int
    :ivar job_execution_id: The unique identifier of the job execution.
    :vartype job_execution_id: str
    :ivar lifecycle: The detailed state of the job execution. Known values are: "Created",
     "InProgress", "WaitingForChildJobExecutions", "WaitingForRetry", "Succeeded",
     "SucceededWithSkipped", "Failed", "TimedOut", "Canceled", and "Skipped".
    :vartype lifecycle: str or ~azure.mgmt.sql.models.JobExecutionLifecycle
    :ivar provisioning_state: The ARM provisioning state of the job execution. Known values are:
     "Created", "InProgress", "Succeeded", "Failed", and "Canceled".
    :vartype provisioning_state: str or ~azure.mgmt.sql.models.ProvisioningState
    :ivar create_time: The time that the job execution was created.
    :vartype create_time: ~datetime.datetime
    :ivar start_time: The time that the job execution started.
    :vartype start_time: ~datetime.datetime
    :ivar end_time: The time that the job execution completed.
    :vartype end_time: ~datetime.datetime
    :ivar current_attempts: Number of times the job execution has been attempted.
    :vartype current_attempts: int
    :ivar current_attempt_start_time: Start time of the current attempt.
    :vartype current_attempt_start_time: ~datetime.datetime
    :ivar last_message: The last status or error message.
    :vartype last_message: str
    :ivar target: The target that this execution is executed on.
    :vartype target: ~azure.mgmt.sql.models.JobExecutionTarget
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "job_version": {"readonly": True},
        "step_name": {"readonly": True},
        "step_id": {"readonly": True},
        "job_execution_id": {"readonly": True},
        "lifecycle": {"readonly": True},
        "provisioning_state": {"readonly": True},
        "create_time": {"readonly": True},
        "start_time": {"readonly": True},
        "end_time": {"readonly": True},
        "current_attempt_start_time": {"readonly": True},
        "last_message": {"readonly": True},
        "target": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "job_version": {"key": "properties.jobVersion", "type": "int"},
        "step_name": {"key": "properties.stepName", "type": "str"},
        "step_id": {"key": "properties.stepId", "type": "int"},
        "job_execution_id": {"key": "properties.jobExecutionId", "type": "str"},
        "lifecycle": {"key": "properties.lifecycle", "type": "str"},
        "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
        "create_time": {"key": "properties.createTime", "type": "iso-8601"},
        "start_time": {"key": "properties.startTime", "type": "iso-8601"},
        "end_time": {"key": "properties.endTime", "type": "iso-8601"},
        "current_attempts": {"key": "properties.currentAttempts", "type": "int"},
        "current_attempt_start_time": {"key": "properties.currentAttemptStartTime", "type": "iso-8601"},
        "last_message": {"key": "properties.lastMessage", "type": "str"},
        "target": {"key": "properties.target", "type": "JobExecutionTarget"},
    }

    def __init__(self, *, current_attempts: Optional[int] = None, **kwargs):
        """
        :keyword current_attempts: Number of times the job execution has been attempted.
        :paramtype current_attempts: int
        """
        super().__init__(**kwargs)
        self.job_version = None
        self.step_name = None
        self.step_id = None
        self.job_execution_id = None
        self.lifecycle = None
        self.provisioning_state = None
        self.create_time = None
        self.start_time = None
        self.end_time = None
        self.current_attempts = current_attempts
        self.current_attempt_start_time = None
        self.last_message = None
        self.target = None


class JobExecutionListResult(_serialization.Model):
    """A list of job executions.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.JobExecution]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[JobExecution]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class JobExecutionTarget(_serialization.Model):
    """The target that a job execution is executed on.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar type: The type of the target. Known values are: "TargetGroup", "SqlDatabase",
     "SqlElasticPool", "SqlShardMap", and "SqlServer".
    :vartype type: str or ~azure.mgmt.sql.models.JobTargetType
    :ivar server_name: The server name.
    :vartype server_name: str
    :ivar database_name: The database name.
    :vartype database_name: str
    """

    _validation = {
        "type": {"readonly": True},
        "server_name": {"readonly": True},
        "database_name": {"readonly": True},
    }

    _attribute_map = {
        "type": {"key": "type", "type": "str"},
        "server_name": {"key": "serverName", "type": "str"},
        "database_name": {"key": "databaseName", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.type = None
        self.server_name = None
        self.database_name = None


class JobListResult(_serialization.Model):
    """A list of jobs.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.Job]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[Job]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class JobSchedule(_serialization.Model):
    """Scheduling properties of a job.

    :ivar start_time: Schedule start time.
    :vartype start_time: ~datetime.datetime
    :ivar end_time: Schedule end time.
    :vartype end_time: ~datetime.datetime
    :ivar type: Schedule interval type. Known values are: "Once" and "Recurring".
    :vartype type: str or ~azure.mgmt.sql.models.JobScheduleType
    :ivar enabled: Whether or not the schedule is enabled.
    :vartype enabled: bool
    :ivar interval: Value of the schedule's recurring interval, if the ScheduleType is recurring.
     ISO8601 duration format.
    :vartype interval: str
    """

    _attribute_map = {
        "start_time": {"key": "startTime", "type": "iso-8601"},
        "end_time": {"key": "endTime", "type": "iso-8601"},
        "type": {"key": "type", "type": "str"},
        "enabled": {"key": "enabled", "type": "bool"},
        "interval": {"key": "interval", "type": "str"},
    }

    def __init__(
        self,
        *,
        start_time: datetime.datetime = "0001-01-01T00:00:00+00:00",
        end_time: datetime.datetime = "9999-12-31T11:59:59+00:00",
        type: Union[str, "_models.JobScheduleType"] = "Once",
        enabled: Optional[bool] = None,
        interval: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword start_time: Schedule start time.
        :paramtype start_time: ~datetime.datetime
        :keyword end_time: Schedule end time.
        :paramtype end_time: ~datetime.datetime
        :keyword type: Schedule interval type. Known values are: "Once" and "Recurring".
        :paramtype type: str or ~azure.mgmt.sql.models.JobScheduleType
        :keyword enabled: Whether or not the schedule is enabled.
        :paramtype enabled: bool
        :keyword interval: Value of the schedule's recurring interval, if the ScheduleType is
         recurring. ISO8601 duration format.
        :paramtype interval: str
        """
        super().__init__(**kwargs)
        self.start_time = start_time
        self.end_time = end_time
        self.type = type
        self.enabled = enabled
        self.interval = interval


class JobStep(ProxyResource):
    """A job step.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar step_id: The job step's index within the job. If not specified when creating the job
     step, it will be created as the last step. If not specified when updating the job step, the
     step id is not modified.
    :vartype step_id: int
    :ivar target_group: The resource ID of the target group that the job step will be executed on.
    :vartype target_group: str
    :ivar credential: The resource ID of the job credential that will be used to connect to the
     targets.
    :vartype credential: str
    :ivar action: The action payload of the job step.
    :vartype action: ~azure.mgmt.sql.models.JobStepAction
    :ivar output: Output destination properties of the job step.
    :vartype output: ~azure.mgmt.sql.models.JobStepOutput
    :ivar execution_options: Execution options for the job step.
    :vartype execution_options: ~azure.mgmt.sql.models.JobStepExecutionOptions
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "step_id": {"key": "properties.stepId", "type": "int"},
        "target_group": {"key": "properties.targetGroup", "type": "str"},
        "credential": {"key": "properties.credential", "type": "str"},
        "action": {"key": "properties.action", "type": "JobStepAction"},
        "output": {"key": "properties.output", "type": "JobStepOutput"},
        "execution_options": {"key": "properties.executionOptions", "type": "JobStepExecutionOptions"},
    }

    def __init__(
        self,
        *,
        step_id: Optional[int] = None,
        target_group: Optional[str] = None,
        credential: Optional[str] = None,
        action: Optional["_models.JobStepAction"] = None,
        output: Optional["_models.JobStepOutput"] = None,
        execution_options: Optional["_models.JobStepExecutionOptions"] = None,
        **kwargs
    ):
        """
        :keyword step_id: The job step's index within the job. If not specified when creating the job
         step, it will be created as the last step. If not specified when updating the job step, the
         step id is not modified.
        :paramtype step_id: int
        :keyword target_group: The resource ID of the target group that the job step will be executed
         on.
        :paramtype target_group: str
        :keyword credential: The resource ID of the job credential that will be used to connect to the
         targets.
        :paramtype credential: str
        :keyword action: The action payload of the job step.
        :paramtype action: ~azure.mgmt.sql.models.JobStepAction
        :keyword output: Output destination properties of the job step.
        :paramtype output: ~azure.mgmt.sql.models.JobStepOutput
        :keyword execution_options: Execution options for the job step.
        :paramtype execution_options: ~azure.mgmt.sql.models.JobStepExecutionOptions
        """
        super().__init__(**kwargs)
        self.step_id = step_id
        self.target_group = target_group
        self.credential = credential
        self.action = action
        self.output = output
        self.execution_options = execution_options


class JobStepAction(_serialization.Model):
    """The action to be executed by a job step.

    All required parameters must be populated in order to send to Azure.

    :ivar type: Type of action being executed by the job step. "TSql"
    :vartype type: str or ~azure.mgmt.sql.models.JobStepActionType
    :ivar source: The source of the action to execute. "Inline"
    :vartype source: str or ~azure.mgmt.sql.models.JobStepActionSource
    :ivar value: The action value, for example the text of the T-SQL script to execute. Required.
    :vartype value: str
    """

    _validation = {
        "value": {"required": True},
    }

    _attribute_map = {
        "type": {"key": "type", "type": "str"},
        "source": {"key": "source", "type": "str"},
        "value": {"key": "value", "type": "str"},
    }

    def __init__(
        self,
        *,
        value: str,
        type: Union[str, "_models.JobStepActionType"] = "TSql",
        source: Union[str, "_models.JobStepActionSource"] = "Inline",
        **kwargs
    ):
        """
        :keyword type: Type of action being executed by the job step. "TSql"
        :paramtype type: str or ~azure.mgmt.sql.models.JobStepActionType
        :keyword source: The source of the action to execute. "Inline"
        :paramtype source: str or ~azure.mgmt.sql.models.JobStepActionSource
        :keyword value: The action value, for example the text of the T-SQL script to execute.
         Required.
        :paramtype value: str
        """
        super().__init__(**kwargs)
        self.type = type
        self.source = source
        self.value = value


class JobStepExecutionOptions(_serialization.Model):
    """The execution options of a job step.

    :ivar timeout_seconds: Execution timeout for the job step.
    :vartype timeout_seconds: int
    :ivar retry_attempts: Maximum number of times the job step will be reattempted if the first
     attempt fails.
    :vartype retry_attempts: int
    :ivar initial_retry_interval_seconds: Initial delay between retries for job step execution.
    :vartype initial_retry_interval_seconds: int
    :ivar maximum_retry_interval_seconds: The maximum amount of time to wait between retries for
     job step execution.
    :vartype maximum_retry_interval_seconds: int
    :ivar retry_interval_backoff_multiplier: The backoff multiplier for the time between retries.
    :vartype retry_interval_backoff_multiplier: float
    """

    _attribute_map = {
        "timeout_seconds": {"key": "timeoutSeconds", "type": "int"},
        "retry_attempts": {"key": "retryAttempts", "type": "int"},
        "initial_retry_interval_seconds": {"key": "initialRetryIntervalSeconds", "type": "int"},
        "maximum_retry_interval_seconds": {"key": "maximumRetryIntervalSeconds", "type": "int"},
        "retry_interval_backoff_multiplier": {"key": "retryIntervalBackoffMultiplier", "type": "float"},
    }

    def __init__(
        self,
        *,
        timeout_seconds: int = 43200,
        retry_attempts: int = 10,
        initial_retry_interval_seconds: int = 1,
        maximum_retry_interval_seconds: int = 120,
        retry_interval_backoff_multiplier: float = 2,
        **kwargs
    ):
        """
        :keyword timeout_seconds: Execution timeout for the job step.
        :paramtype timeout_seconds: int
        :keyword retry_attempts: Maximum number of times the job step will be reattempted if the first
         attempt fails.
        :paramtype retry_attempts: int
        :keyword initial_retry_interval_seconds: Initial delay between retries for job step execution.
        :paramtype initial_retry_interval_seconds: int
        :keyword maximum_retry_interval_seconds: The maximum amount of time to wait between retries for
         job step execution.
        :paramtype maximum_retry_interval_seconds: int
        :keyword retry_interval_backoff_multiplier: The backoff multiplier for the time between
         retries.
        :paramtype retry_interval_backoff_multiplier: float
        """
        super().__init__(**kwargs)
        self.timeout_seconds = timeout_seconds
        self.retry_attempts = retry_attempts
        self.initial_retry_interval_seconds = initial_retry_interval_seconds
        self.maximum_retry_interval_seconds = maximum_retry_interval_seconds
        self.retry_interval_backoff_multiplier = retry_interval_backoff_multiplier


class JobStepListResult(_serialization.Model):
    """A list of job steps.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.JobStep]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[JobStep]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class JobStepOutput(_serialization.Model):
    """The output configuration of a job step.

    All required parameters must be populated in order to send to Azure.

    :ivar type: The output destination type. "SqlDatabase"
    :vartype type: str or ~azure.mgmt.sql.models.JobStepOutputType
    :ivar subscription_id: The output destination subscription id.
    :vartype subscription_id: str
    :ivar resource_group_name: The output destination resource group.
    :vartype resource_group_name: str
    :ivar server_name: The output destination server name. Required.
    :vartype server_name: str
    :ivar database_name: The output destination database. Required.
    :vartype database_name: str
    :ivar schema_name: The output destination schema.
    :vartype schema_name: str
    :ivar table_name: The output destination table. Required.
    :vartype table_name: str
    :ivar credential: The resource ID of the credential to use to connect to the output
     destination. Required.
    :vartype credential: str
    """

    _validation = {
        "server_name": {"required": True},
        "database_name": {"required": True},
        "table_name": {"required": True},
        "credential": {"required": True},
    }

    _attribute_map = {
        "type": {"key": "type", "type": "str"},
        "subscription_id": {"key": "subscriptionId", "type": "str"},
        "resource_group_name": {"key": "resourceGroupName", "type": "str"},
        "server_name": {"key": "serverName", "type": "str"},
        "database_name": {"key": "databaseName", "type": "str"},
        "schema_name": {"key": "schemaName", "type": "str"},
        "table_name": {"key": "tableName", "type": "str"},
        "credential": {"key": "credential", "type": "str"},
    }

    def __init__(
        self,
        *,
        server_name: str,
        database_name: str,
        table_name: str,
        credential: str,
        type: Union[str, "_models.JobStepOutputType"] = "SqlDatabase",
        subscription_id: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        schema_name: str = "dbo",
        **kwargs
    ):
        """
        :keyword type: The output destination type. "SqlDatabase"
        :paramtype type: str or ~azure.mgmt.sql.models.JobStepOutputType
        :keyword subscription_id: The output destination subscription id.
        :paramtype subscription_id: str
        :keyword resource_group_name: The output destination resource group.
        :paramtype resource_group_name: str
        :keyword server_name: The output destination server name. Required.
        :paramtype server_name: str
        :keyword database_name: The output destination database. Required.
        :paramtype database_name: str
        :keyword schema_name: The output destination schema.
        :paramtype schema_name: str
        :keyword table_name: The output destination table. Required.
        :paramtype table_name: str
        :keyword credential: The resource ID of the credential to use to connect to the output
         destination. Required.
        :paramtype credential: str
        """
        super().__init__(**kwargs)
        self.type = type
        self.subscription_id = subscription_id
        self.resource_group_name = resource_group_name
        self.server_name = server_name
        self.database_name = database_name
        self.schema_name = schema_name
        self.table_name = table_name
        self.credential = credential


class JobTarget(_serialization.Model):
    """A job target, for example a specific database or a container of databases that is evaluated during job execution.

    All required parameters must be populated in order to send to Azure.

    :ivar membership_type: Whether the target is included or excluded from the group. Known values
     are: "Include" and "Exclude".
    :vartype membership_type: str or ~azure.mgmt.sql.models.JobTargetGroupMembershipType
    :ivar type: The target type. Required. Known values are: "TargetGroup", "SqlDatabase",
     "SqlElasticPool", "SqlShardMap", and "SqlServer".
    :vartype type: str or ~azure.mgmt.sql.models.JobTargetType
    :ivar server_name: The target server name.
    :vartype server_name: str
    :ivar database_name: The target database name.
    :vartype database_name: str
    :ivar elastic_pool_name: The target elastic pool name.
    :vartype elastic_pool_name: str
    :ivar shard_map_name: The target shard map.
    :vartype shard_map_name: str
    :ivar refresh_credential: The resource ID of the credential that is used during job execution
     to connect to the target and determine the list of databases inside the target.
    :vartype refresh_credential: str
    """

    _validation = {
        "type": {"required": True},
    }

    _attribute_map = {
        "membership_type": {"key": "membershipType", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "server_name": {"key": "serverName", "type": "str"},
        "database_name": {"key": "databaseName", "type": "str"},
        "elastic_pool_name": {"key": "elasticPoolName", "type": "str"},
        "shard_map_name": {"key": "shardMapName", "type": "str"},
        "refresh_credential": {"key": "refreshCredential", "type": "str"},
    }

    def __init__(
        self,
        *,
        type: Union[str, "_models.JobTargetType"],
        membership_type: Union[str, "_models.JobTargetGroupMembershipType"] = "Include",
        server_name: Optional[str] = None,
        database_name: Optional[str] = None,
        elastic_pool_name: Optional[str] = None,
        shard_map_name: Optional[str] = None,
        refresh_credential: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword membership_type: Whether the target is included or excluded from the group. Known
         values are: "Include" and "Exclude".
        :paramtype membership_type: str or ~azure.mgmt.sql.models.JobTargetGroupMembershipType
        :keyword type: The target type. Required. Known values are: "TargetGroup", "SqlDatabase",
         "SqlElasticPool", "SqlShardMap", and "SqlServer".
        :paramtype type: str or ~azure.mgmt.sql.models.JobTargetType
        :keyword server_name: The target server name.
        :paramtype server_name: str
        :keyword database_name: The target database name.
        :paramtype database_name: str
        :keyword elastic_pool_name: The target elastic pool name.
        :paramtype elastic_pool_name: str
        :keyword shard_map_name: The target shard map.
        :paramtype shard_map_name: str
        :keyword refresh_credential: The resource ID of the credential that is used during job
         execution to connect to the target and determine the list of databases inside the target.
        :paramtype refresh_credential: str
        """
        super().__init__(**kwargs)
        self.membership_type = membership_type
        self.type = type
        self.server_name = server_name
        self.database_name = database_name
        self.elastic_pool_name = elastic_pool_name
        self.shard_map_name = shard_map_name
        self.refresh_credential = refresh_credential


class JobTargetGroup(ProxyResource):
    """A group of job targets.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar members: Members of the target group.
    :vartype members: list[~azure.mgmt.sql.models.JobTarget]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "members": {"key": "properties.members", "type": "[JobTarget]"},
    }

    def __init__(self, *, members: Optional[List["_models.JobTarget"]] = None, **kwargs):
        """
        :keyword members: Members of the target group.
        :paramtype members: list[~azure.mgmt.sql.models.JobTarget]
        """
        super().__init__(**kwargs)
        self.members = members


class JobTargetGroupListResult(_serialization.Model):
    """A list of target groups.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.JobTargetGroup]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[JobTargetGroup]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class JobVersion(ProxyResource):
    """A job version.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)


class JobVersionListResult(_serialization.Model):
    """A list of job versions.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.JobVersion]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[JobVersion]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class LedgerDigestUploads(ProxyResource):
    """Azure SQL Database ledger digest upload settings.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar digest_storage_endpoint: The digest storage endpoint, which must be either an Azure blob
     storage endpoint or an URI for Azure Confidential Ledger.
    :vartype digest_storage_endpoint: str
    :ivar state: Specifies the state of ledger digest upload. Known values are: "Enabled" and
     "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.LedgerDigestUploadsState
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "digest_storage_endpoint": {"key": "properties.digestStorageEndpoint", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
    }

    def __init__(self, *, digest_storage_endpoint: Optional[str] = None, **kwargs):
        """
        :keyword digest_storage_endpoint: The digest storage endpoint, which must be either an Azure
         blob storage endpoint or an URI for Azure Confidential Ledger.
        :paramtype digest_storage_endpoint: str
        """
        super().__init__(**kwargs)
        self.digest_storage_endpoint = digest_storage_endpoint
        self.state = None


class LedgerDigestUploadsListResult(_serialization.Model):
    """A list of ledger digest upload settings.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.LedgerDigestUploads]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[LedgerDigestUploads]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class LicenseTypeCapability(_serialization.Model):
    """The license type capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: License type identifier.
    :vartype name: str
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.status = None
        self.reason = reason


class LocationCapabilities(_serialization.Model):
    """The location capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The location name.
    :vartype name: str
    :ivar supported_server_versions: The list of supported server versions.
    :vartype supported_server_versions: list[~azure.mgmt.sql.models.ServerVersionCapability]
    :ivar supported_managed_instance_versions: The list of supported managed instance versions.
    :vartype supported_managed_instance_versions:
     list[~azure.mgmt.sql.models.ManagedInstanceVersionCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "supported_server_versions": {"readonly": True},
        "supported_managed_instance_versions": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "supported_server_versions": {"key": "supportedServerVersions", "type": "[ServerVersionCapability]"},
        "supported_managed_instance_versions": {
            "key": "supportedManagedInstanceVersions",
            "type": "[ManagedInstanceVersionCapability]",
        },
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.supported_server_versions = None
        self.supported_managed_instance_versions = None
        self.status = None
        self.reason = reason


class LogicalDatabaseTransparentDataEncryption(ProxyResource):
    """A logical database transparent data encryption state.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar state: Specifies the state of the transparent data encryption. Known values are:
     "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.TransparentDataEncryptionState
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
    }

    def __init__(self, *, state: Optional[Union[str, "_models.TransparentDataEncryptionState"]] = None, **kwargs):
        """
        :keyword state: Specifies the state of the transparent data encryption. Known values are:
         "Enabled" and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.TransparentDataEncryptionState
        """
        super().__init__(**kwargs)
        self.state = state


class LogicalDatabaseTransparentDataEncryptionListResult(_serialization.Model):
    """A list of transparent data encryptions.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[LogicalDatabaseTransparentDataEncryption]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class LogicalServerAdvancedThreatProtectionListResult(_serialization.Model):
    """A list of the server's Advanced Threat Protection configurations.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerAdvancedThreatProtection]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerAdvancedThreatProtection]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class LogicalServerSecurityAlertPolicyListResult(_serialization.Model):
    """A list of the server's security alert policies.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerSecurityAlertPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerSecurityAlertPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class LogSizeCapability(_serialization.Model):
    """The log size capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar limit: The log size limit (see 'unit' for the units).
    :vartype limit: int
    :ivar unit: The units that the limit is expressed in. Known values are: "Megabytes",
     "Gigabytes", "Terabytes", "Petabytes", and "Percent".
    :vartype unit: str or ~azure.mgmt.sql.models.LogSizeUnit
    """

    _validation = {
        "limit": {"readonly": True},
        "unit": {"readonly": True},
    }

    _attribute_map = {
        "limit": {"key": "limit", "type": "int"},
        "unit": {"key": "unit", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.limit = None
        self.unit = None


class LongTermRetentionBackup(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A long term retention backup.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar server_name: The server name that the backup database belong to.
    :vartype server_name: str
    :ivar server_create_time: The create time of the server.
    :vartype server_create_time: ~datetime.datetime
    :ivar database_name: The name of the database the backup belong to.
    :vartype database_name: str
    :ivar database_deletion_time: The delete time of the database.
    :vartype database_deletion_time: ~datetime.datetime
    :ivar backup_time: The time the backup was taken.
    :vartype backup_time: ~datetime.datetime
    :ivar backup_expiration_time: The time the long term retention backup will expire.
    :vartype backup_expiration_time: ~datetime.datetime
    :ivar backup_storage_redundancy: The storage redundancy type of the backup. Known values are:
     "Geo", "Local", "Zone", and "GeoZone".
    :vartype backup_storage_redundancy: str or ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar requested_backup_storage_redundancy: The storage redundancy type of the backup. Known
     values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype requested_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "server_name": {"readonly": True},
        "server_create_time": {"readonly": True},
        "database_name": {"readonly": True},
        "database_deletion_time": {"readonly": True},
        "backup_time": {"readonly": True},
        "backup_expiration_time": {"readonly": True},
        "backup_storage_redundancy": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "server_name": {"key": "properties.serverName", "type": "str"},
        "server_create_time": {"key": "properties.serverCreateTime", "type": "iso-8601"},
        "database_name": {"key": "properties.databaseName", "type": "str"},
        "database_deletion_time": {"key": "properties.databaseDeletionTime", "type": "iso-8601"},
        "backup_time": {"key": "properties.backupTime", "type": "iso-8601"},
        "backup_expiration_time": {"key": "properties.backupExpirationTime", "type": "iso-8601"},
        "backup_storage_redundancy": {"key": "properties.backupStorageRedundancy", "type": "str"},
        "requested_backup_storage_redundancy": {"key": "properties.requestedBackupStorageRedundancy", "type": "str"},
    }

    def __init__(
        self,
        *,
        requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None,
        **kwargs
    ):
        """
        :keyword requested_backup_storage_redundancy: The storage redundancy type of the backup. Known
         values are: "Geo", "Local", "Zone", and "GeoZone".
        :paramtype requested_backup_storage_redundancy: str or
         ~azure.mgmt.sql.models.BackupStorageRedundancy
        """
        super().__init__(**kwargs)
        self.server_name = None
        self.server_create_time = None
        self.database_name = None
        self.database_deletion_time = None
        self.backup_time = None
        self.backup_expiration_time = None
        self.backup_storage_redundancy = None
        self.requested_backup_storage_redundancy = requested_backup_storage_redundancy


class LongTermRetentionBackupListResult(_serialization.Model):
    """A list of long term retention backups.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.LongTermRetentionBackup]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[LongTermRetentionBackup]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class LongTermRetentionBackupOperationResult(ProxyResource):
    """A LongTermRetentionBackup operation result resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar request_id: Request Id.
    :vartype request_id: str
    :ivar operation_type: Operation type.
    :vartype operation_type: str
    :ivar from_backup_resource_id: Source backup resource id.
    :vartype from_backup_resource_id: str
    :ivar to_backup_resource_id: Target backup resource id.
    :vartype to_backup_resource_id: str
    :ivar target_backup_storage_redundancy: The storage redundancy type of the copied backup. Known
     values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype target_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar status: Operation status.
    :vartype status: str
    :ivar message: Progress message.
    :vartype message: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "request_id": {"readonly": True},
        "operation_type": {"readonly": True},
        "from_backup_resource_id": {"readonly": True},
        "to_backup_resource_id": {"readonly": True},
        "target_backup_storage_redundancy": {"readonly": True},
        "status": {"readonly": True},
        "message": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "request_id": {"key": "properties.requestId", "type": "str"},
        "operation_type": {"key": "properties.operationType", "type": "str"},
        "from_backup_resource_id": {"key": "properties.fromBackupResourceId", "type": "str"},
        "to_backup_resource_id": {"key": "properties.toBackupResourceId", "type": "str"},
        "target_backup_storage_redundancy": {"key": "properties.targetBackupStorageRedundancy", "type": "str"},
        "status": {"key": "properties.status", "type": "str"},
        "message": {"key": "properties.message", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.request_id = None
        self.operation_type = None
        self.from_backup_resource_id = None
        self.to_backup_resource_id = None
        self.target_backup_storage_redundancy = None
        self.status = None
        self.message = None


class LongTermRetentionPolicy(ProxyResource):
    """A long term retention policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar weekly_retention: The weekly retention policy for an LTR backup in an ISO 8601 format.
    :vartype weekly_retention: str
    :ivar monthly_retention: The monthly retention policy for an LTR backup in an ISO 8601 format.
    :vartype monthly_retention: str
    :ivar yearly_retention: The yearly retention policy for an LTR backup in an ISO 8601 format.
    :vartype yearly_retention: str
    :ivar week_of_year: The week of year to take the yearly backup in an ISO 8601 format.
    :vartype week_of_year: int
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "weekly_retention": {"key": "properties.weeklyRetention", "type": "str"},
        "monthly_retention": {"key": "properties.monthlyRetention", "type": "str"},
        "yearly_retention": {"key": "properties.yearlyRetention", "type": "str"},
        "week_of_year": {"key": "properties.weekOfYear", "type": "int"},
    }

    def __init__(
        self,
        *,
        weekly_retention: Optional[str] = None,
        monthly_retention: Optional[str] = None,
        yearly_retention: Optional[str] = None,
        week_of_year: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword weekly_retention: The weekly retention policy for an LTR backup in an ISO 8601 format.
        :paramtype weekly_retention: str
        :keyword monthly_retention: The monthly retention policy for an LTR backup in an ISO 8601
         format.
        :paramtype monthly_retention: str
        :keyword yearly_retention: The yearly retention policy for an LTR backup in an ISO 8601 format.
        :paramtype yearly_retention: str
        :keyword week_of_year: The week of year to take the yearly backup in an ISO 8601 format.
        :paramtype week_of_year: int
        """
        super().__init__(**kwargs)
        self.weekly_retention = weekly_retention
        self.monthly_retention = monthly_retention
        self.yearly_retention = yearly_retention
        self.week_of_year = week_of_year


class LongTermRetentionPolicyListResult(_serialization.Model):
    """A list of long term retention policies.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.LongTermRetentionPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[LongTermRetentionPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class MaintenanceConfigurationCapability(_serialization.Model):
    """The maintenance configuration capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: Maintenance configuration name.
    :vartype name: str
    :ivar zone_redundant: Whether or not zone redundancy is supported for the maintenance
     configuration.
    :vartype zone_redundant: bool
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "zone_redundant": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "zone_redundant": {"key": "zoneRedundant", "type": "bool"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.zone_redundant = None
        self.status = None
        self.reason = reason


class MaintenanceWindowOptions(ProxyResource):
    """Maintenance window options.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar is_enabled: Whether maintenance windows are enabled for the database.
    :vartype is_enabled: bool
    :ivar maintenance_window_cycles: Available maintenance cycles e.g. {Saturday, 0, 48\ *60},
     {Wednesday, 0, 24*\ 60}.
    :vartype maintenance_window_cycles: list[~azure.mgmt.sql.models.MaintenanceWindowTimeRange]
    :ivar min_duration_in_minutes: Minimum duration of maintenance window.
    :vartype min_duration_in_minutes: int
    :ivar default_duration_in_minutes: Default duration for maintenance window.
    :vartype default_duration_in_minutes: int
    :ivar min_cycles: Minimum number of maintenance windows cycles to be set on the database.
    :vartype min_cycles: int
    :ivar time_granularity_in_minutes: Time granularity in minutes for maintenance windows.
    :vartype time_granularity_in_minutes: int
    :ivar allow_multiple_maintenance_windows_per_cycle: Whether we allow multiple maintenance
     windows per cycle.
    :vartype allow_multiple_maintenance_windows_per_cycle: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "is_enabled": {"key": "properties.isEnabled", "type": "bool"},
        "maintenance_window_cycles": {
            "key": "properties.maintenanceWindowCycles",
            "type": "[MaintenanceWindowTimeRange]",
        },
        "min_duration_in_minutes": {"key": "properties.minDurationInMinutes", "type": "int"},
        "default_duration_in_minutes": {"key": "properties.defaultDurationInMinutes", "type": "int"},
        "min_cycles": {"key": "properties.minCycles", "type": "int"},
        "time_granularity_in_minutes": {"key": "properties.timeGranularityInMinutes", "type": "int"},
        "allow_multiple_maintenance_windows_per_cycle": {
            "key": "properties.allowMultipleMaintenanceWindowsPerCycle",
            "type": "bool",
        },
    }

    def __init__(
        self,
        *,
        is_enabled: Optional[bool] = None,
        maintenance_window_cycles: Optional[List["_models.MaintenanceWindowTimeRange"]] = None,
        min_duration_in_minutes: Optional[int] = None,
        default_duration_in_minutes: Optional[int] = None,
        min_cycles: Optional[int] = None,
        time_granularity_in_minutes: Optional[int] = None,
        allow_multiple_maintenance_windows_per_cycle: Optional[bool] = None,
        **kwargs
    ):
        """
        :keyword is_enabled: Whether maintenance windows are enabled for the database.
        :paramtype is_enabled: bool
        :keyword maintenance_window_cycles: Available maintenance cycles e.g. {Saturday, 0, 48\ *60},
         {Wednesday, 0, 24*\ 60}.
        :paramtype maintenance_window_cycles: list[~azure.mgmt.sql.models.MaintenanceWindowTimeRange]
        :keyword min_duration_in_minutes: Minimum duration of maintenance window.
        :paramtype min_duration_in_minutes: int
        :keyword default_duration_in_minutes: Default duration for maintenance window.
        :paramtype default_duration_in_minutes: int
        :keyword min_cycles: Minimum number of maintenance windows cycles to be set on the database.
        :paramtype min_cycles: int
        :keyword time_granularity_in_minutes: Time granularity in minutes for maintenance windows.
        :paramtype time_granularity_in_minutes: int
        :keyword allow_multiple_maintenance_windows_per_cycle: Whether we allow multiple maintenance
         windows per cycle.
        :paramtype allow_multiple_maintenance_windows_per_cycle: bool
        """
        super().__init__(**kwargs)
        self.is_enabled = is_enabled
        self.maintenance_window_cycles = maintenance_window_cycles
        self.min_duration_in_minutes = min_duration_in_minutes
        self.default_duration_in_minutes = default_duration_in_minutes
        self.min_cycles = min_cycles
        self.time_granularity_in_minutes = time_granularity_in_minutes
        self.allow_multiple_maintenance_windows_per_cycle = allow_multiple_maintenance_windows_per_cycle


class MaintenanceWindows(ProxyResource):
    """Maintenance windows.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar time_ranges:
    :vartype time_ranges: list[~azure.mgmt.sql.models.MaintenanceWindowTimeRange]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "time_ranges": {"key": "properties.timeRanges", "type": "[MaintenanceWindowTimeRange]"},
    }

    def __init__(self, *, time_ranges: Optional[List["_models.MaintenanceWindowTimeRange"]] = None, **kwargs):
        """
        :keyword time_ranges:
        :paramtype time_ranges: list[~azure.mgmt.sql.models.MaintenanceWindowTimeRange]
        """
        super().__init__(**kwargs)
        self.time_ranges = time_ranges


class MaintenanceWindowTimeRange(_serialization.Model):
    """Maintenance window time range.

    :ivar day_of_week: Day of maintenance window. Known values are: "Sunday", "Monday", "Tuesday",
     "Wednesday", "Thursday", "Friday", and "Saturday".
    :vartype day_of_week: str or ~azure.mgmt.sql.models.DayOfWeek
    :ivar start_time: Start time minutes offset from 12am.
    :vartype start_time: str
    :ivar duration: Duration of maintenance window in minutes.
    :vartype duration: str
    """

    _attribute_map = {
        "day_of_week": {"key": "dayOfWeek", "type": "str"},
        "start_time": {"key": "startTime", "type": "str"},
        "duration": {"key": "duration", "type": "str"},
    }

    def __init__(
        self,
        *,
        day_of_week: Optional[Union[str, "_models.DayOfWeek"]] = None,
        start_time: Optional[str] = None,
        duration: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword day_of_week: Day of maintenance window. Known values are: "Sunday", "Monday",
         "Tuesday", "Wednesday", "Thursday", "Friday", and "Saturday".
        :paramtype day_of_week: str or ~azure.mgmt.sql.models.DayOfWeek
        :keyword start_time: Start time minutes offset from 12am.
        :paramtype start_time: str
        :keyword duration: Duration of maintenance window in minutes.
        :paramtype duration: str
        """
        super().__init__(**kwargs)
        self.day_of_week = day_of_week
        self.start_time = start_time
        self.duration = duration


class ManagedBackupShortTermRetentionPolicy(ProxyResource):
    """A short term retention policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar retention_days: The backup retention period in days. This is how many days Point-in-Time
     Restore will be supported.
    :vartype retention_days: int
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "retention_days": {"key": "properties.retentionDays", "type": "int"},
    }

    def __init__(self, *, retention_days: Optional[int] = None, **kwargs):
        """
        :keyword retention_days: The backup retention period in days. This is how many days
         Point-in-Time Restore will be supported.
        :paramtype retention_days: int
        """
        super().__init__(**kwargs)
        self.retention_days = retention_days


class ManagedBackupShortTermRetentionPolicyListResult(_serialization.Model):
    """A list of short term retention policies.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedBackupShortTermRetentionPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedDatabase(TrackedResource):  # pylint: disable=too-many-instance-attributes
    """A managed database resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location. Required.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar collation: Collation of the managed database.
    :vartype collation: str
    :ivar status: Status of the database. Known values are: "Online", "Offline", "Shutdown",
     "Creating", "Inaccessible", "Restoring", and "Updating".
    :vartype status: str or ~azure.mgmt.sql.models.ManagedDatabaseStatus
    :ivar creation_date: Creation date of the database.
    :vartype creation_date: ~datetime.datetime
    :ivar earliest_restore_point: Earliest restore point in time for point in time restore.
    :vartype earliest_restore_point: ~datetime.datetime
    :ivar restore_point_in_time: Conditional. If createMode is PointInTimeRestore, this value is
     required. Specifies the point in time (ISO8601 format) of the source database that will be
     restored to create the new database.
    :vartype restore_point_in_time: ~datetime.datetime
    :ivar default_secondary_location: Geo paired region.
    :vartype default_secondary_location: str
    :ivar catalog_collation: Collation of the metadata catalog. Known values are:
     "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS".
    :vartype catalog_collation: str or ~azure.mgmt.sql.models.CatalogCollationType
    :ivar create_mode: Managed database create mode. PointInTimeRestore: Create a database by
     restoring a point in time backup of an existing database. SourceDatabaseName,
     SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a
     database by restoring from external backup files. Collation, StorageContainerUri and
     StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a
     geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database
     resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a
     long term retention backup (longTermRetentionBackupResourceId required). Known values are:
     "Default", "RestoreExternalBackup", "PointInTimeRestore", "Recovery", and
     "RestoreLongTermRetentionBackup".
    :vartype create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode
    :ivar storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value is
     required. Specifies the uri of the storage container where backups for this restore are stored.
    :vartype storage_container_uri: str
    :ivar source_database_id: The resource identifier of the source database associated with create
     operation of this database.
    :vartype source_database_id: str
    :ivar restorable_dropped_database_id: The restorable dropped database resource id to restore
     when creating this database.
    :vartype restorable_dropped_database_id: str
    :ivar storage_container_identity: Conditional. If createMode is RestoreExternalBackup, this
     value is used. Specifies the identity used for storage container authentication. Can be
     'SharedAccessSignature' or 'ManagedIdentity'; if not specified 'SharedAccessSignature' is
     assumed.
    :vartype storage_container_identity: str
    :ivar storage_container_sas_token: Conditional. If createMode is RestoreExternalBackup and
     storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage
     container sas token.
    :vartype storage_container_sas_token: str
    :ivar failover_group_id: Instance Failover Group resource identifier that this managed database
     belongs to.
    :vartype failover_group_id: str
    :ivar recoverable_database_id: The resource identifier of the recoverable database associated
     with create operation of this database.
    :vartype recoverable_database_id: str
    :ivar long_term_retention_backup_resource_id: The name of the Long Term Retention backup to be
     used for restore of this managed database.
    :vartype long_term_retention_backup_resource_id: str
    :ivar auto_complete_restore: Whether to auto complete restore of this managed database.
    :vartype auto_complete_restore: bool
    :ivar last_backup_name: Last backup file name for restore of this managed database.
    :vartype last_backup_name: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"required": True},
        "status": {"readonly": True},
        "creation_date": {"readonly": True},
        "earliest_restore_point": {"readonly": True},
        "default_secondary_location": {"readonly": True},
        "failover_group_id": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "tags": {"key": "tags", "type": "{str}"},
        "collation": {"key": "properties.collation", "type": "str"},
        "status": {"key": "properties.status", "type": "str"},
        "creation_date": {"key": "properties.creationDate", "type": "iso-8601"},
        "earliest_restore_point": {"key": "properties.earliestRestorePoint", "type": "iso-8601"},
        "restore_point_in_time": {"key": "properties.restorePointInTime", "type": "iso-8601"},
        "default_secondary_location": {"key": "properties.defaultSecondaryLocation", "type": "str"},
        "catalog_collation": {"key": "properties.catalogCollation", "type": "str"},
        "create_mode": {"key": "properties.createMode", "type": "str"},
        "storage_container_uri": {"key": "properties.storageContainerUri", "type": "str"},
        "source_database_id": {"key": "properties.sourceDatabaseId", "type": "str"},
        "restorable_dropped_database_id": {"key": "properties.restorableDroppedDatabaseId", "type": "str"},
        "storage_container_identity": {"key": "properties.storageContainerIdentity", "type": "str"},
        "storage_container_sas_token": {"key": "properties.storageContainerSasToken", "type": "str"},
        "failover_group_id": {"key": "properties.failoverGroupId", "type": "str"},
        "recoverable_database_id": {"key": "properties.recoverableDatabaseId", "type": "str"},
        "long_term_retention_backup_resource_id": {
            "key": "properties.longTermRetentionBackupResourceId",
            "type": "str",
        },
        "auto_complete_restore": {"key": "properties.autoCompleteRestore", "type": "bool"},
        "last_backup_name": {"key": "properties.lastBackupName", "type": "str"},
    }

    def __init__(
        self,
        *,
        location: str,
        tags: Optional[Dict[str, str]] = None,
        collation: Optional[str] = None,
        restore_point_in_time: Optional[datetime.datetime] = None,
        catalog_collation: Optional[Union[str, "_models.CatalogCollationType"]] = None,
        create_mode: Optional[Union[str, "_models.ManagedDatabaseCreateMode"]] = None,
        storage_container_uri: Optional[str] = None,
        source_database_id: Optional[str] = None,
        restorable_dropped_database_id: Optional[str] = None,
        storage_container_identity: Optional[str] = None,
        storage_container_sas_token: Optional[str] = None,
        recoverable_database_id: Optional[str] = None,
        long_term_retention_backup_resource_id: Optional[str] = None,
        auto_complete_restore: Optional[bool] = None,
        last_backup_name: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword location: Resource location. Required.
        :paramtype location: str
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword collation: Collation of the managed database.
        :paramtype collation: str
        :keyword restore_point_in_time: Conditional. If createMode is PointInTimeRestore, this value is
         required. Specifies the point in time (ISO8601 format) of the source database that will be
         restored to create the new database.
        :paramtype restore_point_in_time: ~datetime.datetime
        :keyword catalog_collation: Collation of the metadata catalog. Known values are:
         "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS".
        :paramtype catalog_collation: str or ~azure.mgmt.sql.models.CatalogCollationType
        :keyword create_mode: Managed database create mode. PointInTimeRestore: Create a database by
         restoring a point in time backup of an existing database. SourceDatabaseName,
         SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a
         database by restoring from external backup files. Collation, StorageContainerUri and
         StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a
         geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database
         resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a
         long term retention backup (longTermRetentionBackupResourceId required). Known values are:
         "Default", "RestoreExternalBackup", "PointInTimeRestore", "Recovery", and
         "RestoreLongTermRetentionBackup".
        :paramtype create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode
        :keyword storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value
         is required. Specifies the uri of the storage container where backups for this restore are
         stored.
        :paramtype storage_container_uri: str
        :keyword source_database_id: The resource identifier of the source database associated with
         create operation of this database.
        :paramtype source_database_id: str
        :keyword restorable_dropped_database_id: The restorable dropped database resource id to restore
         when creating this database.
        :paramtype restorable_dropped_database_id: str
        :keyword storage_container_identity: Conditional. If createMode is RestoreExternalBackup, this
         value is used. Specifies the identity used for storage container authentication. Can be
         'SharedAccessSignature' or 'ManagedIdentity'; if not specified 'SharedAccessSignature' is
         assumed.
        :paramtype storage_container_identity: str
        :keyword storage_container_sas_token: Conditional. If createMode is RestoreExternalBackup and
         storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage
         container sas token.
        :paramtype storage_container_sas_token: str
        :keyword recoverable_database_id: The resource identifier of the recoverable database
         associated with create operation of this database.
        :paramtype recoverable_database_id: str
        :keyword long_term_retention_backup_resource_id: The name of the Long Term Retention backup to
         be used for restore of this managed database.
        :paramtype long_term_retention_backup_resource_id: str
        :keyword auto_complete_restore: Whether to auto complete restore of this managed database.
        :paramtype auto_complete_restore: bool
        :keyword last_backup_name: Last backup file name for restore of this managed database.
        :paramtype last_backup_name: str
        """
        super().__init__(location=location, tags=tags, **kwargs)
        self.collation = collation
        self.status = None
        self.creation_date = None
        self.earliest_restore_point = None
        self.restore_point_in_time = restore_point_in_time
        self.default_secondary_location = None
        self.catalog_collation = catalog_collation
        self.create_mode = create_mode
        self.storage_container_uri = storage_container_uri
        self.source_database_id = source_database_id
        self.restorable_dropped_database_id = restorable_dropped_database_id
        self.storage_container_identity = storage_container_identity
        self.storage_container_sas_token = storage_container_sas_token
        self.failover_group_id = None
        self.recoverable_database_id = recoverable_database_id
        self.long_term_retention_backup_resource_id = long_term_retention_backup_resource_id
        self.auto_complete_restore = auto_complete_restore
        self.last_backup_name = last_backup_name


class ManagedDatabaseAdvancedThreatProtection(ProxyResource):
    """A managed database Advanced Threat Protection.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of AdvancedThreatProtectionResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar state: Specifies the state of the Advanced Threat Protection, whether it is enabled or
     disabled or a state has not been applied yet on the specific database or server. Known values
     are: "New", "Enabled", and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState
    :ivar creation_time: Specifies the UTC creation time of the policy.
    :vartype creation_time: ~datetime.datetime
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
        "creation_time": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "state": {"key": "properties.state", "type": "str"},
        "creation_time": {"key": "properties.creationTime", "type": "iso-8601"},
    }

    def __init__(self, *, state: Optional[Union[str, "_models.AdvancedThreatProtectionState"]] = None, **kwargs):
        """
        :keyword state: Specifies the state of the Advanced Threat Protection, whether it is enabled or
         disabled or a state has not been applied yet on the specific database or server. Known values
         are: "New", "Enabled", and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.state = state
        self.creation_time = None


class ManagedDatabaseAdvancedThreatProtectionListResult(_serialization.Model):
    """A list of the managed database's Advanced Threat Protection settings.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedDatabaseAdvancedThreatProtection]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedDatabaseAdvancedThreatProtection]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedDatabaseListResult(_serialization.Model):
    """A list of managed databases.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedDatabase]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedDatabase]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedDatabaseMoveDefinition(_serialization.Model):
    """Contains the information necessary to perform a managed database move.

    All required parameters must be populated in order to send to Azure.

    :ivar destination_managed_database_id: The destination managed database ID. Required.
    :vartype destination_managed_database_id: str
    """

    _validation = {
        "destination_managed_database_id": {"required": True},
    }

    _attribute_map = {
        "destination_managed_database_id": {"key": "destinationManagedDatabaseId", "type": "str"},
    }

    def __init__(self, *, destination_managed_database_id: str, **kwargs):
        """
        :keyword destination_managed_database_id: The destination managed database ID. Required.
        :paramtype destination_managed_database_id: str
        """
        super().__init__(**kwargs)
        self.destination_managed_database_id = destination_managed_database_id


class ManagedDatabaseMoveOperationListResult(_serialization.Model):
    """List of managed database move operations.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedDatabaseMoveOperationResult]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedDatabaseMoveOperationResult]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedDatabaseMoveOperationResult(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A managed database move operation.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar operation: The name of operation.
    :vartype operation: str
    :ivar operation_friendly_name: The friendly name of operation.
    :vartype operation_friendly_name: str
    :ivar start_time: The operation start time.
    :vartype start_time: ~datetime.datetime
    :ivar state: The operation state. Known values are: "Pending", "InProgress", "Succeeded",
     "Failed", "CancelInProgress", and "Cancelled".
    :vartype state: str or ~azure.mgmt.sql.models.ManagementOperationState
    :ivar operation_mode: Operation mode. Known values are: "Move" and "Copy".
    :vartype operation_mode: str or ~azure.mgmt.sql.models.MoveOperationMode
    :ivar source_managed_instance_name: Source Managed Instance name.
    :vartype source_managed_instance_name: str
    :ivar target_managed_instance_name: Target Managed Instance name.
    :vartype target_managed_instance_name: str
    :ivar source_managed_instance_id: Source Managed Instance resource id.
    :vartype source_managed_instance_id: str
    :ivar target_managed_instance_id: Target Managed instance resource id.
    :vartype target_managed_instance_id: str
    :ivar source_database_name: Source database name.
    :vartype source_database_name: str
    :ivar target_database_name: Target database name.
    :vartype target_database_name: str
    :ivar is_cancellable: Is move operation cancellable.
    :vartype is_cancellable: bool
    :ivar error_code: The operation error code.
    :vartype error_code: int
    :ivar error_description: The operation error description.
    :vartype error_description: str
    :ivar error_severity: The operation error severity.
    :vartype error_severity: int
    :ivar is_user_error: Whether or not the error is a user error.
    :vartype is_user_error: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "operation": {"readonly": True},
        "operation_friendly_name": {"readonly": True},
        "start_time": {"readonly": True},
        "state": {"readonly": True},
        "operation_mode": {"readonly": True},
        "source_managed_instance_name": {"readonly": True},
        "target_managed_instance_name": {"readonly": True},
        "source_managed_instance_id": {"readonly": True},
        "target_managed_instance_id": {"readonly": True},
        "source_database_name": {"readonly": True},
        "target_database_name": {"readonly": True},
        "is_cancellable": {"readonly": True},
        "error_code": {"readonly": True},
        "error_description": {"readonly": True},
        "error_severity": {"readonly": True},
        "is_user_error": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "operation": {"key": "properties.operation", "type": "str"},
        "operation_friendly_name": {"key": "properties.operationFriendlyName", "type": "str"},
        "start_time": {"key": "properties.startTime", "type": "iso-8601"},
        "state": {"key": "properties.state", "type": "str"},
        "operation_mode": {"key": "properties.operationMode", "type": "str"},
        "source_managed_instance_name": {"key": "properties.sourceManagedInstanceName", "type": "str"},
        "target_managed_instance_name": {"key": "properties.targetManagedInstanceName", "type": "str"},
        "source_managed_instance_id": {"key": "properties.sourceManagedInstanceId", "type": "str"},
        "target_managed_instance_id": {"key": "properties.targetManagedInstanceId", "type": "str"},
        "source_database_name": {"key": "properties.sourceDatabaseName", "type": "str"},
        "target_database_name": {"key": "properties.targetDatabaseName", "type": "str"},
        "is_cancellable": {"key": "properties.isCancellable", "type": "bool"},
        "error_code": {"key": "properties.errorCode", "type": "int"},
        "error_description": {"key": "properties.errorDescription", "type": "str"},
        "error_severity": {"key": "properties.errorSeverity", "type": "int"},
        "is_user_error": {"key": "properties.isUserError", "type": "bool"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.operation = None
        self.operation_friendly_name = None
        self.start_time = None
        self.state = None
        self.operation_mode = None
        self.source_managed_instance_name = None
        self.target_managed_instance_name = None
        self.source_managed_instance_id = None
        self.target_managed_instance_id = None
        self.source_database_name = None
        self.target_database_name = None
        self.is_cancellable = None
        self.error_code = None
        self.error_description = None
        self.error_severity = None
        self.is_user_error = None


class ManagedDatabaseRestoreDetailsBackupSetProperties(_serialization.Model):
    """The managed database's restore details backup set properties.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar status: Backup set status.
    :vartype status: str
    :ivar first_stripe_name: First stripe name.
    :vartype first_stripe_name: str
    :ivar number_of_stripes: Number of stripes.
    :vartype number_of_stripes: int
    :ivar backup_size_mb: Backup size.
    :vartype backup_size_mb: int
    :ivar restore_started_timestamp_utc: Last restored file time.
    :vartype restore_started_timestamp_utc: ~datetime.datetime
    :ivar restore_finished_timestamp_utc: Last restored file time.
    :vartype restore_finished_timestamp_utc: ~datetime.datetime
    """

    _validation = {
        "status": {"readonly": True},
        "first_stripe_name": {"readonly": True},
        "number_of_stripes": {"readonly": True},
        "backup_size_mb": {"readonly": True},
        "restore_started_timestamp_utc": {"readonly": True},
        "restore_finished_timestamp_utc": {"readonly": True},
    }

    _attribute_map = {
        "status": {"key": "status", "type": "str"},
        "first_stripe_name": {"key": "firstStripeName", "type": "str"},
        "number_of_stripes": {"key": "numberOfStripes", "type": "int"},
        "backup_size_mb": {"key": "backupSizeMB", "type": "int"},
        "restore_started_timestamp_utc": {"key": "restoreStartedTimestampUtc", "type": "iso-8601"},
        "restore_finished_timestamp_utc": {"key": "restoreFinishedTimestampUtc", "type": "iso-8601"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.status = None
        self.first_stripe_name = None
        self.number_of_stripes = None
        self.backup_size_mb = None
        self.restore_started_timestamp_utc = None
        self.restore_finished_timestamp_utc = None


class ManagedDatabaseRestoreDetailsResult(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A managed database restore details.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar type_properties_type: Restore type.
    :vartype type_properties_type: str
    :ivar status: Restore status.
    :vartype status: str
    :ivar block_reason: The reason why restore is in Blocked state.
    :vartype block_reason: str
    :ivar last_uploaded_file_name: Last uploaded file name.
    :vartype last_uploaded_file_name: str
    :ivar last_uploaded_file_time: Last uploaded file time.
    :vartype last_uploaded_file_time: ~datetime.datetime
    :ivar last_restored_file_name: Last restored file name.
    :vartype last_restored_file_name: str
    :ivar last_restored_file_time: Last restored file time.
    :vartype last_restored_file_time: ~datetime.datetime
    :ivar percent_completed: Percent completed.
    :vartype percent_completed: int
    :ivar current_restored_size_mb: Current restored size MB.
    :vartype current_restored_size_mb: int
    :ivar current_restore_plan_size_mb: Current restore plan size MB.
    :vartype current_restore_plan_size_mb: int
    :ivar current_backup_type: Current backup type.
    :vartype current_backup_type: str
    :ivar current_restoring_file_name: Current restoring file name.
    :vartype current_restoring_file_name: str
    :ivar number_of_files_detected: Number of files detected.
    :vartype number_of_files_detected: int
    :ivar number_of_files_queued: Number of files queued.
    :vartype number_of_files_queued: int
    :ivar number_of_files_skipped: Number of files skipped.
    :vartype number_of_files_skipped: int
    :ivar number_of_files_restoring: Number of files restoring.
    :vartype number_of_files_restoring: int
    :ivar number_of_files_restored: Number of files restored.
    :vartype number_of_files_restored: int
    :ivar number_of_files_unrestorable: Number of files unrestorable.
    :vartype number_of_files_unrestorable: int
    :ivar full_backup_sets: Full backup sets.
    :vartype full_backup_sets:
     list[~azure.mgmt.sql.models.ManagedDatabaseRestoreDetailsBackupSetProperties]
    :ivar diff_backup_sets: Diff backup sets.
    :vartype diff_backup_sets:
     list[~azure.mgmt.sql.models.ManagedDatabaseRestoreDetailsBackupSetProperties]
    :ivar log_backup_sets: Log backup sets.
    :vartype log_backup_sets:
     list[~azure.mgmt.sql.models.ManagedDatabaseRestoreDetailsBackupSetProperties]
    :ivar unrestorable_files: Unrestorable files.
    :vartype unrestorable_files:
     list[~azure.mgmt.sql.models.ManagedDatabaseRestoreDetailsUnrestorableFileProperties]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "type_properties_type": {"readonly": True},
        "status": {"readonly": True},
        "block_reason": {"readonly": True},
        "last_uploaded_file_name": {"readonly": True},
        "last_uploaded_file_time": {"readonly": True},
        "last_restored_file_name": {"readonly": True},
        "last_restored_file_time": {"readonly": True},
        "percent_completed": {"readonly": True},
        "current_restored_size_mb": {"readonly": True},
        "current_restore_plan_size_mb": {"readonly": True},
        "current_backup_type": {"readonly": True},
        "current_restoring_file_name": {"readonly": True},
        "number_of_files_detected": {"readonly": True},
        "number_of_files_queued": {"readonly": True},
        "number_of_files_skipped": {"readonly": True},
        "number_of_files_restoring": {"readonly": True},
        "number_of_files_restored": {"readonly": True},
        "number_of_files_unrestorable": {"readonly": True},
        "full_backup_sets": {"readonly": True},
        "diff_backup_sets": {"readonly": True},
        "log_backup_sets": {"readonly": True},
        "unrestorable_files": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "type_properties_type": {"key": "properties.type", "type": "str"},
        "status": {"key": "properties.status", "type": "str"},
        "block_reason": {"key": "properties.blockReason", "type": "str"},
        "last_uploaded_file_name": {"key": "properties.lastUploadedFileName", "type": "str"},
        "last_uploaded_file_time": {"key": "properties.lastUploadedFileTime", "type": "iso-8601"},
        "last_restored_file_name": {"key": "properties.lastRestoredFileName", "type": "str"},
        "last_restored_file_time": {"key": "properties.lastRestoredFileTime", "type": "iso-8601"},
        "percent_completed": {"key": "properties.percentCompleted", "type": "int"},
        "current_restored_size_mb": {"key": "properties.currentRestoredSizeMB", "type": "int"},
        "current_restore_plan_size_mb": {"key": "properties.currentRestorePlanSizeMB", "type": "int"},
        "current_backup_type": {"key": "properties.currentBackupType", "type": "str"},
        "current_restoring_file_name": {"key": "properties.currentRestoringFileName", "type": "str"},
        "number_of_files_detected": {"key": "properties.numberOfFilesDetected", "type": "int"},
        "number_of_files_queued": {"key": "properties.numberOfFilesQueued", "type": "int"},
        "number_of_files_skipped": {"key": "properties.numberOfFilesSkipped", "type": "int"},
        "number_of_files_restoring": {"key": "properties.numberOfFilesRestoring", "type": "int"},
        "number_of_files_restored": {"key": "properties.numberOfFilesRestored", "type": "int"},
        "number_of_files_unrestorable": {"key": "properties.numberOfFilesUnrestorable", "type": "int"},
        "full_backup_sets": {
            "key": "properties.fullBackupSets",
            "type": "[ManagedDatabaseRestoreDetailsBackupSetProperties]",
        },
        "diff_backup_sets": {
            "key": "properties.diffBackupSets",
            "type": "[ManagedDatabaseRestoreDetailsBackupSetProperties]",
        },
        "log_backup_sets": {
            "key": "properties.logBackupSets",
            "type": "[ManagedDatabaseRestoreDetailsBackupSetProperties]",
        },
        "unrestorable_files": {
            "key": "properties.unrestorableFiles",
            "type": "[ManagedDatabaseRestoreDetailsUnrestorableFileProperties]",
        },
    }

    def __init__(self, **kwargs):  # pylint: disable=too-many-locals
        """ """
        super().__init__(**kwargs)
        self.type_properties_type = None
        self.status = None
        self.block_reason = None
        self.last_uploaded_file_name = None
        self.last_uploaded_file_time = None
        self.last_restored_file_name = None
        self.last_restored_file_time = None
        self.percent_completed = None
        self.current_restored_size_mb = None
        self.current_restore_plan_size_mb = None
        self.current_backup_type = None
        self.current_restoring_file_name = None
        self.number_of_files_detected = None
        self.number_of_files_queued = None
        self.number_of_files_skipped = None
        self.number_of_files_restoring = None
        self.number_of_files_restored = None
        self.number_of_files_unrestorable = None
        self.full_backup_sets = None
        self.diff_backup_sets = None
        self.log_backup_sets = None
        self.unrestorable_files = None


class ManagedDatabaseRestoreDetailsUnrestorableFileProperties(_serialization.Model):
    """The managed database's restore details unrestorable file properties.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: File name.
    :vartype name: str
    """

    _validation = {
        "name": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.name = None


class ManagedDatabaseSecurityAlertPolicy(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A managed database security alert policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar state: Specifies the state of the policy, whether it is enabled or disabled or a policy
     has not been applied yet on the specific database. Known values are: "New", "Enabled", and
     "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState
    :ivar disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are:
     Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action,
     Brute_Force.
    :vartype disabled_alerts: list[str]
    :ivar email_addresses: Specifies an array of e-mail addresses to which the alert is sent.
    :vartype email_addresses: list[str]
    :ivar email_account_admins: Specifies that the alert is sent to the account administrators.
    :vartype email_account_admins: bool
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection
     audit logs.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the Threat Detection audit
     storage account.
    :vartype storage_account_access_key: str
    :ivar retention_days: Specifies the number of days to keep in the Threat Detection audit logs.
    :vartype retention_days: int
    :ivar creation_time: Specifies the UTC creation time of the policy.
    :vartype creation_time: ~datetime.datetime
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "creation_time": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
        "disabled_alerts": {"key": "properties.disabledAlerts", "type": "[str]"},
        "email_addresses": {"key": "properties.emailAddresses", "type": "[str]"},
        "email_account_admins": {"key": "properties.emailAccountAdmins", "type": "bool"},
        "storage_endpoint": {"key": "properties.storageEndpoint", "type": "str"},
        "storage_account_access_key": {"key": "properties.storageAccountAccessKey", "type": "str"},
        "retention_days": {"key": "properties.retentionDays", "type": "int"},
        "creation_time": {"key": "properties.creationTime", "type": "iso-8601"},
    }

    def __init__(
        self,
        *,
        state: Optional[Union[str, "_models.SecurityAlertPolicyState"]] = None,
        disabled_alerts: Optional[List[str]] = None,
        email_addresses: Optional[List[str]] = None,
        email_account_admins: Optional[bool] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        retention_days: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword state: Specifies the state of the policy, whether it is enabled or disabled or a
         policy has not been applied yet on the specific database. Known values are: "New", "Enabled",
         and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState
        :keyword disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are:
         Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action,
         Brute_Force.
        :paramtype disabled_alerts: list[str]
        :keyword email_addresses: Specifies an array of e-mail addresses to which the alert is sent.
        :paramtype email_addresses: list[str]
        :keyword email_account_admins: Specifies that the alert is sent to the account administrators.
        :paramtype email_account_admins: bool
        :keyword storage_endpoint: Specifies the blob storage endpoint (e.g.
         https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection
         audit logs.
        :paramtype storage_endpoint: str
        :keyword storage_account_access_key: Specifies the identifier key of the Threat Detection audit
         storage account.
        :paramtype storage_account_access_key: str
        :keyword retention_days: Specifies the number of days to keep in the Threat Detection audit
         logs.
        :paramtype retention_days: int
        """
        super().__init__(**kwargs)
        self.state = state
        self.disabled_alerts = disabled_alerts
        self.email_addresses = email_addresses
        self.email_account_admins = email_account_admins
        self.storage_endpoint = storage_endpoint
        self.storage_account_access_key = storage_account_access_key
        self.retention_days = retention_days
        self.creation_time = None


class ManagedDatabaseSecurityAlertPolicyListResult(_serialization.Model):
    """A list of the managed database's security alert policies.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedDatabaseSecurityAlertPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedDatabaseSecurityAlertPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedDatabaseStartMoveDefinition(_serialization.Model):
    """Contains the information necessary to start a managed database move.

    All required parameters must be populated in order to send to Azure.

    :ivar destination_managed_database_id: The destination managed database ID. Required.
    :vartype destination_managed_database_id: str
    :ivar operation_mode: The move operation mode. Known values are: "Move" and "Copy".
    :vartype operation_mode: str or ~azure.mgmt.sql.models.MoveOperationMode
    """

    _validation = {
        "destination_managed_database_id": {"required": True},
    }

    _attribute_map = {
        "destination_managed_database_id": {"key": "destinationManagedDatabaseId", "type": "str"},
        "operation_mode": {"key": "operationMode", "type": "str"},
    }

    def __init__(
        self,
        *,
        destination_managed_database_id: str,
        operation_mode: Optional[Union[str, "_models.MoveOperationMode"]] = None,
        **kwargs
    ):
        """
        :keyword destination_managed_database_id: The destination managed database ID. Required.
        :paramtype destination_managed_database_id: str
        :keyword operation_mode: The move operation mode. Known values are: "Move" and "Copy".
        :paramtype operation_mode: str or ~azure.mgmt.sql.models.MoveOperationMode
        """
        super().__init__(**kwargs)
        self.destination_managed_database_id = destination_managed_database_id
        self.operation_mode = operation_mode


class ManagedDatabaseUpdate(_serialization.Model):  # pylint: disable=too-many-instance-attributes
    """An managed database update.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar collation: Collation of the managed database.
    :vartype collation: str
    :ivar status: Status of the database. Known values are: "Online", "Offline", "Shutdown",
     "Creating", "Inaccessible", "Restoring", and "Updating".
    :vartype status: str or ~azure.mgmt.sql.models.ManagedDatabaseStatus
    :ivar creation_date: Creation date of the database.
    :vartype creation_date: ~datetime.datetime
    :ivar earliest_restore_point: Earliest restore point in time for point in time restore.
    :vartype earliest_restore_point: ~datetime.datetime
    :ivar restore_point_in_time: Conditional. If createMode is PointInTimeRestore, this value is
     required. Specifies the point in time (ISO8601 format) of the source database that will be
     restored to create the new database.
    :vartype restore_point_in_time: ~datetime.datetime
    :ivar default_secondary_location: Geo paired region.
    :vartype default_secondary_location: str
    :ivar catalog_collation: Collation of the metadata catalog. Known values are:
     "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS".
    :vartype catalog_collation: str or ~azure.mgmt.sql.models.CatalogCollationType
    :ivar create_mode: Managed database create mode. PointInTimeRestore: Create a database by
     restoring a point in time backup of an existing database. SourceDatabaseName,
     SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a
     database by restoring from external backup files. Collation, StorageContainerUri and
     StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a
     geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database
     resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a
     long term retention backup (longTermRetentionBackupResourceId required). Known values are:
     "Default", "RestoreExternalBackup", "PointInTimeRestore", "Recovery", and
     "RestoreLongTermRetentionBackup".
    :vartype create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode
    :ivar storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value is
     required. Specifies the uri of the storage container where backups for this restore are stored.
    :vartype storage_container_uri: str
    :ivar source_database_id: The resource identifier of the source database associated with create
     operation of this database.
    :vartype source_database_id: str
    :ivar restorable_dropped_database_id: The restorable dropped database resource id to restore
     when creating this database.
    :vartype restorable_dropped_database_id: str
    :ivar storage_container_identity: Conditional. If createMode is RestoreExternalBackup, this
     value is used. Specifies the identity used for storage container authentication. Can be
     'SharedAccessSignature' or 'ManagedIdentity'; if not specified 'SharedAccessSignature' is
     assumed.
    :vartype storage_container_identity: str
    :ivar storage_container_sas_token: Conditional. If createMode is RestoreExternalBackup and
     storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage
     container sas token.
    :vartype storage_container_sas_token: str
    :ivar failover_group_id: Instance Failover Group resource identifier that this managed database
     belongs to.
    :vartype failover_group_id: str
    :ivar recoverable_database_id: The resource identifier of the recoverable database associated
     with create operation of this database.
    :vartype recoverable_database_id: str
    :ivar long_term_retention_backup_resource_id: The name of the Long Term Retention backup to be
     used for restore of this managed database.
    :vartype long_term_retention_backup_resource_id: str
    :ivar auto_complete_restore: Whether to auto complete restore of this managed database.
    :vartype auto_complete_restore: bool
    :ivar last_backup_name: Last backup file name for restore of this managed database.
    :vartype last_backup_name: str
    """

    _validation = {
        "status": {"readonly": True},
        "creation_date": {"readonly": True},
        "earliest_restore_point": {"readonly": True},
        "default_secondary_location": {"readonly": True},
        "failover_group_id": {"readonly": True},
    }

    _attribute_map = {
        "tags": {"key": "tags", "type": "{str}"},
        "collation": {"key": "properties.collation", "type": "str"},
        "status": {"key": "properties.status", "type": "str"},
        "creation_date": {"key": "properties.creationDate", "type": "iso-8601"},
        "earliest_restore_point": {"key": "properties.earliestRestorePoint", "type": "iso-8601"},
        "restore_point_in_time": {"key": "properties.restorePointInTime", "type": "iso-8601"},
        "default_secondary_location": {"key": "properties.defaultSecondaryLocation", "type": "str"},
        "catalog_collation": {"key": "properties.catalogCollation", "type": "str"},
        "create_mode": {"key": "properties.createMode", "type": "str"},
        "storage_container_uri": {"key": "properties.storageContainerUri", "type": "str"},
        "source_database_id": {"key": "properties.sourceDatabaseId", "type": "str"},
        "restorable_dropped_database_id": {"key": "properties.restorableDroppedDatabaseId", "type": "str"},
        "storage_container_identity": {"key": "properties.storageContainerIdentity", "type": "str"},
        "storage_container_sas_token": {"key": "properties.storageContainerSasToken", "type": "str"},
        "failover_group_id": {"key": "properties.failoverGroupId", "type": "str"},
        "recoverable_database_id": {"key": "properties.recoverableDatabaseId", "type": "str"},
        "long_term_retention_backup_resource_id": {
            "key": "properties.longTermRetentionBackupResourceId",
            "type": "str",
        },
        "auto_complete_restore": {"key": "properties.autoCompleteRestore", "type": "bool"},
        "last_backup_name": {"key": "properties.lastBackupName", "type": "str"},
    }

    def __init__(
        self,
        *,
        tags: Optional[Dict[str, str]] = None,
        collation: Optional[str] = None,
        restore_point_in_time: Optional[datetime.datetime] = None,
        catalog_collation: Optional[Union[str, "_models.CatalogCollationType"]] = None,
        create_mode: Optional[Union[str, "_models.ManagedDatabaseCreateMode"]] = None,
        storage_container_uri: Optional[str] = None,
        source_database_id: Optional[str] = None,
        restorable_dropped_database_id: Optional[str] = None,
        storage_container_identity: Optional[str] = None,
        storage_container_sas_token: Optional[str] = None,
        recoverable_database_id: Optional[str] = None,
        long_term_retention_backup_resource_id: Optional[str] = None,
        auto_complete_restore: Optional[bool] = None,
        last_backup_name: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword collation: Collation of the managed database.
        :paramtype collation: str
        :keyword restore_point_in_time: Conditional. If createMode is PointInTimeRestore, this value is
         required. Specifies the point in time (ISO8601 format) of the source database that will be
         restored to create the new database.
        :paramtype restore_point_in_time: ~datetime.datetime
        :keyword catalog_collation: Collation of the metadata catalog. Known values are:
         "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS".
        :paramtype catalog_collation: str or ~azure.mgmt.sql.models.CatalogCollationType
        :keyword create_mode: Managed database create mode. PointInTimeRestore: Create a database by
         restoring a point in time backup of an existing database. SourceDatabaseName,
         SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a
         database by restoring from external backup files. Collation, StorageContainerUri and
         StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a
         geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database
         resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a
         long term retention backup (longTermRetentionBackupResourceId required). Known values are:
         "Default", "RestoreExternalBackup", "PointInTimeRestore", "Recovery", and
         "RestoreLongTermRetentionBackup".
        :paramtype create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode
        :keyword storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value
         is required. Specifies the uri of the storage container where backups for this restore are
         stored.
        :paramtype storage_container_uri: str
        :keyword source_database_id: The resource identifier of the source database associated with
         create operation of this database.
        :paramtype source_database_id: str
        :keyword restorable_dropped_database_id: The restorable dropped database resource id to restore
         when creating this database.
        :paramtype restorable_dropped_database_id: str
        :keyword storage_container_identity: Conditional. If createMode is RestoreExternalBackup, this
         value is used. Specifies the identity used for storage container authentication. Can be
         'SharedAccessSignature' or 'ManagedIdentity'; if not specified 'SharedAccessSignature' is
         assumed.
        :paramtype storage_container_identity: str
        :keyword storage_container_sas_token: Conditional. If createMode is RestoreExternalBackup and
         storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage
         container sas token.
        :paramtype storage_container_sas_token: str
        :keyword recoverable_database_id: The resource identifier of the recoverable database
         associated with create operation of this database.
        :paramtype recoverable_database_id: str
        :keyword long_term_retention_backup_resource_id: The name of the Long Term Retention backup to
         be used for restore of this managed database.
        :paramtype long_term_retention_backup_resource_id: str
        :keyword auto_complete_restore: Whether to auto complete restore of this managed database.
        :paramtype auto_complete_restore: bool
        :keyword last_backup_name: Last backup file name for restore of this managed database.
        :paramtype last_backup_name: str
        """
        super().__init__(**kwargs)
        self.tags = tags
        self.collation = collation
        self.status = None
        self.creation_date = None
        self.earliest_restore_point = None
        self.restore_point_in_time = restore_point_in_time
        self.default_secondary_location = None
        self.catalog_collation = catalog_collation
        self.create_mode = create_mode
        self.storage_container_uri = storage_container_uri
        self.source_database_id = source_database_id
        self.restorable_dropped_database_id = restorable_dropped_database_id
        self.storage_container_identity = storage_container_identity
        self.storage_container_sas_token = storage_container_sas_token
        self.failover_group_id = None
        self.recoverable_database_id = recoverable_database_id
        self.long_term_retention_backup_resource_id = long_term_retention_backup_resource_id
        self.auto_complete_restore = auto_complete_restore
        self.last_backup_name = last_backup_name


class ManagedInstance(TrackedResource):  # pylint: disable=too-many-instance-attributes
    """An Azure SQL managed instance.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location. Required.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar identity: The Azure Active Directory identity of the managed instance.
    :vartype identity: ~azure.mgmt.sql.models.ResourceIdentity
    :ivar sku: Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4,
     BC_Gen5.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar provisioning_state: Known values are: "Creating", "Deleting", "Updating", "Unknown",
     "Succeeded", "Failed", "Accepted", "Created", "Deleted", "Unrecognized", "Running", "Canceled",
     "NotSpecified", "Registering", and "TimedOut".
    :vartype provisioning_state: str or
     ~azure.mgmt.sql.models.ManagedInstancePropertiesProvisioningState
    :ivar managed_instance_create_mode: Specifies the mode of database creation.

     Default: Regular instance creation.

     Restore: Creates an instance by restoring a set of backups to specific point in time.
     RestorePointInTime and SourceManagedInstanceId must be specified. Known values are: "Default"
     and "PointInTimeRestore".
    :vartype managed_instance_create_mode: str or ~azure.mgmt.sql.models.ManagedServerCreateMode
    :ivar fully_qualified_domain_name: The fully qualified domain name of the managed instance.
    :vartype fully_qualified_domain_name: str
    :ivar administrator_login: Administrator username for the managed instance. Can only be
     specified when the managed instance is being created (and is required for creation).
    :vartype administrator_login: str
    :ivar administrator_login_password: The administrator login password (required for managed
     instance creation).
    :vartype administrator_login_password: str
    :ivar subnet_id: Subnet resource ID for the managed instance.
    :vartype subnet_id: str
    :ivar state: The state of the managed instance.
    :vartype state: str
    :ivar license_type: The license type. Possible values are 'LicenseIncluded' (regular price
     inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL
     licenses). Known values are: "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.ManagedInstanceLicenseType
    :ivar v_cores: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80.
    :vartype v_cores: int
    :ivar storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 8192.
     Increments of 32 GB allowed only.
    :vartype storage_size_in_gb: int
    :ivar collation: Collation of the managed instance.
    :vartype collation: str
    :ivar dns_zone: The Dns Zone that the managed instance is in.
    :vartype dns_zone: str
    :ivar dns_zone_partner: The resource id of another managed instance whose DNS zone this managed
     instance will share after creation.
    :vartype dns_zone_partner: str
    :ivar public_data_endpoint_enabled: Whether or not the public data endpoint is enabled.
    :vartype public_data_endpoint_enabled: bool
    :ivar source_managed_instance_id: The resource identifier of the source managed instance
     associated with create operation of this instance.
    :vartype source_managed_instance_id: str
    :ivar restore_point_in_time: Specifies the point in time (ISO8601 format) of the source
     database that will be restored to create the new database.
    :vartype restore_point_in_time: ~datetime.datetime
    :ivar proxy_override: Connection type used for connecting to the instance. Known values are:
     "Proxy", "Redirect", and "Default".
    :vartype proxy_override: str or ~azure.mgmt.sql.models.ManagedInstanceProxyOverride
    :ivar timezone_id: Id of the timezone. Allowed values are timezones supported by Windows.
     Windows keeps details on supported timezones, including the id, in registry under
     KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.
     You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM
     sys.time_zone_info.
     List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in
     PowerShell.
     An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time".
    :vartype timezone_id: str
    :ivar instance_pool_id: The Id of the instance pool this managed server belongs to.
    :vartype instance_pool_id: str
    :ivar maintenance_configuration_id: Specifies maintenance configuration id to apply to this
     managed instance.
    :vartype maintenance_configuration_id: str
    :ivar private_endpoint_connections: List of private endpoint connections on a managed instance.
    :vartype private_endpoint_connections: list[~azure.mgmt.sql.models.ManagedInstancePecProperty]
    :ivar minimal_tls_version: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'.
    :vartype minimal_tls_version: str
    :ivar current_backup_storage_redundancy: The storage account type used to store backups for
     this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage),
     Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). Known values are: "Geo",
     "Local", "Zone", and "GeoZone".
    :vartype current_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar requested_backup_storage_redundancy: The storage account type to be used to store backups
     for this instance. The options are Local (LocallyRedundantStorage), Zone
     (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). Known
     values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype requested_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar zone_redundant: Whether or not the multi-az is enabled.
    :vartype zone_redundant: bool
    :ivar primary_user_assigned_identity_id: The resource id of a user assigned identity to be used
     by default.
    :vartype primary_user_assigned_identity_id: str
    :ivar key_id: A CMK URI of the key to use for encryption.
    :vartype key_id: str
    :ivar administrators: The Azure Active Directory administrator of the server.
    :vartype administrators: ~azure.mgmt.sql.models.ManagedInstanceExternalAdministrator
    :ivar service_principal: The managed instance's service principal.
    :vartype service_principal: ~azure.mgmt.sql.models.ServicePrincipal
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"required": True},
        "provisioning_state": {"readonly": True},
        "fully_qualified_domain_name": {"readonly": True},
        "state": {"readonly": True},
        "dns_zone": {"readonly": True},
        "private_endpoint_connections": {"readonly": True},
        "current_backup_storage_redundancy": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "tags": {"key": "tags", "type": "{str}"},
        "identity": {"key": "identity", "type": "ResourceIdentity"},
        "sku": {"key": "sku", "type": "Sku"},
        "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
        "managed_instance_create_mode": {"key": "properties.managedInstanceCreateMode", "type": "str"},
        "fully_qualified_domain_name": {"key": "properties.fullyQualifiedDomainName", "type": "str"},
        "administrator_login": {"key": "properties.administratorLogin", "type": "str"},
        "administrator_login_password": {"key": "properties.administratorLoginPassword", "type": "str"},
        "subnet_id": {"key": "properties.subnetId", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
        "license_type": {"key": "properties.licenseType", "type": "str"},
        "v_cores": {"key": "properties.vCores", "type": "int"},
        "storage_size_in_gb": {"key": "properties.storageSizeInGB", "type": "int"},
        "collation": {"key": "properties.collation", "type": "str"},
        "dns_zone": {"key": "properties.dnsZone", "type": "str"},
        "dns_zone_partner": {"key": "properties.dnsZonePartner", "type": "str"},
        "public_data_endpoint_enabled": {"key": "properties.publicDataEndpointEnabled", "type": "bool"},
        "source_managed_instance_id": {"key": "properties.sourceManagedInstanceId", "type": "str"},
        "restore_point_in_time": {"key": "properties.restorePointInTime", "type": "iso-8601"},
        "proxy_override": {"key": "properties.proxyOverride", "type": "str"},
        "timezone_id": {"key": "properties.timezoneId", "type": "str"},
        "instance_pool_id": {"key": "properties.instancePoolId", "type": "str"},
        "maintenance_configuration_id": {"key": "properties.maintenanceConfigurationId", "type": "str"},
        "private_endpoint_connections": {
            "key": "properties.privateEndpointConnections",
            "type": "[ManagedInstancePecProperty]",
        },
        "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"},
        "current_backup_storage_redundancy": {"key": "properties.currentBackupStorageRedundancy", "type": "str"},
        "requested_backup_storage_redundancy": {"key": "properties.requestedBackupStorageRedundancy", "type": "str"},
        "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"},
        "primary_user_assigned_identity_id": {"key": "properties.primaryUserAssignedIdentityId", "type": "str"},
        "key_id": {"key": "properties.keyId", "type": "str"},
        "administrators": {"key": "properties.administrators", "type": "ManagedInstanceExternalAdministrator"},
        "service_principal": {"key": "properties.servicePrincipal", "type": "ServicePrincipal"},
    }

    def __init__(  # pylint: disable=too-many-locals
        self,
        *,
        location: str,
        tags: Optional[Dict[str, str]] = None,
        identity: Optional["_models.ResourceIdentity"] = None,
        sku: Optional["_models.Sku"] = None,
        managed_instance_create_mode: Optional[Union[str, "_models.ManagedServerCreateMode"]] = None,
        administrator_login: Optional[str] = None,
        administrator_login_password: Optional[str] = None,
        subnet_id: Optional[str] = None,
        license_type: Optional[Union[str, "_models.ManagedInstanceLicenseType"]] = None,
        v_cores: Optional[int] = None,
        storage_size_in_gb: Optional[int] = None,
        collation: Optional[str] = None,
        dns_zone_partner: Optional[str] = None,
        public_data_endpoint_enabled: Optional[bool] = None,
        source_managed_instance_id: Optional[str] = None,
        restore_point_in_time: Optional[datetime.datetime] = None,
        proxy_override: Optional[Union[str, "_models.ManagedInstanceProxyOverride"]] = None,
        timezone_id: Optional[str] = None,
        instance_pool_id: Optional[str] = None,
        maintenance_configuration_id: Optional[str] = None,
        minimal_tls_version: Optional[str] = None,
        requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None,
        zone_redundant: Optional[bool] = None,
        primary_user_assigned_identity_id: Optional[str] = None,
        key_id: Optional[str] = None,
        administrators: Optional["_models.ManagedInstanceExternalAdministrator"] = None,
        service_principal: Optional["_models.ServicePrincipal"] = None,
        **kwargs
    ):
        """
        :keyword location: Resource location. Required.
        :paramtype location: str
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword identity: The Azure Active Directory identity of the managed instance.
        :paramtype identity: ~azure.mgmt.sql.models.ResourceIdentity
        :keyword sku: Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4,
         BC_Gen5.
        :paramtype sku: ~azure.mgmt.sql.models.Sku
        :keyword managed_instance_create_mode: Specifies the mode of database creation.

         Default: Regular instance creation.

         Restore: Creates an instance by restoring a set of backups to specific point in time.
         RestorePointInTime and SourceManagedInstanceId must be specified. Known values are: "Default"
         and "PointInTimeRestore".
        :paramtype managed_instance_create_mode: str or ~azure.mgmt.sql.models.ManagedServerCreateMode
        :keyword administrator_login: Administrator username for the managed instance. Can only be
         specified when the managed instance is being created (and is required for creation).
        :paramtype administrator_login: str
        :keyword administrator_login_password: The administrator login password (required for managed
         instance creation).
        :paramtype administrator_login_password: str
        :keyword subnet_id: Subnet resource ID for the managed instance.
        :paramtype subnet_id: str
        :keyword license_type: The license type. Possible values are 'LicenseIncluded' (regular price
         inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL
         licenses). Known values are: "LicenseIncluded" and "BasePrice".
        :paramtype license_type: str or ~azure.mgmt.sql.models.ManagedInstanceLicenseType
        :keyword v_cores: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80.
        :paramtype v_cores: int
        :keyword storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 8192.
         Increments of 32 GB allowed only.
        :paramtype storage_size_in_gb: int
        :keyword collation: Collation of the managed instance.
        :paramtype collation: str
        :keyword dns_zone_partner: The resource id of another managed instance whose DNS zone this
         managed instance will share after creation.
        :paramtype dns_zone_partner: str
        :keyword public_data_endpoint_enabled: Whether or not the public data endpoint is enabled.
        :paramtype public_data_endpoint_enabled: bool
        :keyword source_managed_instance_id: The resource identifier of the source managed instance
         associated with create operation of this instance.
        :paramtype source_managed_instance_id: str
        :keyword restore_point_in_time: Specifies the point in time (ISO8601 format) of the source
         database that will be restored to create the new database.
        :paramtype restore_point_in_time: ~datetime.datetime
        :keyword proxy_override: Connection type used for connecting to the instance. Known values are:
         "Proxy", "Redirect", and "Default".
        :paramtype proxy_override: str or ~azure.mgmt.sql.models.ManagedInstanceProxyOverride
        :keyword timezone_id: Id of the timezone. Allowed values are timezones supported by Windows.
         Windows keeps details on supported timezones, including the id, in registry under
         KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.
         You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM
         sys.time_zone_info.
         List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in
         PowerShell.
         An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time".
        :paramtype timezone_id: str
        :keyword instance_pool_id: The Id of the instance pool this managed server belongs to.
        :paramtype instance_pool_id: str
        :keyword maintenance_configuration_id: Specifies maintenance configuration id to apply to this
         managed instance.
        :paramtype maintenance_configuration_id: str
        :keyword minimal_tls_version: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'.
        :paramtype minimal_tls_version: str
        :keyword requested_backup_storage_redundancy: The storage account type to be used to store
         backups for this instance. The options are Local (LocallyRedundantStorage), Zone
         (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). Known
         values are: "Geo", "Local", "Zone", and "GeoZone".
        :paramtype requested_backup_storage_redundancy: str or
         ~azure.mgmt.sql.models.BackupStorageRedundancy
        :keyword zone_redundant: Whether or not the multi-az is enabled.
        :paramtype zone_redundant: bool
        :keyword primary_user_assigned_identity_id: The resource id of a user assigned identity to be
         used by default.
        :paramtype primary_user_assigned_identity_id: str
        :keyword key_id: A CMK URI of the key to use for encryption.
        :paramtype key_id: str
        :keyword administrators: The Azure Active Directory administrator of the server.
        :paramtype administrators: ~azure.mgmt.sql.models.ManagedInstanceExternalAdministrator
        :keyword service_principal: The managed instance's service principal.
        :paramtype service_principal: ~azure.mgmt.sql.models.ServicePrincipal
        """
        super().__init__(location=location, tags=tags, **kwargs)
        self.identity = identity
        self.sku = sku
        self.provisioning_state = None
        self.managed_instance_create_mode = managed_instance_create_mode
        self.fully_qualified_domain_name = None
        self.administrator_login = administrator_login
        self.administrator_login_password = administrator_login_password
        self.subnet_id = subnet_id
        self.state = None
        self.license_type = license_type
        self.v_cores = v_cores
        self.storage_size_in_gb = storage_size_in_gb
        self.collation = collation
        self.dns_zone = None
        self.dns_zone_partner = dns_zone_partner
        self.public_data_endpoint_enabled = public_data_endpoint_enabled
        self.source_managed_instance_id = source_managed_instance_id
        self.restore_point_in_time = restore_point_in_time
        self.proxy_override = proxy_override
        self.timezone_id = timezone_id
        self.instance_pool_id = instance_pool_id
        self.maintenance_configuration_id = maintenance_configuration_id
        self.private_endpoint_connections = None
        self.minimal_tls_version = minimal_tls_version
        self.current_backup_storage_redundancy = None
        self.requested_backup_storage_redundancy = requested_backup_storage_redundancy
        self.zone_redundant = zone_redundant
        self.primary_user_assigned_identity_id = primary_user_assigned_identity_id
        self.key_id = key_id
        self.administrators = administrators
        self.service_principal = service_principal


class ManagedInstanceAdministrator(ProxyResource):
    """An Azure SQL managed instance administrator.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar administrator_type: Type of the managed instance administrator. "ActiveDirectory"
    :vartype administrator_type: str or ~azure.mgmt.sql.models.ManagedInstanceAdministratorType
    :ivar login: Login name of the managed instance administrator.
    :vartype login: str
    :ivar sid: SID (object ID) of the managed instance administrator.
    :vartype sid: str
    :ivar tenant_id: Tenant ID of the managed instance administrator.
    :vartype tenant_id: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "administrator_type": {"key": "properties.administratorType", "type": "str"},
        "login": {"key": "properties.login", "type": "str"},
        "sid": {"key": "properties.sid", "type": "str"},
        "tenant_id": {"key": "properties.tenantId", "type": "str"},
    }

    def __init__(
        self,
        *,
        administrator_type: Optional[Union[str, "_models.ManagedInstanceAdministratorType"]] = None,
        login: Optional[str] = None,
        sid: Optional[str] = None,
        tenant_id: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword administrator_type: Type of the managed instance administrator. "ActiveDirectory"
        :paramtype administrator_type: str or ~azure.mgmt.sql.models.ManagedInstanceAdministratorType
        :keyword login: Login name of the managed instance administrator.
        :paramtype login: str
        :keyword sid: SID (object ID) of the managed instance administrator.
        :paramtype sid: str
        :keyword tenant_id: Tenant ID of the managed instance administrator.
        :paramtype tenant_id: str
        """
        super().__init__(**kwargs)
        self.administrator_type = administrator_type
        self.login = login
        self.sid = sid
        self.tenant_id = tenant_id


class ManagedInstanceAdministratorListResult(_serialization.Model):
    """A list of managed instance administrators.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstanceAdministrator]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstanceAdministrator]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstanceAdvancedThreatProtection(ProxyResource):
    """A managed instance Advanced Threat Protection.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of AdvancedThreatProtectionResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar state: Specifies the state of the Advanced Threat Protection, whether it is enabled or
     disabled or a state has not been applied yet on the specific database or server. Known values
     are: "New", "Enabled", and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState
    :ivar creation_time: Specifies the UTC creation time of the policy.
    :vartype creation_time: ~datetime.datetime
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
        "creation_time": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "state": {"key": "properties.state", "type": "str"},
        "creation_time": {"key": "properties.creationTime", "type": "iso-8601"},
    }

    def __init__(self, *, state: Optional[Union[str, "_models.AdvancedThreatProtectionState"]] = None, **kwargs):
        """
        :keyword state: Specifies the state of the Advanced Threat Protection, whether it is enabled or
         disabled or a state has not been applied yet on the specific database or server. Known values
         are: "New", "Enabled", and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.state = state
        self.creation_time = None


class ManagedInstanceAdvancedThreatProtectionListResult(_serialization.Model):
    """A list of the managed instance's Advanced Threat Protection settings.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstanceAdvancedThreatProtection]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstanceAdvancedThreatProtection]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstanceAzureADOnlyAuthentication(ProxyResource):
    """Azure Active Directory only authentication.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
    :vartype azure_ad_only_authentication: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "azure_ad_only_authentication": {"key": "properties.azureADOnlyAuthentication", "type": "bool"},
    }

    def __init__(self, *, azure_ad_only_authentication: Optional[bool] = None, **kwargs):
        """
        :keyword azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
        :paramtype azure_ad_only_authentication: bool
        """
        super().__init__(**kwargs)
        self.azure_ad_only_authentication = azure_ad_only_authentication


class ManagedInstanceAzureADOnlyAuthListResult(_serialization.Model):
    """A list of active directory only authentications.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstanceAzureADOnlyAuthentication]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstanceAzureADOnlyAuthentication]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstanceDtc(ProxyResource):
    """SQL Managed Instance DTC.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar dtc_enabled: Active status of managed instance DTC.
    :vartype dtc_enabled: bool
    :ivar security_settings: Security settings of managed instance DTC.
    :vartype security_settings: ~azure.mgmt.sql.models.ManagedInstanceDtcSecuritySettings
    :ivar external_dns_suffix_search_list: External dns suffix search list of managed instance DTC.
    :vartype external_dns_suffix_search_list: list[str]
    :ivar dtc_host_name_dns_suffix: Host name dns suffix of managed instance DTC.
    :vartype dtc_host_name_dns_suffix: str
    :ivar provisioning_state: Provisioning state of managed instance DTC. Known values are:
     "Created", "InProgress", "Succeeded", "Failed", and "Canceled".
    :vartype provisioning_state: str or ~azure.mgmt.sql.models.ProvisioningState
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "dtc_host_name_dns_suffix": {"readonly": True},
        "provisioning_state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "dtc_enabled": {"key": "properties.dtcEnabled", "type": "bool"},
        "security_settings": {"key": "properties.securitySettings", "type": "ManagedInstanceDtcSecuritySettings"},
        "external_dns_suffix_search_list": {"key": "properties.externalDnsSuffixSearchList", "type": "[str]"},
        "dtc_host_name_dns_suffix": {"key": "properties.dtcHostNameDnsSuffix", "type": "str"},
        "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
    }

    def __init__(
        self,
        *,
        dtc_enabled: Optional[bool] = None,
        security_settings: Optional["_models.ManagedInstanceDtcSecuritySettings"] = None,
        external_dns_suffix_search_list: Optional[List[str]] = None,
        **kwargs
    ):
        """
        :keyword dtc_enabled: Active status of managed instance DTC.
        :paramtype dtc_enabled: bool
        :keyword security_settings: Security settings of managed instance DTC.
        :paramtype security_settings: ~azure.mgmt.sql.models.ManagedInstanceDtcSecuritySettings
        :keyword external_dns_suffix_search_list: External dns suffix search list of managed instance
         DTC.
        :paramtype external_dns_suffix_search_list: list[str]
        """
        super().__init__(**kwargs)
        self.dtc_enabled = dtc_enabled
        self.security_settings = security_settings
        self.external_dns_suffix_search_list = external_dns_suffix_search_list
        self.dtc_host_name_dns_suffix = None
        self.provisioning_state = None


class ManagedInstanceDtcListResult(_serialization.Model):
    """A list of managed instance's DTCs.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstanceDtc]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstanceDtc]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstanceDtcSecuritySettings(_serialization.Model):
    """The Security Settings of managed instance DTC.

    :ivar transaction_manager_communication_settings: Transaction Manager communication settings of
     managed instance DTC.
    :vartype transaction_manager_communication_settings:
     ~azure.mgmt.sql.models.ManagedInstanceDtcTransactionManagerCommunicationSettings
    :ivar xa_transactions_enabled: Allow XA Transactions to managed instance DTC.
    :vartype xa_transactions_enabled: bool
    :ivar sna_lu6_point2_transactions_enabled: Allow SNA LU 6.2 Transactions to managed instance
     DTC.
    :vartype sna_lu6_point2_transactions_enabled: bool
    :ivar xa_transactions_default_timeout: Default timeout for XA Transactions (in seconds).
    :vartype xa_transactions_default_timeout: int
    :ivar xa_transactions_maximum_timeout: Maximum timeout for XA Transactions (in seconds).
    :vartype xa_transactions_maximum_timeout: int
    """

    _attribute_map = {
        "transaction_manager_communication_settings": {
            "key": "transactionManagerCommunicationSettings",
            "type": "ManagedInstanceDtcTransactionManagerCommunicationSettings",
        },
        "xa_transactions_enabled": {"key": "xaTransactionsEnabled", "type": "bool"},
        "sna_lu6_point2_transactions_enabled": {"key": "snaLu6point2TransactionsEnabled", "type": "bool"},
        "xa_transactions_default_timeout": {"key": "xaTransactionsDefaultTimeout", "type": "int"},
        "xa_transactions_maximum_timeout": {"key": "xaTransactionsMaximumTimeout", "type": "int"},
    }

    def __init__(
        self,
        *,
        transaction_manager_communication_settings: Optional[
            "_models.ManagedInstanceDtcTransactionManagerCommunicationSettings"
        ] = None,
        xa_transactions_enabled: Optional[bool] = None,
        sna_lu6_point2_transactions_enabled: Optional[bool] = None,
        xa_transactions_default_timeout: Optional[int] = None,
        xa_transactions_maximum_timeout: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword transaction_manager_communication_settings: Transaction Manager communication settings
         of managed instance DTC.
        :paramtype transaction_manager_communication_settings:
         ~azure.mgmt.sql.models.ManagedInstanceDtcTransactionManagerCommunicationSettings
        :keyword xa_transactions_enabled: Allow XA Transactions to managed instance DTC.
        :paramtype xa_transactions_enabled: bool
        :keyword sna_lu6_point2_transactions_enabled: Allow SNA LU 6.2 Transactions to managed instance
         DTC.
        :paramtype sna_lu6_point2_transactions_enabled: bool
        :keyword xa_transactions_default_timeout: Default timeout for XA Transactions (in seconds).
        :paramtype xa_transactions_default_timeout: int
        :keyword xa_transactions_maximum_timeout: Maximum timeout for XA Transactions (in seconds).
        :paramtype xa_transactions_maximum_timeout: int
        """
        super().__init__(**kwargs)
        self.transaction_manager_communication_settings = transaction_manager_communication_settings
        self.xa_transactions_enabled = xa_transactions_enabled
        self.sna_lu6_point2_transactions_enabled = sna_lu6_point2_transactions_enabled
        self.xa_transactions_default_timeout = xa_transactions_default_timeout
        self.xa_transactions_maximum_timeout = xa_transactions_maximum_timeout


class ManagedInstanceDtcTransactionManagerCommunicationSettings(_serialization.Model):
    """The Transaction Manager Communication Settings of managed instance DTC.

    :ivar allow_inbound_enabled: Allow Inbound traffic to managed instance DTC.
    :vartype allow_inbound_enabled: bool
    :ivar allow_outbound_enabled: Allow Outbound traffic of managed instance DTC.
    :vartype allow_outbound_enabled: bool
    :ivar authentication: Authentication type of managed instance DTC.
    :vartype authentication: str
    """

    _attribute_map = {
        "allow_inbound_enabled": {"key": "allowInboundEnabled", "type": "bool"},
        "allow_outbound_enabled": {"key": "allowOutboundEnabled", "type": "bool"},
        "authentication": {"key": "authentication", "type": "str"},
    }

    def __init__(
        self,
        *,
        allow_inbound_enabled: Optional[bool] = None,
        allow_outbound_enabled: Optional[bool] = None,
        authentication: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword allow_inbound_enabled: Allow Inbound traffic to managed instance DTC.
        :paramtype allow_inbound_enabled: bool
        :keyword allow_outbound_enabled: Allow Outbound traffic of managed instance DTC.
        :paramtype allow_outbound_enabled: bool
        :keyword authentication: Authentication type of managed instance DTC.
        :paramtype authentication: str
        """
        super().__init__(**kwargs)
        self.allow_inbound_enabled = allow_inbound_enabled
        self.allow_outbound_enabled = allow_outbound_enabled
        self.authentication = authentication


class ManagedInstanceEditionCapability(_serialization.Model):
    """The managed server capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The managed server version name.
    :vartype name: str
    :ivar supported_families: The supported families.
    :vartype supported_families: list[~azure.mgmt.sql.models.ManagedInstanceFamilyCapability]
    :ivar supported_storage_capabilities: The list of supported storage capabilities for this
     edition.
    :vartype supported_storage_capabilities: list[~azure.mgmt.sql.models.StorageCapability]
    :ivar zone_redundant: Whether or not zone redundancy is supported for the edition.
    :vartype zone_redundant: bool
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "supported_families": {"readonly": True},
        "supported_storage_capabilities": {"readonly": True},
        "zone_redundant": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "supported_families": {"key": "supportedFamilies", "type": "[ManagedInstanceFamilyCapability]"},
        "supported_storage_capabilities": {"key": "supportedStorageCapabilities", "type": "[StorageCapability]"},
        "zone_redundant": {"key": "zoneRedundant", "type": "bool"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.supported_families = None
        self.supported_storage_capabilities = None
        self.zone_redundant = None
        self.status = None
        self.reason = reason


class ManagedInstanceEncryptionProtector(ProxyResource):
    """The managed instance encryption protector.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar kind: Kind of encryption protector. This is metadata used for the Azure portal
     experience.
    :vartype kind: str
    :ivar server_key_name: The name of the managed instance key.
    :vartype server_key_name: str
    :ivar server_key_type: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'.
     Known values are: "ServiceManaged" and "AzureKeyVault".
    :vartype server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType
    :ivar uri: The URI of the server key.
    :vartype uri: str
    :ivar thumbprint: Thumbprint of the server key.
    :vartype thumbprint: str
    :ivar auto_rotation_enabled: Key auto rotation opt-in flag. Either true or false.
    :vartype auto_rotation_enabled: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "kind": {"readonly": True},
        "uri": {"readonly": True},
        "thumbprint": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "kind": {"key": "kind", "type": "str"},
        "server_key_name": {"key": "properties.serverKeyName", "type": "str"},
        "server_key_type": {"key": "properties.serverKeyType", "type": "str"},
        "uri": {"key": "properties.uri", "type": "str"},
        "thumbprint": {"key": "properties.thumbprint", "type": "str"},
        "auto_rotation_enabled": {"key": "properties.autoRotationEnabled", "type": "bool"},
    }

    def __init__(
        self,
        *,
        server_key_name: Optional[str] = None,
        server_key_type: Optional[Union[str, "_models.ServerKeyType"]] = None,
        auto_rotation_enabled: Optional[bool] = None,
        **kwargs
    ):
        """
        :keyword server_key_name: The name of the managed instance key.
        :paramtype server_key_name: str
        :keyword server_key_type: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'.
         Known values are: "ServiceManaged" and "AzureKeyVault".
        :paramtype server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType
        :keyword auto_rotation_enabled: Key auto rotation opt-in flag. Either true or false.
        :paramtype auto_rotation_enabled: bool
        """
        super().__init__(**kwargs)
        self.kind = None
        self.server_key_name = server_key_name
        self.server_key_type = server_key_type
        self.uri = None
        self.thumbprint = None
        self.auto_rotation_enabled = auto_rotation_enabled


class ManagedInstanceEncryptionProtectorListResult(_serialization.Model):
    """A list of managed instance encryption protectors.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstanceEncryptionProtector]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstanceEncryptionProtector]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstanceExternalAdministrator(_serialization.Model):
    """Properties of a active directory administrator.

    :ivar administrator_type: Type of the sever administrator. "ActiveDirectory"
    :vartype administrator_type: str or ~azure.mgmt.sql.models.AdministratorType
    :ivar principal_type: Principal Type of the sever administrator. Known values are: "User",
     "Group", and "Application".
    :vartype principal_type: str or ~azure.mgmt.sql.models.PrincipalType
    :ivar login: Login name of the server administrator.
    :vartype login: str
    :ivar sid: SID (object ID) of the server administrator.
    :vartype sid: str
    :ivar tenant_id: Tenant ID of the administrator.
    :vartype tenant_id: str
    :ivar azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
    :vartype azure_ad_only_authentication: bool
    """

    _attribute_map = {
        "administrator_type": {"key": "administratorType", "type": "str"},
        "principal_type": {"key": "principalType", "type": "str"},
        "login": {"key": "login", "type": "str"},
        "sid": {"key": "sid", "type": "str"},
        "tenant_id": {"key": "tenantId", "type": "str"},
        "azure_ad_only_authentication": {"key": "azureADOnlyAuthentication", "type": "bool"},
    }

    def __init__(
        self,
        *,
        administrator_type: Optional[Union[str, "_models.AdministratorType"]] = None,
        principal_type: Optional[Union[str, "_models.PrincipalType"]] = None,
        login: Optional[str] = None,
        sid: Optional[str] = None,
        tenant_id: Optional[str] = None,
        azure_ad_only_authentication: Optional[bool] = None,
        **kwargs
    ):
        """
        :keyword administrator_type: Type of the sever administrator. "ActiveDirectory"
        :paramtype administrator_type: str or ~azure.mgmt.sql.models.AdministratorType
        :keyword principal_type: Principal Type of the sever administrator. Known values are: "User",
         "Group", and "Application".
        :paramtype principal_type: str or ~azure.mgmt.sql.models.PrincipalType
        :keyword login: Login name of the server administrator.
        :paramtype login: str
        :keyword sid: SID (object ID) of the server administrator.
        :paramtype sid: str
        :keyword tenant_id: Tenant ID of the administrator.
        :paramtype tenant_id: str
        :keyword azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
        :paramtype azure_ad_only_authentication: bool
        """
        super().__init__(**kwargs)
        self.administrator_type = administrator_type
        self.principal_type = principal_type
        self.login = login
        self.sid = sid
        self.tenant_id = tenant_id
        self.azure_ad_only_authentication = azure_ad_only_authentication


class ManagedInstanceFamilyCapability(_serialization.Model):
    """The managed server family capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: Family name.
    :vartype name: str
    :ivar sku: SKU name.
    :vartype sku: str
    :ivar supported_license_types: List of supported license types.
    :vartype supported_license_types: list[~azure.mgmt.sql.models.LicenseTypeCapability]
    :ivar supported_vcores_values: List of supported virtual cores values.
    :vartype supported_vcores_values: list[~azure.mgmt.sql.models.ManagedInstanceVcoresCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "sku": {"readonly": True},
        "supported_license_types": {"readonly": True},
        "supported_vcores_values": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "sku": {"key": "sku", "type": "str"},
        "supported_license_types": {"key": "supportedLicenseTypes", "type": "[LicenseTypeCapability]"},
        "supported_vcores_values": {"key": "supportedVcoresValues", "type": "[ManagedInstanceVcoresCapability]"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.sku = None
        self.supported_license_types = None
        self.supported_vcores_values = None
        self.status = None
        self.reason = reason


class ManagedInstanceKey(ProxyResource):
    """A managed instance key.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar kind: Kind of encryption protector. This is metadata used for the Azure portal
     experience.
    :vartype kind: str
    :ivar server_key_type: The key type like 'ServiceManaged', 'AzureKeyVault'. Known values are:
     "ServiceManaged" and "AzureKeyVault".
    :vartype server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType
    :ivar uri: The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required.
    :vartype uri: str
    :ivar thumbprint: Thumbprint of the key.
    :vartype thumbprint: str
    :ivar creation_date: The key creation date.
    :vartype creation_date: ~datetime.datetime
    :ivar auto_rotation_enabled: Key auto rotation opt-in flag. Either true or false.
    :vartype auto_rotation_enabled: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "kind": {"readonly": True},
        "thumbprint": {"readonly": True},
        "creation_date": {"readonly": True},
        "auto_rotation_enabled": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "kind": {"key": "kind", "type": "str"},
        "server_key_type": {"key": "properties.serverKeyType", "type": "str"},
        "uri": {"key": "properties.uri", "type": "str"},
        "thumbprint": {"key": "properties.thumbprint", "type": "str"},
        "creation_date": {"key": "properties.creationDate", "type": "iso-8601"},
        "auto_rotation_enabled": {"key": "properties.autoRotationEnabled", "type": "bool"},
    }

    def __init__(
        self,
        *,
        server_key_type: Optional[Union[str, "_models.ServerKeyType"]] = None,
        uri: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword server_key_type: The key type like 'ServiceManaged', 'AzureKeyVault'. Known values
         are: "ServiceManaged" and "AzureKeyVault".
        :paramtype server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType
        :keyword uri: The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is
         required.
        :paramtype uri: str
        """
        super().__init__(**kwargs)
        self.kind = None
        self.server_key_type = server_key_type
        self.uri = uri
        self.thumbprint = None
        self.creation_date = None
        self.auto_rotation_enabled = None


class ManagedInstanceKeyListResult(_serialization.Model):
    """A list of managed instance keys.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstanceKey]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstanceKey]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstanceListResult(_serialization.Model):
    """A list of managed instances.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstance]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstance]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstanceLongTermRetentionBackup(ProxyResource):
    """A long term retention backup for a managed database.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar managed_instance_name: The managed instance that the backup database belongs to.
    :vartype managed_instance_name: str
    :ivar managed_instance_create_time: The create time of the instance.
    :vartype managed_instance_create_time: ~datetime.datetime
    :ivar database_name: The name of the database the backup belong to.
    :vartype database_name: str
    :ivar database_deletion_time: The delete time of the database.
    :vartype database_deletion_time: ~datetime.datetime
    :ivar backup_time: The time the backup was taken.
    :vartype backup_time: ~datetime.datetime
    :ivar backup_expiration_time: The time the long term retention backup will expire.
    :vartype backup_expiration_time: ~datetime.datetime
    :ivar backup_storage_redundancy: The storage redundancy type of the backup. Known values are:
     "Geo", "Local", "Zone", and "GeoZone".
    :vartype backup_storage_redundancy: str or ~azure.mgmt.sql.models.BackupStorageRedundancy
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "managed_instance_name": {"readonly": True},
        "managed_instance_create_time": {"readonly": True},
        "database_name": {"readonly": True},
        "database_deletion_time": {"readonly": True},
        "backup_time": {"readonly": True},
        "backup_expiration_time": {"readonly": True},
        "backup_storage_redundancy": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "managed_instance_name": {"key": "properties.managedInstanceName", "type": "str"},
        "managed_instance_create_time": {"key": "properties.managedInstanceCreateTime", "type": "iso-8601"},
        "database_name": {"key": "properties.databaseName", "type": "str"},
        "database_deletion_time": {"key": "properties.databaseDeletionTime", "type": "iso-8601"},
        "backup_time": {"key": "properties.backupTime", "type": "iso-8601"},
        "backup_expiration_time": {"key": "properties.backupExpirationTime", "type": "iso-8601"},
        "backup_storage_redundancy": {"key": "properties.backupStorageRedundancy", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.managed_instance_name = None
        self.managed_instance_create_time = None
        self.database_name = None
        self.database_deletion_time = None
        self.backup_time = None
        self.backup_expiration_time = None
        self.backup_storage_redundancy = None


class ManagedInstanceLongTermRetentionBackupListResult(_serialization.Model):
    """A list of long term retention backups for managed database(s).

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackup]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstanceLongTermRetentionBackup]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstanceLongTermRetentionPolicy(ProxyResource):
    """A long term retention policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar weekly_retention: The weekly retention policy for an LTR backup in an ISO 8601 format.
    :vartype weekly_retention: str
    :ivar monthly_retention: The monthly retention policy for an LTR backup in an ISO 8601 format.
    :vartype monthly_retention: str
    :ivar yearly_retention: The yearly retention policy for an LTR backup in an ISO 8601 format.
    :vartype yearly_retention: str
    :ivar week_of_year: The week of year to take the yearly backup in an ISO 8601 format.
    :vartype week_of_year: int
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "weekly_retention": {"key": "properties.weeklyRetention", "type": "str"},
        "monthly_retention": {"key": "properties.monthlyRetention", "type": "str"},
        "yearly_retention": {"key": "properties.yearlyRetention", "type": "str"},
        "week_of_year": {"key": "properties.weekOfYear", "type": "int"},
    }

    def __init__(
        self,
        *,
        weekly_retention: Optional[str] = None,
        monthly_retention: Optional[str] = None,
        yearly_retention: Optional[str] = None,
        week_of_year: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword weekly_retention: The weekly retention policy for an LTR backup in an ISO 8601 format.
        :paramtype weekly_retention: str
        :keyword monthly_retention: The monthly retention policy for an LTR backup in an ISO 8601
         format.
        :paramtype monthly_retention: str
        :keyword yearly_retention: The yearly retention policy for an LTR backup in an ISO 8601 format.
        :paramtype yearly_retention: str
        :keyword week_of_year: The week of year to take the yearly backup in an ISO 8601 format.
        :paramtype week_of_year: int
        """
        super().__init__(**kwargs)
        self.weekly_retention = weekly_retention
        self.monthly_retention = monthly_retention
        self.yearly_retention = yearly_retention
        self.week_of_year = week_of_year


class ManagedInstanceLongTermRetentionPolicyListResult(_serialization.Model):
    """A list of long term retention policies.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstanceLongTermRetentionPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstanceMaintenanceConfigurationCapability(_serialization.Model):
    """The maintenance configuration capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: Maintenance configuration name.
    :vartype name: str
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.status = None
        self.reason = reason


class ManagedInstanceOperation(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A managed instance operation.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar managed_instance_name: The name of the managed instance the operation is being performed
     on.
    :vartype managed_instance_name: str
    :ivar operation: The name of operation.
    :vartype operation: str
    :ivar operation_friendly_name: The friendly name of operation.
    :vartype operation_friendly_name: str
    :ivar percent_complete: The percentage of the operation completed.
    :vartype percent_complete: int
    :ivar start_time: The operation start time.
    :vartype start_time: ~datetime.datetime
    :ivar state: The operation state. Known values are: "Pending", "InProgress", "Succeeded",
     "Failed", "CancelInProgress", and "Cancelled".
    :vartype state: str or ~azure.mgmt.sql.models.ManagementOperationState
    :ivar error_code: The operation error code.
    :vartype error_code: int
    :ivar error_description: The operation error description.
    :vartype error_description: str
    :ivar error_severity: The operation error severity.
    :vartype error_severity: int
    :ivar is_user_error: Whether or not the error is a user error.
    :vartype is_user_error: bool
    :ivar estimated_completion_time: The estimated completion time of the operation.
    :vartype estimated_completion_time: ~datetime.datetime
    :ivar description: The operation description.
    :vartype description: str
    :ivar is_cancellable: Whether the operation can be cancelled.
    :vartype is_cancellable: bool
    :ivar operation_parameters: The operation parameters.
    :vartype operation_parameters: ~azure.mgmt.sql.models.ManagedInstanceOperationParametersPair
    :ivar operation_steps: The operation steps.
    :vartype operation_steps: ~azure.mgmt.sql.models.ManagedInstanceOperationSteps
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "managed_instance_name": {"readonly": True},
        "operation": {"readonly": True},
        "operation_friendly_name": {"readonly": True},
        "percent_complete": {"readonly": True},
        "start_time": {"readonly": True},
        "state": {"readonly": True},
        "error_code": {"readonly": True},
        "error_description": {"readonly": True},
        "error_severity": {"readonly": True},
        "is_user_error": {"readonly": True},
        "estimated_completion_time": {"readonly": True},
        "description": {"readonly": True},
        "is_cancellable": {"readonly": True},
        "operation_parameters": {"readonly": True},
        "operation_steps": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "managed_instance_name": {"key": "properties.managedInstanceName", "type": "str"},
        "operation": {"key": "properties.operation", "type": "str"},
        "operation_friendly_name": {"key": "properties.operationFriendlyName", "type": "str"},
        "percent_complete": {"key": "properties.percentComplete", "type": "int"},
        "start_time": {"key": "properties.startTime", "type": "iso-8601"},
        "state": {"key": "properties.state", "type": "str"},
        "error_code": {"key": "properties.errorCode", "type": "int"},
        "error_description": {"key": "properties.errorDescription", "type": "str"},
        "error_severity": {"key": "properties.errorSeverity", "type": "int"},
        "is_user_error": {"key": "properties.isUserError", "type": "bool"},
        "estimated_completion_time": {"key": "properties.estimatedCompletionTime", "type": "iso-8601"},
        "description": {"key": "properties.description", "type": "str"},
        "is_cancellable": {"key": "properties.isCancellable", "type": "bool"},
        "operation_parameters": {
            "key": "properties.operationParameters",
            "type": "ManagedInstanceOperationParametersPair",
        },
        "operation_steps": {"key": "properties.operationSteps", "type": "ManagedInstanceOperationSteps"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.managed_instance_name = None
        self.operation = None
        self.operation_friendly_name = None
        self.percent_complete = None
        self.start_time = None
        self.state = None
        self.error_code = None
        self.error_description = None
        self.error_severity = None
        self.is_user_error = None
        self.estimated_completion_time = None
        self.description = None
        self.is_cancellable = None
        self.operation_parameters = None
        self.operation_steps = None


class ManagedInstanceOperationListResult(_serialization.Model):
    """The response to a list managed instance operations request.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstanceOperation]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstanceOperation]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstanceOperationParametersPair(_serialization.Model):
    """The parameters of a managed instance operation.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar current_parameters: The current parameters.
    :vartype current_parameters: ~azure.mgmt.sql.models.UpsertManagedServerOperationParameters
    :ivar requested_parameters: The requested parameters.
    :vartype requested_parameters: ~azure.mgmt.sql.models.UpsertManagedServerOperationParameters
    """

    _validation = {
        "current_parameters": {"readonly": True},
        "requested_parameters": {"readonly": True},
    }

    _attribute_map = {
        "current_parameters": {"key": "currentParameters", "type": "UpsertManagedServerOperationParameters"},
        "requested_parameters": {"key": "requestedParameters", "type": "UpsertManagedServerOperationParameters"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.current_parameters = None
        self.requested_parameters = None


class ManagedInstanceOperationSteps(_serialization.Model):
    """The steps of a managed instance operation.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar total_steps: The total number of operation steps.
    :vartype total_steps: str
    :ivar current_step: The number of current operation steps.
    :vartype current_step: int
    :ivar steps_list: The operation steps list.
    :vartype steps_list: list[~azure.mgmt.sql.models.UpsertManagedServerOperationStep]
    """

    _validation = {
        "total_steps": {"readonly": True},
        "current_step": {"readonly": True},
        "steps_list": {"readonly": True},
    }

    _attribute_map = {
        "total_steps": {"key": "totalSteps", "type": "str"},
        "current_step": {"key": "currentStep", "type": "int"},
        "steps_list": {"key": "stepsList", "type": "[UpsertManagedServerOperationStep]"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.total_steps = None
        self.current_step = None
        self.steps_list = None


class ManagedInstancePairInfo(_serialization.Model):
    """Pairs of Managed Instances in the failover group.

    :ivar primary_managed_instance_id: Id of Primary Managed Instance in pair.
    :vartype primary_managed_instance_id: str
    :ivar partner_managed_instance_id: Id of Partner Managed Instance in pair.
    :vartype partner_managed_instance_id: str
    """

    _attribute_map = {
        "primary_managed_instance_id": {"key": "primaryManagedInstanceId", "type": "str"},
        "partner_managed_instance_id": {"key": "partnerManagedInstanceId", "type": "str"},
    }

    def __init__(
        self,
        *,
        primary_managed_instance_id: Optional[str] = None,
        partner_managed_instance_id: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword primary_managed_instance_id: Id of Primary Managed Instance in pair.
        :paramtype primary_managed_instance_id: str
        :keyword partner_managed_instance_id: Id of Partner Managed Instance in pair.
        :paramtype partner_managed_instance_id: str
        """
        super().__init__(**kwargs)
        self.primary_managed_instance_id = primary_managed_instance_id
        self.partner_managed_instance_id = partner_managed_instance_id


class ManagedInstancePecProperty(_serialization.Model):
    """A private endpoint connection under a managed instance.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar properties: Private endpoint connection properties.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstancePrivateEndpointConnectionProperties
    """

    _validation = {
        "id": {"readonly": True},
        "properties": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "properties": {"key": "properties", "type": "ManagedInstancePrivateEndpointConnectionProperties"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.id = None
        self.properties = None


class ManagedInstancePrivateEndpointConnection(ProxyResource):
    """A private endpoint connection.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar private_endpoint: Private endpoint which the connection belongs to.
    :vartype private_endpoint: ~azure.mgmt.sql.models.ManagedInstancePrivateEndpointProperty
    :ivar private_link_service_connection_state: Connection State of the Private Endpoint
     Connection.
    :vartype private_link_service_connection_state:
     ~azure.mgmt.sql.models.ManagedInstancePrivateLinkServiceConnectionStateProperty
    :ivar provisioning_state: State of the Private Endpoint Connection.
    :vartype provisioning_state: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "provisioning_state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "private_endpoint": {"key": "properties.privateEndpoint", "type": "ManagedInstancePrivateEndpointProperty"},
        "private_link_service_connection_state": {
            "key": "properties.privateLinkServiceConnectionState",
            "type": "ManagedInstancePrivateLinkServiceConnectionStateProperty",
        },
        "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
    }

    def __init__(
        self,
        *,
        private_endpoint: Optional["_models.ManagedInstancePrivateEndpointProperty"] = None,
        private_link_service_connection_state: Optional[
            "_models.ManagedInstancePrivateLinkServiceConnectionStateProperty"
        ] = None,
        **kwargs
    ):
        """
        :keyword private_endpoint: Private endpoint which the connection belongs to.
        :paramtype private_endpoint: ~azure.mgmt.sql.models.ManagedInstancePrivateEndpointProperty
        :keyword private_link_service_connection_state: Connection State of the Private Endpoint
         Connection.
        :paramtype private_link_service_connection_state:
         ~azure.mgmt.sql.models.ManagedInstancePrivateLinkServiceConnectionStateProperty
        """
        super().__init__(**kwargs)
        self.private_endpoint = private_endpoint
        self.private_link_service_connection_state = private_link_service_connection_state
        self.provisioning_state = None


class ManagedInstancePrivateEndpointConnectionListResult(_serialization.Model):
    """A list of private endpoint connections.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstancePrivateEndpointConnection]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstancePrivateEndpointConnection]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstancePrivateEndpointConnectionProperties(_serialization.Model):
    """Properties of a private endpoint connection.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar private_endpoint: Private endpoint which the connection belongs to.
    :vartype private_endpoint: ~azure.mgmt.sql.models.ManagedInstancePrivateEndpointProperty
    :ivar private_link_service_connection_state: Connection State of the Private Endpoint
     Connection.
    :vartype private_link_service_connection_state:
     ~azure.mgmt.sql.models.ManagedInstancePrivateLinkServiceConnectionStateProperty
    :ivar provisioning_state: State of the Private Endpoint Connection.
    :vartype provisioning_state: str
    """

    _validation = {
        "provisioning_state": {"readonly": True},
    }

    _attribute_map = {
        "private_endpoint": {"key": "privateEndpoint", "type": "ManagedInstancePrivateEndpointProperty"},
        "private_link_service_connection_state": {
            "key": "privateLinkServiceConnectionState",
            "type": "ManagedInstancePrivateLinkServiceConnectionStateProperty",
        },
        "provisioning_state": {"key": "provisioningState", "type": "str"},
    }

    def __init__(
        self,
        *,
        private_endpoint: Optional["_models.ManagedInstancePrivateEndpointProperty"] = None,
        private_link_service_connection_state: Optional[
            "_models.ManagedInstancePrivateLinkServiceConnectionStateProperty"
        ] = None,
        **kwargs
    ):
        """
        :keyword private_endpoint: Private endpoint which the connection belongs to.
        :paramtype private_endpoint: ~azure.mgmt.sql.models.ManagedInstancePrivateEndpointProperty
        :keyword private_link_service_connection_state: Connection State of the Private Endpoint
         Connection.
        :paramtype private_link_service_connection_state:
         ~azure.mgmt.sql.models.ManagedInstancePrivateLinkServiceConnectionStateProperty
        """
        super().__init__(**kwargs)
        self.private_endpoint = private_endpoint
        self.private_link_service_connection_state = private_link_service_connection_state
        self.provisioning_state = None


class ManagedInstancePrivateEndpointProperty(_serialization.Model):
    """ManagedInstancePrivateEndpointProperty.

    :ivar id: Resource id of the private endpoint.
    :vartype id: str
    """

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
    }

    def __init__(self, *, id: Optional[str] = None, **kwargs):  # pylint: disable=redefined-builtin
        """
        :keyword id: Resource id of the private endpoint.
        :paramtype id: str
        """
        super().__init__(**kwargs)
        self.id = id


class ManagedInstancePrivateLink(ProxyResource):
    """A private link resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar properties: The private link resource group id.
    :vartype properties: ~azure.mgmt.sql.models.ManagedInstancePrivateLinkProperties
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "properties": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "properties": {"key": "properties", "type": "ManagedInstancePrivateLinkProperties"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.properties = None


class ManagedInstancePrivateLinkListResult(_serialization.Model):
    """A list of private link resources.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstancePrivateLink]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstancePrivateLink]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstancePrivateLinkProperties(_serialization.Model):
    """Properties of a private link resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar group_id: The private link resource group id.
    :vartype group_id: str
    :ivar required_members: The private link resource required member names.
    :vartype required_members: list[str]
    """

    _validation = {
        "group_id": {"readonly": True},
        "required_members": {"readonly": True},
    }

    _attribute_map = {
        "group_id": {"key": "groupId", "type": "str"},
        "required_members": {"key": "requiredMembers", "type": "[str]"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.group_id = None
        self.required_members = None


class ManagedInstancePrivateLinkServiceConnectionStateProperty(_serialization.Model):
    """ManagedInstancePrivateLinkServiceConnectionStateProperty.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar status: The private link service connection status. Required.
    :vartype status: str
    :ivar description: The private link service connection description. Required.
    :vartype description: str
    :ivar actions_required: The private link service connection description.
    :vartype actions_required: str
    """

    _validation = {
        "status": {"required": True},
        "description": {"required": True},
        "actions_required": {"readonly": True},
    }

    _attribute_map = {
        "status": {"key": "status", "type": "str"},
        "description": {"key": "description", "type": "str"},
        "actions_required": {"key": "actionsRequired", "type": "str"},
    }

    def __init__(self, *, status: str, description: str, **kwargs):
        """
        :keyword status: The private link service connection status. Required.
        :paramtype status: str
        :keyword description: The private link service connection description. Required.
        :paramtype description: str
        """
        super().__init__(**kwargs)
        self.status = status
        self.description = description
        self.actions_required = None


class ManagedInstanceQuery(ProxyResource):
    """Database query.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar query_text: Query text.
    :vartype query_text: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "query_text": {"key": "properties.queryText", "type": "str"},
    }

    def __init__(self, *, query_text: Optional[str] = None, **kwargs):
        """
        :keyword query_text: Query text.
        :paramtype query_text: str
        """
        super().__init__(**kwargs)
        self.query_text = query_text


class ManagedInstanceQueryStatistics(_serialization.Model):
    """Execution statistics for one particular query.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.QueryStatistics]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[QueryStatistics]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedInstanceUpdate(_serialization.Model):  # pylint: disable=too-many-instance-attributes
    """An update request for an Azure SQL Database managed instance.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar sku: Managed instance sku.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar identity: Managed instance identity.
    :vartype identity: ~azure.mgmt.sql.models.ResourceIdentity
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar provisioning_state: Known values are: "Creating", "Deleting", "Updating", "Unknown",
     "Succeeded", "Failed", "Accepted", "Created", "Deleted", "Unrecognized", "Running", "Canceled",
     "NotSpecified", "Registering", and "TimedOut".
    :vartype provisioning_state: str or
     ~azure.mgmt.sql.models.ManagedInstancePropertiesProvisioningState
    :ivar managed_instance_create_mode: Specifies the mode of database creation.

     Default: Regular instance creation.

     Restore: Creates an instance by restoring a set of backups to specific point in time.
     RestorePointInTime and SourceManagedInstanceId must be specified. Known values are: "Default"
     and "PointInTimeRestore".
    :vartype managed_instance_create_mode: str or ~azure.mgmt.sql.models.ManagedServerCreateMode
    :ivar fully_qualified_domain_name: The fully qualified domain name of the managed instance.
    :vartype fully_qualified_domain_name: str
    :ivar administrator_login: Administrator username for the managed instance. Can only be
     specified when the managed instance is being created (and is required for creation).
    :vartype administrator_login: str
    :ivar administrator_login_password: The administrator login password (required for managed
     instance creation).
    :vartype administrator_login_password: str
    :ivar subnet_id: Subnet resource ID for the managed instance.
    :vartype subnet_id: str
    :ivar state: The state of the managed instance.
    :vartype state: str
    :ivar license_type: The license type. Possible values are 'LicenseIncluded' (regular price
     inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL
     licenses). Known values are: "LicenseIncluded" and "BasePrice".
    :vartype license_type: str or ~azure.mgmt.sql.models.ManagedInstanceLicenseType
    :ivar v_cores: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80.
    :vartype v_cores: int
    :ivar storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 8192.
     Increments of 32 GB allowed only.
    :vartype storage_size_in_gb: int
    :ivar collation: Collation of the managed instance.
    :vartype collation: str
    :ivar dns_zone: The Dns Zone that the managed instance is in.
    :vartype dns_zone: str
    :ivar dns_zone_partner: The resource id of another managed instance whose DNS zone this managed
     instance will share after creation.
    :vartype dns_zone_partner: str
    :ivar public_data_endpoint_enabled: Whether or not the public data endpoint is enabled.
    :vartype public_data_endpoint_enabled: bool
    :ivar source_managed_instance_id: The resource identifier of the source managed instance
     associated with create operation of this instance.
    :vartype source_managed_instance_id: str
    :ivar restore_point_in_time: Specifies the point in time (ISO8601 format) of the source
     database that will be restored to create the new database.
    :vartype restore_point_in_time: ~datetime.datetime
    :ivar proxy_override: Connection type used for connecting to the instance. Known values are:
     "Proxy", "Redirect", and "Default".
    :vartype proxy_override: str or ~azure.mgmt.sql.models.ManagedInstanceProxyOverride
    :ivar timezone_id: Id of the timezone. Allowed values are timezones supported by Windows.
     Windows keeps details on supported timezones, including the id, in registry under
     KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.
     You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM
     sys.time_zone_info.
     List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in
     PowerShell.
     An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time".
    :vartype timezone_id: str
    :ivar instance_pool_id: The Id of the instance pool this managed server belongs to.
    :vartype instance_pool_id: str
    :ivar maintenance_configuration_id: Specifies maintenance configuration id to apply to this
     managed instance.
    :vartype maintenance_configuration_id: str
    :ivar private_endpoint_connections: List of private endpoint connections on a managed instance.
    :vartype private_endpoint_connections: list[~azure.mgmt.sql.models.ManagedInstancePecProperty]
    :ivar minimal_tls_version: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'.
    :vartype minimal_tls_version: str
    :ivar current_backup_storage_redundancy: The storage account type used to store backups for
     this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage),
     Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). Known values are: "Geo",
     "Local", "Zone", and "GeoZone".
    :vartype current_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar requested_backup_storage_redundancy: The storage account type to be used to store backups
     for this instance. The options are Local (LocallyRedundantStorage), Zone
     (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). Known
     values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype requested_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    :ivar zone_redundant: Whether or not the multi-az is enabled.
    :vartype zone_redundant: bool
    :ivar primary_user_assigned_identity_id: The resource id of a user assigned identity to be used
     by default.
    :vartype primary_user_assigned_identity_id: str
    :ivar key_id: A CMK URI of the key to use for encryption.
    :vartype key_id: str
    :ivar administrators: The Azure Active Directory administrator of the server.
    :vartype administrators: ~azure.mgmt.sql.models.ManagedInstanceExternalAdministrator
    :ivar service_principal: The managed instance's service principal.
    :vartype service_principal: ~azure.mgmt.sql.models.ServicePrincipal
    """

    _validation = {
        "provisioning_state": {"readonly": True},
        "fully_qualified_domain_name": {"readonly": True},
        "state": {"readonly": True},
        "dns_zone": {"readonly": True},
        "private_endpoint_connections": {"readonly": True},
        "current_backup_storage_redundancy": {"readonly": True},
    }

    _attribute_map = {
        "sku": {"key": "sku", "type": "Sku"},
        "identity": {"key": "identity", "type": "ResourceIdentity"},
        "tags": {"key": "tags", "type": "{str}"},
        "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
        "managed_instance_create_mode": {"key": "properties.managedInstanceCreateMode", "type": "str"},
        "fully_qualified_domain_name": {"key": "properties.fullyQualifiedDomainName", "type": "str"},
        "administrator_login": {"key": "properties.administratorLogin", "type": "str"},
        "administrator_login_password": {"key": "properties.administratorLoginPassword", "type": "str"},
        "subnet_id": {"key": "properties.subnetId", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
        "license_type": {"key": "properties.licenseType", "type": "str"},
        "v_cores": {"key": "properties.vCores", "type": "int"},
        "storage_size_in_gb": {"key": "properties.storageSizeInGB", "type": "int"},
        "collation": {"key": "properties.collation", "type": "str"},
        "dns_zone": {"key": "properties.dnsZone", "type": "str"},
        "dns_zone_partner": {"key": "properties.dnsZonePartner", "type": "str"},
        "public_data_endpoint_enabled": {"key": "properties.publicDataEndpointEnabled", "type": "bool"},
        "source_managed_instance_id": {"key": "properties.sourceManagedInstanceId", "type": "str"},
        "restore_point_in_time": {"key": "properties.restorePointInTime", "type": "iso-8601"},
        "proxy_override": {"key": "properties.proxyOverride", "type": "str"},
        "timezone_id": {"key": "properties.timezoneId", "type": "str"},
        "instance_pool_id": {"key": "properties.instancePoolId", "type": "str"},
        "maintenance_configuration_id": {"key": "properties.maintenanceConfigurationId", "type": "str"},
        "private_endpoint_connections": {
            "key": "properties.privateEndpointConnections",
            "type": "[ManagedInstancePecProperty]",
        },
        "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"},
        "current_backup_storage_redundancy": {"key": "properties.currentBackupStorageRedundancy", "type": "str"},
        "requested_backup_storage_redundancy": {"key": "properties.requestedBackupStorageRedundancy", "type": "str"},
        "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"},
        "primary_user_assigned_identity_id": {"key": "properties.primaryUserAssignedIdentityId", "type": "str"},
        "key_id": {"key": "properties.keyId", "type": "str"},
        "administrators": {"key": "properties.administrators", "type": "ManagedInstanceExternalAdministrator"},
        "service_principal": {"key": "properties.servicePrincipal", "type": "ServicePrincipal"},
    }

    def __init__(  # pylint: disable=too-many-locals
        self,
        *,
        sku: Optional["_models.Sku"] = None,
        identity: Optional["_models.ResourceIdentity"] = None,
        tags: Optional[Dict[str, str]] = None,
        managed_instance_create_mode: Optional[Union[str, "_models.ManagedServerCreateMode"]] = None,
        administrator_login: Optional[str] = None,
        administrator_login_password: Optional[str] = None,
        subnet_id: Optional[str] = None,
        license_type: Optional[Union[str, "_models.ManagedInstanceLicenseType"]] = None,
        v_cores: Optional[int] = None,
        storage_size_in_gb: Optional[int] = None,
        collation: Optional[str] = None,
        dns_zone_partner: Optional[str] = None,
        public_data_endpoint_enabled: Optional[bool] = None,
        source_managed_instance_id: Optional[str] = None,
        restore_point_in_time: Optional[datetime.datetime] = None,
        proxy_override: Optional[Union[str, "_models.ManagedInstanceProxyOverride"]] = None,
        timezone_id: Optional[str] = None,
        instance_pool_id: Optional[str] = None,
        maintenance_configuration_id: Optional[str] = None,
        minimal_tls_version: Optional[str] = None,
        requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None,
        zone_redundant: Optional[bool] = None,
        primary_user_assigned_identity_id: Optional[str] = None,
        key_id: Optional[str] = None,
        administrators: Optional["_models.ManagedInstanceExternalAdministrator"] = None,
        service_principal: Optional["_models.ServicePrincipal"] = None,
        **kwargs
    ):
        """
        :keyword sku: Managed instance sku.
        :paramtype sku: ~azure.mgmt.sql.models.Sku
        :keyword identity: Managed instance identity.
        :paramtype identity: ~azure.mgmt.sql.models.ResourceIdentity
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword managed_instance_create_mode: Specifies the mode of database creation.

         Default: Regular instance creation.

         Restore: Creates an instance by restoring a set of backups to specific point in time.
         RestorePointInTime and SourceManagedInstanceId must be specified. Known values are: "Default"
         and "PointInTimeRestore".
        :paramtype managed_instance_create_mode: str or ~azure.mgmt.sql.models.ManagedServerCreateMode
        :keyword administrator_login: Administrator username for the managed instance. Can only be
         specified when the managed instance is being created (and is required for creation).
        :paramtype administrator_login: str
        :keyword administrator_login_password: The administrator login password (required for managed
         instance creation).
        :paramtype administrator_login_password: str
        :keyword subnet_id: Subnet resource ID for the managed instance.
        :paramtype subnet_id: str
        :keyword license_type: The license type. Possible values are 'LicenseIncluded' (regular price
         inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL
         licenses). Known values are: "LicenseIncluded" and "BasePrice".
        :paramtype license_type: str or ~azure.mgmt.sql.models.ManagedInstanceLicenseType
        :keyword v_cores: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80.
        :paramtype v_cores: int
        :keyword storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 8192.
         Increments of 32 GB allowed only.
        :paramtype storage_size_in_gb: int
        :keyword collation: Collation of the managed instance.
        :paramtype collation: str
        :keyword dns_zone_partner: The resource id of another managed instance whose DNS zone this
         managed instance will share after creation.
        :paramtype dns_zone_partner: str
        :keyword public_data_endpoint_enabled: Whether or not the public data endpoint is enabled.
        :paramtype public_data_endpoint_enabled: bool
        :keyword source_managed_instance_id: The resource identifier of the source managed instance
         associated with create operation of this instance.
        :paramtype source_managed_instance_id: str
        :keyword restore_point_in_time: Specifies the point in time (ISO8601 format) of the source
         database that will be restored to create the new database.
        :paramtype restore_point_in_time: ~datetime.datetime
        :keyword proxy_override: Connection type used for connecting to the instance. Known values are:
         "Proxy", "Redirect", and "Default".
        :paramtype proxy_override: str or ~azure.mgmt.sql.models.ManagedInstanceProxyOverride
        :keyword timezone_id: Id of the timezone. Allowed values are timezones supported by Windows.
         Windows keeps details on supported timezones, including the id, in registry under
         KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.
         You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM
         sys.time_zone_info.
         List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in
         PowerShell.
         An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time".
        :paramtype timezone_id: str
        :keyword instance_pool_id: The Id of the instance pool this managed server belongs to.
        :paramtype instance_pool_id: str
        :keyword maintenance_configuration_id: Specifies maintenance configuration id to apply to this
         managed instance.
        :paramtype maintenance_configuration_id: str
        :keyword minimal_tls_version: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'.
        :paramtype minimal_tls_version: str
        :keyword requested_backup_storage_redundancy: The storage account type to be used to store
         backups for this instance. The options are Local (LocallyRedundantStorage), Zone
         (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). Known
         values are: "Geo", "Local", "Zone", and "GeoZone".
        :paramtype requested_backup_storage_redundancy: str or
         ~azure.mgmt.sql.models.BackupStorageRedundancy
        :keyword zone_redundant: Whether or not the multi-az is enabled.
        :paramtype zone_redundant: bool
        :keyword primary_user_assigned_identity_id: The resource id of a user assigned identity to be
         used by default.
        :paramtype primary_user_assigned_identity_id: str
        :keyword key_id: A CMK URI of the key to use for encryption.
        :paramtype key_id: str
        :keyword administrators: The Azure Active Directory administrator of the server.
        :paramtype administrators: ~azure.mgmt.sql.models.ManagedInstanceExternalAdministrator
        :keyword service_principal: The managed instance's service principal.
        :paramtype service_principal: ~azure.mgmt.sql.models.ServicePrincipal
        """
        super().__init__(**kwargs)
        self.sku = sku
        self.identity = identity
        self.tags = tags
        self.provisioning_state = None
        self.managed_instance_create_mode = managed_instance_create_mode
        self.fully_qualified_domain_name = None
        self.administrator_login = administrator_login
        self.administrator_login_password = administrator_login_password
        self.subnet_id = subnet_id
        self.state = None
        self.license_type = license_type
        self.v_cores = v_cores
        self.storage_size_in_gb = storage_size_in_gb
        self.collation = collation
        self.dns_zone = None
        self.dns_zone_partner = dns_zone_partner
        self.public_data_endpoint_enabled = public_data_endpoint_enabled
        self.source_managed_instance_id = source_managed_instance_id
        self.restore_point_in_time = restore_point_in_time
        self.proxy_override = proxy_override
        self.timezone_id = timezone_id
        self.instance_pool_id = instance_pool_id
        self.maintenance_configuration_id = maintenance_configuration_id
        self.private_endpoint_connections = None
        self.minimal_tls_version = minimal_tls_version
        self.current_backup_storage_redundancy = None
        self.requested_backup_storage_redundancy = requested_backup_storage_redundancy
        self.zone_redundant = zone_redundant
        self.primary_user_assigned_identity_id = primary_user_assigned_identity_id
        self.key_id = key_id
        self.administrators = administrators
        self.service_principal = service_principal


class ManagedInstanceVcoresCapability(_serialization.Model):
    """The managed instance virtual cores capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The virtual cores identifier.
    :vartype name: str
    :ivar value: The virtual cores value.
    :vartype value: int
    :ivar included_max_size: Included size.
    :vartype included_max_size: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar supported_storage_sizes: Storage size ranges.
    :vartype supported_storage_sizes: list[~azure.mgmt.sql.models.MaxSizeRangeCapability]
    :ivar instance_pool_supported: True if this service objective is supported for managed
     instances in an instance pool.
    :vartype instance_pool_supported: bool
    :ivar standalone_supported: True if this service objective is supported for standalone managed
     instances.
    :vartype standalone_supported: bool
    :ivar supported_maintenance_configurations: List of supported maintenance configurations.
    :vartype supported_maintenance_configurations:
     list[~azure.mgmt.sql.models.ManagedInstanceMaintenanceConfigurationCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "value": {"readonly": True},
        "included_max_size": {"readonly": True},
        "supported_storage_sizes": {"readonly": True},
        "instance_pool_supported": {"readonly": True},
        "standalone_supported": {"readonly": True},
        "supported_maintenance_configurations": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "value": {"key": "value", "type": "int"},
        "included_max_size": {"key": "includedMaxSize", "type": "MaxSizeCapability"},
        "supported_storage_sizes": {"key": "supportedStorageSizes", "type": "[MaxSizeRangeCapability]"},
        "instance_pool_supported": {"key": "instancePoolSupported", "type": "bool"},
        "standalone_supported": {"key": "standaloneSupported", "type": "bool"},
        "supported_maintenance_configurations": {
            "key": "supportedMaintenanceConfigurations",
            "type": "[ManagedInstanceMaintenanceConfigurationCapability]",
        },
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.value = None
        self.included_max_size = None
        self.supported_storage_sizes = None
        self.instance_pool_supported = None
        self.standalone_supported = None
        self.supported_maintenance_configurations = None
        self.status = None
        self.reason = reason


class ManagedInstanceVersionCapability(_serialization.Model):
    """The managed instance capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The server version name.
    :vartype name: str
    :ivar supported_editions: The list of supported managed instance editions.
    :vartype supported_editions: list[~azure.mgmt.sql.models.ManagedInstanceEditionCapability]
    :ivar supported_instance_pool_editions: The list of supported instance pool editions.
    :vartype supported_instance_pool_editions:
     list[~azure.mgmt.sql.models.InstancePoolEditionCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "supported_editions": {"readonly": True},
        "supported_instance_pool_editions": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "supported_editions": {"key": "supportedEditions", "type": "[ManagedInstanceEditionCapability]"},
        "supported_instance_pool_editions": {
            "key": "supportedInstancePoolEditions",
            "type": "[InstancePoolEditionCapability]",
        },
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.supported_editions = None
        self.supported_instance_pool_editions = None
        self.status = None
        self.reason = reason


class ManagedInstanceVulnerabilityAssessment(ProxyResource):
    """A managed instance vulnerability assessment.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar storage_container_path: A blob storage container path to hold the scan results (e.g.
     https://myStorage.blob.core.windows.net/VaScans/).
    :vartype storage_container_path: str
    :ivar storage_container_sas_key: A shared access signature (SAS Key) that has write access to
     the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey'
     isn't specified, StorageContainerSasKey is required. Applies only if the storage account is not
     behind a Vnet or a firewall.
    :vartype storage_container_sas_key: str
    :ivar storage_account_access_key: Specifies the identifier key of the storage account for
     vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified,
     storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet
     or a firewall.
    :vartype storage_account_access_key: str
    :ivar recurring_scans: The recurring scans settings.
    :vartype recurring_scans:
     ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "storage_container_path": {"key": "properties.storageContainerPath", "type": "str"},
        "storage_container_sas_key": {"key": "properties.storageContainerSasKey", "type": "str"},
        "storage_account_access_key": {"key": "properties.storageAccountAccessKey", "type": "str"},
        "recurring_scans": {
            "key": "properties.recurringScans",
            "type": "VulnerabilityAssessmentRecurringScansProperties",
        },
    }

    def __init__(
        self,
        *,
        storage_container_path: Optional[str] = None,
        storage_container_sas_key: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        recurring_scans: Optional["_models.VulnerabilityAssessmentRecurringScansProperties"] = None,
        **kwargs
    ):
        """
        :keyword storage_container_path: A blob storage container path to hold the scan results (e.g.
         https://myStorage.blob.core.windows.net/VaScans/).
        :paramtype storage_container_path: str
        :keyword storage_container_sas_key: A shared access signature (SAS Key) that has write access
         to the blob container specified in 'storageContainerPath' parameter. If
         'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. Applies only if
         the storage account is not behind a Vnet or a firewall.
        :paramtype storage_container_sas_key: str
        :keyword storage_account_access_key: Specifies the identifier key of the storage account for
         vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified,
         storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet
         or a firewall.
        :paramtype storage_account_access_key: str
        :keyword recurring_scans: The recurring scans settings.
        :paramtype recurring_scans:
         ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties
        """
        super().__init__(**kwargs)
        self.storage_container_path = storage_container_path
        self.storage_container_sas_key = storage_container_sas_key
        self.storage_account_access_key = storage_account_access_key
        self.recurring_scans = recurring_scans


class ManagedInstanceVulnerabilityAssessmentListResult(_serialization.Model):
    """A list of the ManagedInstance's vulnerability assessments.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedInstanceVulnerabilityAssessment]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedInstanceVulnerabilityAssessment]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedServerDnsAlias(ProxyResource):
    """A managed server DNS alias.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar azure_dns_record: The fully qualified DNS record for managed server alias.
    :vartype azure_dns_record: str
    :ivar public_azure_dns_record: The fully qualified public DNS record for managed server alias.
    :vartype public_azure_dns_record: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "azure_dns_record": {"readonly": True},
        "public_azure_dns_record": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "azure_dns_record": {"key": "properties.azureDnsRecord", "type": "str"},
        "public_azure_dns_record": {"key": "properties.publicAzureDnsRecord", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.azure_dns_record = None
        self.public_azure_dns_record = None


class ManagedServerDnsAliasAcquisition(_serialization.Model):
    """A managed server DNS alias acquisition request.

    All required parameters must be populated in order to send to Azure.

    :ivar old_managed_server_dns_alias_resource_id: The resource ID of the managed server DNS alias
     that will be acquired to point to this managed server instead. Required.
    :vartype old_managed_server_dns_alias_resource_id: str
    """

    _validation = {
        "old_managed_server_dns_alias_resource_id": {"required": True},
    }

    _attribute_map = {
        "old_managed_server_dns_alias_resource_id": {"key": "oldManagedServerDnsAliasResourceId", "type": "str"},
    }

    def __init__(self, *, old_managed_server_dns_alias_resource_id: str, **kwargs):
        """
        :keyword old_managed_server_dns_alias_resource_id: The resource ID of the managed server DNS
         alias that will be acquired to point to this managed server instead. Required.
        :paramtype old_managed_server_dns_alias_resource_id: str
        """
        super().__init__(**kwargs)
        self.old_managed_server_dns_alias_resource_id = old_managed_server_dns_alias_resource_id


class ManagedServerDnsAliasCreation(_serialization.Model):
    """A managed server dns alias creation request.

    :ivar create_dns_record: Whether or not DNS record should be created for this alias.
    :vartype create_dns_record: bool
    """

    _attribute_map = {
        "create_dns_record": {"key": "createDnsRecord", "type": "bool"},
    }

    def __init__(self, *, create_dns_record: bool = True, **kwargs):
        """
        :keyword create_dns_record: Whether or not DNS record should be created for this alias.
        :paramtype create_dns_record: bool
        """
        super().__init__(**kwargs)
        self.create_dns_record = create_dns_record


class ManagedServerDnsAliasListResult(_serialization.Model):
    """A list of managed server DNS aliases.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedServerDnsAlias]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedServerDnsAlias]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedServerSecurityAlertPolicy(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A managed server security alert policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of SecurityAlertPolicyResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar state: Specifies the state of the policy, whether it is enabled or disabled or a policy
     has not been applied yet on the specific database. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.SecurityAlertsPolicyState
    :ivar disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are:
     Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action,
     Brute_Force.
    :vartype disabled_alerts: list[str]
    :ivar email_addresses: Specifies an array of e-mail addresses to which the alert is sent.
    :vartype email_addresses: list[str]
    :ivar email_account_admins: Specifies that the alert is sent to the account administrators.
    :vartype email_account_admins: bool
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection
     audit logs.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the Threat Detection audit
     storage account.
    :vartype storage_account_access_key: str
    :ivar retention_days: Specifies the number of days to keep in the Threat Detection audit logs.
    :vartype retention_days: int
    :ivar creation_time: Specifies the UTC creation time of the policy.
    :vartype creation_time: ~datetime.datetime
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
        "creation_time": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "state": {"key": "properties.state", "type": "str"},
        "disabled_alerts": {"key": "properties.disabledAlerts", "type": "[str]"},
        "email_addresses": {"key": "properties.emailAddresses", "type": "[str]"},
        "email_account_admins": {"key": "properties.emailAccountAdmins", "type": "bool"},
        "storage_endpoint": {"key": "properties.storageEndpoint", "type": "str"},
        "storage_account_access_key": {"key": "properties.storageAccountAccessKey", "type": "str"},
        "retention_days": {"key": "properties.retentionDays", "type": "int"},
        "creation_time": {"key": "properties.creationTime", "type": "iso-8601"},
    }

    def __init__(
        self,
        *,
        state: Optional[Union[str, "_models.SecurityAlertsPolicyState"]] = None,
        disabled_alerts: Optional[List[str]] = None,
        email_addresses: Optional[List[str]] = None,
        email_account_admins: Optional[bool] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        retention_days: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword state: Specifies the state of the policy, whether it is enabled or disabled or a
         policy has not been applied yet on the specific database. Known values are: "Enabled" and
         "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.SecurityAlertsPolicyState
        :keyword disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are:
         Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action,
         Brute_Force.
        :paramtype disabled_alerts: list[str]
        :keyword email_addresses: Specifies an array of e-mail addresses to which the alert is sent.
        :paramtype email_addresses: list[str]
        :keyword email_account_admins: Specifies that the alert is sent to the account administrators.
        :paramtype email_account_admins: bool
        :keyword storage_endpoint: Specifies the blob storage endpoint (e.g.
         https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection
         audit logs.
        :paramtype storage_endpoint: str
        :keyword storage_account_access_key: Specifies the identifier key of the Threat Detection audit
         storage account.
        :paramtype storage_account_access_key: str
        :keyword retention_days: Specifies the number of days to keep in the Threat Detection audit
         logs.
        :paramtype retention_days: int
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.state = state
        self.disabled_alerts = disabled_alerts
        self.email_addresses = email_addresses
        self.email_account_admins = email_account_admins
        self.storage_endpoint = storage_endpoint
        self.storage_account_access_key = storage_account_access_key
        self.retention_days = retention_days
        self.creation_time = None


class ManagedServerSecurityAlertPolicyListResult(_serialization.Model):
    """A list of the managed Server's security alert policies.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedServerSecurityAlertPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ManagedTransparentDataEncryption(ProxyResource):
    """A managed database transparent data encryption state.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar state: Specifies the state of the transparent data encryption. Known values are:
     "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.TransparentDataEncryptionState
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
    }

    def __init__(self, *, state: Optional[Union[str, "_models.TransparentDataEncryptionState"]] = None, **kwargs):
        """
        :keyword state: Specifies the state of the transparent data encryption. Known values are:
         "Enabled" and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.TransparentDataEncryptionState
        """
        super().__init__(**kwargs)
        self.state = state


class ManagedTransparentDataEncryptionListResult(_serialization.Model):
    """A list of managed transparent data encryptions.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ManagedTransparentDataEncryption]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ManagedTransparentDataEncryption]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class MaxSizeCapability(_serialization.Model):
    """The maximum size capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar limit: The maximum size limit (see 'unit' for the units).
    :vartype limit: int
    :ivar unit: The units that the limit is expressed in. Known values are: "Megabytes",
     "Gigabytes", "Terabytes", and "Petabytes".
    :vartype unit: str or ~azure.mgmt.sql.models.MaxSizeUnit
    """

    _validation = {
        "limit": {"readonly": True},
        "unit": {"readonly": True},
    }

    _attribute_map = {
        "limit": {"key": "limit", "type": "int"},
        "unit": {"key": "unit", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.limit = None
        self.unit = None


class MaxSizeRangeCapability(_serialization.Model):
    """The maximum size range capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar min_value: Minimum value.
    :vartype min_value: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar max_value: Maximum value.
    :vartype max_value: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar scale_size: Scale/step size for discrete values between the minimum value and the maximum
     value.
    :vartype scale_size: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar log_size: Size of transaction log.
    :vartype log_size: ~azure.mgmt.sql.models.LogSizeCapability
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "min_value": {"readonly": True},
        "max_value": {"readonly": True},
        "scale_size": {"readonly": True},
        "log_size": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "min_value": {"key": "minValue", "type": "MaxSizeCapability"},
        "max_value": {"key": "maxValue", "type": "MaxSizeCapability"},
        "scale_size": {"key": "scaleSize", "type": "MaxSizeCapability"},
        "log_size": {"key": "logSize", "type": "LogSizeCapability"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.min_value = None
        self.max_value = None
        self.scale_size = None
        self.log_size = None
        self.status = None
        self.reason = reason


class Metric(_serialization.Model):
    """Database metrics.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar start_time: The start time for the metric (ISO-8601 format).
    :vartype start_time: ~datetime.datetime
    :ivar end_time: The end time for the metric (ISO-8601 format).
    :vartype end_time: ~datetime.datetime
    :ivar time_grain: The time step to be used to summarize the metric values.
    :vartype time_grain: str
    :ivar unit: The unit of the metric. Known values are: "count", "bytes", "seconds", "percent",
     "countPerSecond", and "bytesPerSecond".
    :vartype unit: str or ~azure.mgmt.sql.models.UnitType
    :ivar name: The name information for the metric.
    :vartype name: ~azure.mgmt.sql.models.MetricName
    :ivar metric_values: The metric values for the specified time window and timestep.
    :vartype metric_values: list[~azure.mgmt.sql.models.MetricValue]
    """

    _validation = {
        "start_time": {"readonly": True},
        "end_time": {"readonly": True},
        "time_grain": {"readonly": True},
        "unit": {"readonly": True},
        "name": {"readonly": True},
        "metric_values": {"readonly": True},
    }

    _attribute_map = {
        "start_time": {"key": "startTime", "type": "iso-8601"},
        "end_time": {"key": "endTime", "type": "iso-8601"},
        "time_grain": {"key": "timeGrain", "type": "str"},
        "unit": {"key": "unit", "type": "str"},
        "name": {"key": "name", "type": "MetricName"},
        "metric_values": {"key": "metricValues", "type": "[MetricValue]"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.start_time = None
        self.end_time = None
        self.time_grain = None
        self.unit = None
        self.name = None
        self.metric_values = None


class MetricAvailability(_serialization.Model):
    """A metric availability value.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar retention: The length of retention for the database metric.
    :vartype retention: str
    :ivar time_grain: The granularity of the database metric.
    :vartype time_grain: str
    """

    _validation = {
        "retention": {"readonly": True},
        "time_grain": {"readonly": True},
    }

    _attribute_map = {
        "retention": {"key": "retention", "type": "str"},
        "time_grain": {"key": "timeGrain", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.retention = None
        self.time_grain = None


class MetricDefinition(_serialization.Model):
    """A database metric definition.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The name information for the metric.
    :vartype name: ~azure.mgmt.sql.models.MetricName
    :ivar primary_aggregation_type: The primary aggregation type defining how metric values are
     displayed. Known values are: "None", "Average", "Count", "Minimum", "Maximum", and "Total".
    :vartype primary_aggregation_type: str or ~azure.mgmt.sql.models.PrimaryAggregationType
    :ivar resource_uri: The resource uri of the database.
    :vartype resource_uri: str
    :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent",
     "CountPerSecond", and "BytesPerSecond".
    :vartype unit: str or ~azure.mgmt.sql.models.UnitDefinitionType
    :ivar metric_availabilities: The list of database metric availabilities for the metric.
    :vartype metric_availabilities: list[~azure.mgmt.sql.models.MetricAvailability]
    """

    _validation = {
        "name": {"readonly": True},
        "primary_aggregation_type": {"readonly": True},
        "resource_uri": {"readonly": True},
        "unit": {"readonly": True},
        "metric_availabilities": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "MetricName"},
        "primary_aggregation_type": {"key": "primaryAggregationType", "type": "str"},
        "resource_uri": {"key": "resourceUri", "type": "str"},
        "unit": {"key": "unit", "type": "str"},
        "metric_availabilities": {"key": "metricAvailabilities", "type": "[MetricAvailability]"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.name = None
        self.primary_aggregation_type = None
        self.resource_uri = None
        self.unit = None
        self.metric_availabilities = None


class MetricDefinitionListResult(_serialization.Model):
    """The response to a list database metric definitions request.

    All required parameters must be populated in order to send to Azure.

    :ivar value: The list of metric definitions for the database. Required.
    :vartype value: list[~azure.mgmt.sql.models.MetricDefinition]
    """

    _validation = {
        "value": {"required": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[MetricDefinition]"},
    }

    def __init__(self, *, value: List["_models.MetricDefinition"], **kwargs):
        """
        :keyword value: The list of metric definitions for the database. Required.
        :paramtype value: list[~azure.mgmt.sql.models.MetricDefinition]
        """
        super().__init__(**kwargs)
        self.value = value


class MetricListResult(_serialization.Model):
    """The response to a list database metrics request.

    All required parameters must be populated in order to send to Azure.

    :ivar value: The list of metrics for the database. Required.
    :vartype value: list[~azure.mgmt.sql.models.Metric]
    """

    _validation = {
        "value": {"required": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[Metric]"},
    }

    def __init__(self, *, value: List["_models.Metric"], **kwargs):
        """
        :keyword value: The list of metrics for the database. Required.
        :paramtype value: list[~azure.mgmt.sql.models.Metric]
        """
        super().__init__(**kwargs)
        self.value = value


class MetricName(_serialization.Model):
    """A database metric name.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: The name of the database metric.
    :vartype value: str
    :ivar localized_value: The friendly name of the database metric.
    :vartype localized_value: str
    """

    _validation = {
        "value": {"readonly": True},
        "localized_value": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "str"},
        "localized_value": {"key": "localizedValue", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.localized_value = None


class MetricValue(_serialization.Model):
    """Represents database metrics.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar count: The number of values for the metric.
    :vartype count: int
    :ivar average: The average value of the metric.
    :vartype average: float
    :ivar maximum: The max value of the metric.
    :vartype maximum: float
    :ivar minimum: The min value of the metric.
    :vartype minimum: float
    :ivar timestamp: The metric timestamp (ISO-8601 format).
    :vartype timestamp: ~datetime.datetime
    :ivar total: The total value of the metric.
    :vartype total: float
    """

    _validation = {
        "count": {"readonly": True},
        "average": {"readonly": True},
        "maximum": {"readonly": True},
        "minimum": {"readonly": True},
        "timestamp": {"readonly": True},
        "total": {"readonly": True},
    }

    _attribute_map = {
        "count": {"key": "count", "type": "int"},
        "average": {"key": "average", "type": "float"},
        "maximum": {"key": "maximum", "type": "float"},
        "minimum": {"key": "minimum", "type": "float"},
        "timestamp": {"key": "timestamp", "type": "iso-8601"},
        "total": {"key": "total", "type": "float"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.count = None
        self.average = None
        self.maximum = None
        self.minimum = None
        self.timestamp = None
        self.total = None


class MinCapacityCapability(_serialization.Model):
    """The min capacity capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Min capacity value.
    :vartype value: float
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "value": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "float"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.value = None
        self.status = None
        self.reason = reason


class Name(_serialization.Model):
    """ARM Usage Name.

    :ivar value: Usage name value.
    :vartype value: str
    :ivar localized_value: Usage name localized value.
    :vartype localized_value: str
    """

    _attribute_map = {
        "value": {"key": "value", "type": "str"},
        "localized_value": {"key": "localizedValue", "type": "str"},
    }

    def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs):
        """
        :keyword value: Usage name value.
        :paramtype value: str
        :keyword localized_value: Usage name localized value.
        :paramtype localized_value: str
        """
        super().__init__(**kwargs)
        self.value = value
        self.localized_value = localized_value


class NetworkIsolationSettings(_serialization.Model):
    """Contains the ARM resources for which to create private endpoint connection.

    :ivar storage_account_resource_id: The resource id for the storage account used to store BACPAC
     file. If set, private endpoint connection will be created for the storage account. Must match
     storage account used for StorageUri parameter.
    :vartype storage_account_resource_id: str
    :ivar sql_server_resource_id: The resource id for the SQL server which is the target of this
     request. If set, private endpoint connection will be created for the SQL server. Must match
     server which is target of the operation.
    :vartype sql_server_resource_id: str
    """

    _attribute_map = {
        "storage_account_resource_id": {"key": "storageAccountResourceId", "type": "str"},
        "sql_server_resource_id": {"key": "sqlServerResourceId", "type": "str"},
    }

    def __init__(
        self,
        *,
        storage_account_resource_id: Optional[str] = None,
        sql_server_resource_id: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword storage_account_resource_id: The resource id for the storage account used to store
         BACPAC file. If set, private endpoint connection will be created for the storage account. Must
         match storage account used for StorageUri parameter.
        :paramtype storage_account_resource_id: str
        :keyword sql_server_resource_id: The resource id for the SQL server which is the target of this
         request. If set, private endpoint connection will be created for the SQL server. Must match
         server which is target of the operation.
        :paramtype sql_server_resource_id: str
        """
        super().__init__(**kwargs)
        self.storage_account_resource_id = storage_account_resource_id
        self.sql_server_resource_id = sql_server_resource_id


class Operation(_serialization.Model):
    """SQL REST API operation definition.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The name of the operation being performed on this particular object.
    :vartype name: str
    :ivar display: The localized display information for this particular operation / action.
    :vartype display: ~azure.mgmt.sql.models.OperationDisplay
    :ivar origin: The intended executor of the operation. Known values are: "user" and "system".
    :vartype origin: str or ~azure.mgmt.sql.models.OperationOrigin
    :ivar properties: Additional descriptions for the operation.
    :vartype properties: dict[str, JSON]
    """

    _validation = {
        "name": {"readonly": True},
        "display": {"readonly": True},
        "origin": {"readonly": True},
        "properties": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "display": {"key": "display", "type": "OperationDisplay"},
        "origin": {"key": "origin", "type": "str"},
        "properties": {"key": "properties", "type": "{object}"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.name = None
        self.display = None
        self.origin = None
        self.properties = None


class OperationDisplay(_serialization.Model):
    """Display metadata associated with the operation.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar provider: The localized friendly form of the resource provider name.
    :vartype provider: str
    :ivar resource: The localized friendly form of the resource type related to this
     action/operation.
    :vartype resource: str
    :ivar operation: The localized friendly name for the operation.
    :vartype operation: str
    :ivar description: The localized friendly description for the operation.
    :vartype description: str
    """

    _validation = {
        "provider": {"readonly": True},
        "resource": {"readonly": True},
        "operation": {"readonly": True},
        "description": {"readonly": True},
    }

    _attribute_map = {
        "provider": {"key": "provider", "type": "str"},
        "resource": {"key": "resource", "type": "str"},
        "operation": {"key": "operation", "type": "str"},
        "description": {"key": "description", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.provider = None
        self.resource = None
        self.operation = None
        self.description = None


class OperationImpact(_serialization.Model):
    """The impact of an operation, both in absolute and relative terms.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The name of the impact dimension.
    :vartype name: str
    :ivar unit: The unit in which estimated impact to dimension is measured.
    :vartype unit: str
    :ivar change_value_absolute: The absolute impact to dimension.
    :vartype change_value_absolute: float
    :ivar change_value_relative: The relative impact to dimension (null if not applicable).
    :vartype change_value_relative: float
    """

    _validation = {
        "name": {"readonly": True},
        "unit": {"readonly": True},
        "change_value_absolute": {"readonly": True},
        "change_value_relative": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "unit": {"key": "unit", "type": "str"},
        "change_value_absolute": {"key": "changeValueAbsolute", "type": "float"},
        "change_value_relative": {"key": "changeValueRelative", "type": "float"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.name = None
        self.unit = None
        self.change_value_absolute = None
        self.change_value_relative = None


class OperationListResult(_serialization.Model):
    """Result of the request to list SQL operations.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.Operation]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[Operation]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class OutboundFirewallRule(ProxyResource):
    """An Azure SQL DB Server Outbound Firewall Rule.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar provisioning_state: The state of the outbound rule.
    :vartype provisioning_state: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "provisioning_state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.provisioning_state = None


class OutboundFirewallRuleListResult(_serialization.Model):
    """A list of outbound rules.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.OutboundFirewallRule]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[OutboundFirewallRule]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class PartnerInfo(_serialization.Model):
    """Partner server information for the failover group.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource identifier of the partner server. Required.
    :vartype id: str
    :ivar location: Geo location of the partner server.
    :vartype location: str
    :ivar replication_role: Replication role of the partner server. Known values are: "Primary" and
     "Secondary".
    :vartype replication_role: str or ~azure.mgmt.sql.models.FailoverGroupReplicationRole
    """

    _validation = {
        "id": {"required": True},
        "location": {"readonly": True},
        "replication_role": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "replication_role": {"key": "replicationRole", "type": "str"},
    }

    def __init__(self, *, id: str, **kwargs):  # pylint: disable=redefined-builtin
        """
        :keyword id: Resource identifier of the partner server. Required.
        :paramtype id: str
        """
        super().__init__(**kwargs)
        self.id = id
        self.location = None
        self.replication_role = None


class PartnerRegionInfo(_serialization.Model):
    """Partner region information for the failover group.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar location: Geo location of the partner managed instances.
    :vartype location: str
    :ivar replication_role: Replication role of the partner managed instances. Known values are:
     "Primary" and "Secondary".
    :vartype replication_role: str or ~azure.mgmt.sql.models.InstanceFailoverGroupReplicationRole
    """

    _validation = {
        "replication_role": {"readonly": True},
    }

    _attribute_map = {
        "location": {"key": "location", "type": "str"},
        "replication_role": {"key": "replicationRole", "type": "str"},
    }

    def __init__(self, *, location: Optional[str] = None, **kwargs):
        """
        :keyword location: Geo location of the partner managed instances.
        :paramtype location: str
        """
        super().__init__(**kwargs)
        self.location = location
        self.replication_role = None


class PerformanceLevelCapability(_serialization.Model):
    """The performance level capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Performance level value.
    :vartype value: float
    :ivar unit: Unit type used to measure performance level. Known values are: "DTU" and "VCores".
    :vartype unit: str or ~azure.mgmt.sql.models.PerformanceLevelUnit
    """

    _validation = {
        "value": {"readonly": True},
        "unit": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "float"},
        "unit": {"key": "unit", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.unit = None


class PrivateEndpointConnection(ProxyResource):
    """A private endpoint connection.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar private_endpoint: Private endpoint which the connection belongs to.
    :vartype private_endpoint: ~azure.mgmt.sql.models.PrivateEndpointProperty
    :ivar private_link_service_connection_state: Connection state of the private endpoint
     connection.
    :vartype private_link_service_connection_state:
     ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateProperty
    :ivar provisioning_state: State of the private endpoint connection. Known values are:
     "Approving", "Ready", "Dropping", "Failed", and "Rejecting".
    :vartype provisioning_state: str or ~azure.mgmt.sql.models.PrivateEndpointProvisioningState
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "provisioning_state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpointProperty"},
        "private_link_service_connection_state": {
            "key": "properties.privateLinkServiceConnectionState",
            "type": "PrivateLinkServiceConnectionStateProperty",
        },
        "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
    }

    def __init__(
        self,
        *,
        private_endpoint: Optional["_models.PrivateEndpointProperty"] = None,
        private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None,
        **kwargs
    ):
        """
        :keyword private_endpoint: Private endpoint which the connection belongs to.
        :paramtype private_endpoint: ~azure.mgmt.sql.models.PrivateEndpointProperty
        :keyword private_link_service_connection_state: Connection state of the private endpoint
         connection.
        :paramtype private_link_service_connection_state:
         ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateProperty
        """
        super().__init__(**kwargs)
        self.private_endpoint = private_endpoint
        self.private_link_service_connection_state = private_link_service_connection_state
        self.provisioning_state = None


class PrivateEndpointConnectionListResult(_serialization.Model):
    """A list of private endpoint connections.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.PrivateEndpointConnection]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[PrivateEndpointConnection]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class PrivateEndpointConnectionProperties(_serialization.Model):
    """Properties of a private endpoint connection.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar private_endpoint: Private endpoint which the connection belongs to.
    :vartype private_endpoint: ~azure.mgmt.sql.models.PrivateEndpointProperty
    :ivar private_link_service_connection_state: Connection state of the private endpoint
     connection.
    :vartype private_link_service_connection_state:
     ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateProperty
    :ivar provisioning_state: State of the private endpoint connection. Known values are:
     "Approving", "Ready", "Dropping", "Failed", and "Rejecting".
    :vartype provisioning_state: str or ~azure.mgmt.sql.models.PrivateEndpointProvisioningState
    """

    _validation = {
        "provisioning_state": {"readonly": True},
    }

    _attribute_map = {
        "private_endpoint": {"key": "privateEndpoint", "type": "PrivateEndpointProperty"},
        "private_link_service_connection_state": {
            "key": "privateLinkServiceConnectionState",
            "type": "PrivateLinkServiceConnectionStateProperty",
        },
        "provisioning_state": {"key": "provisioningState", "type": "str"},
    }

    def __init__(
        self,
        *,
        private_endpoint: Optional["_models.PrivateEndpointProperty"] = None,
        private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None,
        **kwargs
    ):
        """
        :keyword private_endpoint: Private endpoint which the connection belongs to.
        :paramtype private_endpoint: ~azure.mgmt.sql.models.PrivateEndpointProperty
        :keyword private_link_service_connection_state: Connection state of the private endpoint
         connection.
        :paramtype private_link_service_connection_state:
         ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateProperty
        """
        super().__init__(**kwargs)
        self.private_endpoint = private_endpoint
        self.private_link_service_connection_state = private_link_service_connection_state
        self.provisioning_state = None


class PrivateEndpointConnectionRequestStatus(_serialization.Model):
    """Contains the private endpoint connection requests status.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar private_link_service_id: Resource id for which the private endpoint is created.
    :vartype private_link_service_id: str
    :ivar private_endpoint_connection_name: The connection name for the private endpoint.
    :vartype private_endpoint_connection_name: str
    :ivar status: Status of this private endpoint connection.
    :vartype status: str
    """

    _validation = {
        "private_link_service_id": {"readonly": True},
        "private_endpoint_connection_name": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "private_link_service_id": {"key": "privateLinkServiceId", "type": "str"},
        "private_endpoint_connection_name": {"key": "privateEndpointConnectionName", "type": "str"},
        "status": {"key": "status", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.private_link_service_id = None
        self.private_endpoint_connection_name = None
        self.status = None


class PrivateEndpointProperty(_serialization.Model):
    """PrivateEndpointProperty.

    :ivar id: Resource id of the private endpoint.
    :vartype id: str
    """

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
    }

    def __init__(self, *, id: Optional[str] = None, **kwargs):  # pylint: disable=redefined-builtin
        """
        :keyword id: Resource id of the private endpoint.
        :paramtype id: str
        """
        super().__init__(**kwargs)
        self.id = id


class PrivateLinkResource(ProxyResource):
    """A private link resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar properties: The private link resource group id.
    :vartype properties: ~azure.mgmt.sql.models.PrivateLinkResourceProperties
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "properties": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "properties": {"key": "properties", "type": "PrivateLinkResourceProperties"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.properties = None


class PrivateLinkResourceListResult(_serialization.Model):
    """A list of private link resources.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.PrivateLinkResource]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[PrivateLinkResource]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class PrivateLinkResourceProperties(_serialization.Model):
    """Properties of a private link resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar group_id: The private link resource group id.
    :vartype group_id: str
    :ivar required_members: The private link resource required member names.
    :vartype required_members: list[str]
    :ivar required_zone_names: The private link resource required zone names.
    :vartype required_zone_names: list[str]
    """

    _validation = {
        "group_id": {"readonly": True},
        "required_members": {"readonly": True},
        "required_zone_names": {"readonly": True},
    }

    _attribute_map = {
        "group_id": {"key": "groupId", "type": "str"},
        "required_members": {"key": "requiredMembers", "type": "[str]"},
        "required_zone_names": {"key": "requiredZoneNames", "type": "[str]"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.group_id = None
        self.required_members = None
        self.required_zone_names = None


class PrivateLinkServiceConnectionStateProperty(_serialization.Model):
    """PrivateLinkServiceConnectionStateProperty.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar status: The private link service connection status. Required. Known values are:
     "Approved", "Pending", "Rejected", and "Disconnected".
    :vartype status: str or ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateStatus
    :ivar description: The private link service connection description. Required.
    :vartype description: str
    :ivar actions_required: The actions required for private link service connection. "None"
    :vartype actions_required: str or
     ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateActionsRequire
    """

    _validation = {
        "status": {"required": True},
        "description": {"required": True},
        "actions_required": {"readonly": True},
    }

    _attribute_map = {
        "status": {"key": "status", "type": "str"},
        "description": {"key": "description", "type": "str"},
        "actions_required": {"key": "actionsRequired", "type": "str"},
    }

    def __init__(
        self, *, status: Union[str, "_models.PrivateLinkServiceConnectionStateStatus"], description: str, **kwargs
    ):
        """
        :keyword status: The private link service connection status. Required. Known values are:
         "Approved", "Pending", "Rejected", and "Disconnected".
        :paramtype status: str or ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateStatus
        :keyword description: The private link service connection description. Required.
        :paramtype description: str
        """
        super().__init__(**kwargs)
        self.status = status
        self.description = description
        self.actions_required = None


class QueryCheck(_serialization.Model):
    """SQL Vulnerability Assessment query check object.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar query: SQL Vulnerability Assessment rule query.
    :vartype query: str
    :ivar expected_result: SQL Vulnerability Assessment query expected result.
    :vartype expected_result: list[list[str]]
    :ivar column_names: SQL Vulnerability Assessment column names of query expected result.
    :vartype column_names: list[str]
    """

    _validation = {
        "query": {"readonly": True},
        "expected_result": {"readonly": True},
        "column_names": {"readonly": True},
    }

    _attribute_map = {
        "query": {"key": "query", "type": "str"},
        "expected_result": {"key": "expectedResult", "type": "[[str]]"},
        "column_names": {"key": "columnNames", "type": "[str]"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.query = None
        self.expected_result = None
        self.column_names = None


class QueryMetricInterval(_serialization.Model):
    """Properties of a query metrics interval.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar interval_start_time: The start time for the metric interval (ISO-8601 format).
    :vartype interval_start_time: str
    :ivar interval_type: Interval type (length). Known values are: "PT1H" and "P1D".
    :vartype interval_type: str or ~azure.mgmt.sql.models.QueryTimeGrainType
    :ivar execution_count: Execution count of a query in this interval.
    :vartype execution_count: int
    :ivar metrics: List of metric objects for this interval.
    :vartype metrics: list[~azure.mgmt.sql.models.QueryMetricProperties]
    """

    _validation = {
        "interval_start_time": {"readonly": True},
        "interval_type": {"readonly": True},
        "execution_count": {"readonly": True},
    }

    _attribute_map = {
        "interval_start_time": {"key": "intervalStartTime", "type": "str"},
        "interval_type": {"key": "intervalType", "type": "str"},
        "execution_count": {"key": "executionCount", "type": "int"},
        "metrics": {"key": "metrics", "type": "[QueryMetricProperties]"},
    }

    def __init__(self, *, metrics: Optional[List["_models.QueryMetricProperties"]] = None, **kwargs):
        """
        :keyword metrics: List of metric objects for this interval.
        :paramtype metrics: list[~azure.mgmt.sql.models.QueryMetricProperties]
        """
        super().__init__(**kwargs)
        self.interval_start_time = None
        self.interval_type = None
        self.execution_count = None
        self.metrics = metrics


class QueryMetricProperties(_serialization.Model):
    """Properties of a topquery metric in one interval.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The name information for the metric.
    :vartype name: str
    :ivar display_name: The UI appropriate name for the metric.
    :vartype display_name: str
    :ivar unit: The unit of the metric. Known values are: "percentage", "KB", "microseconds", and
     "count".
    :vartype unit: str or ~azure.mgmt.sql.models.QueryMetricUnitType
    :ivar value: The value of the metric.
    :vartype value: float
    :ivar min: Metric value when min() aggregate function is used over the interval.
    :vartype min: float
    :ivar max: Metric value when max() aggregate function is used over the interval.
    :vartype max: float
    :ivar avg: Metric value when avg() aggregate function is used over the interval.
    :vartype avg: float
    :ivar sum: Metric value when sum() aggregate function is used over the interval.
    :vartype sum: float
    :ivar stdev: Metric value when stdev aggregate function is used over the interval.
    :vartype stdev: float
    """

    _validation = {
        "name": {"readonly": True},
        "display_name": {"readonly": True},
        "unit": {"readonly": True},
        "value": {"readonly": True},
        "min": {"readonly": True},
        "max": {"readonly": True},
        "avg": {"readonly": True},
        "sum": {"readonly": True},
        "stdev": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "display_name": {"key": "displayName", "type": "str"},
        "unit": {"key": "unit", "type": "str"},
        "value": {"key": "value", "type": "float"},
        "min": {"key": "min", "type": "float"},
        "max": {"key": "max", "type": "float"},
        "avg": {"key": "avg", "type": "float"},
        "sum": {"key": "sum", "type": "float"},
        "stdev": {"key": "stdev", "type": "float"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.name = None
        self.display_name = None
        self.unit = None
        self.value = None
        self.min = None
        self.max = None
        self.avg = None
        self.sum = None
        self.stdev = None


class QueryStatistics(ProxyResource):
    """QueryStatistics.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar database_name: Database name of the database in which this query was executed.
    :vartype database_name: str
    :ivar query_id: Unique query id (unique within one database).
    :vartype query_id: str
    :ivar start_time: The start time for the metric (ISO-8601 format).
    :vartype start_time: str
    :ivar end_time: The end time for the metric (ISO-8601 format).
    :vartype end_time: str
    :ivar intervals: List of intervals with appropriate metric data.
    :vartype intervals: list[~azure.mgmt.sql.models.QueryMetricInterval]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "database_name": {"readonly": True},
        "query_id": {"readonly": True},
        "start_time": {"readonly": True},
        "end_time": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "database_name": {"key": "properties.databaseName", "type": "str"},
        "query_id": {"key": "properties.queryId", "type": "str"},
        "start_time": {"key": "properties.startTime", "type": "str"},
        "end_time": {"key": "properties.endTime", "type": "str"},
        "intervals": {"key": "properties.intervals", "type": "[QueryMetricInterval]"},
    }

    def __init__(self, *, intervals: Optional[List["_models.QueryMetricInterval"]] = None, **kwargs):
        """
        :keyword intervals: List of intervals with appropriate metric data.
        :paramtype intervals: list[~azure.mgmt.sql.models.QueryMetricInterval]
        """
        super().__init__(**kwargs)
        self.database_name = None
        self.query_id = None
        self.start_time = None
        self.end_time = None
        self.intervals = intervals


class QueryStatisticsProperties(_serialization.Model):
    """Properties of a query execution statistics.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar database_name: Database name of the database in which this query was executed.
    :vartype database_name: str
    :ivar query_id: Unique query id (unique within one database).
    :vartype query_id: str
    :ivar start_time: The start time for the metric (ISO-8601 format).
    :vartype start_time: str
    :ivar end_time: The end time for the metric (ISO-8601 format).
    :vartype end_time: str
    :ivar intervals: List of intervals with appropriate metric data.
    :vartype intervals: list[~azure.mgmt.sql.models.QueryMetricInterval]
    """

    _validation = {
        "database_name": {"readonly": True},
        "query_id": {"readonly": True},
        "start_time": {"readonly": True},
        "end_time": {"readonly": True},
    }

    _attribute_map = {
        "database_name": {"key": "databaseName", "type": "str"},
        "query_id": {"key": "queryId", "type": "str"},
        "start_time": {"key": "startTime", "type": "str"},
        "end_time": {"key": "endTime", "type": "str"},
        "intervals": {"key": "intervals", "type": "[QueryMetricInterval]"},
    }

    def __init__(self, *, intervals: Optional[List["_models.QueryMetricInterval"]] = None, **kwargs):
        """
        :keyword intervals: List of intervals with appropriate metric data.
        :paramtype intervals: list[~azure.mgmt.sql.models.QueryMetricInterval]
        """
        super().__init__(**kwargs)
        self.database_name = None
        self.query_id = None
        self.start_time = None
        self.end_time = None
        self.intervals = intervals


class ReadScaleCapability(_serialization.Model):
    """The read scale capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar max_number_of_replicas: The maximum number of read scale replicas.
    :vartype max_number_of_replicas: int
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "max_number_of_replicas": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "max_number_of_replicas": {"key": "maxNumberOfReplicas", "type": "int"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.max_number_of_replicas = None
        self.status = None
        self.reason = reason


class RecommendedAction(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """Database, Server or Elastic Pool Recommended Action.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar kind: Resource kind.
    :vartype kind: str
    :ivar location: Resource location.
    :vartype location: str
    :ivar recommendation_reason: Gets the reason for recommending this action. e.g.,
     DuplicateIndex.
    :vartype recommendation_reason: str
    :ivar valid_since: Gets the time since when this recommended action is valid.
    :vartype valid_since: ~datetime.datetime
    :ivar last_refresh: Gets time when this recommended action was last refreshed.
    :vartype last_refresh: ~datetime.datetime
    :ivar state: Gets the info of the current state the recommended action is in.
    :vartype state: ~azure.mgmt.sql.models.RecommendedActionStateInfo
    :ivar is_executable_action: Gets if this recommended action is actionable by user.
    :vartype is_executable_action: bool
    :ivar is_revertable_action: Gets if changes applied by this recommended action can be reverted
     by user.
    :vartype is_revertable_action: bool
    :ivar is_archived_action: Gets if this recommended action was suggested some time ago but user
     chose to ignore this and system added a new recommended action again.
    :vartype is_archived_action: bool
    :ivar execute_action_start_time: Gets the time when system started applying this recommended
     action on the user resource. e.g., index creation start time.
    :vartype execute_action_start_time: ~datetime.datetime
    :ivar execute_action_duration: Gets the time taken for applying this recommended action on user
     resource. e.g., time taken for index creation.
    :vartype execute_action_duration: str
    :ivar revert_action_start_time: Gets the time when system started reverting changes of this
     recommended action on user resource. e.g., time when index drop is executed.
    :vartype revert_action_start_time: ~datetime.datetime
    :ivar revert_action_duration: Gets the time taken for reverting changes of this recommended
     action on user resource. e.g., time taken for dropping the created index.
    :vartype revert_action_duration: str
    :ivar execute_action_initiated_by: Gets if approval for applying this recommended action was
     given by user/system. Known values are: "User" and "System".
    :vartype execute_action_initiated_by: str or
     ~azure.mgmt.sql.models.RecommendedActionInitiatedBy
    :ivar execute_action_initiated_time: Gets the time when this recommended action was approved
     for execution.
    :vartype execute_action_initiated_time: ~datetime.datetime
    :ivar revert_action_initiated_by: Gets if approval for reverting this recommended action was
     given by user/system. Known values are: "User" and "System".
    :vartype revert_action_initiated_by: str or ~azure.mgmt.sql.models.RecommendedActionInitiatedBy
    :ivar revert_action_initiated_time: Gets the time when this recommended action was approved for
     revert.
    :vartype revert_action_initiated_time: ~datetime.datetime
    :ivar score: Gets the impact of this recommended action. Possible values are 1 - Low impact, 2
     - Medium Impact and 3 - High Impact.
    :vartype score: int
    :ivar implementation_details: Gets the implementation details of this recommended action for
     user to apply it manually.
    :vartype implementation_details: ~azure.mgmt.sql.models.RecommendedActionImplementationInfo
    :ivar error_details: Gets the error details if and why this recommended action is put to error
     state.
    :vartype error_details: ~azure.mgmt.sql.models.RecommendedActionErrorInfo
    :ivar estimated_impact: Gets the estimated impact info for this recommended action e.g.,
     Estimated CPU gain, Estimated Disk Space change.
    :vartype estimated_impact: list[~azure.mgmt.sql.models.RecommendedActionImpactRecord]
    :ivar observed_impact: Gets the observed/actual impact info for this recommended action e.g.,
     Actual CPU gain, Actual Disk Space change.
    :vartype observed_impact: list[~azure.mgmt.sql.models.RecommendedActionImpactRecord]
    :ivar time_series: Gets the time series info of metrics for this recommended action e.g., CPU
     consumption time series.
    :vartype time_series: list[~azure.mgmt.sql.models.RecommendedActionMetricInfo]
    :ivar linked_objects: Gets the linked objects, if any.
    :vartype linked_objects: list[str]
    :ivar details: Gets additional details specific to this recommended action.
    :vartype details: dict[str, JSON]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "kind": {"readonly": True},
        "location": {"readonly": True},
        "recommendation_reason": {"readonly": True},
        "valid_since": {"readonly": True},
        "last_refresh": {"readonly": True},
        "is_executable_action": {"readonly": True},
        "is_revertable_action": {"readonly": True},
        "is_archived_action": {"readonly": True},
        "execute_action_start_time": {"readonly": True},
        "execute_action_duration": {"readonly": True},
        "revert_action_start_time": {"readonly": True},
        "revert_action_duration": {"readonly": True},
        "execute_action_initiated_by": {"readonly": True},
        "execute_action_initiated_time": {"readonly": True},
        "revert_action_initiated_by": {"readonly": True},
        "revert_action_initiated_time": {"readonly": True},
        "score": {"readonly": True},
        "implementation_details": {"readonly": True},
        "error_details": {"readonly": True},
        "estimated_impact": {"readonly": True},
        "observed_impact": {"readonly": True},
        "time_series": {"readonly": True},
        "linked_objects": {"readonly": True},
        "details": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "kind": {"key": "kind", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "recommendation_reason": {"key": "properties.recommendationReason", "type": "str"},
        "valid_since": {"key": "properties.validSince", "type": "iso-8601"},
        "last_refresh": {"key": "properties.lastRefresh", "type": "iso-8601"},
        "state": {"key": "properties.state", "type": "RecommendedActionStateInfo"},
        "is_executable_action": {"key": "properties.isExecutableAction", "type": "bool"},
        "is_revertable_action": {"key": "properties.isRevertableAction", "type": "bool"},
        "is_archived_action": {"key": "properties.isArchivedAction", "type": "bool"},
        "execute_action_start_time": {"key": "properties.executeActionStartTime", "type": "iso-8601"},
        "execute_action_duration": {"key": "properties.executeActionDuration", "type": "str"},
        "revert_action_start_time": {"key": "properties.revertActionStartTime", "type": "iso-8601"},
        "revert_action_duration": {"key": "properties.revertActionDuration", "type": "str"},
        "execute_action_initiated_by": {"key": "properties.executeActionInitiatedBy", "type": "str"},
        "execute_action_initiated_time": {"key": "properties.executeActionInitiatedTime", "type": "iso-8601"},
        "revert_action_initiated_by": {"key": "properties.revertActionInitiatedBy", "type": "str"},
        "revert_action_initiated_time": {"key": "properties.revertActionInitiatedTime", "type": "iso-8601"},
        "score": {"key": "properties.score", "type": "int"},
        "implementation_details": {
            "key": "properties.implementationDetails",
            "type": "RecommendedActionImplementationInfo",
        },
        "error_details": {"key": "properties.errorDetails", "type": "RecommendedActionErrorInfo"},
        "estimated_impact": {"key": "properties.estimatedImpact", "type": "[RecommendedActionImpactRecord]"},
        "observed_impact": {"key": "properties.observedImpact", "type": "[RecommendedActionImpactRecord]"},
        "time_series": {"key": "properties.timeSeries", "type": "[RecommendedActionMetricInfo]"},
        "linked_objects": {"key": "properties.linkedObjects", "type": "[str]"},
        "details": {"key": "properties.details", "type": "{object}"},
    }

    def __init__(  # pylint: disable=too-many-locals
        self, *, state: Optional["_models.RecommendedActionStateInfo"] = None, **kwargs
    ):
        """
        :keyword state: Gets the info of the current state the recommended action is in.
        :paramtype state: ~azure.mgmt.sql.models.RecommendedActionStateInfo
        """
        super().__init__(**kwargs)
        self.kind = None
        self.location = None
        self.recommendation_reason = None
        self.valid_since = None
        self.last_refresh = None
        self.state = state
        self.is_executable_action = None
        self.is_revertable_action = None
        self.is_archived_action = None
        self.execute_action_start_time = None
        self.execute_action_duration = None
        self.revert_action_start_time = None
        self.revert_action_duration = None
        self.execute_action_initiated_by = None
        self.execute_action_initiated_time = None
        self.revert_action_initiated_by = None
        self.revert_action_initiated_time = None
        self.score = None
        self.implementation_details = None
        self.error_details = None
        self.estimated_impact = None
        self.observed_impact = None
        self.time_series = None
        self.linked_objects = None
        self.details = None


class RecommendedActionErrorInfo(_serialization.Model):
    """Contains error information for an Azure SQL Database, Server or Elastic Pool Recommended Action.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar error_code: Gets the reason why the recommended action was put to error state. e.g.,
     DatabaseHasQdsOff, IndexAlreadyExists.
    :vartype error_code: str
    :ivar is_retryable: Gets whether the error could be ignored and recommended action could be
     retried. Possible values are: Yes/No. Known values are: "Yes" and "No".
    :vartype is_retryable: str or ~azure.mgmt.sql.models.IsRetryable
    """

    _validation = {
        "error_code": {"readonly": True},
        "is_retryable": {"readonly": True},
    }

    _attribute_map = {
        "error_code": {"key": "errorCode", "type": "str"},
        "is_retryable": {"key": "isRetryable", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.error_code = None
        self.is_retryable = None


class RecommendedActionImpactRecord(_serialization.Model):
    """Contains information of estimated or observed impact on various metrics for an Azure SQL Database, Server or Elastic Pool Recommended Action.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar dimension_name: Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange,
     NumberOfQueriesAffected.
    :vartype dimension_name: str
    :ivar unit: Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange,
     NumberOfQueriesAffected.
    :vartype unit: str
    :ivar absolute_value: Gets the absolute value of this dimension if applicable. e.g., Number of
     Queries affected.
    :vartype absolute_value: float
    :ivar change_value_absolute: Gets the absolute change in the value of this dimension. e.g.,
     Absolute Disk space change in Megabytes.
    :vartype change_value_absolute: float
    :ivar change_value_relative: Gets the relative change in the value of this dimension. e.g.,
     Relative Disk space change in Percentage.
    :vartype change_value_relative: float
    """

    _validation = {
        "dimension_name": {"readonly": True},
        "unit": {"readonly": True},
        "absolute_value": {"readonly": True},
        "change_value_absolute": {"readonly": True},
        "change_value_relative": {"readonly": True},
    }

    _attribute_map = {
        "dimension_name": {"key": "dimensionName", "type": "str"},
        "unit": {"key": "unit", "type": "str"},
        "absolute_value": {"key": "absoluteValue", "type": "float"},
        "change_value_absolute": {"key": "changeValueAbsolute", "type": "float"},
        "change_value_relative": {"key": "changeValueRelative", "type": "float"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.dimension_name = None
        self.unit = None
        self.absolute_value = None
        self.change_value_absolute = None
        self.change_value_relative = None


class RecommendedActionImplementationInfo(_serialization.Model):
    """Contains information for manual implementation for an Azure SQL Database, Server or Elastic Pool Recommended Action.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar method: Gets the method in which this recommended action can be manually implemented.
     e.g., TSql, AzurePowerShell. Known values are: "TSql" and "AzurePowerShell".
    :vartype method: str or ~azure.mgmt.sql.models.ImplementationMethod
    :ivar script: Gets the manual implementation script. e.g., T-SQL script that could be executed
     on the database.
    :vartype script: str
    """

    _validation = {
        "method": {"readonly": True},
        "script": {"readonly": True},
    }

    _attribute_map = {
        "method": {"key": "method", "type": "str"},
        "script": {"key": "script", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.method = None
        self.script = None


class RecommendedActionMetricInfo(_serialization.Model):
    """Contains time series of various impacted metrics for an Azure SQL Database, Server or Elastic Pool Recommended Action.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar metric_name: Gets the name of the metric. e.g., CPU, Number of Queries.
    :vartype metric_name: str
    :ivar unit: Gets the unit in which metric is measured. e.g., DTU, Frequency.
    :vartype unit: str
    :ivar time_grain: Gets the duration of time interval for the value given by this MetricInfo.
     e.g., PT1H (1 hour).
    :vartype time_grain: str
    :ivar start_time: Gets the start time of time interval given by this MetricInfo.
    :vartype start_time: ~datetime.datetime
    :ivar value: Gets the value of the metric in the time interval given by this MetricInfo.
    :vartype value: float
    """

    _validation = {
        "metric_name": {"readonly": True},
        "unit": {"readonly": True},
        "time_grain": {"readonly": True},
        "start_time": {"readonly": True},
        "value": {"readonly": True},
    }

    _attribute_map = {
        "metric_name": {"key": "metricName", "type": "str"},
        "unit": {"key": "unit", "type": "str"},
        "time_grain": {"key": "timeGrain", "type": "str"},
        "start_time": {"key": "startTime", "type": "iso-8601"},
        "value": {"key": "value", "type": "float"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.metric_name = None
        self.unit = None
        self.time_grain = None
        self.start_time = None
        self.value = None


class RecommendedActionStateInfo(_serialization.Model):
    """Contains information of current state for an Azure SQL Database, Server or Elastic Pool Recommended Action.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar current_value: Current state the recommended action is in. Some commonly used states are:
     Active      -> recommended action is active and no action has been taken yet. Pending     ->
     recommended action is approved for and is awaiting execution. Executing   -> recommended action
     is being applied on the user database. Verifying   -> recommended action was applied and is
     being verified of its usefulness by the system. Success     -> recommended action was applied
     and improvement found during verification. Pending Revert  -> verification found little or no
     improvement so recommended action is queued for revert or user has manually reverted. Reverting
     -> changes made while applying recommended action are being reverted on the user database.
     Reverted    -> successfully reverted the changes made by recommended action on user database.
     Ignored     -> user explicitly ignored/discarded the recommended action. Required. Known values
     are: "Active", "Pending", "Executing", "Verifying", "PendingRevert", "RevertCancelled",
     "Reverting", "Reverted", "Ignored", "Expired", "Monitoring", "Resolved", "Success", and
     "Error".
    :vartype current_value: str or ~azure.mgmt.sql.models.RecommendedActionCurrentState
    :ivar action_initiated_by: Gets who initiated the execution of this recommended action.
     Possible Value are: User    -> When user explicity notified system to apply the recommended
     action. System  -> When auto-execute status of this advisor was set to 'Enabled', in which case
     the system applied it. Known values are: "User" and "System".
    :vartype action_initiated_by: str or ~azure.mgmt.sql.models.RecommendedActionInitiatedBy
    :ivar last_modified: Gets the time when the state was last modified.
    :vartype last_modified: ~datetime.datetime
    """

    _validation = {
        "current_value": {"required": True},
        "action_initiated_by": {"readonly": True},
        "last_modified": {"readonly": True},
    }

    _attribute_map = {
        "current_value": {"key": "currentValue", "type": "str"},
        "action_initiated_by": {"key": "actionInitiatedBy", "type": "str"},
        "last_modified": {"key": "lastModified", "type": "iso-8601"},
    }

    def __init__(self, *, current_value: Union[str, "_models.RecommendedActionCurrentState"], **kwargs):
        """
        :keyword current_value: Current state the recommended action is in. Some commonly used states
         are: Active      -> recommended action is active and no action has been taken yet. Pending
         -> recommended action is approved for and is awaiting execution. Executing   -> recommended
         action is being applied on the user database. Verifying   -> recommended action was applied and
         is being verified of its usefulness by the system. Success     -> recommended action was
         applied and improvement found during verification. Pending Revert  -> verification found little
         or no improvement so recommended action is queued for revert or user has manually reverted.
         Reverting   -> changes made while applying recommended action are being reverted on the user
         database. Reverted    -> successfully reverted the changes made by recommended action on user
         database. Ignored     -> user explicitly ignored/discarded the recommended action. Required.
         Known values are: "Active", "Pending", "Executing", "Verifying", "PendingRevert",
         "RevertCancelled", "Reverting", "Reverted", "Ignored", "Expired", "Monitoring", "Resolved",
         "Success", and "Error".
        :paramtype current_value: str or ~azure.mgmt.sql.models.RecommendedActionCurrentState
        """
        super().__init__(**kwargs)
        self.current_value = current_value
        self.action_initiated_by = None
        self.last_modified = None


class RecommendedSensitivityLabelUpdate(ProxyResource):
    """A recommended sensitivity label update operation.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar op: Known values are: "enable" and "disable".
    :vartype op: str or ~azure.mgmt.sql.models.RecommendedSensitivityLabelUpdateKind
    :ivar schema: Schema name of the column to update.
    :vartype schema: str
    :ivar table: Table name of the column to update.
    :vartype table: str
    :ivar column: Column name to update.
    :vartype column: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "op": {"key": "properties.op", "type": "str"},
        "schema": {"key": "properties.schema", "type": "str"},
        "table": {"key": "properties.table", "type": "str"},
        "column": {"key": "properties.column", "type": "str"},
    }

    def __init__(
        self,
        *,
        op: Optional[Union[str, "_models.RecommendedSensitivityLabelUpdateKind"]] = None,
        schema: Optional[str] = None,
        table: Optional[str] = None,
        column: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword op: Known values are: "enable" and "disable".
        :paramtype op: str or ~azure.mgmt.sql.models.RecommendedSensitivityLabelUpdateKind
        :keyword schema: Schema name of the column to update.
        :paramtype schema: str
        :keyword table: Table name of the column to update.
        :paramtype table: str
        :keyword column: Column name to update.
        :paramtype column: str
        """
        super().__init__(**kwargs)
        self.op = op
        self.schema = schema
        self.table = table
        self.column = column


class RecommendedSensitivityLabelUpdateList(_serialization.Model):
    """A list of recommended sensitivity label update operations.

    :ivar operations:
    :vartype operations: list[~azure.mgmt.sql.models.RecommendedSensitivityLabelUpdate]
    """

    _attribute_map = {
        "operations": {"key": "operations", "type": "[RecommendedSensitivityLabelUpdate]"},
    }

    def __init__(self, *, operations: Optional[List["_models.RecommendedSensitivityLabelUpdate"]] = None, **kwargs):
        """
        :keyword operations:
        :paramtype operations: list[~azure.mgmt.sql.models.RecommendedSensitivityLabelUpdate]
        """
        super().__init__(**kwargs)
        self.operations = operations


class RecoverableDatabase(ProxyResource):
    """A recoverable database.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar edition: The edition of the database.
    :vartype edition: str
    :ivar service_level_objective: The service level objective name of the database.
    :vartype service_level_objective: str
    :ivar elastic_pool_name: The elastic pool name of the database.
    :vartype elastic_pool_name: str
    :ivar last_available_backup_date: The last available backup date of the database (ISO8601
     format).
    :vartype last_available_backup_date: ~datetime.datetime
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "edition": {"readonly": True},
        "service_level_objective": {"readonly": True},
        "elastic_pool_name": {"readonly": True},
        "last_available_backup_date": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "edition": {"key": "properties.edition", "type": "str"},
        "service_level_objective": {"key": "properties.serviceLevelObjective", "type": "str"},
        "elastic_pool_name": {"key": "properties.elasticPoolName", "type": "str"},
        "last_available_backup_date": {"key": "properties.lastAvailableBackupDate", "type": "iso-8601"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.edition = None
        self.service_level_objective = None
        self.elastic_pool_name = None
        self.last_available_backup_date = None


class RecoverableDatabaseListResult(_serialization.Model):
    """The response to a list recoverable databases request.

    All required parameters must be populated in order to send to Azure.

    :ivar value: A list of recoverable databases. Required.
    :vartype value: list[~azure.mgmt.sql.models.RecoverableDatabase]
    """

    _validation = {
        "value": {"required": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[RecoverableDatabase]"},
    }

    def __init__(self, *, value: List["_models.RecoverableDatabase"], **kwargs):
        """
        :keyword value: A list of recoverable databases. Required.
        :paramtype value: list[~azure.mgmt.sql.models.RecoverableDatabase]
        """
        super().__init__(**kwargs)
        self.value = value


class RecoverableManagedDatabase(ProxyResource):
    """A recoverable managed database resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar last_available_backup_date: The last available backup date.
    :vartype last_available_backup_date: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "last_available_backup_date": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "last_available_backup_date": {"key": "properties.lastAvailableBackupDate", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.last_available_backup_date = None


class RecoverableManagedDatabaseListResult(_serialization.Model):
    """A list of recoverable managed databases.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.RecoverableManagedDatabase]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[RecoverableManagedDatabase]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class Remediation(_serialization.Model):
    """SQL Vulnerability Assessment remediation Details.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar description: SQL Vulnerability Assessment remediation description.
    :vartype description: str
    :ivar scripts: SQL Vulnerability Assessment remediation script.
    :vartype scripts: list[str]
    :ivar automated: SQL Vulnerability Assessment is remediation automated.
    :vartype automated: bool
    :ivar portal_link: SQL Vulnerability Assessment optional link to remediate in Azure Portal.
    :vartype portal_link: str
    """

    _validation = {
        "description": {"readonly": True},
        "scripts": {"readonly": True},
        "automated": {"readonly": True},
        "portal_link": {"readonly": True},
    }

    _attribute_map = {
        "description": {"key": "description", "type": "str"},
        "scripts": {"key": "scripts", "type": "[str]"},
        "automated": {"key": "automated", "type": "bool"},
        "portal_link": {"key": "portalLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.description = None
        self.scripts = None
        self.automated = None
        self.portal_link = None


class ReplicationLink(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A replication link.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar partner_server: Resource partner server.
    :vartype partner_server: str
    :ivar partner_database: Resource partner database.
    :vartype partner_database: str
    :ivar partner_location: Resource partner location.
    :vartype partner_location: str
    :ivar role: Local replication role. Known values are: "Primary", "Secondary",
     "NonReadableSecondary", "Source", and "Copy".
    :vartype role: str or ~azure.mgmt.sql.models.ReplicationRole
    :ivar partner_role: Partner replication role. Known values are: "Primary", "Secondary",
     "NonReadableSecondary", "Source", and "Copy".
    :vartype partner_role: str or ~azure.mgmt.sql.models.ReplicationRole
    :ivar replication_mode: Replication mode.
    :vartype replication_mode: str
    :ivar start_time: Time at which the link was created.
    :vartype start_time: ~datetime.datetime
    :ivar percent_complete: Seeding completion percentage for the link.
    :vartype percent_complete: int
    :ivar replication_state: Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). Known values
     are: "PENDING", "SEEDING", "CATCH_UP", and "SUSPENDED".
    :vartype replication_state: str or ~azure.mgmt.sql.models.ReplicationState
    :ivar is_termination_allowed: Whether the user is currently allowed to terminate the link.
    :vartype is_termination_allowed: bool
    :ivar link_type: Link type (GEO, NAMED, STANDBY). Known values are: "GEO", "NAMED", and
     "STANDBY".
    :vartype link_type: str or ~azure.mgmt.sql.models.ReplicationLinkType
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "partner_server": {"readonly": True},
        "partner_database": {"readonly": True},
        "partner_location": {"readonly": True},
        "role": {"readonly": True},
        "partner_role": {"readonly": True},
        "replication_mode": {"readonly": True},
        "start_time": {"readonly": True},
        "percent_complete": {"readonly": True},
        "replication_state": {"readonly": True},
        "is_termination_allowed": {"readonly": True},
        "link_type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "partner_server": {"key": "properties.partnerServer", "type": "str"},
        "partner_database": {"key": "properties.partnerDatabase", "type": "str"},
        "partner_location": {"key": "properties.partnerLocation", "type": "str"},
        "role": {"key": "properties.role", "type": "str"},
        "partner_role": {"key": "properties.partnerRole", "type": "str"},
        "replication_mode": {"key": "properties.replicationMode", "type": "str"},
        "start_time": {"key": "properties.startTime", "type": "iso-8601"},
        "percent_complete": {"key": "properties.percentComplete", "type": "int"},
        "replication_state": {"key": "properties.replicationState", "type": "str"},
        "is_termination_allowed": {"key": "properties.isTerminationAllowed", "type": "bool"},
        "link_type": {"key": "properties.linkType", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.partner_server = None
        self.partner_database = None
        self.partner_location = None
        self.role = None
        self.partner_role = None
        self.replication_mode = None
        self.start_time = None
        self.percent_complete = None
        self.replication_state = None
        self.is_termination_allowed = None
        self.link_type = None


class ReplicationLinkListResult(_serialization.Model):
    """A list of replication links.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ReplicationLink]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ReplicationLink]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ResourceIdentity(_serialization.Model):
    """Azure Active Directory identity configuration for a resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar user_assigned_identities: The resource ids of the user assigned identities to use.
    :vartype user_assigned_identities: dict[str, ~azure.mgmt.sql.models.UserIdentity]
    :ivar principal_id: The Azure Active Directory principal id.
    :vartype principal_id: str
    :ivar type: The identity type. Set this to 'SystemAssigned' in order to automatically create
     and assign an Azure Active Directory principal for the resource. Known values are: "None",
     "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned".
    :vartype type: str or ~azure.mgmt.sql.models.IdentityType
    :ivar tenant_id: The Azure Active Directory tenant id.
    :vartype tenant_id: str
    """

    _validation = {
        "principal_id": {"readonly": True},
        "tenant_id": {"readonly": True},
    }

    _attribute_map = {
        "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserIdentity}"},
        "principal_id": {"key": "principalId", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "tenant_id": {"key": "tenantId", "type": "str"},
    }

    def __init__(
        self,
        *,
        user_assigned_identities: Optional[Dict[str, "_models.UserIdentity"]] = None,
        type: Optional[Union[str, "_models.IdentityType"]] = None,
        **kwargs
    ):
        """
        :keyword user_assigned_identities: The resource ids of the user assigned identities to use.
        :paramtype user_assigned_identities: dict[str, ~azure.mgmt.sql.models.UserIdentity]
        :keyword type: The identity type. Set this to 'SystemAssigned' in order to automatically create
         and assign an Azure Active Directory principal for the resource. Known values are: "None",
         "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned".
        :paramtype type: str or ~azure.mgmt.sql.models.IdentityType
        """
        super().__init__(**kwargs)
        self.user_assigned_identities = user_assigned_identities
        self.principal_id = None
        self.type = type
        self.tenant_id = None


class ResourceMoveDefinition(_serialization.Model):
    """Contains the information necessary to perform a resource move (rename).

    All required parameters must be populated in order to send to Azure.

    :ivar id: The target ID for the resource. Required.
    :vartype id: str
    """

    _validation = {
        "id": {"required": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
    }

    def __init__(self, *, id: str, **kwargs):  # pylint: disable=redefined-builtin
        """
        :keyword id: The target ID for the resource. Required.
        :paramtype id: str
        """
        super().__init__(**kwargs)
        self.id = id


class RestorableDroppedDatabase(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A restorable dropped database resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar sku: The name and tier of the SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar location: Resource location.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar database_name: The name of the database.
    :vartype database_name: str
    :ivar max_size_bytes: The max size of the database expressed in bytes.
    :vartype max_size_bytes: int
    :ivar creation_date: The creation date of the database (ISO8601 format).
    :vartype creation_date: ~datetime.datetime
    :ivar deletion_date: The deletion date of the database (ISO8601 format).
    :vartype deletion_date: ~datetime.datetime
    :ivar earliest_restore_date: The earliest restore date of the database (ISO8601 format).
    :vartype earliest_restore_date: ~datetime.datetime
    :ivar backup_storage_redundancy: The storage account type used to store backups for this
     database. Known values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype backup_storage_redundancy: str or ~azure.mgmt.sql.models.BackupStorageRedundancy
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "database_name": {"readonly": True},
        "max_size_bytes": {"readonly": True},
        "creation_date": {"readonly": True},
        "deletion_date": {"readonly": True},
        "earliest_restore_date": {"readonly": True},
        "backup_storage_redundancy": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "sku": {"key": "sku", "type": "Sku"},
        "location": {"key": "location", "type": "str"},
        "tags": {"key": "tags", "type": "{str}"},
        "database_name": {"key": "properties.databaseName", "type": "str"},
        "max_size_bytes": {"key": "properties.maxSizeBytes", "type": "int"},
        "creation_date": {"key": "properties.creationDate", "type": "iso-8601"},
        "deletion_date": {"key": "properties.deletionDate", "type": "iso-8601"},
        "earliest_restore_date": {"key": "properties.earliestRestoreDate", "type": "iso-8601"},
        "backup_storage_redundancy": {"key": "properties.backupStorageRedundancy", "type": "str"},
    }

    def __init__(
        self,
        *,
        sku: Optional["_models.Sku"] = None,
        location: Optional[str] = None,
        tags: Optional[Dict[str, str]] = None,
        **kwargs
    ):
        """
        :keyword sku: The name and tier of the SKU.
        :paramtype sku: ~azure.mgmt.sql.models.Sku
        :keyword location: Resource location.
        :paramtype location: str
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        """
        super().__init__(**kwargs)
        self.sku = sku
        self.location = location
        self.tags = tags
        self.database_name = None
        self.max_size_bytes = None
        self.creation_date = None
        self.deletion_date = None
        self.earliest_restore_date = None
        self.backup_storage_redundancy = None


class RestorableDroppedDatabaseListResult(_serialization.Model):
    """A list of restorable dropped databases.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.RestorableDroppedDatabase]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[RestorableDroppedDatabase]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class RestorableDroppedManagedDatabase(TrackedResource):
    """A restorable dropped managed database resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location. Required.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar database_name: The name of the database.
    :vartype database_name: str
    :ivar creation_date: The creation date of the database (ISO8601 format).
    :vartype creation_date: ~datetime.datetime
    :ivar deletion_date: The deletion date of the database (ISO8601 format).
    :vartype deletion_date: ~datetime.datetime
    :ivar earliest_restore_date: The earliest restore date of the database (ISO8601 format).
    :vartype earliest_restore_date: ~datetime.datetime
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"required": True},
        "database_name": {"readonly": True},
        "creation_date": {"readonly": True},
        "deletion_date": {"readonly": True},
        "earliest_restore_date": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "tags": {"key": "tags", "type": "{str}"},
        "database_name": {"key": "properties.databaseName", "type": "str"},
        "creation_date": {"key": "properties.creationDate", "type": "iso-8601"},
        "deletion_date": {"key": "properties.deletionDate", "type": "iso-8601"},
        "earliest_restore_date": {"key": "properties.earliestRestoreDate", "type": "iso-8601"},
    }

    def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs):
        """
        :keyword location: Resource location. Required.
        :paramtype location: str
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        """
        super().__init__(location=location, tags=tags, **kwargs)
        self.database_name = None
        self.creation_date = None
        self.deletion_date = None
        self.earliest_restore_date = None


class RestorableDroppedManagedDatabaseListResult(_serialization.Model):
    """A list of restorable dropped managed databases.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.RestorableDroppedManagedDatabase]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[RestorableDroppedManagedDatabase]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class RestorePoint(ProxyResource):
    """Database restore points.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location.
    :vartype location: str
    :ivar restore_point_type: The type of restore point. Known values are: "CONTINUOUS" and
     "DISCRETE".
    :vartype restore_point_type: str or ~azure.mgmt.sql.models.RestorePointType
    :ivar earliest_restore_date: The earliest time to which this database can be restored.
    :vartype earliest_restore_date: ~datetime.datetime
    :ivar restore_point_creation_date: The time the backup was taken.
    :vartype restore_point_creation_date: ~datetime.datetime
    :ivar restore_point_label: The label of restore point for backup request by user.
    :vartype restore_point_label: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"readonly": True},
        "restore_point_type": {"readonly": True},
        "earliest_restore_date": {"readonly": True},
        "restore_point_creation_date": {"readonly": True},
        "restore_point_label": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "restore_point_type": {"key": "properties.restorePointType", "type": "str"},
        "earliest_restore_date": {"key": "properties.earliestRestoreDate", "type": "iso-8601"},
        "restore_point_creation_date": {"key": "properties.restorePointCreationDate", "type": "iso-8601"},
        "restore_point_label": {"key": "properties.restorePointLabel", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.location = None
        self.restore_point_type = None
        self.earliest_restore_date = None
        self.restore_point_creation_date = None
        self.restore_point_label = None


class RestorePointListResult(_serialization.Model):
    """A list of long term retention backups.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.RestorePoint]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[RestorePoint]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SecurityEvent(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A security event.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar event_time: The time when the security event occurred.
    :vartype event_time: ~datetime.datetime
    :ivar security_event_type: The type of the security event. Known values are: "Undefined",
     "SqlInjectionVulnerability", and "SqlInjectionExploit".
    :vartype security_event_type: str or ~azure.mgmt.sql.models.SecurityEventType
    :ivar subscription: The subscription name.
    :vartype subscription: str
    :ivar server: The server name.
    :vartype server: str
    :ivar database: The database name.
    :vartype database: str
    :ivar client_ip: The IP address of the client who executed the statement.
    :vartype client_ip: str
    :ivar application_name: The application used to execute the statement.
    :vartype application_name: str
    :ivar principal_name: The principal user who executed the statement.
    :vartype principal_name: str
    :ivar security_event_sql_injection_additional_properties: The sql injection additional
     properties, populated only if the type of the security event is sql injection.
    :vartype security_event_sql_injection_additional_properties:
     ~azure.mgmt.sql.models.SecurityEventSqlInjectionAdditionalProperties
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "event_time": {"readonly": True},
        "security_event_type": {"readonly": True},
        "subscription": {"readonly": True},
        "server": {"readonly": True},
        "database": {"readonly": True},
        "client_ip": {"readonly": True},
        "application_name": {"readonly": True},
        "principal_name": {"readonly": True},
        "security_event_sql_injection_additional_properties": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "event_time": {"key": "properties.eventTime", "type": "iso-8601"},
        "security_event_type": {"key": "properties.securityEventType", "type": "str"},
        "subscription": {"key": "properties.subscription", "type": "str"},
        "server": {"key": "properties.server", "type": "str"},
        "database": {"key": "properties.database", "type": "str"},
        "client_ip": {"key": "properties.clientIp", "type": "str"},
        "application_name": {"key": "properties.applicationName", "type": "str"},
        "principal_name": {"key": "properties.principalName", "type": "str"},
        "security_event_sql_injection_additional_properties": {
            "key": "properties.securityEventSqlInjectionAdditionalProperties",
            "type": "SecurityEventSqlInjectionAdditionalProperties",
        },
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.event_time = None
        self.security_event_type = None
        self.subscription = None
        self.server = None
        self.database = None
        self.client_ip = None
        self.application_name = None
        self.principal_name = None
        self.security_event_sql_injection_additional_properties = None


class SecurityEventCollection(_serialization.Model):
    """A list of security events.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SecurityEvent]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SecurityEvent]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SecurityEventsFilterParameters(_serialization.Model):
    """The properties that are supported in the $filter operation.

    :ivar event_time: Filter on the event time.
    :vartype event_time: ~datetime.datetime
    :ivar show_server_records: Whether to show server records or not.
    :vartype show_server_records: bool
    """

    _attribute_map = {
        "event_time": {"key": "eventTime", "type": "iso-8601"},
        "show_server_records": {"key": "showServerRecords", "type": "bool"},
    }

    def __init__(
        self, *, event_time: Optional[datetime.datetime] = None, show_server_records: Optional[bool] = None, **kwargs
    ):
        """
        :keyword event_time: Filter on the event time.
        :paramtype event_time: ~datetime.datetime
        :keyword show_server_records: Whether to show server records or not.
        :paramtype show_server_records: bool
        """
        super().__init__(**kwargs)
        self.event_time = event_time
        self.show_server_records = show_server_records


class SecurityEventSqlInjectionAdditionalProperties(_serialization.Model):
    """The properties of a security event sql injection additional properties.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar threat_id: The threat ID.
    :vartype threat_id: str
    :ivar statement: The statement.
    :vartype statement: str
    :ivar statement_highlight_offset: The statement highlight offset.
    :vartype statement_highlight_offset: int
    :ivar statement_highlight_length: The statement highlight length.
    :vartype statement_highlight_length: int
    :ivar error_code: The sql error code.
    :vartype error_code: int
    :ivar error_severity: The sql error severity.
    :vartype error_severity: int
    :ivar error_message: The sql error message.
    :vartype error_message: str
    """

    _validation = {
        "threat_id": {"readonly": True},
        "statement": {"readonly": True},
        "statement_highlight_offset": {"readonly": True},
        "statement_highlight_length": {"readonly": True},
        "error_code": {"readonly": True},
        "error_severity": {"readonly": True},
        "error_message": {"readonly": True},
    }

    _attribute_map = {
        "threat_id": {"key": "threatId", "type": "str"},
        "statement": {"key": "statement", "type": "str"},
        "statement_highlight_offset": {"key": "statementHighlightOffset", "type": "int"},
        "statement_highlight_length": {"key": "statementHighlightLength", "type": "int"},
        "error_code": {"key": "errorCode", "type": "int"},
        "error_severity": {"key": "errorSeverity", "type": "int"},
        "error_message": {"key": "errorMessage", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.threat_id = None
        self.statement = None
        self.statement_highlight_offset = None
        self.statement_highlight_length = None
        self.error_code = None
        self.error_severity = None
        self.error_message = None


class SensitivityLabel(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A sensitivity label.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar managed_by: Resource that manages the sensitivity label.
    :vartype managed_by: str
    :ivar schema_name: The schema name.
    :vartype schema_name: str
    :ivar table_name: The table name.
    :vartype table_name: str
    :ivar column_name: The column name.
    :vartype column_name: str
    :ivar label_name: The label name.
    :vartype label_name: str
    :ivar label_id: The label ID.
    :vartype label_id: str
    :ivar information_type: The information type.
    :vartype information_type: str
    :ivar information_type_id: The information type ID.
    :vartype information_type_id: str
    :ivar is_disabled: Is sensitivity recommendation disabled. Applicable for recommended
     sensitivity label only. Specifies whether the sensitivity recommendation on this column is
     disabled (dismissed) or not.
    :vartype is_disabled: bool
    :ivar rank: Known values are: "None", "Low", "Medium", "High", and "Critical".
    :vartype rank: str or ~azure.mgmt.sql.models.SensitivityLabelRank
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "managed_by": {"readonly": True},
        "schema_name": {"readonly": True},
        "table_name": {"readonly": True},
        "column_name": {"readonly": True},
        "is_disabled": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "managed_by": {"key": "managedBy", "type": "str"},
        "schema_name": {"key": "properties.schemaName", "type": "str"},
        "table_name": {"key": "properties.tableName", "type": "str"},
        "column_name": {"key": "properties.columnName", "type": "str"},
        "label_name": {"key": "properties.labelName", "type": "str"},
        "label_id": {"key": "properties.labelId", "type": "str"},
        "information_type": {"key": "properties.informationType", "type": "str"},
        "information_type_id": {"key": "properties.informationTypeId", "type": "str"},
        "is_disabled": {"key": "properties.isDisabled", "type": "bool"},
        "rank": {"key": "properties.rank", "type": "str"},
    }

    def __init__(
        self,
        *,
        label_name: Optional[str] = None,
        label_id: Optional[str] = None,
        information_type: Optional[str] = None,
        information_type_id: Optional[str] = None,
        rank: Optional[Union[str, "_models.SensitivityLabelRank"]] = None,
        **kwargs
    ):
        """
        :keyword label_name: The label name.
        :paramtype label_name: str
        :keyword label_id: The label ID.
        :paramtype label_id: str
        :keyword information_type: The information type.
        :paramtype information_type: str
        :keyword information_type_id: The information type ID.
        :paramtype information_type_id: str
        :keyword rank: Known values are: "None", "Low", "Medium", "High", and "Critical".
        :paramtype rank: str or ~azure.mgmt.sql.models.SensitivityLabelRank
        """
        super().__init__(**kwargs)
        self.managed_by = None
        self.schema_name = None
        self.table_name = None
        self.column_name = None
        self.label_name = label_name
        self.label_id = label_id
        self.information_type = information_type
        self.information_type_id = information_type_id
        self.is_disabled = None
        self.rank = rank


class SensitivityLabelListResult(_serialization.Model):
    """A list of sensitivity labels.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SensitivityLabel]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SensitivityLabel]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SensitivityLabelUpdate(ProxyResource):
    """A sensitivity label update operation.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar op: Known values are: "set" and "remove".
    :vartype op: str or ~azure.mgmt.sql.models.SensitivityLabelUpdateKind
    :ivar schema: Schema name of the column to update.
    :vartype schema: str
    :ivar table: Table name of the column to update.
    :vartype table: str
    :ivar column: Column name to update.
    :vartype column: str
    :ivar sensitivity_label: The sensitivity label information to apply on a column.
    :vartype sensitivity_label: ~azure.mgmt.sql.models.SensitivityLabel
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "op": {"key": "properties.op", "type": "str"},
        "schema": {"key": "properties.schema", "type": "str"},
        "table": {"key": "properties.table", "type": "str"},
        "column": {"key": "properties.column", "type": "str"},
        "sensitivity_label": {"key": "properties.sensitivityLabel", "type": "SensitivityLabel"},
    }

    def __init__(
        self,
        *,
        op: Optional[Union[str, "_models.SensitivityLabelUpdateKind"]] = None,
        schema: Optional[str] = None,
        table: Optional[str] = None,
        column: Optional[str] = None,
        sensitivity_label: Optional["_models.SensitivityLabel"] = None,
        **kwargs
    ):
        """
        :keyword op: Known values are: "set" and "remove".
        :paramtype op: str or ~azure.mgmt.sql.models.SensitivityLabelUpdateKind
        :keyword schema: Schema name of the column to update.
        :paramtype schema: str
        :keyword table: Table name of the column to update.
        :paramtype table: str
        :keyword column: Column name to update.
        :paramtype column: str
        :keyword sensitivity_label: The sensitivity label information to apply on a column.
        :paramtype sensitivity_label: ~azure.mgmt.sql.models.SensitivityLabel
        """
        super().__init__(**kwargs)
        self.op = op
        self.schema = schema
        self.table = table
        self.column = column
        self.sensitivity_label = sensitivity_label


class SensitivityLabelUpdateList(_serialization.Model):
    """A list of sensitivity label update operations.

    :ivar operations:
    :vartype operations: list[~azure.mgmt.sql.models.SensitivityLabelUpdate]
    """

    _attribute_map = {
        "operations": {"key": "operations", "type": "[SensitivityLabelUpdate]"},
    }

    def __init__(self, *, operations: Optional[List["_models.SensitivityLabelUpdate"]] = None, **kwargs):
        """
        :keyword operations:
        :paramtype operations: list[~azure.mgmt.sql.models.SensitivityLabelUpdate]
        """
        super().__init__(**kwargs)
        self.operations = operations


class Server(TrackedResource):  # pylint: disable=too-many-instance-attributes
    """An Azure SQL Database server.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location. Required.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar identity: The Azure Active Directory identity of the server.
    :vartype identity: ~azure.mgmt.sql.models.ResourceIdentity
    :ivar kind: Kind of sql server. This is metadata used for the Azure portal experience.
    :vartype kind: str
    :ivar administrator_login: Administrator username for the server. Once created it cannot be
     changed.
    :vartype administrator_login: str
    :ivar administrator_login_password: The administrator login password (required for server
     creation).
    :vartype administrator_login_password: str
    :ivar version: The version of the server.
    :vartype version: str
    :ivar state: The state of the server.
    :vartype state: str
    :ivar fully_qualified_domain_name: The fully qualified domain name of the server.
    :vartype fully_qualified_domain_name: str
    :ivar private_endpoint_connections: List of private endpoint connections on a server.
    :vartype private_endpoint_connections:
     list[~azure.mgmt.sql.models.ServerPrivateEndpointConnection]
    :ivar minimal_tls_version: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'.
    :vartype minimal_tls_version: str
    :ivar public_network_access: Whether or not public endpoint access is allowed for this server.
     Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values are:
     "Enabled" and "Disabled".
    :vartype public_network_access: str or ~azure.mgmt.sql.models.ServerNetworkAccessFlag
    :ivar workspace_feature: Whether or not existing server has a workspace created and if it
     allows connection from workspace. Known values are: "Connected" and "Disconnected".
    :vartype workspace_feature: str or ~azure.mgmt.sql.models.ServerWorkspaceFeature
    :ivar primary_user_assigned_identity_id: The resource id of a user assigned identity to be used
     by default.
    :vartype primary_user_assigned_identity_id: str
    :ivar federated_client_id: The Client id used for cross tenant CMK scenario.
    :vartype federated_client_id: str
    :ivar key_id: A CMK URI of the key to use for encryption.
    :vartype key_id: str
    :ivar administrators: The Azure Active Directory identity of the server.
    :vartype administrators: ~azure.mgmt.sql.models.ServerExternalAdministrator
    :ivar restrict_outbound_network_access: Whether or not to restrict outbound network access for
     this server.  Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values
     are: "Enabled" and "Disabled".
    :vartype restrict_outbound_network_access: str or
     ~azure.mgmt.sql.models.ServerNetworkAccessFlag
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"required": True},
        "kind": {"readonly": True},
        "state": {"readonly": True},
        "fully_qualified_domain_name": {"readonly": True},
        "private_endpoint_connections": {"readonly": True},
        "workspace_feature": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "tags": {"key": "tags", "type": "{str}"},
        "identity": {"key": "identity", "type": "ResourceIdentity"},
        "kind": {"key": "kind", "type": "str"},
        "administrator_login": {"key": "properties.administratorLogin", "type": "str"},
        "administrator_login_password": {"key": "properties.administratorLoginPassword", "type": "str"},
        "version": {"key": "properties.version", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
        "fully_qualified_domain_name": {"key": "properties.fullyQualifiedDomainName", "type": "str"},
        "private_endpoint_connections": {
            "key": "properties.privateEndpointConnections",
            "type": "[ServerPrivateEndpointConnection]",
        },
        "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"},
        "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"},
        "workspace_feature": {"key": "properties.workspaceFeature", "type": "str"},
        "primary_user_assigned_identity_id": {"key": "properties.primaryUserAssignedIdentityId", "type": "str"},
        "federated_client_id": {"key": "properties.federatedClientId", "type": "str"},
        "key_id": {"key": "properties.keyId", "type": "str"},
        "administrators": {"key": "properties.administrators", "type": "ServerExternalAdministrator"},
        "restrict_outbound_network_access": {"key": "properties.restrictOutboundNetworkAccess", "type": "str"},
    }

    def __init__(
        self,
        *,
        location: str,
        tags: Optional[Dict[str, str]] = None,
        identity: Optional["_models.ResourceIdentity"] = None,
        administrator_login: Optional[str] = None,
        administrator_login_password: Optional[str] = None,
        version: Optional[str] = None,
        minimal_tls_version: Optional[str] = None,
        public_network_access: Optional[Union[str, "_models.ServerNetworkAccessFlag"]] = None,
        primary_user_assigned_identity_id: Optional[str] = None,
        federated_client_id: Optional[str] = None,
        key_id: Optional[str] = None,
        administrators: Optional["_models.ServerExternalAdministrator"] = None,
        restrict_outbound_network_access: Optional[Union[str, "_models.ServerNetworkAccessFlag"]] = None,
        **kwargs
    ):
        """
        :keyword location: Resource location. Required.
        :paramtype location: str
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword identity: The Azure Active Directory identity of the server.
        :paramtype identity: ~azure.mgmt.sql.models.ResourceIdentity
        :keyword administrator_login: Administrator username for the server. Once created it cannot be
         changed.
        :paramtype administrator_login: str
        :keyword administrator_login_password: The administrator login password (required for server
         creation).
        :paramtype administrator_login_password: str
        :keyword version: The version of the server.
        :paramtype version: str
        :keyword minimal_tls_version: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'.
        :paramtype minimal_tls_version: str
        :keyword public_network_access: Whether or not public endpoint access is allowed for this
         server.  Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values are:
         "Enabled" and "Disabled".
        :paramtype public_network_access: str or ~azure.mgmt.sql.models.ServerNetworkAccessFlag
        :keyword primary_user_assigned_identity_id: The resource id of a user assigned identity to be
         used by default.
        :paramtype primary_user_assigned_identity_id: str
        :keyword federated_client_id: The Client id used for cross tenant CMK scenario.
        :paramtype federated_client_id: str
        :keyword key_id: A CMK URI of the key to use for encryption.
        :paramtype key_id: str
        :keyword administrators: The Azure Active Directory identity of the server.
        :paramtype administrators: ~azure.mgmt.sql.models.ServerExternalAdministrator
        :keyword restrict_outbound_network_access: Whether or not to restrict outbound network access
         for this server.  Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known
         values are: "Enabled" and "Disabled".
        :paramtype restrict_outbound_network_access: str or
         ~azure.mgmt.sql.models.ServerNetworkAccessFlag
        """
        super().__init__(location=location, tags=tags, **kwargs)
        self.identity = identity
        self.kind = None
        self.administrator_login = administrator_login
        self.administrator_login_password = administrator_login_password
        self.version = version
        self.state = None
        self.fully_qualified_domain_name = None
        self.private_endpoint_connections = None
        self.minimal_tls_version = minimal_tls_version
        self.public_network_access = public_network_access
        self.workspace_feature = None
        self.primary_user_assigned_identity_id = primary_user_assigned_identity_id
        self.federated_client_id = federated_client_id
        self.key_id = key_id
        self.administrators = administrators
        self.restrict_outbound_network_access = restrict_outbound_network_access


class ServerAdvancedThreatProtection(ProxyResource):
    """A server Advanced Threat Protection.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of AdvancedThreatProtectionResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar state: Specifies the state of the Advanced Threat Protection, whether it is enabled or
     disabled or a state has not been applied yet on the specific database or server. Known values
     are: "New", "Enabled", and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState
    :ivar creation_time: Specifies the UTC creation time of the policy.
    :vartype creation_time: ~datetime.datetime
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
        "creation_time": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "state": {"key": "properties.state", "type": "str"},
        "creation_time": {"key": "properties.creationTime", "type": "iso-8601"},
    }

    def __init__(self, *, state: Optional[Union[str, "_models.AdvancedThreatProtectionState"]] = None, **kwargs):
        """
        :keyword state: Specifies the state of the Advanced Threat Protection, whether it is enabled or
         disabled or a state has not been applied yet on the specific database or server. Known values
         are: "New", "Enabled", and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.state = state
        self.creation_time = None


class ServerAutomaticTuning(ProxyResource):
    """Server-level Automatic Tuning.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar desired_state: Automatic tuning desired state. Known values are: "Custom", "Auto", and
     "Unspecified".
    :vartype desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningServerMode
    :ivar actual_state: Automatic tuning actual state. Known values are: "Custom", "Auto", and
     "Unspecified".
    :vartype actual_state: str or ~azure.mgmt.sql.models.AutomaticTuningServerMode
    :ivar options: Automatic tuning options definition.
    :vartype options: dict[str, ~azure.mgmt.sql.models.AutomaticTuningServerOptions]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "actual_state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "desired_state": {"key": "properties.desiredState", "type": "str"},
        "actual_state": {"key": "properties.actualState", "type": "str"},
        "options": {"key": "properties.options", "type": "{AutomaticTuningServerOptions}"},
    }

    def __init__(
        self,
        *,
        desired_state: Optional[Union[str, "_models.AutomaticTuningServerMode"]] = None,
        options: Optional[Dict[str, "_models.AutomaticTuningServerOptions"]] = None,
        **kwargs
    ):
        """
        :keyword desired_state: Automatic tuning desired state. Known values are: "Custom", "Auto", and
         "Unspecified".
        :paramtype desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningServerMode
        :keyword options: Automatic tuning options definition.
        :paramtype options: dict[str, ~azure.mgmt.sql.models.AutomaticTuningServerOptions]
        """
        super().__init__(**kwargs)
        self.desired_state = desired_state
        self.actual_state = None
        self.options = options


class ServerAzureADAdministrator(ProxyResource):
    """Azure Active Directory administrator.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar administrator_type: Type of the sever administrator. "ActiveDirectory"
    :vartype administrator_type: str or ~azure.mgmt.sql.models.AdministratorType
    :ivar login: Login name of the server administrator.
    :vartype login: str
    :ivar sid: SID (object ID) of the server administrator.
    :vartype sid: str
    :ivar tenant_id: Tenant ID of the administrator.
    :vartype tenant_id: str
    :ivar azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
    :vartype azure_ad_only_authentication: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "azure_ad_only_authentication": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "administrator_type": {"key": "properties.administratorType", "type": "str"},
        "login": {"key": "properties.login", "type": "str"},
        "sid": {"key": "properties.sid", "type": "str"},
        "tenant_id": {"key": "properties.tenantId", "type": "str"},
        "azure_ad_only_authentication": {"key": "properties.azureADOnlyAuthentication", "type": "bool"},
    }

    def __init__(
        self,
        *,
        administrator_type: Optional[Union[str, "_models.AdministratorType"]] = None,
        login: Optional[str] = None,
        sid: Optional[str] = None,
        tenant_id: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword administrator_type: Type of the sever administrator. "ActiveDirectory"
        :paramtype administrator_type: str or ~azure.mgmt.sql.models.AdministratorType
        :keyword login: Login name of the server administrator.
        :paramtype login: str
        :keyword sid: SID (object ID) of the server administrator.
        :paramtype sid: str
        :keyword tenant_id: Tenant ID of the administrator.
        :paramtype tenant_id: str
        """
        super().__init__(**kwargs)
        self.administrator_type = administrator_type
        self.login = login
        self.sid = sid
        self.tenant_id = tenant_id
        self.azure_ad_only_authentication = None


class ServerAzureADOnlyAuthentication(ProxyResource):
    """Azure Active Directory only authentication.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
    :vartype azure_ad_only_authentication: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "azure_ad_only_authentication": {"key": "properties.azureADOnlyAuthentication", "type": "bool"},
    }

    def __init__(self, *, azure_ad_only_authentication: Optional[bool] = None, **kwargs):
        """
        :keyword azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
        :paramtype azure_ad_only_authentication: bool
        """
        super().__init__(**kwargs)
        self.azure_ad_only_authentication = azure_ad_only_authentication


class ServerBlobAuditingPolicy(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A server blob auditing policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar is_devops_audit_enabled: Specifies the state of devops audit. If state is Enabled, devops
     logs will be sent to Azure Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled',
     'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true

     When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit'
     diagnostic logs category on the master database should also be created.

     Diagnostic Settings URI format:
     PUT
     https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_devops_audit_enabled: bool
    :ivar retention_days: Specifies the number of days to keep in the audit logs in the storage
     account.
    :vartype retention_days: int
    :ivar audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit.

     The recommended set of action groups to use is the following combination - this will audit all
     the queries and stored procedures executed against the database, as well as successful and
     failed logins:

     BATCH_COMPLETED_GROUP,
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
     FAILED_DATABASE_AUTHENTICATION_GROUP.

     This above combination is also the set that is configured by default when enabling auditing
     from the Azure portal.

     The supported action groups to audit are (note: choose only specific groups that cover your
     auditing needs. Using unnecessary groups could lead to very large quantities of audit records):

     APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
     BACKUP_RESTORE_GROUP
     DATABASE_LOGOUT_GROUP
     DATABASE_OBJECT_CHANGE_GROUP
     DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
     DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
     DATABASE_OPERATION_GROUP
     DATABASE_PERMISSION_CHANGE_GROUP
     DATABASE_PRINCIPAL_CHANGE_GROUP
     DATABASE_PRINCIPAL_IMPERSONATION_GROUP
     DATABASE_ROLE_MEMBER_CHANGE_GROUP
     FAILED_DATABASE_AUTHENTICATION_GROUP
     SCHEMA_OBJECT_ACCESS_GROUP
     SCHEMA_OBJECT_CHANGE_GROUP
     SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
     SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
     SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
     USER_CHANGE_PASSWORD_GROUP
     BATCH_STARTED_GROUP
     BATCH_COMPLETED_GROUP
     DBCC_GROUP
     DATABASE_OWNERSHIP_CHANGE_GROUP
     DATABASE_CHANGE_GROUP
     LEDGER_OPERATION_GROUP

     These are groups that cover all sql statements and stored procedures executed against the
     database, and should not be used in combination with other groups as this will result in
     duplicate audit logs.

     For more information, see `Database-Level Audit Action Groups
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.

     For Database auditing policy, specific Actions can also be specified (note that Actions cannot
     be specified for Server auditing policy). The supported actions to audit are:
     SELECT
     UPDATE
     INSERT
     DELETE
     EXECUTE
     RECEIVE
     REFERENCES

     The general form for defining an action to be audited is:
     {action} ON {object} BY {principal}

     Note that :code:`<object>` in the above format can refer to an object like a table, view, or
     stored procedure, or an entire database or schema. For the latter cases, the forms
     DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively.

     For example:
     SELECT on dbo.myTable by public
     SELECT on DATABASE::myDatabase by public
     SELECT on SCHEMA::mySchema by public

     For more information, see `Database-Level Audit Actions
     <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_.
    :vartype audit_actions_and_groups: list[str]
    :ivar is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the
     storage's secondary key.
    :vartype is_storage_secondary_key_in_use: bool
    :ivar is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure
     Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.

     When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
     diagnostic logs category on the database should be also created.
     Note that for server level audit you should use the 'master' database as {databaseName}.

     Diagnostic Settings URI format:
     PUT
     https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_azure_monitor_target_enabled: bool
    :ivar queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before audit
     actions are forced to be processed.
     The default minimum value is 1000 (1 second). The maximum is 2,147,483,647.
    :vartype queue_delay_ms: int
    :ivar is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
     storage.
    :vartype is_managed_identity_in_use: bool
    :ivar state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled is required.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:


     #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
        For more information, see `Auditing to storage using Managed Identity authentication
     <https://go.microsoft.com/fwlink/?linkid=2114355>`_.
    :vartype storage_account_access_key: str
    :ivar storage_account_subscription_id: Specifies the blob storage subscription Id.
    :vartype storage_account_subscription_id: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "is_devops_audit_enabled": {"key": "properties.isDevopsAuditEnabled", "type": "bool"},
        "retention_days": {"key": "properties.retentionDays", "type": "int"},
        "audit_actions_and_groups": {"key": "properties.auditActionsAndGroups", "type": "[str]"},
        "is_storage_secondary_key_in_use": {"key": "properties.isStorageSecondaryKeyInUse", "type": "bool"},
        "is_azure_monitor_target_enabled": {"key": "properties.isAzureMonitorTargetEnabled", "type": "bool"},
        "queue_delay_ms": {"key": "properties.queueDelayMs", "type": "int"},
        "is_managed_identity_in_use": {"key": "properties.isManagedIdentityInUse", "type": "bool"},
        "state": {"key": "properties.state", "type": "str"},
        "storage_endpoint": {"key": "properties.storageEndpoint", "type": "str"},
        "storage_account_access_key": {"key": "properties.storageAccountAccessKey", "type": "str"},
        "storage_account_subscription_id": {"key": "properties.storageAccountSubscriptionId", "type": "str"},
    }

    def __init__(
        self,
        *,
        is_devops_audit_enabled: Optional[bool] = None,
        retention_days: Optional[int] = None,
        audit_actions_and_groups: Optional[List[str]] = None,
        is_storage_secondary_key_in_use: Optional[bool] = None,
        is_azure_monitor_target_enabled: Optional[bool] = None,
        queue_delay_ms: Optional[int] = None,
        is_managed_identity_in_use: Optional[bool] = None,
        state: Optional[Union[str, "_models.BlobAuditingPolicyState"]] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        storage_account_subscription_id: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword is_devops_audit_enabled: Specifies the state of devops audit. If state is Enabled,
         devops logs will be sent to Azure Monitor.
         In order to send the events to Azure Monitor, specify 'State' as 'Enabled',
         'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true

         When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit'
         diagnostic logs category on the master database should also be created.

         Diagnostic Settings URI format:
         PUT
         https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

         For more information, see `Diagnostic Settings REST API
         <https://go.microsoft.com/fwlink/?linkid=2033207>`_
         or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
        :paramtype is_devops_audit_enabled: bool
        :keyword retention_days: Specifies the number of days to keep in the audit logs in the storage
         account.
        :paramtype retention_days: int
        :keyword audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit.

         The recommended set of action groups to use is the following combination - this will audit all
         the queries and stored procedures executed against the database, as well as successful and
         failed logins:

         BATCH_COMPLETED_GROUP,
         SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP,
         FAILED_DATABASE_AUTHENTICATION_GROUP.

         This above combination is also the set that is configured by default when enabling auditing
         from the Azure portal.

         The supported action groups to audit are (note: choose only specific groups that cover your
         auditing needs. Using unnecessary groups could lead to very large quantities of audit records):

         APPLICATION_ROLE_CHANGE_PASSWORD_GROUP
         BACKUP_RESTORE_GROUP
         DATABASE_LOGOUT_GROUP
         DATABASE_OBJECT_CHANGE_GROUP
         DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP
         DATABASE_OBJECT_PERMISSION_CHANGE_GROUP
         DATABASE_OPERATION_GROUP
         DATABASE_PERMISSION_CHANGE_GROUP
         DATABASE_PRINCIPAL_CHANGE_GROUP
         DATABASE_PRINCIPAL_IMPERSONATION_GROUP
         DATABASE_ROLE_MEMBER_CHANGE_GROUP
         FAILED_DATABASE_AUTHENTICATION_GROUP
         SCHEMA_OBJECT_ACCESS_GROUP
         SCHEMA_OBJECT_CHANGE_GROUP
         SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP
         SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP
         SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
         USER_CHANGE_PASSWORD_GROUP
         BATCH_STARTED_GROUP
         BATCH_COMPLETED_GROUP
         DBCC_GROUP
         DATABASE_OWNERSHIP_CHANGE_GROUP
         DATABASE_CHANGE_GROUP
         LEDGER_OPERATION_GROUP

         These are groups that cover all sql statements and stored procedures executed against the
         database, and should not be used in combination with other groups as this will result in
         duplicate audit logs.

         For more information, see `Database-Level Audit Action Groups
         <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups>`_.

         For Database auditing policy, specific Actions can also be specified (note that Actions cannot
         be specified for Server auditing policy). The supported actions to audit are:
         SELECT
         UPDATE
         INSERT
         DELETE
         EXECUTE
         RECEIVE
         REFERENCES

         The general form for defining an action to be audited is:
         {action} ON {object} BY {principal}

         Note that :code:`<object>` in the above format can refer to an object like a table, view, or
         stored procedure, or an entire database or schema. For the latter cases, the forms
         DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively.

         For example:
         SELECT on dbo.myTable by public
         SELECT on DATABASE::myDatabase by public
         SELECT on SCHEMA::mySchema by public

         For more information, see `Database-Level Audit Actions
         <https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions>`_.
        :paramtype audit_actions_and_groups: list[str]
        :keyword is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is
         the storage's secondary key.
        :paramtype is_storage_secondary_key_in_use: bool
        :keyword is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure
         Monitor.
         In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
         'IsAzureMonitorTargetEnabled' as true.

         When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents'
         diagnostic logs category on the database should be also created.
         Note that for server level audit you should use the 'master' database as {databaseName}.

         Diagnostic Settings URI format:
         PUT
         https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

         For more information, see `Diagnostic Settings REST API
         <https://go.microsoft.com/fwlink/?linkid=2033207>`_
         or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
        :paramtype is_azure_monitor_target_enabled: bool
        :keyword queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before
         audit actions are forced to be processed.
         The default minimum value is 1000 (1 second). The maximum is 2,147,483,647.
        :paramtype queue_delay_ms: int
        :keyword is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
         storage.
        :paramtype is_managed_identity_in_use: bool
        :keyword state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
         isAzureMonitorTargetEnabled are required. Known values are: "Enabled" and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
        :keyword storage_endpoint: Specifies the blob storage endpoint (e.g.
         https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or
         isAzureMonitorTargetEnabled is required.
        :paramtype storage_endpoint: str
        :keyword storage_account_access_key: Specifies the identifier key of the auditing storage
         account.
         If state is Enabled and storageEndpoint is specified, not specifying the
         storageAccountAccessKey will use SQL server system-assigned managed identity to access the
         storage.
         Prerequisites for using managed identity authentication:


         #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
         #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
         Contributor' RBAC role to the server identity.
            For more information, see `Auditing to storage using Managed Identity authentication
         <https://go.microsoft.com/fwlink/?linkid=2114355>`_.
        :paramtype storage_account_access_key: str
        :keyword storage_account_subscription_id: Specifies the blob storage subscription Id.
        :paramtype storage_account_subscription_id: str
        """
        super().__init__(**kwargs)
        self.is_devops_audit_enabled = is_devops_audit_enabled
        self.retention_days = retention_days
        self.audit_actions_and_groups = audit_actions_and_groups
        self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use
        self.is_azure_monitor_target_enabled = is_azure_monitor_target_enabled
        self.queue_delay_ms = queue_delay_ms
        self.is_managed_identity_in_use = is_managed_identity_in_use
        self.state = state
        self.storage_endpoint = storage_endpoint
        self.storage_account_access_key = storage_account_access_key
        self.storage_account_subscription_id = storage_account_subscription_id


class ServerBlobAuditingPolicyListResult(_serialization.Model):
    """A list of server auditing settings.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerBlobAuditingPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerBlobAuditingPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ServerCommunicationLink(ProxyResource):
    """Server communication link.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Communication link location.
    :vartype location: str
    :ivar kind: Communication link kind.  This property is used for Azure Portal metadata.
    :vartype kind: str
    :ivar state: The state.
    :vartype state: str
    :ivar partner_server: The name of the partner server.
    :vartype partner_server: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"readonly": True},
        "kind": {"readonly": True},
        "state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "kind": {"key": "kind", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
        "partner_server": {"key": "properties.partnerServer", "type": "str"},
    }

    def __init__(self, *, partner_server: Optional[str] = None, **kwargs):
        """
        :keyword partner_server: The name of the partner server.
        :paramtype partner_server: str
        """
        super().__init__(**kwargs)
        self.location = None
        self.kind = None
        self.state = None
        self.partner_server = partner_server


class ServerCommunicationLinkListResult(_serialization.Model):
    """A list of server communication links.

    :ivar value: The list of server communication links.
    :vartype value: list[~azure.mgmt.sql.models.ServerCommunicationLink]
    """

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerCommunicationLink]"},
    }

    def __init__(self, *, value: Optional[List["_models.ServerCommunicationLink"]] = None, **kwargs):
        """
        :keyword value: The list of server communication links.
        :paramtype value: list[~azure.mgmt.sql.models.ServerCommunicationLink]
        """
        super().__init__(**kwargs)
        self.value = value


class ServerConnectionPolicy(ProxyResource):
    """A server connection policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location.
    :vartype location: str
    :ivar kind: Metadata used for the Azure portal experience.
    :vartype kind: str
    :ivar connection_type: The server connection type. Known values are: "Default", "Redirect", and
     "Proxy".
    :vartype connection_type: str or ~azure.mgmt.sql.models.ServerConnectionType
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"readonly": True},
        "kind": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "kind": {"key": "kind", "type": "str"},
        "connection_type": {"key": "properties.connectionType", "type": "str"},
    }

    def __init__(self, *, connection_type: Optional[Union[str, "_models.ServerConnectionType"]] = None, **kwargs):
        """
        :keyword connection_type: The server connection type. Known values are: "Default", "Redirect",
         and "Proxy".
        :paramtype connection_type: str or ~azure.mgmt.sql.models.ServerConnectionType
        """
        super().__init__(**kwargs)
        self.location = None
        self.kind = None
        self.connection_type = connection_type


class ServerConnectionPolicyListResult(_serialization.Model):
    """A list of server connection policy objects.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerConnectionPolicy]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerConnectionPolicy]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ServerDevOpsAuditingSettings(ProxyResource):
    """A server DevOps auditing settings.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of ServerDevOpsAuditSettingsResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar is_azure_monitor_target_enabled: Specifies whether DevOps audit events are sent to Azure
     Monitor.
     In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
     'IsAzureMonitorTargetEnabled' as true.

     When using REST API to configure DevOps audit, Diagnostic Settings with
     'DevOpsOperationsAudit' diagnostic logs category on the master database should be also created.

     Diagnostic Settings URI format:
     PUT
     https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

     For more information, see `Diagnostic Settings REST API
     <https://go.microsoft.com/fwlink/?linkid=2033207>`_
     or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
    :vartype is_azure_monitor_target_enabled: bool
    :ivar is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
     storage.
    :vartype is_managed_identity_in_use: bool
    :ivar state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled are required. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or
     isAzureMonitorTargetEnabled is required.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account.
     If state is Enabled and storageEndpoint is specified, not specifying the
     storageAccountAccessKey will use SQL server system-assigned managed identity to access the
     storage.
     Prerequisites for using managed identity authentication:


     #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
     #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
     Contributor' RBAC role to the server identity.
        For more information, see `Auditing to storage using Managed Identity authentication
     <https://go.microsoft.com/fwlink/?linkid=2114355>`_.
    :vartype storage_account_access_key: str
    :ivar storage_account_subscription_id: Specifies the blob storage subscription Id.
    :vartype storage_account_subscription_id: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "is_azure_monitor_target_enabled": {"key": "properties.isAzureMonitorTargetEnabled", "type": "bool"},
        "is_managed_identity_in_use": {"key": "properties.isManagedIdentityInUse", "type": "bool"},
        "state": {"key": "properties.state", "type": "str"},
        "storage_endpoint": {"key": "properties.storageEndpoint", "type": "str"},
        "storage_account_access_key": {"key": "properties.storageAccountAccessKey", "type": "str"},
        "storage_account_subscription_id": {"key": "properties.storageAccountSubscriptionId", "type": "str"},
    }

    def __init__(
        self,
        *,
        is_azure_monitor_target_enabled: Optional[bool] = None,
        is_managed_identity_in_use: Optional[bool] = None,
        state: Optional[Union[str, "_models.BlobAuditingPolicyState"]] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        storage_account_subscription_id: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword is_azure_monitor_target_enabled: Specifies whether DevOps audit events are sent to
         Azure Monitor.
         In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and
         'IsAzureMonitorTargetEnabled' as true.

         When using REST API to configure DevOps audit, Diagnostic Settings with
         'DevOpsOperationsAudit' diagnostic logs category on the master database should be also created.

         Diagnostic Settings URI format:
         PUT
         https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview

         For more information, see `Diagnostic Settings REST API
         <https://go.microsoft.com/fwlink/?linkid=2033207>`_
         or `Diagnostic Settings PowerShell <https://go.microsoft.com/fwlink/?linkid=2033043>`_.
        :paramtype is_azure_monitor_target_enabled: bool
        :keyword is_managed_identity_in_use: Specifies whether Managed Identity is used to access blob
         storage.
        :paramtype is_managed_identity_in_use: bool
        :keyword state: Specifies the state of the audit. If state is Enabled, storageEndpoint or
         isAzureMonitorTargetEnabled are required. Known values are: "Enabled" and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.BlobAuditingPolicyState
        :keyword storage_endpoint: Specifies the blob storage endpoint (e.g.
         https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or
         isAzureMonitorTargetEnabled is required.
        :paramtype storage_endpoint: str
        :keyword storage_account_access_key: Specifies the identifier key of the auditing storage
         account.
         If state is Enabled and storageEndpoint is specified, not specifying the
         storageAccountAccessKey will use SQL server system-assigned managed identity to access the
         storage.
         Prerequisites for using managed identity authentication:


         #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD).
         #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data
         Contributor' RBAC role to the server identity.
            For more information, see `Auditing to storage using Managed Identity authentication
         <https://go.microsoft.com/fwlink/?linkid=2114355>`_.
        :paramtype storage_account_access_key: str
        :keyword storage_account_subscription_id: Specifies the blob storage subscription Id.
        :paramtype storage_account_subscription_id: str
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.is_azure_monitor_target_enabled = is_azure_monitor_target_enabled
        self.is_managed_identity_in_use = is_managed_identity_in_use
        self.state = state
        self.storage_endpoint = storage_endpoint
        self.storage_account_access_key = storage_account_access_key
        self.storage_account_subscription_id = storage_account_subscription_id


class ServerDevOpsAuditSettingsListResult(_serialization.Model):
    """A list of server DevOps audit settings.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerDevOpsAuditingSettings]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerDevOpsAuditingSettings]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ServerDnsAlias(ProxyResource):
    """A server DNS alias.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar azure_dns_record: The fully qualified DNS record for alias.
    :vartype azure_dns_record: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "azure_dns_record": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "azure_dns_record": {"key": "properties.azureDnsRecord", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.azure_dns_record = None


class ServerDnsAliasAcquisition(_serialization.Model):
    """A server dns alias acquisition request.

    All required parameters must be populated in order to send to Azure.

    :ivar old_server_dns_alias_id: The id of the server alias that will be acquired to point to
     this server instead. Required.
    :vartype old_server_dns_alias_id: str
    """

    _validation = {
        "old_server_dns_alias_id": {"required": True},
    }

    _attribute_map = {
        "old_server_dns_alias_id": {"key": "oldServerDnsAliasId", "type": "str"},
    }

    def __init__(self, *, old_server_dns_alias_id: str, **kwargs):
        """
        :keyword old_server_dns_alias_id: The id of the server alias that will be acquired to point to
         this server instead. Required.
        :paramtype old_server_dns_alias_id: str
        """
        super().__init__(**kwargs)
        self.old_server_dns_alias_id = old_server_dns_alias_id


class ServerDnsAliasListResult(_serialization.Model):
    """A list of server DNS aliases.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerDnsAlias]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerDnsAlias]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ServerExternalAdministrator(_serialization.Model):
    """Properties of a active directory administrator.

    :ivar administrator_type: Type of the sever administrator. "ActiveDirectory"
    :vartype administrator_type: str or ~azure.mgmt.sql.models.AdministratorType
    :ivar principal_type: Principal Type of the sever administrator. Known values are: "User",
     "Group", and "Application".
    :vartype principal_type: str or ~azure.mgmt.sql.models.PrincipalType
    :ivar login: Login name of the server administrator.
    :vartype login: str
    :ivar sid: SID (object ID) of the server administrator.
    :vartype sid: str
    :ivar tenant_id: Tenant ID of the administrator.
    :vartype tenant_id: str
    :ivar azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
    :vartype azure_ad_only_authentication: bool
    """

    _attribute_map = {
        "administrator_type": {"key": "administratorType", "type": "str"},
        "principal_type": {"key": "principalType", "type": "str"},
        "login": {"key": "login", "type": "str"},
        "sid": {"key": "sid", "type": "str"},
        "tenant_id": {"key": "tenantId", "type": "str"},
        "azure_ad_only_authentication": {"key": "azureADOnlyAuthentication", "type": "bool"},
    }

    def __init__(
        self,
        *,
        administrator_type: Optional[Union[str, "_models.AdministratorType"]] = None,
        principal_type: Optional[Union[str, "_models.PrincipalType"]] = None,
        login: Optional[str] = None,
        sid: Optional[str] = None,
        tenant_id: Optional[str] = None,
        azure_ad_only_authentication: Optional[bool] = None,
        **kwargs
    ):
        """
        :keyword administrator_type: Type of the sever administrator. "ActiveDirectory"
        :paramtype administrator_type: str or ~azure.mgmt.sql.models.AdministratorType
        :keyword principal_type: Principal Type of the sever administrator. Known values are: "User",
         "Group", and "Application".
        :paramtype principal_type: str or ~azure.mgmt.sql.models.PrincipalType
        :keyword login: Login name of the server administrator.
        :paramtype login: str
        :keyword sid: SID (object ID) of the server administrator.
        :paramtype sid: str
        :keyword tenant_id: Tenant ID of the administrator.
        :paramtype tenant_id: str
        :keyword azure_ad_only_authentication: Azure Active Directory only Authentication enabled.
        :paramtype azure_ad_only_authentication: bool
        """
        super().__init__(**kwargs)
        self.administrator_type = administrator_type
        self.principal_type = principal_type
        self.login = login
        self.sid = sid
        self.tenant_id = tenant_id
        self.azure_ad_only_authentication = azure_ad_only_authentication


class ServerInfo(_serialization.Model):
    """Server info for the server trust group.

    All required parameters must be populated in order to send to Azure.

    :ivar server_id: Server Id. Required.
    :vartype server_id: str
    """

    _validation = {
        "server_id": {"required": True},
    }

    _attribute_map = {
        "server_id": {"key": "serverId", "type": "str"},
    }

    def __init__(self, *, server_id: str, **kwargs):
        """
        :keyword server_id: Server Id. Required.
        :paramtype server_id: str
        """
        super().__init__(**kwargs)
        self.server_id = server_id


class ServerKey(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A server key.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar kind: Kind of encryption protector. This is metadata used for the Azure portal
     experience.
    :vartype kind: str
    :ivar location: Resource location.
    :vartype location: str
    :ivar subregion: Subregion of the server key.
    :vartype subregion: str
    :ivar server_key_type: The server key type like 'ServiceManaged', 'AzureKeyVault'. Known values
     are: "ServiceManaged" and "AzureKeyVault".
    :vartype server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType
    :ivar uri: The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is
     required.
    :vartype uri: str
    :ivar thumbprint: Thumbprint of the server key.
    :vartype thumbprint: str
    :ivar creation_date: The server key creation date.
    :vartype creation_date: ~datetime.datetime
    :ivar auto_rotation_enabled: Key auto rotation opt-in flag. Either true or false.
    :vartype auto_rotation_enabled: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "kind": {"readonly": True},
        "location": {"readonly": True},
        "subregion": {"readonly": True},
        "thumbprint": {"readonly": True},
        "creation_date": {"readonly": True},
        "auto_rotation_enabled": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "kind": {"key": "kind", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "subregion": {"key": "properties.subregion", "type": "str"},
        "server_key_type": {"key": "properties.serverKeyType", "type": "str"},
        "uri": {"key": "properties.uri", "type": "str"},
        "thumbprint": {"key": "properties.thumbprint", "type": "str"},
        "creation_date": {"key": "properties.creationDate", "type": "iso-8601"},
        "auto_rotation_enabled": {"key": "properties.autoRotationEnabled", "type": "bool"},
    }

    def __init__(
        self,
        *,
        server_key_type: Optional[Union[str, "_models.ServerKeyType"]] = None,
        uri: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword server_key_type: The server key type like 'ServiceManaged', 'AzureKeyVault'. Known
         values are: "ServiceManaged" and "AzureKeyVault".
        :paramtype server_key_type: str or ~azure.mgmt.sql.models.ServerKeyType
        :keyword uri: The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is
         required.
        :paramtype uri: str
        """
        super().__init__(**kwargs)
        self.kind = None
        self.location = None
        self.subregion = None
        self.server_key_type = server_key_type
        self.uri = uri
        self.thumbprint = None
        self.creation_date = None
        self.auto_rotation_enabled = None


class ServerKeyListResult(_serialization.Model):
    """A list of server keys.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerKey]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerKey]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ServerListResult(_serialization.Model):
    """A list of servers.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.Server]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[Server]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ServerOperation(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A server operation.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar operation: The name of operation.
    :vartype operation: str
    :ivar operation_friendly_name: The friendly name of operation.
    :vartype operation_friendly_name: str
    :ivar percent_complete: The percentage of the operation completed.
    :vartype percent_complete: int
    :ivar server_name: The name of the server.
    :vartype server_name: str
    :ivar start_time: The operation start time.
    :vartype start_time: ~datetime.datetime
    :ivar state: The operation state. Known values are: "Pending", "InProgress", "Succeeded",
     "Failed", "CancelInProgress", and "Cancelled".
    :vartype state: str or ~azure.mgmt.sql.models.ManagementOperationState
    :ivar error_code: The operation error code.
    :vartype error_code: int
    :ivar error_description: The operation error description.
    :vartype error_description: str
    :ivar error_severity: The operation error severity.
    :vartype error_severity: int
    :ivar is_user_error: Whether or not the error is a user error.
    :vartype is_user_error: bool
    :ivar estimated_completion_time: The estimated completion time of the operation.
    :vartype estimated_completion_time: ~datetime.datetime
    :ivar description: The operation description.
    :vartype description: str
    :ivar is_cancellable: Whether the operation can be cancelled.
    :vartype is_cancellable: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "operation": {"readonly": True},
        "operation_friendly_name": {"readonly": True},
        "percent_complete": {"readonly": True},
        "server_name": {"readonly": True},
        "start_time": {"readonly": True},
        "state": {"readonly": True},
        "error_code": {"readonly": True},
        "error_description": {"readonly": True},
        "error_severity": {"readonly": True},
        "is_user_error": {"readonly": True},
        "estimated_completion_time": {"readonly": True},
        "description": {"readonly": True},
        "is_cancellable": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "operation": {"key": "properties.operation", "type": "str"},
        "operation_friendly_name": {"key": "properties.operationFriendlyName", "type": "str"},
        "percent_complete": {"key": "properties.percentComplete", "type": "int"},
        "server_name": {"key": "properties.serverName", "type": "str"},
        "start_time": {"key": "properties.startTime", "type": "iso-8601"},
        "state": {"key": "properties.state", "type": "str"},
        "error_code": {"key": "properties.errorCode", "type": "int"},
        "error_description": {"key": "properties.errorDescription", "type": "str"},
        "error_severity": {"key": "properties.errorSeverity", "type": "int"},
        "is_user_error": {"key": "properties.isUserError", "type": "bool"},
        "estimated_completion_time": {"key": "properties.estimatedCompletionTime", "type": "iso-8601"},
        "description": {"key": "properties.description", "type": "str"},
        "is_cancellable": {"key": "properties.isCancellable", "type": "bool"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.operation = None
        self.operation_friendly_name = None
        self.percent_complete = None
        self.server_name = None
        self.start_time = None
        self.state = None
        self.error_code = None
        self.error_description = None
        self.error_severity = None
        self.is_user_error = None
        self.estimated_completion_time = None
        self.description = None
        self.is_cancellable = None


class ServerOperationListResult(_serialization.Model):
    """The response to a list server operations request.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerOperation]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerOperation]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ServerPrivateEndpointConnection(_serialization.Model):
    """A private endpoint connection under a server.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar properties: Private endpoint connection properties.
    :vartype properties: ~azure.mgmt.sql.models.PrivateEndpointConnectionProperties
    """

    _validation = {
        "id": {"readonly": True},
        "properties": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.id = None
        self.properties = None


class ServerSecurityAlertPolicy(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A server security alert policy.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of SecurityAlertPolicyResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar state: Specifies the state of the policy, whether it is enabled or disabled or a policy
     has not been applied yet on the specific database. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.SecurityAlertsPolicyState
    :ivar disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are:
     Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action,
     Brute_Force.
    :vartype disabled_alerts: list[str]
    :ivar email_addresses: Specifies an array of e-mail addresses to which the alert is sent.
    :vartype email_addresses: list[str]
    :ivar email_account_admins: Specifies that the alert is sent to the account administrators.
    :vartype email_account_admins: bool
    :ivar storage_endpoint: Specifies the blob storage endpoint (e.g.
     https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection
     audit logs.
    :vartype storage_endpoint: str
    :ivar storage_account_access_key: Specifies the identifier key of the Threat Detection audit
     storage account.
    :vartype storage_account_access_key: str
    :ivar retention_days: Specifies the number of days to keep in the Threat Detection audit logs.
    :vartype retention_days: int
    :ivar creation_time: Specifies the UTC creation time of the policy.
    :vartype creation_time: ~datetime.datetime
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
        "creation_time": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "state": {"key": "properties.state", "type": "str"},
        "disabled_alerts": {"key": "properties.disabledAlerts", "type": "[str]"},
        "email_addresses": {"key": "properties.emailAddresses", "type": "[str]"},
        "email_account_admins": {"key": "properties.emailAccountAdmins", "type": "bool"},
        "storage_endpoint": {"key": "properties.storageEndpoint", "type": "str"},
        "storage_account_access_key": {"key": "properties.storageAccountAccessKey", "type": "str"},
        "retention_days": {"key": "properties.retentionDays", "type": "int"},
        "creation_time": {"key": "properties.creationTime", "type": "iso-8601"},
    }

    def __init__(
        self,
        *,
        state: Optional[Union[str, "_models.SecurityAlertsPolicyState"]] = None,
        disabled_alerts: Optional[List[str]] = None,
        email_addresses: Optional[List[str]] = None,
        email_account_admins: Optional[bool] = None,
        storage_endpoint: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        retention_days: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword state: Specifies the state of the policy, whether it is enabled or disabled or a
         policy has not been applied yet on the specific database. Known values are: "Enabled" and
         "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.SecurityAlertsPolicyState
        :keyword disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are:
         Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action,
         Brute_Force.
        :paramtype disabled_alerts: list[str]
        :keyword email_addresses: Specifies an array of e-mail addresses to which the alert is sent.
        :paramtype email_addresses: list[str]
        :keyword email_account_admins: Specifies that the alert is sent to the account administrators.
        :paramtype email_account_admins: bool
        :keyword storage_endpoint: Specifies the blob storage endpoint (e.g.
         https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection
         audit logs.
        :paramtype storage_endpoint: str
        :keyword storage_account_access_key: Specifies the identifier key of the Threat Detection audit
         storage account.
        :paramtype storage_account_access_key: str
        :keyword retention_days: Specifies the number of days to keep in the Threat Detection audit
         logs.
        :paramtype retention_days: int
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.state = state
        self.disabled_alerts = disabled_alerts
        self.email_addresses = email_addresses
        self.email_account_admins = email_account_admins
        self.storage_endpoint = storage_endpoint
        self.storage_account_access_key = storage_account_access_key
        self.retention_days = retention_days
        self.creation_time = None


class ServerTrustCertificate(ProxyResource):
    """Server trust certificate imported from box to enable connection between box and Sql Managed Instance.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar public_blob: The certificate public blob.
    :vartype public_blob: str
    :ivar thumbprint: The certificate thumbprint.
    :vartype thumbprint: str
    :ivar certificate_name: The certificate name.
    :vartype certificate_name: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "thumbprint": {"readonly": True},
        "certificate_name": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "public_blob": {"key": "properties.publicBlob", "type": "str"},
        "thumbprint": {"key": "properties.thumbprint", "type": "str"},
        "certificate_name": {"key": "properties.certificateName", "type": "str"},
    }

    def __init__(self, *, public_blob: Optional[str] = None, **kwargs):
        """
        :keyword public_blob: The certificate public blob.
        :paramtype public_blob: str
        """
        super().__init__(**kwargs)
        self.public_blob = public_blob
        self.thumbprint = None
        self.certificate_name = None


class ServerTrustCertificatesListResult(_serialization.Model):
    """A list of server trust certificates in instance.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerTrustCertificate]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerTrustCertificate]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ServerTrustGroup(ProxyResource):
    """A server trust group.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar group_members: Group members information for the server trust group.
    :vartype group_members: list[~azure.mgmt.sql.models.ServerInfo]
    :ivar trust_scopes: Trust scope of the server trust group.
    :vartype trust_scopes: list[str or
     ~azure.mgmt.sql.models.ServerTrustGroupPropertiesTrustScopesItem]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "group_members": {"key": "properties.groupMembers", "type": "[ServerInfo]"},
        "trust_scopes": {"key": "properties.trustScopes", "type": "[str]"},
    }

    def __init__(
        self,
        *,
        group_members: Optional[List["_models.ServerInfo"]] = None,
        trust_scopes: Optional[List[Union[str, "_models.ServerTrustGroupPropertiesTrustScopesItem"]]] = None,
        **kwargs
    ):
        """
        :keyword group_members: Group members information for the server trust group.
        :paramtype group_members: list[~azure.mgmt.sql.models.ServerInfo]
        :keyword trust_scopes: Trust scope of the server trust group.
        :paramtype trust_scopes: list[str or
         ~azure.mgmt.sql.models.ServerTrustGroupPropertiesTrustScopesItem]
        """
        super().__init__(**kwargs)
        self.group_members = group_members
        self.trust_scopes = trust_scopes


class ServerTrustGroupListResult(_serialization.Model):
    """A list of server trust groups.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerTrustGroup]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerTrustGroup]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ServerUpdate(_serialization.Model):  # pylint: disable=too-many-instance-attributes
    """An update request for an Azure SQL Database server.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar identity: Server identity.
    :vartype identity: ~azure.mgmt.sql.models.ResourceIdentity
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar administrator_login: Administrator username for the server. Once created it cannot be
     changed.
    :vartype administrator_login: str
    :ivar administrator_login_password: The administrator login password (required for server
     creation).
    :vartype administrator_login_password: str
    :ivar version: The version of the server.
    :vartype version: str
    :ivar state: The state of the server.
    :vartype state: str
    :ivar fully_qualified_domain_name: The fully qualified domain name of the server.
    :vartype fully_qualified_domain_name: str
    :ivar private_endpoint_connections: List of private endpoint connections on a server.
    :vartype private_endpoint_connections:
     list[~azure.mgmt.sql.models.ServerPrivateEndpointConnection]
    :ivar minimal_tls_version: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'.
    :vartype minimal_tls_version: str
    :ivar public_network_access: Whether or not public endpoint access is allowed for this server.
     Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values are:
     "Enabled" and "Disabled".
    :vartype public_network_access: str or ~azure.mgmt.sql.models.ServerNetworkAccessFlag
    :ivar workspace_feature: Whether or not existing server has a workspace created and if it
     allows connection from workspace. Known values are: "Connected" and "Disconnected".
    :vartype workspace_feature: str or ~azure.mgmt.sql.models.ServerWorkspaceFeature
    :ivar primary_user_assigned_identity_id: The resource id of a user assigned identity to be used
     by default.
    :vartype primary_user_assigned_identity_id: str
    :ivar federated_client_id: The Client id used for cross tenant CMK scenario.
    :vartype federated_client_id: str
    :ivar key_id: A CMK URI of the key to use for encryption.
    :vartype key_id: str
    :ivar administrators: The Azure Active Directory identity of the server.
    :vartype administrators: ~azure.mgmt.sql.models.ServerExternalAdministrator
    :ivar restrict_outbound_network_access: Whether or not to restrict outbound network access for
     this server.  Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values
     are: "Enabled" and "Disabled".
    :vartype restrict_outbound_network_access: str or
     ~azure.mgmt.sql.models.ServerNetworkAccessFlag
    """

    _validation = {
        "state": {"readonly": True},
        "fully_qualified_domain_name": {"readonly": True},
        "private_endpoint_connections": {"readonly": True},
        "workspace_feature": {"readonly": True},
    }

    _attribute_map = {
        "identity": {"key": "identity", "type": "ResourceIdentity"},
        "tags": {"key": "tags", "type": "{str}"},
        "administrator_login": {"key": "properties.administratorLogin", "type": "str"},
        "administrator_login_password": {"key": "properties.administratorLoginPassword", "type": "str"},
        "version": {"key": "properties.version", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
        "fully_qualified_domain_name": {"key": "properties.fullyQualifiedDomainName", "type": "str"},
        "private_endpoint_connections": {
            "key": "properties.privateEndpointConnections",
            "type": "[ServerPrivateEndpointConnection]",
        },
        "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"},
        "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"},
        "workspace_feature": {"key": "properties.workspaceFeature", "type": "str"},
        "primary_user_assigned_identity_id": {"key": "properties.primaryUserAssignedIdentityId", "type": "str"},
        "federated_client_id": {"key": "properties.federatedClientId", "type": "str"},
        "key_id": {"key": "properties.keyId", "type": "str"},
        "administrators": {"key": "properties.administrators", "type": "ServerExternalAdministrator"},
        "restrict_outbound_network_access": {"key": "properties.restrictOutboundNetworkAccess", "type": "str"},
    }

    def __init__(
        self,
        *,
        identity: Optional["_models.ResourceIdentity"] = None,
        tags: Optional[Dict[str, str]] = None,
        administrator_login: Optional[str] = None,
        administrator_login_password: Optional[str] = None,
        version: Optional[str] = None,
        minimal_tls_version: Optional[str] = None,
        public_network_access: Optional[Union[str, "_models.ServerNetworkAccessFlag"]] = None,
        primary_user_assigned_identity_id: Optional[str] = None,
        federated_client_id: Optional[str] = None,
        key_id: Optional[str] = None,
        administrators: Optional["_models.ServerExternalAdministrator"] = None,
        restrict_outbound_network_access: Optional[Union[str, "_models.ServerNetworkAccessFlag"]] = None,
        **kwargs
    ):
        """
        :keyword identity: Server identity.
        :paramtype identity: ~azure.mgmt.sql.models.ResourceIdentity
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword administrator_login: Administrator username for the server. Once created it cannot be
         changed.
        :paramtype administrator_login: str
        :keyword administrator_login_password: The administrator login password (required for server
         creation).
        :paramtype administrator_login_password: str
        :keyword version: The version of the server.
        :paramtype version: str
        :keyword minimal_tls_version: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'.
        :paramtype minimal_tls_version: str
        :keyword public_network_access: Whether or not public endpoint access is allowed for this
         server.  Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values are:
         "Enabled" and "Disabled".
        :paramtype public_network_access: str or ~azure.mgmt.sql.models.ServerNetworkAccessFlag
        :keyword primary_user_assigned_identity_id: The resource id of a user assigned identity to be
         used by default.
        :paramtype primary_user_assigned_identity_id: str
        :keyword federated_client_id: The Client id used for cross tenant CMK scenario.
        :paramtype federated_client_id: str
        :keyword key_id: A CMK URI of the key to use for encryption.
        :paramtype key_id: str
        :keyword administrators: The Azure Active Directory identity of the server.
        :paramtype administrators: ~azure.mgmt.sql.models.ServerExternalAdministrator
        :keyword restrict_outbound_network_access: Whether or not to restrict outbound network access
         for this server.  Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known
         values are: "Enabled" and "Disabled".
        :paramtype restrict_outbound_network_access: str or
         ~azure.mgmt.sql.models.ServerNetworkAccessFlag
        """
        super().__init__(**kwargs)
        self.identity = identity
        self.tags = tags
        self.administrator_login = administrator_login
        self.administrator_login_password = administrator_login_password
        self.version = version
        self.state = None
        self.fully_qualified_domain_name = None
        self.private_endpoint_connections = None
        self.minimal_tls_version = minimal_tls_version
        self.public_network_access = public_network_access
        self.workspace_feature = None
        self.primary_user_assigned_identity_id = primary_user_assigned_identity_id
        self.federated_client_id = federated_client_id
        self.key_id = key_id
        self.administrators = administrators
        self.restrict_outbound_network_access = restrict_outbound_network_access


class ServerUsage(_serialization.Model):
    """Represents server metrics.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: Name of the server usage metric.
    :vartype name: str
    :ivar resource_name: The name of the resource.
    :vartype resource_name: str
    :ivar display_name: The metric display name.
    :vartype display_name: str
    :ivar current_value: The current value of the metric.
    :vartype current_value: float
    :ivar limit: The current limit of the metric.
    :vartype limit: float
    :ivar unit: The units of the metric.
    :vartype unit: str
    :ivar next_reset_time: The next reset time for the metric (ISO8601 format).
    :vartype next_reset_time: ~datetime.datetime
    """

    _validation = {
        "name": {"readonly": True},
        "resource_name": {"readonly": True},
        "display_name": {"readonly": True},
        "current_value": {"readonly": True},
        "limit": {"readonly": True},
        "unit": {"readonly": True},
        "next_reset_time": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "resource_name": {"key": "resourceName", "type": "str"},
        "display_name": {"key": "displayName", "type": "str"},
        "current_value": {"key": "currentValue", "type": "float"},
        "limit": {"key": "limit", "type": "float"},
        "unit": {"key": "unit", "type": "str"},
        "next_reset_time": {"key": "nextResetTime", "type": "iso-8601"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.name = None
        self.resource_name = None
        self.display_name = None
        self.current_value = None
        self.limit = None
        self.unit = None
        self.next_reset_time = None


class ServerUsageListResult(_serialization.Model):
    """Represents the response to a list server metrics request.

    All required parameters must be populated in order to send to Azure.

    :ivar value: The list of server metrics for the server. Required.
    :vartype value: list[~azure.mgmt.sql.models.ServerUsage]
    """

    _validation = {
        "value": {"required": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerUsage]"},
    }

    def __init__(self, *, value: List["_models.ServerUsage"], **kwargs):
        """
        :keyword value: The list of server metrics for the server. Required.
        :paramtype value: list[~azure.mgmt.sql.models.ServerUsage]
        """
        super().__init__(**kwargs)
        self.value = value


class ServerVersionCapability(_serialization.Model):
    """The server capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar name: The server version name.
    :vartype name: str
    :ivar supported_editions: The list of supported database editions.
    :vartype supported_editions: list[~azure.mgmt.sql.models.EditionCapability]
    :ivar supported_elastic_pool_editions: The list of supported elastic pool editions.
    :vartype supported_elastic_pool_editions:
     list[~azure.mgmt.sql.models.ElasticPoolEditionCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "name": {"readonly": True},
        "supported_editions": {"readonly": True},
        "supported_elastic_pool_editions": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "supported_editions": {"key": "supportedEditions", "type": "[EditionCapability]"},
        "supported_elastic_pool_editions": {
            "key": "supportedElasticPoolEditions",
            "type": "[ElasticPoolEditionCapability]",
        },
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.name = None
        self.supported_editions = None
        self.supported_elastic_pool_editions = None
        self.status = None
        self.reason = reason


class ServerVulnerabilityAssessment(ProxyResource):
    """A server vulnerability assessment.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar storage_container_path: A blob storage container path to hold the scan results (e.g.
     https://myStorage.blob.core.windows.net/VaScans/).
    :vartype storage_container_path: str
    :ivar storage_container_sas_key: A shared access signature (SAS Key) that has write access to
     the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey'
     isn't specified, StorageContainerSasKey is required. Applies only if the storage account is not
     behind a Vnet or a firewall.
    :vartype storage_container_sas_key: str
    :ivar storage_account_access_key: Specifies the identifier key of the storage account for
     vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified,
     storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet
     or a firewall.
    :vartype storage_account_access_key: str
    :ivar recurring_scans: The recurring scans settings.
    :vartype recurring_scans:
     ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "storage_container_path": {"key": "properties.storageContainerPath", "type": "str"},
        "storage_container_sas_key": {"key": "properties.storageContainerSasKey", "type": "str"},
        "storage_account_access_key": {"key": "properties.storageAccountAccessKey", "type": "str"},
        "recurring_scans": {
            "key": "properties.recurringScans",
            "type": "VulnerabilityAssessmentRecurringScansProperties",
        },
    }

    def __init__(
        self,
        *,
        storage_container_path: Optional[str] = None,
        storage_container_sas_key: Optional[str] = None,
        storage_account_access_key: Optional[str] = None,
        recurring_scans: Optional["_models.VulnerabilityAssessmentRecurringScansProperties"] = None,
        **kwargs
    ):
        """
        :keyword storage_container_path: A blob storage container path to hold the scan results (e.g.
         https://myStorage.blob.core.windows.net/VaScans/).
        :paramtype storage_container_path: str
        :keyword storage_container_sas_key: A shared access signature (SAS Key) that has write access
         to the blob container specified in 'storageContainerPath' parameter. If
         'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. Applies only if
         the storage account is not behind a Vnet or a firewall.
        :paramtype storage_container_sas_key: str
        :keyword storage_account_access_key: Specifies the identifier key of the storage account for
         vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified,
         storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet
         or a firewall.
        :paramtype storage_account_access_key: str
        :keyword recurring_scans: The recurring scans settings.
        :paramtype recurring_scans:
         ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties
        """
        super().__init__(**kwargs)
        self.storage_container_path = storage_container_path
        self.storage_container_sas_key = storage_container_sas_key
        self.storage_account_access_key = storage_account_access_key
        self.recurring_scans = recurring_scans


class ServerVulnerabilityAssessmentListResult(_serialization.Model):
    """A list of the server's vulnerability assessments.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.ServerVulnerabilityAssessment]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServerVulnerabilityAssessment]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class ServiceObjective(ProxyResource):
    """Represents a database service objective.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar service_objective_name: The name for the service objective.
    :vartype service_objective_name: str
    :ivar is_default: Gets whether the service level objective is the default service objective.
    :vartype is_default: bool
    :ivar is_system: Gets whether the service level objective is a system service objective.
    :vartype is_system: bool
    :ivar description: The description for the service level objective.
    :vartype description: str
    :ivar enabled: Gets whether the service level objective is enabled.
    :vartype enabled: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "service_objective_name": {"readonly": True},
        "is_default": {"readonly": True},
        "is_system": {"readonly": True},
        "description": {"readonly": True},
        "enabled": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "service_objective_name": {"key": "properties.serviceObjectiveName", "type": "str"},
        "is_default": {"key": "properties.isDefault", "type": "bool"},
        "is_system": {"key": "properties.isSystem", "type": "bool"},
        "description": {"key": "properties.description", "type": "str"},
        "enabled": {"key": "properties.enabled", "type": "bool"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.service_objective_name = None
        self.is_default = None
        self.is_system = None
        self.description = None
        self.enabled = None


class ServiceObjectiveCapability(_serialization.Model):  # pylint: disable=too-many-instance-attributes
    """The service objectives capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: The unique ID of the service objective.
    :vartype id: str
    :ivar name: The service objective name.
    :vartype name: str
    :ivar supported_max_sizes: The list of supported maximum database sizes.
    :vartype supported_max_sizes: list[~azure.mgmt.sql.models.MaxSizeRangeCapability]
    :ivar performance_level: The performance level.
    :vartype performance_level: ~azure.mgmt.sql.models.PerformanceLevelCapability
    :ivar sku: The sku.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar supported_license_types: List of supported license types.
    :vartype supported_license_types: list[~azure.mgmt.sql.models.LicenseTypeCapability]
    :ivar included_max_size: The included (free) max size.
    :vartype included_max_size: ~azure.mgmt.sql.models.MaxSizeCapability
    :ivar zone_redundant: Whether or not zone redundancy is supported for the service objective.
    :vartype zone_redundant: bool
    :ivar supported_auto_pause_delay: Supported time range for auto pause delay.
    :vartype supported_auto_pause_delay: ~azure.mgmt.sql.models.AutoPauseDelayTimeRange
    :ivar supported_min_capacities: List of supported min capacities.
    :vartype supported_min_capacities: list[~azure.mgmt.sql.models.MinCapacityCapability]
    :ivar compute_model: The compute model.
    :vartype compute_model: str
    :ivar supported_maintenance_configurations: List of supported maintenance configurations.
    :vartype supported_maintenance_configurations:
     list[~azure.mgmt.sql.models.MaintenanceConfigurationCapability]
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "supported_max_sizes": {"readonly": True},
        "performance_level": {"readonly": True},
        "sku": {"readonly": True},
        "supported_license_types": {"readonly": True},
        "included_max_size": {"readonly": True},
        "zone_redundant": {"readonly": True},
        "supported_auto_pause_delay": {"readonly": True},
        "supported_min_capacities": {"readonly": True},
        "compute_model": {"readonly": True},
        "supported_maintenance_configurations": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "supported_max_sizes": {"key": "supportedMaxSizes", "type": "[MaxSizeRangeCapability]"},
        "performance_level": {"key": "performanceLevel", "type": "PerformanceLevelCapability"},
        "sku": {"key": "sku", "type": "Sku"},
        "supported_license_types": {"key": "supportedLicenseTypes", "type": "[LicenseTypeCapability]"},
        "included_max_size": {"key": "includedMaxSize", "type": "MaxSizeCapability"},
        "zone_redundant": {"key": "zoneRedundant", "type": "bool"},
        "supported_auto_pause_delay": {"key": "supportedAutoPauseDelay", "type": "AutoPauseDelayTimeRange"},
        "supported_min_capacities": {"key": "supportedMinCapacities", "type": "[MinCapacityCapability]"},
        "compute_model": {"key": "computeModel", "type": "str"},
        "supported_maintenance_configurations": {
            "key": "supportedMaintenanceConfigurations",
            "type": "[MaintenanceConfigurationCapability]",
        },
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.id = None
        self.name = None
        self.supported_max_sizes = None
        self.performance_level = None
        self.sku = None
        self.supported_license_types = None
        self.included_max_size = None
        self.zone_redundant = None
        self.supported_auto_pause_delay = None
        self.supported_min_capacities = None
        self.compute_model = None
        self.supported_maintenance_configurations = None
        self.status = None
        self.reason = reason


class ServiceObjectiveListResult(_serialization.Model):
    """Represents the response to a get database service objectives request.

    All required parameters must be populated in order to send to Azure.

    :ivar value: The list of database service objectives. Required.
    :vartype value: list[~azure.mgmt.sql.models.ServiceObjective]
    """

    _validation = {
        "value": {"required": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[ServiceObjective]"},
    }

    def __init__(self, *, value: List["_models.ServiceObjective"], **kwargs):
        """
        :keyword value: The list of database service objectives. Required.
        :paramtype value: list[~azure.mgmt.sql.models.ServiceObjective]
        """
        super().__init__(**kwargs)
        self.value = value


class ServicePrincipal(_serialization.Model):
    """The managed instance's service principal configuration for a resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar principal_id: The Azure Active Directory application object id.
    :vartype principal_id: str
    :ivar client_id: The Azure Active Directory application client id.
    :vartype client_id: str
    :ivar tenant_id: The Azure Active Directory tenant id.
    :vartype tenant_id: str
    :ivar type: Service principal type. Known values are: "None" and "SystemAssigned".
    :vartype type: str or ~azure.mgmt.sql.models.ServicePrincipalType
    """

    _validation = {
        "principal_id": {"readonly": True},
        "client_id": {"readonly": True},
        "tenant_id": {"readonly": True},
    }

    _attribute_map = {
        "principal_id": {"key": "principalId", "type": "str"},
        "client_id": {"key": "clientId", "type": "str"},
        "tenant_id": {"key": "tenantId", "type": "str"},
        "type": {"key": "type", "type": "str"},
    }

    def __init__(self, *, type: Optional[Union[str, "_models.ServicePrincipalType"]] = None, **kwargs):
        """
        :keyword type: Service principal type. Known values are: "None" and "SystemAssigned".
        :paramtype type: str or ~azure.mgmt.sql.models.ServicePrincipalType
        """
        super().__init__(**kwargs)
        self.principal_id = None
        self.client_id = None
        self.tenant_id = None
        self.type = type


class Sku(_serialization.Model):
    """An ARM Resource SKU.

    All required parameters must be populated in order to send to Azure.

    :ivar name: The name of the SKU, typically, a letter + Number code, e.g. P3. Required.
    :vartype name: str
    :ivar tier: The tier or edition of the particular SKU, e.g. Basic, Premium.
    :vartype tier: str
    :ivar size: Size of the particular SKU.
    :vartype size: str
    :ivar family: If the service has different generations of hardware, for the same SKU, then that
     can be captured here.
    :vartype family: str
    :ivar capacity: Capacity of the particular SKU.
    :vartype capacity: int
    """

    _validation = {
        "name": {"required": True},
    }

    _attribute_map = {
        "name": {"key": "name", "type": "str"},
        "tier": {"key": "tier", "type": "str"},
        "size": {"key": "size", "type": "str"},
        "family": {"key": "family", "type": "str"},
        "capacity": {"key": "capacity", "type": "int"},
    }

    def __init__(
        self,
        *,
        name: str,
        tier: Optional[str] = None,
        size: Optional[str] = None,
        family: Optional[str] = None,
        capacity: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword name: The name of the SKU, typically, a letter + Number code, e.g. P3. Required.
        :paramtype name: str
        :keyword tier: The tier or edition of the particular SKU, e.g. Basic, Premium.
        :paramtype tier: str
        :keyword size: Size of the particular SKU.
        :paramtype size: str
        :keyword family: If the service has different generations of hardware, for the same SKU, then
         that can be captured here.
        :paramtype family: str
        :keyword capacity: Capacity of the particular SKU.
        :paramtype capacity: int
        """
        super().__init__(**kwargs)
        self.name = name
        self.tier = tier
        self.size = size
        self.family = family
        self.capacity = capacity


class SloUsageMetric(_serialization.Model):
    """A Slo Usage Metric.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar service_level_objective: The serviceLevelObjective for SLO usage metric. Known values
     are: "System", "System0", "System1", "System2", "System3", "System4", "System2L", "System3L",
     "System4L", "Free", "Basic", "S0", "S1", "S2", "S3", "S4", "S6", "S7", "S9", "S12", "P1", "P2",
     "P3", "P4", "P6", "P11", "P15", "PRS1", "PRS2", "PRS4", "PRS6", "DW100", "DW200", "DW300",
     "DW400", "DW500", "DW600", "DW1000", "DW1200", "DW1000c", "DW1500", "DW1500c", "DW2000",
     "DW2000c", "DW3000", "DW2500c", "DW3000c", "DW6000", "DW5000c", "DW6000c", "DW7500c",
     "DW10000c", "DW15000c", "DW30000c", "DS100", "DS200", "DS300", "DS400", "DS500", "DS600",
     "DS1000", "DS1200", "DS1500", "DS2000", and "ElasticPool".
    :vartype service_level_objective: str or ~azure.mgmt.sql.models.ServiceObjectiveName
    :ivar service_level_objective_id: The serviceLevelObjectiveId for SLO usage metric.
    :vartype service_level_objective_id: str
    :ivar in_range_time_ratio: Gets or sets inRangeTimeRatio for SLO usage metric.
    :vartype in_range_time_ratio: float
    """

    _validation = {
        "service_level_objective": {"readonly": True},
        "service_level_objective_id": {"readonly": True},
        "in_range_time_ratio": {"readonly": True},
    }

    _attribute_map = {
        "service_level_objective": {"key": "serviceLevelObjective", "type": "str"},
        "service_level_objective_id": {"key": "serviceLevelObjectiveId", "type": "str"},
        "in_range_time_ratio": {"key": "inRangeTimeRatio", "type": "float"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.service_level_objective = None
        self.service_level_objective_id = None
        self.in_range_time_ratio = None


class SqlAgentConfiguration(ProxyResource):
    """A recoverable managed database resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar state: The state of Sql Agent. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.SqlAgentConfigurationPropertiesState
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
    }

    def __init__(self, *, state: Optional[Union[str, "_models.SqlAgentConfigurationPropertiesState"]] = None, **kwargs):
        """
        :keyword state: The state of Sql Agent. Known values are: "Enabled" and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.SqlAgentConfigurationPropertiesState
        """
        super().__init__(**kwargs)
        self.state = state


class SqlVulnerabilityAssessment(ProxyResource):
    """A SQL Vulnerability Assessment.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of SqlVulnerabilityAssessmentResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar state: Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or
     disabled or a state has not been applied yet on the specific database or server. Known values
     are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.sql.models.SqlVulnerabilityAssessmentState
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "state": {"key": "properties.state", "type": "str"},
    }

    def __init__(self, *, state: Optional[Union[str, "_models.SqlVulnerabilityAssessmentState"]] = None, **kwargs):
        """
        :keyword state: Specifies the state of the SQL Vulnerability Assessment, whether it is enabled
         or disabled or a state has not been applied yet on the specific database or server. Known
         values are: "Enabled" and "Disabled".
        :paramtype state: str or ~azure.mgmt.sql.models.SqlVulnerabilityAssessmentState
        """
        super().__init__(**kwargs)
        self.system_data = None
        self.state = state


class SqlVulnerabilityAssessmentListResult(_serialization.Model):
    """A list of SQL Vulnerability Assessments.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SqlVulnerabilityAssessment]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SqlVulnerabilityAssessment]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SqlVulnerabilityAssessmentScanError(_serialization.Model):
    """Properties of a vulnerability assessment scan error.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar code: The error code.
    :vartype code: str
    :ivar message: The error message.
    :vartype message: str
    """

    _validation = {
        "code": {"readonly": True},
        "message": {"readonly": True},
    }

    _attribute_map = {
        "code": {"key": "code", "type": "str"},
        "message": {"key": "message", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.code = None
        self.message = None


class SQLVulnerabilityAssessmentScanListResult(_serialization.Model):
    """A list of vulnerability assessment scan results.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SqlVulnerabilityAssessmentScanResults]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SqlVulnerabilityAssessmentScanResults]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SqlVulnerabilityAssessmentScanRecord(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A vulnerability assessment scan record.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of SqlVulnerabilityAssessmentScanRecordResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar scan_id: The scan ID.
    :vartype scan_id: str
    :ivar trigger_type: The scan trigger type. Known values are: "OnDemand" and "Recurring".
    :vartype trigger_type: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentScanTriggerType
    :ivar state: The scan status. Known values are: "Passed", "Failed", "FailedToRun", and
     "InProgress".
    :vartype state: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentScanState
    :ivar start_time: The scan start time (UTC).
    :vartype start_time: ~datetime.datetime
    :ivar end_time: The scan end time (UTC).
    :vartype end_time: ~datetime.datetime
    :ivar errors: The scan errors.
    :vartype errors: list[~azure.mgmt.sql.models.SqlVulnerabilityAssessmentScanError]
    :ivar server: The server name.
    :vartype server: str
    :ivar database: The database name.
    :vartype database: str
    :ivar sql_version: The SQL version.
    :vartype sql_version: str
    :ivar high_severity_failed_rules_count: The number of failed rules with high severity.
    :vartype high_severity_failed_rules_count: int
    :ivar medium_severity_failed_rules_count: The number of failed rules with medium severity.
    :vartype medium_severity_failed_rules_count: int
    :ivar low_severity_failed_rules_count: The number of failed rules with low severity.
    :vartype low_severity_failed_rules_count: int
    :ivar total_passed_rules_count: The number of total passed rules.
    :vartype total_passed_rules_count: int
    :ivar total_failed_rules_count: The number of total failed rules.
    :vartype total_failed_rules_count: int
    :ivar total_rules_count: The number of total rules assessed.
    :vartype total_rules_count: int
    :ivar is_baseline_applied: Baseline created for this database, and has one or more rules.
    :vartype is_baseline_applied: bool
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
        "scan_id": {"readonly": True},
        "trigger_type": {"readonly": True},
        "state": {"readonly": True},
        "start_time": {"readonly": True},
        "end_time": {"readonly": True},
        "errors": {"readonly": True},
        "server": {"readonly": True},
        "database": {"readonly": True},
        "sql_version": {"readonly": True},
        "high_severity_failed_rules_count": {"readonly": True},
        "medium_severity_failed_rules_count": {"readonly": True},
        "low_severity_failed_rules_count": {"readonly": True},
        "total_passed_rules_count": {"readonly": True},
        "total_failed_rules_count": {"readonly": True},
        "total_rules_count": {"readonly": True},
        "is_baseline_applied": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "scan_id": {"key": "properties.scanId", "type": "str"},
        "trigger_type": {"key": "properties.triggerType", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
        "start_time": {"key": "properties.startTime", "type": "iso-8601"},
        "end_time": {"key": "properties.endTime", "type": "iso-8601"},
        "errors": {"key": "properties.errors", "type": "[SqlVulnerabilityAssessmentScanError]"},
        "server": {"key": "properties.server", "type": "str"},
        "database": {"key": "properties.database", "type": "str"},
        "sql_version": {"key": "properties.sqlVersion", "type": "str"},
        "high_severity_failed_rules_count": {"key": "properties.highSeverityFailedRulesCount", "type": "int"},
        "medium_severity_failed_rules_count": {"key": "properties.mediumSeverityFailedRulesCount", "type": "int"},
        "low_severity_failed_rules_count": {"key": "properties.lowSeverityFailedRulesCount", "type": "int"},
        "total_passed_rules_count": {"key": "properties.totalPassedRulesCount", "type": "int"},
        "total_failed_rules_count": {"key": "properties.totalFailedRulesCount", "type": "int"},
        "total_rules_count": {"key": "properties.totalRulesCount", "type": "int"},
        "is_baseline_applied": {"key": "properties.isBaselineApplied", "type": "bool"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.system_data = None
        self.scan_id = None
        self.trigger_type = None
        self.state = None
        self.start_time = None
        self.end_time = None
        self.errors = None
        self.server = None
        self.database = None
        self.sql_version = None
        self.high_severity_failed_rules_count = None
        self.medium_severity_failed_rules_count = None
        self.low_severity_failed_rules_count = None
        self.total_passed_rules_count = None
        self.total_failed_rules_count = None
        self.total_rules_count = None
        self.is_baseline_applied = None


class SqlVulnerabilityAssessmentScanRecordListResult(_serialization.Model):
    """A list of vulnerability assessment scan records.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SqlVulnerabilityAssessmentScanRecord]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SqlVulnerabilityAssessmentScanRecord]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SqlVulnerabilityAssessmentScanResults(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """SqlVulnerabilityAssessmentScanResults.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar system_data: SystemData of AdvancedThreatProtectionResource.
    :vartype system_data: ~azure.mgmt.sql.models.SystemData
    :ivar rule_id: SQL Vulnerability Assessment rule Id.
    :vartype rule_id: str
    :ivar status: SQL Vulnerability Assessment rule result status. Known values are: "NonFinding",
     "Finding", and "InternalError".
    :vartype status: str or ~azure.mgmt.sql.models.RuleStatus
    :ivar error_message: SQL Vulnerability Assessment error message.
    :vartype error_message: str
    :ivar is_trimmed: SQL Vulnerability Assessment is the query results trimmed.
    :vartype is_trimmed: bool
    :ivar query_results: SQL Vulnerability Assessment query results that was run.
    :vartype query_results: list[list[str]]
    :ivar remediation: SQL Vulnerability Assessment the remediation details.
    :vartype remediation: ~azure.mgmt.sql.models.Remediation
    :ivar baseline_adjusted_result: SQL Vulnerability Assessment rule result adjusted with
     baseline.
    :vartype baseline_adjusted_result: ~azure.mgmt.sql.models.BaselineAdjustedResult
    :ivar rule_metadata: SQL Vulnerability Assessment rule metadata.
    :vartype rule_metadata: ~azure.mgmt.sql.models.VaRule
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "system_data": {"readonly": True},
        "rule_id": {"readonly": True},
        "status": {"readonly": True},
        "error_message": {"readonly": True},
        "is_trimmed": {"readonly": True},
        "query_results": {"readonly": True},
        "remediation": {"readonly": True},
        "baseline_adjusted_result": {"readonly": True},
        "rule_metadata": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "system_data": {"key": "systemData", "type": "SystemData"},
        "rule_id": {"key": "properties.ruleId", "type": "str"},
        "status": {"key": "properties.status", "type": "str"},
        "error_message": {"key": "properties.errorMessage", "type": "str"},
        "is_trimmed": {"key": "properties.isTrimmed", "type": "bool"},
        "query_results": {"key": "properties.queryResults", "type": "[[str]]"},
        "remediation": {"key": "properties.remediation", "type": "Remediation"},
        "baseline_adjusted_result": {"key": "properties.baselineAdjustedResult", "type": "BaselineAdjustedResult"},
        "rule_metadata": {"key": "properties.ruleMetadata", "type": "VaRule"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.system_data = None
        self.rule_id = None
        self.status = None
        self.error_message = None
        self.is_trimmed = None
        self.query_results = None
        self.remediation = None
        self.baseline_adjusted_result = None
        self.rule_metadata = None


class StorageCapability(_serialization.Model):
    """The storage account type capability.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar storage_account_type: The storage account type for the database's backups. Known values
     are: "GRS", "LRS", and "ZRS".
    :vartype storage_account_type: str or
     ~azure.mgmt.sql.models.StorageCapabilityStorageAccountType
    :ivar status: The status of the capability. Known values are: "Visible", "Available",
     "Default", and "Disabled".
    :vartype status: str or ~azure.mgmt.sql.models.CapabilityStatus
    :ivar reason: The reason for the capability not being available.
    :vartype reason: str
    """

    _validation = {
        "storage_account_type": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "storage_account_type": {"key": "storageAccountType", "type": "str"},
        "status": {"key": "status", "type": "str"},
        "reason": {"key": "reason", "type": "str"},
    }

    def __init__(self, *, reason: Optional[str] = None, **kwargs):
        """
        :keyword reason: The reason for the capability not being available.
        :paramtype reason: str
        """
        super().__init__(**kwargs)
        self.storage_account_type = None
        self.status = None
        self.reason = reason


class SubscriptionUsage(ProxyResource):
    """Usage Metric of a Subscription in a Location.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar display_name: User-readable name of the metric.
    :vartype display_name: str
    :ivar current_value: Current value of the metric.
    :vartype current_value: float
    :ivar limit: Boundary value of the metric.
    :vartype limit: float
    :ivar unit: Unit of the metric.
    :vartype unit: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "display_name": {"readonly": True},
        "current_value": {"readonly": True},
        "limit": {"readonly": True},
        "unit": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "display_name": {"key": "properties.displayName", "type": "str"},
        "current_value": {"key": "properties.currentValue", "type": "float"},
        "limit": {"key": "properties.limit", "type": "float"},
        "unit": {"key": "properties.unit", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.display_name = None
        self.current_value = None
        self.limit = None
        self.unit = None


class SubscriptionUsageListResult(_serialization.Model):
    """A list of subscription usage metrics in a location.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SubscriptionUsage]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SubscriptionUsage]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SynapseLinkWorkspace(ProxyResource):
    """Synapse link workspace resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar workspaces: List of all synapselink workspaces.
    :vartype workspaces: list[~azure.mgmt.sql.models.SynapseLinkWorkspaceInfoProperties]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "workspaces": {"key": "properties.workspaces", "type": "[SynapseLinkWorkspaceInfoProperties]"},
    }

    def __init__(self, *, workspaces: Optional[List["_models.SynapseLinkWorkspaceInfoProperties"]] = None, **kwargs):
        """
        :keyword workspaces: List of all synapselink workspaces.
        :paramtype workspaces: list[~azure.mgmt.sql.models.SynapseLinkWorkspaceInfoProperties]
        """
        super().__init__(**kwargs)
        self.workspaces = workspaces


class SynapseLinkWorkspaceInfoProperties(_serialization.Model):
    """Properties of a Synapse link workspaces.

    :ivar workspace_id: Synapse link workspace id.
    :vartype workspace_id: str
    :ivar link_connection_name: Link connection name.
    :vartype link_connection_name: str
    """

    _attribute_map = {
        "workspace_id": {"key": "workspaceId", "type": "str"},
        "link_connection_name": {"key": "linkConnectionName", "type": "str"},
    }

    def __init__(self, *, workspace_id: Optional[str] = None, link_connection_name: Optional[str] = None, **kwargs):
        """
        :keyword workspace_id: Synapse link workspace id.
        :paramtype workspace_id: str
        :keyword link_connection_name: Link connection name.
        :paramtype link_connection_name: str
        """
        super().__init__(**kwargs)
        self.workspace_id = workspace_id
        self.link_connection_name = link_connection_name


class SynapseLinkWorkspaceListResult(_serialization.Model):
    """A list of synapselink workspaces.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SynapseLinkWorkspace]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SynapseLinkWorkspace]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SyncAgent(ProxyResource):
    """An Azure SQL Database sync agent.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar name_properties_name: Name of the sync agent.
    :vartype name_properties_name: str
    :ivar sync_database_id: ARM resource id of the sync database in the sync agent.
    :vartype sync_database_id: str
    :ivar last_alive_time: Last alive time of the sync agent.
    :vartype last_alive_time: ~datetime.datetime
    :ivar state: State of the sync agent. Known values are: "Online", "Offline", and
     "NeverConnected".
    :vartype state: str or ~azure.mgmt.sql.models.SyncAgentState
    :ivar is_up_to_date: If the sync agent version is up to date.
    :vartype is_up_to_date: bool
    :ivar expiry_time: Expiration time of the sync agent version.
    :vartype expiry_time: ~datetime.datetime
    :ivar version: Version of the sync agent.
    :vartype version: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "name_properties_name": {"readonly": True},
        "last_alive_time": {"readonly": True},
        "state": {"readonly": True},
        "is_up_to_date": {"readonly": True},
        "expiry_time": {"readonly": True},
        "version": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "name_properties_name": {"key": "properties.name", "type": "str"},
        "sync_database_id": {"key": "properties.syncDatabaseId", "type": "str"},
        "last_alive_time": {"key": "properties.lastAliveTime", "type": "iso-8601"},
        "state": {"key": "properties.state", "type": "str"},
        "is_up_to_date": {"key": "properties.isUpToDate", "type": "bool"},
        "expiry_time": {"key": "properties.expiryTime", "type": "iso-8601"},
        "version": {"key": "properties.version", "type": "str"},
    }

    def __init__(self, *, sync_database_id: Optional[str] = None, **kwargs):
        """
        :keyword sync_database_id: ARM resource id of the sync database in the sync agent.
        :paramtype sync_database_id: str
        """
        super().__init__(**kwargs)
        self.name_properties_name = None
        self.sync_database_id = sync_database_id
        self.last_alive_time = None
        self.state = None
        self.is_up_to_date = None
        self.expiry_time = None
        self.version = None


class SyncAgentKeyProperties(_serialization.Model):
    """Properties of an Azure SQL Database sync agent key.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar sync_agent_key: Key of sync agent.
    :vartype sync_agent_key: str
    """

    _validation = {
        "sync_agent_key": {"readonly": True},
    }

    _attribute_map = {
        "sync_agent_key": {"key": "syncAgentKey", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.sync_agent_key = None


class SyncAgentLinkedDatabase(ProxyResource):
    """An Azure SQL Database sync agent linked database.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar database_type: Type of the sync agent linked database. Known values are:
     "AzureSqlDatabase" and "SqlServerDatabase".
    :vartype database_type: str or ~azure.mgmt.sql.models.SyncMemberDbType
    :ivar database_id: Id of the sync agent linked database.
    :vartype database_id: str
    :ivar description: Description of the sync agent linked database.
    :vartype description: str
    :ivar server_name: Server name of the sync agent linked database.
    :vartype server_name: str
    :ivar database_name: Database name of the sync agent linked database.
    :vartype database_name: str
    :ivar user_name: User name of the sync agent linked database.
    :vartype user_name: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "database_type": {"readonly": True},
        "database_id": {"readonly": True},
        "description": {"readonly": True},
        "server_name": {"readonly": True},
        "database_name": {"readonly": True},
        "user_name": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "database_type": {"key": "properties.databaseType", "type": "str"},
        "database_id": {"key": "properties.databaseId", "type": "str"},
        "description": {"key": "properties.description", "type": "str"},
        "server_name": {"key": "properties.serverName", "type": "str"},
        "database_name": {"key": "properties.databaseName", "type": "str"},
        "user_name": {"key": "properties.userName", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.database_type = None
        self.database_id = None
        self.description = None
        self.server_name = None
        self.database_name = None
        self.user_name = None


class SyncAgentLinkedDatabaseListResult(_serialization.Model):
    """A list of sync agent linked databases.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SyncAgentLinkedDatabase]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SyncAgentLinkedDatabase]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SyncAgentListResult(_serialization.Model):
    """A list of sync agents.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SyncAgent]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SyncAgent]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SyncDatabaseIdListResult(_serialization.Model):
    """A list of sync database ID properties.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SyncDatabaseIdProperties]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SyncDatabaseIdProperties]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SyncDatabaseIdProperties(_serialization.Model):
    """Properties of the sync database id.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: ARM resource id of sync database.
    :vartype id: str
    """

    _validation = {
        "id": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.id = None


class SyncFullSchemaProperties(_serialization.Model):
    """Properties of the database full schema.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar tables: List of tables in the database full schema.
    :vartype tables: list[~azure.mgmt.sql.models.SyncFullSchemaTable]
    :ivar last_update_time: Last update time of the database schema.
    :vartype last_update_time: ~datetime.datetime
    """

    _validation = {
        "tables": {"readonly": True},
        "last_update_time": {"readonly": True},
    }

    _attribute_map = {
        "tables": {"key": "tables", "type": "[SyncFullSchemaTable]"},
        "last_update_time": {"key": "lastUpdateTime", "type": "iso-8601"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.tables = None
        self.last_update_time = None


class SyncFullSchemaPropertiesListResult(_serialization.Model):
    """A list of sync schema properties.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SyncFullSchemaProperties]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SyncFullSchemaProperties]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SyncFullSchemaTable(_serialization.Model):
    """Properties of the table in the database full schema.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar columns: List of columns in the table of database full schema.
    :vartype columns: list[~azure.mgmt.sql.models.SyncFullSchemaTableColumn]
    :ivar error_id: Error id of the table.
    :vartype error_id: str
    :ivar has_error: If there is error in the table.
    :vartype has_error: bool
    :ivar name: Name of the table.
    :vartype name: str
    :ivar quoted_name: Quoted name of the table.
    :vartype quoted_name: str
    """

    _validation = {
        "columns": {"readonly": True},
        "error_id": {"readonly": True},
        "has_error": {"readonly": True},
        "name": {"readonly": True},
        "quoted_name": {"readonly": True},
    }

    _attribute_map = {
        "columns": {"key": "columns", "type": "[SyncFullSchemaTableColumn]"},
        "error_id": {"key": "errorId", "type": "str"},
        "has_error": {"key": "hasError", "type": "bool"},
        "name": {"key": "name", "type": "str"},
        "quoted_name": {"key": "quotedName", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.columns = None
        self.error_id = None
        self.has_error = None
        self.name = None
        self.quoted_name = None


class SyncFullSchemaTableColumn(_serialization.Model):
    """Properties of the column in the table of database full schema.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar data_size: Data size of the column.
    :vartype data_size: str
    :ivar data_type: Data type of the column.
    :vartype data_type: str
    :ivar error_id: Error id of the column.
    :vartype error_id: str
    :ivar has_error: If there is error in the table.
    :vartype has_error: bool
    :ivar is_primary_key: If it is the primary key of the table.
    :vartype is_primary_key: bool
    :ivar name: Name of the column.
    :vartype name: str
    :ivar quoted_name: Quoted name of the column.
    :vartype quoted_name: str
    """

    _validation = {
        "data_size": {"readonly": True},
        "data_type": {"readonly": True},
        "error_id": {"readonly": True},
        "has_error": {"readonly": True},
        "is_primary_key": {"readonly": True},
        "name": {"readonly": True},
        "quoted_name": {"readonly": True},
    }

    _attribute_map = {
        "data_size": {"key": "dataSize", "type": "str"},
        "data_type": {"key": "dataType", "type": "str"},
        "error_id": {"key": "errorId", "type": "str"},
        "has_error": {"key": "hasError", "type": "bool"},
        "is_primary_key": {"key": "isPrimaryKey", "type": "bool"},
        "name": {"key": "name", "type": "str"},
        "quoted_name": {"key": "quotedName", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.data_size = None
        self.data_type = None
        self.error_id = None
        self.has_error = None
        self.is_primary_key = None
        self.name = None
        self.quoted_name = None


class SyncGroup(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """An Azure SQL Database sync group.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar sku: The name and capacity of the SKU.
    :vartype sku: ~azure.mgmt.sql.models.Sku
    :ivar interval: Sync interval of the sync group.
    :vartype interval: int
    :ivar last_sync_time: Last sync time of the sync group.
    :vartype last_sync_time: ~datetime.datetime
    :ivar conflict_resolution_policy: Conflict resolution policy of the sync group. Known values
     are: "HubWin" and "MemberWin".
    :vartype conflict_resolution_policy: str or ~azure.mgmt.sql.models.SyncConflictResolutionPolicy
    :ivar sync_database_id: ARM resource id of the sync database in the sync group.
    :vartype sync_database_id: str
    :ivar hub_database_user_name: User name for the sync group hub database credential.
    :vartype hub_database_user_name: str
    :ivar hub_database_password: Password for the sync group hub database credential.
    :vartype hub_database_password: str
    :ivar sync_state: Sync state of the sync group. Known values are: "NotReady", "Error",
     "Warning", "Progressing", and "Good".
    :vartype sync_state: str or ~azure.mgmt.sql.models.SyncGroupState
    :ivar schema: Sync schema of the sync group.
    :vartype schema: ~azure.mgmt.sql.models.SyncGroupSchema
    :ivar enable_conflict_logging: If conflict logging is enabled.
    :vartype enable_conflict_logging: bool
    :ivar conflict_logging_retention_in_days: Conflict logging retention period.
    :vartype conflict_logging_retention_in_days: int
    :ivar use_private_link_connection: If use private link connection is enabled.
    :vartype use_private_link_connection: bool
    :ivar private_endpoint_name: Private endpoint name of the sync group if use private link
     connection is enabled.
    :vartype private_endpoint_name: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "last_sync_time": {"readonly": True},
        "sync_state": {"readonly": True},
        "private_endpoint_name": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "sku": {"key": "sku", "type": "Sku"},
        "interval": {"key": "properties.interval", "type": "int"},
        "last_sync_time": {"key": "properties.lastSyncTime", "type": "iso-8601"},
        "conflict_resolution_policy": {"key": "properties.conflictResolutionPolicy", "type": "str"},
        "sync_database_id": {"key": "properties.syncDatabaseId", "type": "str"},
        "hub_database_user_name": {"key": "properties.hubDatabaseUserName", "type": "str"},
        "hub_database_password": {"key": "properties.hubDatabasePassword", "type": "str"},
        "sync_state": {"key": "properties.syncState", "type": "str"},
        "schema": {"key": "properties.schema", "type": "SyncGroupSchema"},
        "enable_conflict_logging": {"key": "properties.enableConflictLogging", "type": "bool"},
        "conflict_logging_retention_in_days": {"key": "properties.conflictLoggingRetentionInDays", "type": "int"},
        "use_private_link_connection": {"key": "properties.usePrivateLinkConnection", "type": "bool"},
        "private_endpoint_name": {"key": "properties.privateEndpointName", "type": "str"},
    }

    def __init__(
        self,
        *,
        sku: Optional["_models.Sku"] = None,
        interval: Optional[int] = None,
        conflict_resolution_policy: Optional[Union[str, "_models.SyncConflictResolutionPolicy"]] = None,
        sync_database_id: Optional[str] = None,
        hub_database_user_name: Optional[str] = None,
        hub_database_password: Optional[str] = None,
        schema: Optional["_models.SyncGroupSchema"] = None,
        enable_conflict_logging: Optional[bool] = None,
        conflict_logging_retention_in_days: Optional[int] = None,
        use_private_link_connection: Optional[bool] = None,
        **kwargs
    ):
        """
        :keyword sku: The name and capacity of the SKU.
        :paramtype sku: ~azure.mgmt.sql.models.Sku
        :keyword interval: Sync interval of the sync group.
        :paramtype interval: int
        :keyword conflict_resolution_policy: Conflict resolution policy of the sync group. Known values
         are: "HubWin" and "MemberWin".
        :paramtype conflict_resolution_policy: str or
         ~azure.mgmt.sql.models.SyncConflictResolutionPolicy
        :keyword sync_database_id: ARM resource id of the sync database in the sync group.
        :paramtype sync_database_id: str
        :keyword hub_database_user_name: User name for the sync group hub database credential.
        :paramtype hub_database_user_name: str
        :keyword hub_database_password: Password for the sync group hub database credential.
        :paramtype hub_database_password: str
        :keyword schema: Sync schema of the sync group.
        :paramtype schema: ~azure.mgmt.sql.models.SyncGroupSchema
        :keyword enable_conflict_logging: If conflict logging is enabled.
        :paramtype enable_conflict_logging: bool
        :keyword conflict_logging_retention_in_days: Conflict logging retention period.
        :paramtype conflict_logging_retention_in_days: int
        :keyword use_private_link_connection: If use private link connection is enabled.
        :paramtype use_private_link_connection: bool
        """
        super().__init__(**kwargs)
        self.sku = sku
        self.interval = interval
        self.last_sync_time = None
        self.conflict_resolution_policy = conflict_resolution_policy
        self.sync_database_id = sync_database_id
        self.hub_database_user_name = hub_database_user_name
        self.hub_database_password = hub_database_password
        self.sync_state = None
        self.schema = schema
        self.enable_conflict_logging = enable_conflict_logging
        self.conflict_logging_retention_in_days = conflict_logging_retention_in_days
        self.use_private_link_connection = use_private_link_connection
        self.private_endpoint_name = None


class SyncGroupListResult(_serialization.Model):
    """A list of sync groups.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SyncGroup]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SyncGroup]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SyncGroupLogListResult(_serialization.Model):
    """A list of sync group log properties.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SyncGroupLogProperties]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SyncGroupLogProperties]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SyncGroupLogProperties(_serialization.Model):
    """Properties of an Azure SQL Database sync group log.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar timestamp: Timestamp of the sync group log.
    :vartype timestamp: ~datetime.datetime
    :ivar type: Type of the sync group log. Known values are: "All", "Error", "Warning", and
     "Success".
    :vartype type: str or ~azure.mgmt.sql.models.SyncGroupLogType
    :ivar source: Source of the sync group log.
    :vartype source: str
    :ivar details: Details of the sync group log.
    :vartype details: str
    :ivar tracing_id: TracingId of the sync group log.
    :vartype tracing_id: str
    :ivar operation_status: OperationStatus of the sync group log.
    :vartype operation_status: str
    """

    _validation = {
        "timestamp": {"readonly": True},
        "type": {"readonly": True},
        "source": {"readonly": True},
        "details": {"readonly": True},
        "tracing_id": {"readonly": True},
        "operation_status": {"readonly": True},
    }

    _attribute_map = {
        "timestamp": {"key": "timestamp", "type": "iso-8601"},
        "type": {"key": "type", "type": "str"},
        "source": {"key": "source", "type": "str"},
        "details": {"key": "details", "type": "str"},
        "tracing_id": {"key": "tracingId", "type": "str"},
        "operation_status": {"key": "operationStatus", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.timestamp = None
        self.type = None
        self.source = None
        self.details = None
        self.tracing_id = None
        self.operation_status = None


class SyncGroupSchema(_serialization.Model):
    """Properties of sync group schema.

    :ivar tables: List of tables in sync group schema.
    :vartype tables: list[~azure.mgmt.sql.models.SyncGroupSchemaTable]
    :ivar master_sync_member_name: Name of master sync member where the schema is from.
    :vartype master_sync_member_name: str
    """

    _attribute_map = {
        "tables": {"key": "tables", "type": "[SyncGroupSchemaTable]"},
        "master_sync_member_name": {"key": "masterSyncMemberName", "type": "str"},
    }

    def __init__(
        self,
        *,
        tables: Optional[List["_models.SyncGroupSchemaTable"]] = None,
        master_sync_member_name: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword tables: List of tables in sync group schema.
        :paramtype tables: list[~azure.mgmt.sql.models.SyncGroupSchemaTable]
        :keyword master_sync_member_name: Name of master sync member where the schema is from.
        :paramtype master_sync_member_name: str
        """
        super().__init__(**kwargs)
        self.tables = tables
        self.master_sync_member_name = master_sync_member_name


class SyncGroupSchemaTable(_serialization.Model):
    """Properties of table in sync group schema.

    :ivar columns: List of columns in sync group schema.
    :vartype columns: list[~azure.mgmt.sql.models.SyncGroupSchemaTableColumn]
    :ivar quoted_name: Quoted name of sync group schema table.
    :vartype quoted_name: str
    """

    _attribute_map = {
        "columns": {"key": "columns", "type": "[SyncGroupSchemaTableColumn]"},
        "quoted_name": {"key": "quotedName", "type": "str"},
    }

    def __init__(
        self,
        *,
        columns: Optional[List["_models.SyncGroupSchemaTableColumn"]] = None,
        quoted_name: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword columns: List of columns in sync group schema.
        :paramtype columns: list[~azure.mgmt.sql.models.SyncGroupSchemaTableColumn]
        :keyword quoted_name: Quoted name of sync group schema table.
        :paramtype quoted_name: str
        """
        super().__init__(**kwargs)
        self.columns = columns
        self.quoted_name = quoted_name


class SyncGroupSchemaTableColumn(_serialization.Model):
    """Properties of column in sync group table.

    :ivar quoted_name: Quoted name of sync group table column.
    :vartype quoted_name: str
    :ivar data_size: Data size of the column.
    :vartype data_size: str
    :ivar data_type: Data type of the column.
    :vartype data_type: str
    """

    _attribute_map = {
        "quoted_name": {"key": "quotedName", "type": "str"},
        "data_size": {"key": "dataSize", "type": "str"},
        "data_type": {"key": "dataType", "type": "str"},
    }

    def __init__(
        self,
        *,
        quoted_name: Optional[str] = None,
        data_size: Optional[str] = None,
        data_type: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword quoted_name: Quoted name of sync group table column.
        :paramtype quoted_name: str
        :keyword data_size: Data size of the column.
        :paramtype data_size: str
        :keyword data_type: Data type of the column.
        :paramtype data_type: str
        """
        super().__init__(**kwargs)
        self.quoted_name = quoted_name
        self.data_size = data_size
        self.data_type = data_type


class SyncMember(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """An Azure SQL Database sync member.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar database_type: Database type of the sync member. Known values are: "AzureSqlDatabase" and
     "SqlServerDatabase".
    :vartype database_type: str or ~azure.mgmt.sql.models.SyncMemberDbType
    :ivar sync_agent_id: ARM resource id of the sync agent in the sync member.
    :vartype sync_agent_id: str
    :ivar sql_server_database_id: SQL Server database id of the sync member.
    :vartype sql_server_database_id: str
    :ivar sync_member_azure_database_resource_id: ARM resource id of the sync member logical
     database, for sync members in Azure.
    :vartype sync_member_azure_database_resource_id: str
    :ivar use_private_link_connection: Whether to use private link connection.
    :vartype use_private_link_connection: bool
    :ivar private_endpoint_name: Private endpoint name of the sync member if use private link
     connection is enabled, for sync members in Azure.
    :vartype private_endpoint_name: str
    :ivar server_name: Server name of the member database in the sync member.
    :vartype server_name: str
    :ivar database_name: Database name of the member database in the sync member.
    :vartype database_name: str
    :ivar user_name: User name of the member database in the sync member.
    :vartype user_name: str
    :ivar password: Password of the member database in the sync member.
    :vartype password: str
    :ivar sync_direction: Sync direction of the sync member. Known values are: "Bidirectional",
     "OneWayMemberToHub", and "OneWayHubToMember".
    :vartype sync_direction: str or ~azure.mgmt.sql.models.SyncDirection
    :ivar sync_state: Sync state of the sync member. Known values are: "SyncInProgress",
     "SyncSucceeded", "SyncFailed", "DisabledTombstoneCleanup", "DisabledBackupRestore",
     "SyncSucceededWithWarnings", "SyncCancelling", "SyncCancelled", "UnProvisioned",
     "Provisioning", "Provisioned", "ProvisionFailed", "DeProvisioning", "DeProvisioned",
     "DeProvisionFailed", "Reprovisioning", "ReprovisionFailed", and "UnReprovisioned".
    :vartype sync_state: str or ~azure.mgmt.sql.models.SyncMemberState
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "private_endpoint_name": {"readonly": True},
        "sync_state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "database_type": {"key": "properties.databaseType", "type": "str"},
        "sync_agent_id": {"key": "properties.syncAgentId", "type": "str"},
        "sql_server_database_id": {"key": "properties.sqlServerDatabaseId", "type": "str"},
        "sync_member_azure_database_resource_id": {
            "key": "properties.syncMemberAzureDatabaseResourceId",
            "type": "str",
        },
        "use_private_link_connection": {"key": "properties.usePrivateLinkConnection", "type": "bool"},
        "private_endpoint_name": {"key": "properties.privateEndpointName", "type": "str"},
        "server_name": {"key": "properties.serverName", "type": "str"},
        "database_name": {"key": "properties.databaseName", "type": "str"},
        "user_name": {"key": "properties.userName", "type": "str"},
        "password": {"key": "properties.password", "type": "str"},
        "sync_direction": {"key": "properties.syncDirection", "type": "str"},
        "sync_state": {"key": "properties.syncState", "type": "str"},
    }

    def __init__(
        self,
        *,
        database_type: Optional[Union[str, "_models.SyncMemberDbType"]] = None,
        sync_agent_id: Optional[str] = None,
        sql_server_database_id: Optional[str] = None,
        sync_member_azure_database_resource_id: Optional[str] = None,
        use_private_link_connection: Optional[bool] = None,
        server_name: Optional[str] = None,
        database_name: Optional[str] = None,
        user_name: Optional[str] = None,
        password: Optional[str] = None,
        sync_direction: Optional[Union[str, "_models.SyncDirection"]] = None,
        **kwargs
    ):
        """
        :keyword database_type: Database type of the sync member. Known values are: "AzureSqlDatabase"
         and "SqlServerDatabase".
        :paramtype database_type: str or ~azure.mgmt.sql.models.SyncMemberDbType
        :keyword sync_agent_id: ARM resource id of the sync agent in the sync member.
        :paramtype sync_agent_id: str
        :keyword sql_server_database_id: SQL Server database id of the sync member.
        :paramtype sql_server_database_id: str
        :keyword sync_member_azure_database_resource_id: ARM resource id of the sync member logical
         database, for sync members in Azure.
        :paramtype sync_member_azure_database_resource_id: str
        :keyword use_private_link_connection: Whether to use private link connection.
        :paramtype use_private_link_connection: bool
        :keyword server_name: Server name of the member database in the sync member.
        :paramtype server_name: str
        :keyword database_name: Database name of the member database in the sync member.
        :paramtype database_name: str
        :keyword user_name: User name of the member database in the sync member.
        :paramtype user_name: str
        :keyword password: Password of the member database in the sync member.
        :paramtype password: str
        :keyword sync_direction: Sync direction of the sync member. Known values are: "Bidirectional",
         "OneWayMemberToHub", and "OneWayHubToMember".
        :paramtype sync_direction: str or ~azure.mgmt.sql.models.SyncDirection
        """
        super().__init__(**kwargs)
        self.database_type = database_type
        self.sync_agent_id = sync_agent_id
        self.sql_server_database_id = sql_server_database_id
        self.sync_member_azure_database_resource_id = sync_member_azure_database_resource_id
        self.use_private_link_connection = use_private_link_connection
        self.private_endpoint_name = None
        self.server_name = server_name
        self.database_name = database_name
        self.user_name = user_name
        self.password = password
        self.sync_direction = sync_direction
        self.sync_state = None


class SyncMemberListResult(_serialization.Model):
    """A list of Azure SQL Database sync members.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.SyncMember]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[SyncMember]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class SystemData(_serialization.Model):
    """Metadata pertaining to creation and last modification of the resource.

    :ivar created_by: The identity that created the resource.
    :vartype created_by: str
    :ivar created_by_type: The type of identity that created the resource. Known values are:
     "User", "Application", "ManagedIdentity", and "Key".
    :vartype created_by_type: str or ~azure.mgmt.sql.models.CreatedByType
    :ivar created_at: The timestamp of resource creation (UTC).
    :vartype created_at: ~datetime.datetime
    :ivar last_modified_by: The identity that last modified the resource.
    :vartype last_modified_by: str
    :ivar last_modified_by_type: The type of identity that last modified the resource. Known values
     are: "User", "Application", "ManagedIdentity", and "Key".
    :vartype last_modified_by_type: str or ~azure.mgmt.sql.models.CreatedByType
    :ivar last_modified_at: The timestamp of resource last modification (UTC).
    :vartype last_modified_at: ~datetime.datetime
    """

    _attribute_map = {
        "created_by": {"key": "createdBy", "type": "str"},
        "created_by_type": {"key": "createdByType", "type": "str"},
        "created_at": {"key": "createdAt", "type": "iso-8601"},
        "last_modified_by": {"key": "lastModifiedBy", "type": "str"},
        "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"},
        "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"},
    }

    def __init__(
        self,
        *,
        created_by: Optional[str] = None,
        created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
        created_at: Optional[datetime.datetime] = None,
        last_modified_by: Optional[str] = None,
        last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
        last_modified_at: Optional[datetime.datetime] = None,
        **kwargs
    ):
        """
        :keyword created_by: The identity that created the resource.
        :paramtype created_by: str
        :keyword created_by_type: The type of identity that created the resource. Known values are:
         "User", "Application", "ManagedIdentity", and "Key".
        :paramtype created_by_type: str or ~azure.mgmt.sql.models.CreatedByType
        :keyword created_at: The timestamp of resource creation (UTC).
        :paramtype created_at: ~datetime.datetime
        :keyword last_modified_by: The identity that last modified the resource.
        :paramtype last_modified_by: str
        :keyword last_modified_by_type: The type of identity that last modified the resource. Known
         values are: "User", "Application", "ManagedIdentity", and "Key".
        :paramtype last_modified_by_type: str or ~azure.mgmt.sql.models.CreatedByType
        :keyword last_modified_at: The timestamp of resource last modification (UTC).
        :paramtype last_modified_at: ~datetime.datetime
        """
        super().__init__(**kwargs)
        self.created_by = created_by
        self.created_by_type = created_by_type
        self.created_at = created_at
        self.last_modified_by = last_modified_by
        self.last_modified_by_type = last_modified_by_type
        self.last_modified_at = last_modified_at


class TdeCertificate(ProxyResource):
    """A TDE certificate that can be uploaded into a server.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar private_blob: The base64 encoded certificate private blob.
    :vartype private_blob: str
    :ivar cert_password: The certificate password.
    :vartype cert_password: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "private_blob": {"key": "properties.privateBlob", "type": "str"},
        "cert_password": {"key": "properties.certPassword", "type": "str"},
    }

    def __init__(self, *, private_blob: Optional[str] = None, cert_password: Optional[str] = None, **kwargs):
        """
        :keyword private_blob: The base64 encoded certificate private blob.
        :paramtype private_blob: str
        :keyword cert_password: The certificate password.
        :paramtype cert_password: str
        """
        super().__init__(**kwargs)
        self.private_blob = private_blob
        self.cert_password = cert_password


class TimeZone(ProxyResource):
    """Time Zone.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar time_zone_id: The time zone id.
    :vartype time_zone_id: str
    :ivar display_name: The time zone display name.
    :vartype display_name: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "time_zone_id": {"readonly": True},
        "display_name": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "time_zone_id": {"key": "properties.timeZoneId", "type": "str"},
        "display_name": {"key": "properties.displayName", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.time_zone_id = None
        self.display_name = None


class TimeZoneListResult(_serialization.Model):
    """A list of time zones.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.TimeZone]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[TimeZone]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class TopQueries(_serialization.Model):
    """TopQueries.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar number_of_queries: Requested number of top queries.
    :vartype number_of_queries: int
    :ivar aggregation_function: Aggregation function used to calculate query metrics.
    :vartype aggregation_function: str
    :ivar observation_metric: Metric used to rank queries.
    :vartype observation_metric: str
    :ivar interval_type: Interval type (length). Known values are: "PT1H" and "P1D".
    :vartype interval_type: str or ~azure.mgmt.sql.models.QueryTimeGrainType
    :ivar start_time: The start time for the metric (ISO-8601 format).
    :vartype start_time: str
    :ivar end_time: The end time for the metric (ISO-8601 format).
    :vartype end_time: str
    :ivar queries: List of top resource consuming queries with appropriate metric data.
    :vartype queries: list[~azure.mgmt.sql.models.QueryStatisticsProperties]
    """

    _validation = {
        "number_of_queries": {"readonly": True},
        "aggregation_function": {"readonly": True},
        "observation_metric": {"readonly": True},
        "interval_type": {"readonly": True},
        "start_time": {"readonly": True},
        "end_time": {"readonly": True},
    }

    _attribute_map = {
        "number_of_queries": {"key": "numberOfQueries", "type": "int"},
        "aggregation_function": {"key": "aggregationFunction", "type": "str"},
        "observation_metric": {"key": "observationMetric", "type": "str"},
        "interval_type": {"key": "intervalType", "type": "str"},
        "start_time": {"key": "startTime", "type": "str"},
        "end_time": {"key": "endTime", "type": "str"},
        "queries": {"key": "queries", "type": "[QueryStatisticsProperties]"},
    }

    def __init__(self, *, queries: Optional[List["_models.QueryStatisticsProperties"]] = None, **kwargs):
        """
        :keyword queries: List of top resource consuming queries with appropriate metric data.
        :paramtype queries: list[~azure.mgmt.sql.models.QueryStatisticsProperties]
        """
        super().__init__(**kwargs)
        self.number_of_queries = None
        self.aggregation_function = None
        self.observation_metric = None
        self.interval_type = None
        self.start_time = None
        self.end_time = None
        self.queries = queries


class TopQueriesListResult(_serialization.Model):
    """A list of top resource consuming queries on managed instance.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.TopQueries]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[TopQueries]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class UpdateLongTermRetentionBackupParameters(_serialization.Model):
    """Contains the information necessary to perform long term retention backup update operation.

    :ivar requested_backup_storage_redundancy: The storage redundancy type of the copied backup.
     Known values are: "Geo", "Local", "Zone", and "GeoZone".
    :vartype requested_backup_storage_redundancy: str or
     ~azure.mgmt.sql.models.BackupStorageRedundancy
    """

    _attribute_map = {
        "requested_backup_storage_redundancy": {"key": "properties.requestedBackupStorageRedundancy", "type": "str"},
    }

    def __init__(
        self,
        *,
        requested_backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None,
        **kwargs
    ):
        """
        :keyword requested_backup_storage_redundancy: The storage redundancy type of the copied backup.
         Known values are: "Geo", "Local", "Zone", and "GeoZone".
        :paramtype requested_backup_storage_redundancy: str or
         ~azure.mgmt.sql.models.BackupStorageRedundancy
        """
        super().__init__(**kwargs)
        self.requested_backup_storage_redundancy = requested_backup_storage_redundancy


class UpdateVirtualClusterDnsServersOperation(ProxyResource):
    """A refresh DNS servers operation.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar status: The status of the DNS refresh operation. Known values are: "Succeeded", "Failed",
     and "InProgress".
    :vartype status: str or ~azure.mgmt.sql.models.DNSRefreshOperationStatus
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "status": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "status": {"key": "properties.status", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.status = None


class UpsertManagedServerOperationParameters(_serialization.Model):
    """UpsertManagedServerOperationParameters.

    :ivar family:
    :vartype family: str
    :ivar tier:
    :vartype tier: str
    :ivar v_cores:
    :vartype v_cores: int
    :ivar storage_size_in_gb:
    :vartype storage_size_in_gb: int
    """

    _attribute_map = {
        "family": {"key": "family", "type": "str"},
        "tier": {"key": "tier", "type": "str"},
        "v_cores": {"key": "vCores", "type": "int"},
        "storage_size_in_gb": {"key": "storageSizeInGB", "type": "int"},
    }

    def __init__(
        self,
        *,
        family: Optional[str] = None,
        tier: Optional[str] = None,
        v_cores: Optional[int] = None,
        storage_size_in_gb: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword family:
        :paramtype family: str
        :keyword tier:
        :paramtype tier: str
        :keyword v_cores:
        :paramtype v_cores: int
        :keyword storage_size_in_gb:
        :paramtype storage_size_in_gb: int
        """
        super().__init__(**kwargs)
        self.family = family
        self.tier = tier
        self.v_cores = v_cores
        self.storage_size_in_gb = storage_size_in_gb


class UpsertManagedServerOperationStep(_serialization.Model):
    """UpsertManagedServerOperationStep.

    :ivar order:
    :vartype order: int
    :ivar name:
    :vartype name: str
    :ivar status: Known values are: "NotStarted", "InProgress", "SlowedDown", "Completed",
     "Failed", and "Canceled".
    :vartype status: str or ~azure.mgmt.sql.models.UpsertManagedServerOperationStepStatus
    """

    _attribute_map = {
        "order": {"key": "order", "type": "int"},
        "name": {"key": "name", "type": "str"},
        "status": {"key": "status", "type": "str"},
    }

    def __init__(
        self,
        *,
        order: Optional[int] = None,
        name: Optional[str] = None,
        status: Optional[Union[str, "_models.UpsertManagedServerOperationStepStatus"]] = None,
        **kwargs
    ):
        """
        :keyword order:
        :paramtype order: int
        :keyword name:
        :paramtype name: str
        :keyword status: Known values are: "NotStarted", "InProgress", "SlowedDown", "Completed",
         "Failed", and "Canceled".
        :paramtype status: str or ~azure.mgmt.sql.models.UpsertManagedServerOperationStepStatus
        """
        super().__init__(**kwargs)
        self.order = order
        self.name = name
        self.status = status


class Usage(_serialization.Model):
    """ARM usage.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: ~azure.mgmt.sql.models.Name
    :ivar type: Resource type.
    :vartype type: str
    :ivar unit: Usage unit.
    :vartype unit: str
    :ivar current_value: Usage current value.
    :vartype current_value: int
    :ivar limit: Usage limit.
    :vartype limit: int
    :ivar requested_limit: Usage requested limit.
    :vartype requested_limit: int
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "unit": {"readonly": True},
        "current_value": {"readonly": True},
        "limit": {"readonly": True},
        "requested_limit": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "Name"},
        "type": {"key": "type", "type": "str"},
        "unit": {"key": "unit", "type": "str"},
        "current_value": {"key": "currentValue", "type": "int"},
        "limit": {"key": "limit", "type": "int"},
        "requested_limit": {"key": "requestedLimit", "type": "int"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.id = None
        self.name = None
        self.type = None
        self.unit = None
        self.current_value = None
        self.limit = None
        self.requested_limit = None


class UsageListResult(_serialization.Model):
    """A list of usages.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.Usage]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[Usage]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class UserIdentity(_serialization.Model):
    """Azure Active Directory identity configuration for a resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar principal_id: The Azure Active Directory principal id.
    :vartype principal_id: str
    :ivar client_id: The Azure Active Directory client id.
    :vartype client_id: str
    """

    _validation = {
        "principal_id": {"readonly": True},
        "client_id": {"readonly": True},
    }

    _attribute_map = {
        "principal_id": {"key": "principalId", "type": "str"},
        "client_id": {"key": "clientId", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.principal_id = None
        self.client_id = None


class VaRule(_serialization.Model):
    """SQL Vulnerability Assessment rule metadata details.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar rule_id: SQL Vulnerability Assessment rule Id.
    :vartype rule_id: str
    :ivar severity: SQL Vulnerability Assessment rule severity. Known values are: "High", "Medium",
     "Low", "Informational", and "Obsolete".
    :vartype severity: str or ~azure.mgmt.sql.models.RuleSeverity
    :ivar category: SQL Vulnerability Assessment rule category.
    :vartype category: str
    :ivar rule_type: SQL Vulnerability Assessment rule type. Known values are: "Binary",
     "BaselineExpected", "PositiveList", and "NegativeList".
    :vartype rule_type: str or ~azure.mgmt.sql.models.RuleType
    :ivar title: SQL Vulnerability Assessment rule title.
    :vartype title: str
    :ivar description: SQL Vulnerability Assessment rule description.
    :vartype description: str
    :ivar rationale: SQL Vulnerability Assessment rule rationale.
    :vartype rationale: str
    :ivar query_check: SQL Vulnerability Assessment rule query details.
    :vartype query_check: ~azure.mgmt.sql.models.QueryCheck
    :ivar benchmark_references: SQL Vulnerability Assessment benchmark references.
    :vartype benchmark_references: list[~azure.mgmt.sql.models.BenchmarkReference]
    """

    _validation = {
        "rule_id": {"readonly": True},
        "severity": {"readonly": True},
        "category": {"readonly": True},
        "rule_type": {"readonly": True},
        "title": {"readonly": True},
        "description": {"readonly": True},
        "rationale": {"readonly": True},
        "query_check": {"readonly": True},
        "benchmark_references": {"readonly": True},
    }

    _attribute_map = {
        "rule_id": {"key": "ruleId", "type": "str"},
        "severity": {"key": "severity", "type": "str"},
        "category": {"key": "category", "type": "str"},
        "rule_type": {"key": "ruleType", "type": "str"},
        "title": {"key": "title", "type": "str"},
        "description": {"key": "description", "type": "str"},
        "rationale": {"key": "rationale", "type": "str"},
        "query_check": {"key": "queryCheck", "type": "QueryCheck"},
        "benchmark_references": {"key": "benchmarkReferences", "type": "[BenchmarkReference]"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.rule_id = None
        self.severity = None
        self.category = None
        self.rule_type = None
        self.title = None
        self.description = None
        self.rationale = None
        self.query_check = None
        self.benchmark_references = None


class VirtualCluster(TrackedResource):
    """An Azure SQL virtual cluster.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar location: Resource location. Required.
    :vartype location: str
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar subnet_id: Subnet resource ID for the virtual cluster.
    :vartype subnet_id: str
    :ivar version: Virtual cluster version.
    :vartype version: str
    :ivar child_resources: List of resources in this virtual cluster.
    :vartype child_resources: list[str]
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "location": {"required": True},
        "subnet_id": {"readonly": True},
        "child_resources": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "location": {"key": "location", "type": "str"},
        "tags": {"key": "tags", "type": "{str}"},
        "subnet_id": {"key": "properties.subnetId", "type": "str"},
        "version": {"key": "properties.version", "type": "str"},
        "child_resources": {"key": "properties.childResources", "type": "[str]"},
    }

    def __init__(
        self, *, location: str, tags: Optional[Dict[str, str]] = None, version: Optional[str] = None, **kwargs
    ):
        """
        :keyword location: Resource location. Required.
        :paramtype location: str
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword version: Virtual cluster version.
        :paramtype version: str
        """
        super().__init__(location=location, tags=tags, **kwargs)
        self.subnet_id = None
        self.version = version
        self.child_resources = None


class VirtualClusterListResult(_serialization.Model):
    """A list of virtual clusters.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.VirtualCluster]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[VirtualCluster]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class VirtualClusterUpdate(_serialization.Model):
    """An update request for virtual cluster.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar subnet_id: Subnet resource ID for the virtual cluster.
    :vartype subnet_id: str
    :ivar version: Virtual cluster version.
    :vartype version: str
    :ivar child_resources: List of resources in this virtual cluster.
    :vartype child_resources: list[str]
    """

    _validation = {
        "subnet_id": {"readonly": True},
        "child_resources": {"readonly": True},
    }

    _attribute_map = {
        "tags": {"key": "tags", "type": "{str}"},
        "subnet_id": {"key": "properties.subnetId", "type": "str"},
        "version": {"key": "properties.version", "type": "str"},
        "child_resources": {"key": "properties.childResources", "type": "[str]"},
    }

    def __init__(self, *, tags: Optional[Dict[str, str]] = None, version: Optional[str] = None, **kwargs):
        """
        :keyword tags: Resource tags.
        :paramtype tags: dict[str, str]
        :keyword version: Virtual cluster version.
        :paramtype version: str
        """
        super().__init__(**kwargs)
        self.tags = tags
        self.subnet_id = None
        self.version = version
        self.child_resources = None


class VirtualNetworkRule(ProxyResource):
    """A virtual network rule.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar virtual_network_subnet_id: The ARM resource id of the virtual network subnet.
    :vartype virtual_network_subnet_id: str
    :ivar ignore_missing_vnet_service_endpoint: Create firewall rule before the virtual network has
     vnet service endpoint enabled.
    :vartype ignore_missing_vnet_service_endpoint: bool
    :ivar state: Virtual Network Rule State. Known values are: "Initializing", "InProgress",
     "Ready", "Failed", "Deleting", and "Unknown".
    :vartype state: str or ~azure.mgmt.sql.models.VirtualNetworkRuleState
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "state": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "virtual_network_subnet_id": {"key": "properties.virtualNetworkSubnetId", "type": "str"},
        "ignore_missing_vnet_service_endpoint": {"key": "properties.ignoreMissingVnetServiceEndpoint", "type": "bool"},
        "state": {"key": "properties.state", "type": "str"},
    }

    def __init__(
        self,
        *,
        virtual_network_subnet_id: Optional[str] = None,
        ignore_missing_vnet_service_endpoint: Optional[bool] = None,
        **kwargs
    ):
        """
        :keyword virtual_network_subnet_id: The ARM resource id of the virtual network subnet.
        :paramtype virtual_network_subnet_id: str
        :keyword ignore_missing_vnet_service_endpoint: Create firewall rule before the virtual network
         has vnet service endpoint enabled.
        :paramtype ignore_missing_vnet_service_endpoint: bool
        """
        super().__init__(**kwargs)
        self.virtual_network_subnet_id = virtual_network_subnet_id
        self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint
        self.state = None


class VirtualNetworkRuleListResult(_serialization.Model):
    """A list of virtual network rules.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.VirtualNetworkRule]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[VirtualNetworkRule]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class VulnerabilityAssessmentRecurringScansProperties(_serialization.Model):
    """Properties of a Vulnerability Assessment recurring scans.

    :ivar is_enabled: Recurring scans state.
    :vartype is_enabled: bool
    :ivar email_subscription_admins: Specifies that the schedule scan notification will be is sent
     to the subscription administrators.
    :vartype email_subscription_admins: bool
    :ivar emails: Specifies an array of e-mail addresses to which the scan notification is sent.
    :vartype emails: list[str]
    """

    _attribute_map = {
        "is_enabled": {"key": "isEnabled", "type": "bool"},
        "email_subscription_admins": {"key": "emailSubscriptionAdmins", "type": "bool"},
        "emails": {"key": "emails", "type": "[str]"},
    }

    def __init__(
        self,
        *,
        is_enabled: Optional[bool] = None,
        email_subscription_admins: bool = True,
        emails: Optional[List[str]] = None,
        **kwargs
    ):
        """
        :keyword is_enabled: Recurring scans state.
        :paramtype is_enabled: bool
        :keyword email_subscription_admins: Specifies that the schedule scan notification will be is
         sent to the subscription administrators.
        :paramtype email_subscription_admins: bool
        :keyword emails: Specifies an array of e-mail addresses to which the scan notification is sent.
        :paramtype emails: list[str]
        """
        super().__init__(**kwargs)
        self.is_enabled = is_enabled
        self.email_subscription_admins = email_subscription_admins
        self.emails = emails


class VulnerabilityAssessmentScanError(_serialization.Model):
    """Properties of a vulnerability assessment scan error.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar code: The error code.
    :vartype code: str
    :ivar message: The error message.
    :vartype message: str
    """

    _validation = {
        "code": {"readonly": True},
        "message": {"readonly": True},
    }

    _attribute_map = {
        "code": {"key": "code", "type": "str"},
        "message": {"key": "message", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.code = None
        self.message = None


class VulnerabilityAssessmentScanRecord(ProxyResource):  # pylint: disable=too-many-instance-attributes
    """A vulnerability assessment scan record.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar scan_id: The scan ID.
    :vartype scan_id: str
    :ivar trigger_type: The scan trigger type. Known values are: "OnDemand" and "Recurring".
    :vartype trigger_type: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentScanTriggerType
    :ivar state: The scan status. Known values are: "Passed", "Failed", "FailedToRun", and
     "InProgress".
    :vartype state: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentScanState
    :ivar start_time: The scan start time (UTC).
    :vartype start_time: ~datetime.datetime
    :ivar end_time: The scan end time (UTC).
    :vartype end_time: ~datetime.datetime
    :ivar errors: The scan errors.
    :vartype errors: list[~azure.mgmt.sql.models.VulnerabilityAssessmentScanError]
    :ivar storage_container_path: The scan results storage container path.
    :vartype storage_container_path: str
    :ivar number_of_failed_security_checks: The number of failed security checks.
    :vartype number_of_failed_security_checks: int
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
        "scan_id": {"readonly": True},
        "trigger_type": {"readonly": True},
        "state": {"readonly": True},
        "start_time": {"readonly": True},
        "end_time": {"readonly": True},
        "errors": {"readonly": True},
        "storage_container_path": {"readonly": True},
        "number_of_failed_security_checks": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "scan_id": {"key": "properties.scanId", "type": "str"},
        "trigger_type": {"key": "properties.triggerType", "type": "str"},
        "state": {"key": "properties.state", "type": "str"},
        "start_time": {"key": "properties.startTime", "type": "iso-8601"},
        "end_time": {"key": "properties.endTime", "type": "iso-8601"},
        "errors": {"key": "properties.errors", "type": "[VulnerabilityAssessmentScanError]"},
        "storage_container_path": {"key": "properties.storageContainerPath", "type": "str"},
        "number_of_failed_security_checks": {"key": "properties.numberOfFailedSecurityChecks", "type": "int"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.scan_id = None
        self.trigger_type = None
        self.state = None
        self.start_time = None
        self.end_time = None
        self.errors = None
        self.storage_container_path = None
        self.number_of_failed_security_checks = None


class VulnerabilityAssessmentScanRecordListResult(_serialization.Model):
    """A list of vulnerability assessment scan records.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.VulnerabilityAssessmentScanRecord]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[VulnerabilityAssessmentScanRecord]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class WorkloadClassifier(ProxyResource):
    """Workload classifier operations for a data warehouse.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar member_name: The workload classifier member name.
    :vartype member_name: str
    :ivar label: The workload classifier label.
    :vartype label: str
    :ivar context: The workload classifier context.
    :vartype context: str
    :ivar start_time: The workload classifier start time for classification.
    :vartype start_time: str
    :ivar end_time: The workload classifier end time for classification.
    :vartype end_time: str
    :ivar importance: The workload classifier importance.
    :vartype importance: str
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "member_name": {"key": "properties.memberName", "type": "str"},
        "label": {"key": "properties.label", "type": "str"},
        "context": {"key": "properties.context", "type": "str"},
        "start_time": {"key": "properties.startTime", "type": "str"},
        "end_time": {"key": "properties.endTime", "type": "str"},
        "importance": {"key": "properties.importance", "type": "str"},
    }

    def __init__(
        self,
        *,
        member_name: Optional[str] = None,
        label: Optional[str] = None,
        context: Optional[str] = None,
        start_time: Optional[str] = None,
        end_time: Optional[str] = None,
        importance: Optional[str] = None,
        **kwargs
    ):
        """
        :keyword member_name: The workload classifier member name.
        :paramtype member_name: str
        :keyword label: The workload classifier label.
        :paramtype label: str
        :keyword context: The workload classifier context.
        :paramtype context: str
        :keyword start_time: The workload classifier start time for classification.
        :paramtype start_time: str
        :keyword end_time: The workload classifier end time for classification.
        :paramtype end_time: str
        :keyword importance: The workload classifier importance.
        :paramtype importance: str
        """
        super().__init__(**kwargs)
        self.member_name = member_name
        self.label = label
        self.context = context
        self.start_time = start_time
        self.end_time = end_time
        self.importance = importance


class WorkloadClassifierListResult(_serialization.Model):
    """A list of workload classifiers for a workload group.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.WorkloadClassifier]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[WorkloadClassifier]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None


class WorkloadGroup(ProxyResource):
    """Workload group operations for a data warehouse.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar id: Resource ID.
    :vartype id: str
    :ivar name: Resource name.
    :vartype name: str
    :ivar type: Resource type.
    :vartype type: str
    :ivar min_resource_percent: The workload group minimum percentage resource.
    :vartype min_resource_percent: int
    :ivar max_resource_percent: The workload group cap percentage resource.
    :vartype max_resource_percent: int
    :ivar min_resource_percent_per_request: The workload group request minimum grant percentage.
    :vartype min_resource_percent_per_request: float
    :ivar max_resource_percent_per_request: The workload group request maximum grant percentage.
    :vartype max_resource_percent_per_request: float
    :ivar importance: The workload group importance level.
    :vartype importance: str
    :ivar query_execution_timeout: The workload group query execution timeout.
    :vartype query_execution_timeout: int
    """

    _validation = {
        "id": {"readonly": True},
        "name": {"readonly": True},
        "type": {"readonly": True},
    }

    _attribute_map = {
        "id": {"key": "id", "type": "str"},
        "name": {"key": "name", "type": "str"},
        "type": {"key": "type", "type": "str"},
        "min_resource_percent": {"key": "properties.minResourcePercent", "type": "int"},
        "max_resource_percent": {"key": "properties.maxResourcePercent", "type": "int"},
        "min_resource_percent_per_request": {"key": "properties.minResourcePercentPerRequest", "type": "float"},
        "max_resource_percent_per_request": {"key": "properties.maxResourcePercentPerRequest", "type": "float"},
        "importance": {"key": "properties.importance", "type": "str"},
        "query_execution_timeout": {"key": "properties.queryExecutionTimeout", "type": "int"},
    }

    def __init__(
        self,
        *,
        min_resource_percent: Optional[int] = None,
        max_resource_percent: Optional[int] = None,
        min_resource_percent_per_request: Optional[float] = None,
        max_resource_percent_per_request: Optional[float] = None,
        importance: Optional[str] = None,
        query_execution_timeout: Optional[int] = None,
        **kwargs
    ):
        """
        :keyword min_resource_percent: The workload group minimum percentage resource.
        :paramtype min_resource_percent: int
        :keyword max_resource_percent: The workload group cap percentage resource.
        :paramtype max_resource_percent: int
        :keyword min_resource_percent_per_request: The workload group request minimum grant percentage.
        :paramtype min_resource_percent_per_request: float
        :keyword max_resource_percent_per_request: The workload group request maximum grant percentage.
        :paramtype max_resource_percent_per_request: float
        :keyword importance: The workload group importance level.
        :paramtype importance: str
        :keyword query_execution_timeout: The workload group query execution timeout.
        :paramtype query_execution_timeout: int
        """
        super().__init__(**kwargs)
        self.min_resource_percent = min_resource_percent
        self.max_resource_percent = max_resource_percent
        self.min_resource_percent_per_request = min_resource_percent_per_request
        self.max_resource_percent_per_request = max_resource_percent_per_request
        self.importance = importance
        self.query_execution_timeout = query_execution_timeout


class WorkloadGroupListResult(_serialization.Model):
    """A list of workload groups.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: Array of results.
    :vartype value: list[~azure.mgmt.sql.models.WorkloadGroup]
    :ivar next_link: Link to retrieve next page of results.
    :vartype next_link: str
    """

    _validation = {
        "value": {"readonly": True},
        "next_link": {"readonly": True},
    }

    _attribute_map = {
        "value": {"key": "value", "type": "[WorkloadGroup]"},
        "next_link": {"key": "nextLink", "type": "str"},
    }

    def __init__(self, **kwargs):
        """ """
        super().__init__(**kwargs)
        self.value = None
        self.next_link = None
