diff --git a/azure-mgmt-sql/HISTORY.rst b/azure-mgmt-sql/HISTORY.rst index 5983dbaadf4f..6a451988a4a8 100644 --- a/azure-mgmt-sql/HISTORY.rst +++ b/azure-mgmt-sql/HISTORY.rst @@ -3,6 +3,33 @@ Release History =============== +0.12.0 (2019-03-28) ++++++++++++++++++++ + +**Features** + +- Model ManagedDatabase has a new parameter recoverable_database_id +- Model ManagedDatabase has a new parameter restorable_dropped_database_id +- Model ServerSecurityAlertPolicy has a new parameter creation_time +- Model ManagedInstanceUpdate has a new parameter public_data_endpoint_enabled +- Model ManagedInstanceUpdate has a new parameter proxy_override +- Model ManagedInstanceUpdate has a new parameter timezone_id +- Model ManagedDatabaseUpdate has a new parameter recoverable_database_id +- Model ManagedDatabaseUpdate has a new parameter restorable_dropped_database_id +- Model ManagedInstance has a new parameter public_data_endpoint_enabled +- Model ManagedInstance has a new parameter proxy_override +- Model ManagedInstance has a new parameter timezone_id +- Added operation group ManagedServerSecurityAlertPoliciesOperations +- Added operation group VirtualClustersOperations +- Added operation group ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations +- Added operation group RestorableDroppedManagedDatabasesOperations +- Added operation group ManagedDatabaseSensitivityLabelsOperations +- Added operation group RecoverableManagedDatabasesOperations +- Added operation group ServerVulnerabilityAssessmentsOperations +- Added operation group ManagedInstanceVulnerabilityAssessmentsOperations +- Added operation group ManagedDatabaseSecurityAlertPoliciesOperations +- Added operation group SensitivityLabelsOperations + 0.11.0 (2018-11-08) +++++++++++++++++++ diff --git a/azure-mgmt-sql/MANIFEST.in b/azure-mgmt-sql/MANIFEST.in index 6ceb27f7a96e..e4884efef41b 100644 --- a/azure-mgmt-sql/MANIFEST.in +++ b/azure-mgmt-sql/MANIFEST.in @@ -1,3 +1,4 @@ +recursive-include tests *.py *.yaml include *.rst include azure/__init__.py include azure/mgmt/__init__.py diff --git a/azure-mgmt-sql/README.rst b/azure-mgmt-sql/README.rst index 84ef601f1e36..328c72485489 100644 --- a/azure-mgmt-sql/README.rst +++ b/azure-mgmt-sql/README.rst @@ -14,25 +14,6 @@ For the older Azure Service Management (ASM) libraries, see For a more complete set of Azure libraries, see the `azure `__ bundle package. -Compatibility -============= - -**IMPORTANT**: If you have an earlier version of the azure package -(version < 1.0), you should uninstall it before installing this package. - -You can check the version using pip: - -.. code:: shell - - pip freeze - -If you see azure==0.11.0 (or any version below 1.0), uninstall it first: - -.. code:: shell - - pip uninstall azure - - Usage ===== diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index e8ceabbdc005..0a543180d7e4 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -79,6 +79,8 @@ from .sync_group_py3 import SyncGroup from .sync_member_py3 import SyncMember from .subscription_usage_py3 import SubscriptionUsage + from .virtual_cluster_py3 import VirtualCluster + from .virtual_cluster_update_py3 import VirtualClusterUpdate from .virtual_network_rule_py3 import VirtualNetworkRule from .extended_database_blob_auditing_policy_py3 import ExtendedDatabaseBlobAuditingPolicy from .extended_server_blob_auditing_policy_py3 import ExtendedServerBlobAuditingPolicy @@ -113,8 +115,12 @@ from .server_dns_alias_py3 import ServerDnsAlias from .server_dns_alias_acquisition_py3 import ServerDnsAliasAcquisition from .server_security_alert_policy_py3 import ServerSecurityAlertPolicy + from .restorable_dropped_managed_database_py3 import RestorableDroppedManagedDatabase from .restore_point_py3 import RestorePoint from .create_database_restore_point_definition_py3 import CreateDatabaseRestorePointDefinition + from .managed_database_security_alert_policy_py3 import ManagedDatabaseSecurityAlertPolicy + from .managed_server_security_alert_policy_py3 import ManagedServerSecurityAlertPolicy + from .sensitivity_label_py3 import SensitivityLabel from .database_operation_py3 import DatabaseOperation from .elastic_pool_operation_py3 import ElasticPoolOperation from .max_size_capability_py3 import MaxSizeCapability @@ -152,6 +158,9 @@ from .tde_certificate_py3 import TdeCertificate from .managed_instance_key_py3 import ManagedInstanceKey from .managed_instance_encryption_protector_py3 import ManagedInstanceEncryptionProtector + from .recoverable_managed_database_py3 import RecoverableManagedDatabase + from .managed_instance_vulnerability_assessment_py3 import ManagedInstanceVulnerabilityAssessment + from .server_vulnerability_assessment_py3 import ServerVulnerabilityAssessment except (SyntaxError, ImportError): from .recoverable_database import RecoverableDatabase from .restorable_dropped_database import RestorableDroppedDatabase @@ -222,6 +231,8 @@ from .sync_group import SyncGroup from .sync_member import SyncMember from .subscription_usage import SubscriptionUsage + from .virtual_cluster import VirtualCluster + from .virtual_cluster_update import VirtualClusterUpdate from .virtual_network_rule import VirtualNetworkRule from .extended_database_blob_auditing_policy import ExtendedDatabaseBlobAuditingPolicy from .extended_server_blob_auditing_policy import ExtendedServerBlobAuditingPolicy @@ -256,8 +267,12 @@ from .server_dns_alias import ServerDnsAlias from .server_dns_alias_acquisition import ServerDnsAliasAcquisition from .server_security_alert_policy import ServerSecurityAlertPolicy + from .restorable_dropped_managed_database import RestorableDroppedManagedDatabase from .restore_point import RestorePoint from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition + from .managed_database_security_alert_policy import ManagedDatabaseSecurityAlertPolicy + from .managed_server_security_alert_policy import ManagedServerSecurityAlertPolicy + from .sensitivity_label import SensitivityLabel from .database_operation import DatabaseOperation from .elastic_pool_operation import ElasticPoolOperation from .max_size_capability import MaxSizeCapability @@ -295,6 +310,9 @@ from .tde_certificate import TdeCertificate from .managed_instance_key import ManagedInstanceKey from .managed_instance_encryption_protector import ManagedInstanceEncryptionProtector + from .recoverable_managed_database import RecoverableManagedDatabase + from .managed_instance_vulnerability_assessment import ManagedInstanceVulnerabilityAssessment + from .server_vulnerability_assessment import ServerVulnerabilityAssessment from .recoverable_database_paged import RecoverableDatabasePaged from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .server_paged import ServerPaged @@ -330,6 +348,7 @@ from .sync_group_paged import SyncGroupPaged from .sync_member_paged import SyncMemberPaged from .subscription_usage_paged import SubscriptionUsagePaged +from .virtual_cluster_paged import VirtualClusterPaged from .virtual_network_rule_paged import VirtualNetworkRulePaged from .database_vulnerability_assessment_paged import DatabaseVulnerabilityAssessmentPaged from .job_agent_paged import JobAgentPaged @@ -343,7 +362,12 @@ from .managed_backup_short_term_retention_policy_paged import ManagedBackupShortTermRetentionPolicyPaged from .managed_database_paged import ManagedDatabasePaged from .server_dns_alias_paged import ServerDnsAliasPaged +from .server_security_alert_policy_paged import ServerSecurityAlertPolicyPaged +from .restorable_dropped_managed_database_paged import RestorableDroppedManagedDatabasePaged from .restore_point_paged import RestorePointPaged +from .managed_database_security_alert_policy_paged import ManagedDatabaseSecurityAlertPolicyPaged +from .managed_server_security_alert_policy_paged import ManagedServerSecurityAlertPolicyPaged +from .sensitivity_label_paged import SensitivityLabelPaged from .database_operation_paged import DatabaseOperationPaged from .elastic_pool_operation_paged import ElasticPoolOperationPaged from .vulnerability_assessment_scan_record_paged import VulnerabilityAssessmentScanRecordPaged @@ -351,6 +375,9 @@ from .backup_short_term_retention_policy_paged import BackupShortTermRetentionPolicyPaged from .managed_instance_key_paged import ManagedInstanceKeyPaged from .managed_instance_encryption_protector_paged import ManagedInstanceEncryptionProtectorPaged +from .recoverable_managed_database_paged import RecoverableManagedDatabasePaged +from .managed_instance_vulnerability_assessment_paged import ManagedInstanceVulnerabilityAssessmentPaged +from .server_vulnerability_assessment_paged import ServerVulnerabilityAssessmentPaged from .sql_management_client_enums import ( CheckNameAvailabilityReason, ServerConnectionType, @@ -385,6 +412,7 @@ ReadOnlyEndpointFailoverPolicy, FailoverGroupReplicationRole, IdentityType, + ManagedInstanceProxyOverride, OperationOrigin, SyncAgentState, SyncMemberDbType, @@ -427,6 +455,7 @@ InstanceFailoverGroupReplicationRole, LongTermRetentionDatabaseState, VulnerabilityAssessmentPolicyBaselineName, + SensitivityLabelSource, CapabilityGroup, ) @@ -500,6 +529,8 @@ 'SyncGroup', 'SyncMember', 'SubscriptionUsage', + 'VirtualCluster', + 'VirtualClusterUpdate', 'VirtualNetworkRule', 'ExtendedDatabaseBlobAuditingPolicy', 'ExtendedServerBlobAuditingPolicy', @@ -534,8 +565,12 @@ 'ServerDnsAlias', 'ServerDnsAliasAcquisition', 'ServerSecurityAlertPolicy', + 'RestorableDroppedManagedDatabase', 'RestorePoint', 'CreateDatabaseRestorePointDefinition', + 'ManagedDatabaseSecurityAlertPolicy', + 'ManagedServerSecurityAlertPolicy', + 'SensitivityLabel', 'DatabaseOperation', 'ElasticPoolOperation', 'MaxSizeCapability', @@ -573,6 +608,9 @@ 'TdeCertificate', 'ManagedInstanceKey', 'ManagedInstanceEncryptionProtector', + 'RecoverableManagedDatabase', + 'ManagedInstanceVulnerabilityAssessment', + 'ServerVulnerabilityAssessment', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', 'ServerPaged', @@ -608,6 +646,7 @@ 'SyncGroupPaged', 'SyncMemberPaged', 'SubscriptionUsagePaged', + 'VirtualClusterPaged', 'VirtualNetworkRulePaged', 'DatabaseVulnerabilityAssessmentPaged', 'JobAgentPaged', @@ -621,7 +660,12 @@ 'ManagedBackupShortTermRetentionPolicyPaged', 'ManagedDatabasePaged', 'ServerDnsAliasPaged', + 'ServerSecurityAlertPolicyPaged', + 'RestorableDroppedManagedDatabasePaged', 'RestorePointPaged', + 'ManagedDatabaseSecurityAlertPolicyPaged', + 'ManagedServerSecurityAlertPolicyPaged', + 'SensitivityLabelPaged', 'DatabaseOperationPaged', 'ElasticPoolOperationPaged', 'VulnerabilityAssessmentScanRecordPaged', @@ -629,6 +673,9 @@ 'BackupShortTermRetentionPolicyPaged', 'ManagedInstanceKeyPaged', 'ManagedInstanceEncryptionProtectorPaged', + 'RecoverableManagedDatabasePaged', + 'ManagedInstanceVulnerabilityAssessmentPaged', + 'ServerVulnerabilityAssessmentPaged', 'CheckNameAvailabilityReason', 'ServerConnectionType', 'SecurityAlertPolicyState', @@ -662,6 +709,7 @@ 'ReadOnlyEndpointFailoverPolicy', 'FailoverGroupReplicationRole', 'IdentityType', + 'ManagedInstanceProxyOverride', 'OperationOrigin', 'SyncAgentState', 'SyncMemberDbType', @@ -704,5 +752,6 @@ 'InstanceFailoverGroupReplicationRole', 'LongTermRetentionDatabaseState', 'VulnerabilityAssessmentPolicyBaselineName', + 'SensitivityLabelSource', 'CapabilityGroup', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/job_schedule.py b/azure-mgmt-sql/azure/mgmt/sql/models/job_schedule.py index 7fab31ef7b8c..354e32c4f5b0 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/job_schedule.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/job_schedule.py @@ -27,7 +27,7 @@ class JobSchedule(Model): :param enabled: Whether or not the schedule is enabled. :type enabled: bool :param interval: Value of the schedule's recurring interval, if the - scheduletype is recurring. ISO8601 duration format. + schedule type is recurring. ISO8601 duration format. :type interval: str """ diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/job_schedule_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/job_schedule_py3.py index 8c0cd37ebefe..4b4a6a8f8971 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/job_schedule_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/job_schedule_py3.py @@ -27,7 +27,7 @@ class JobSchedule(Model): :param enabled: Whether or not the schedule is enabled. :type enabled: bool :param interval: Value of the schedule's recurring interval, if the - scheduletype is recurring. ISO8601 duration format. + schedule type is recurring. ISO8601 duration format. :type interval: str """ diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_database.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database.py index 92d1c06510f0..0c5141eaaef5 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/managed_database.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database.py @@ -32,8 +32,8 @@ class ManagedDatabase(TrackedResource): :type tags: dict[str, str] :param collation: Collation of the managed database. :type collation: str - :ivar status: Status for the database. Possible values include: 'Online', - 'Offline', 'Shutdown', 'Creating', 'Inaccessible' + :ivar status: Status of the database. Possible values include: 'Online', + 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Updating' :vartype status: str or ~azure.mgmt.sql.models.ManagedDatabaseStatus :ivar creation_date: Creation date of the database. :vartype creation_date: datetime @@ -56,8 +56,11 @@ class ManagedDatabase(TrackedResource): 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. Possible values include: - 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + 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. Possible + values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', + 'Recovery' :type create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode :param storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the @@ -66,6 +69,9 @@ class ManagedDatabase(TrackedResource): :param source_database_id: The resource identifier of the source database associated with create operation of this database. :type source_database_id: str + :param restorable_dropped_database_id: The restorable dropped database + resource id to restore when creating this database. + :type restorable_dropped_database_id: str :param storage_container_sas_token: Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. @@ -73,6 +79,9 @@ class ManagedDatabase(TrackedResource): :ivar failover_group_id: Instance Failover Group resource identifier that this managed database belongs to. :vartype failover_group_id: str + :param recoverable_database_id: The resource identifier of the recoverable + database associated with create operation of this database. + :type recoverable_database_id: str """ _validation = { @@ -103,8 +112,10 @@ class ManagedDatabase(TrackedResource): '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_sas_token': {'key': 'properties.storageContainerSasToken', 'type': 'str'}, 'failover_group_id': {'key': 'properties.failoverGroupId', 'type': 'str'}, + 'recoverable_database_id': {'key': 'properties.recoverableDatabaseId', 'type': 'str'}, } def __init__(self, **kwargs): @@ -119,5 +130,7 @@ def __init__(self, **kwargs): self.create_mode = kwargs.get('create_mode', None) self.storage_container_uri = kwargs.get('storage_container_uri', None) self.source_database_id = kwargs.get('source_database_id', None) + self.restorable_dropped_database_id = kwargs.get('restorable_dropped_database_id', None) self.storage_container_sas_token = kwargs.get('storage_container_sas_token', None) self.failover_group_id = None + self.recoverable_database_id = kwargs.get('recoverable_database_id', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_py3.py index 4470afe5bb7e..cc5b655604ad 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_py3.py @@ -32,8 +32,8 @@ class ManagedDatabase(TrackedResource): :type tags: dict[str, str] :param collation: Collation of the managed database. :type collation: str - :ivar status: Status for the database. Possible values include: 'Online', - 'Offline', 'Shutdown', 'Creating', 'Inaccessible' + :ivar status: Status of the database. Possible values include: 'Online', + 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Updating' :vartype status: str or ~azure.mgmt.sql.models.ManagedDatabaseStatus :ivar creation_date: Creation date of the database. :vartype creation_date: datetime @@ -56,8 +56,11 @@ class ManagedDatabase(TrackedResource): 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. Possible values include: - 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + 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. Possible + values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', + 'Recovery' :type create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode :param storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the @@ -66,6 +69,9 @@ class ManagedDatabase(TrackedResource): :param source_database_id: The resource identifier of the source database associated with create operation of this database. :type source_database_id: str + :param restorable_dropped_database_id: The restorable dropped database + resource id to restore when creating this database. + :type restorable_dropped_database_id: str :param storage_container_sas_token: Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. @@ -73,6 +79,9 @@ class ManagedDatabase(TrackedResource): :ivar failover_group_id: Instance Failover Group resource identifier that this managed database belongs to. :vartype failover_group_id: str + :param recoverable_database_id: The resource identifier of the recoverable + database associated with create operation of this database. + :type recoverable_database_id: str """ _validation = { @@ -103,11 +112,13 @@ class ManagedDatabase(TrackedResource): '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_sas_token': {'key': 'properties.storageContainerSasToken', 'type': 'str'}, 'failover_group_id': {'key': 'properties.failoverGroupId', 'type': 'str'}, + 'recoverable_database_id': {'key': 'properties.recoverableDatabaseId', 'type': 'str'}, } - def __init__(self, *, location: str, tags=None, collation: str=None, restore_point_in_time=None, catalog_collation=None, create_mode=None, storage_container_uri: str=None, source_database_id: str=None, storage_container_sas_token: str=None, **kwargs) -> None: + def __init__(self, *, location: str, tags=None, collation: str=None, restore_point_in_time=None, catalog_collation=None, create_mode=None, storage_container_uri: str=None, source_database_id: str=None, restorable_dropped_database_id: str=None, storage_container_sas_token: str=None, recoverable_database_id: str=None, **kwargs) -> None: super(ManagedDatabase, self).__init__(location=location, tags=tags, **kwargs) self.collation = collation self.status = None @@ -119,5 +130,7 @@ def __init__(self, *, location: str, tags=None, collation: str=None, restore_poi 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_sas_token = storage_container_sas_token self.failover_group_id = None + self.recoverable_database_id = recoverable_database_id diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_security_alert_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_security_alert_policy.py new file mode 100644 index 000000000000..e3117c33610e --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_security_alert_policy.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class ManagedDatabaseSecurityAlertPolicy(ProxyResource): + """A managed database security alert 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 + :param state: Required. Specifies the state of the policy, whether it is + enabled or disabled or a policy has not been applied yet on the specific + database. Possible values include: 'New', 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState + :param disabled_alerts: Specifies an array of alerts that are disabled. + Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, + Access_Anomaly, Data_Exfiltration, Unsafe_Action + :type disabled_alerts: list[str] + :param email_addresses: Specifies an array of e-mail addresses to which + the alert is sent. + :type email_addresses: list[str] + :param email_account_admins: Specifies that the alert is sent to the + account administrators. + :type email_account_admins: bool + :param 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. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + Threat Detection audit storage account. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the Threat + Detection audit logs. + :type retention_days: int + :ivar creation_time: Specifies the UTC creation time of the policy. + :vartype creation_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'state': {'required': 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': 'SecurityAlertPolicyState'}, + '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, **kwargs): + super(ManagedDatabaseSecurityAlertPolicy, self).__init__(**kwargs) + self.state = kwargs.get('state', None) + self.disabled_alerts = kwargs.get('disabled_alerts', None) + self.email_addresses = kwargs.get('email_addresses', None) + self.email_account_admins = kwargs.get('email_account_admins', None) + self.storage_endpoint = kwargs.get('storage_endpoint', None) + self.storage_account_access_key = kwargs.get('storage_account_access_key', None) + self.retention_days = kwargs.get('retention_days', None) + self.creation_time = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_security_alert_policy_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_security_alert_policy_paged.py new file mode 100644 index 000000000000..e05f23ba364c --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_security_alert_policy_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ManagedDatabaseSecurityAlertPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedDatabaseSecurityAlertPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedDatabaseSecurityAlertPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedDatabaseSecurityAlertPolicyPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_security_alert_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_security_alert_policy_py3.py new file mode 100644 index 000000000000..365f34280641 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_security_alert_policy_py3.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource_py3 import ProxyResource + + +class ManagedDatabaseSecurityAlertPolicy(ProxyResource): + """A managed database security alert 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 + :param state: Required. Specifies the state of the policy, whether it is + enabled or disabled or a policy has not been applied yet on the specific + database. Possible values include: 'New', 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState + :param disabled_alerts: Specifies an array of alerts that are disabled. + Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, + Access_Anomaly, Data_Exfiltration, Unsafe_Action + :type disabled_alerts: list[str] + :param email_addresses: Specifies an array of e-mail addresses to which + the alert is sent. + :type email_addresses: list[str] + :param email_account_admins: Specifies that the alert is sent to the + account administrators. + :type email_account_admins: bool + :param 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. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + Threat Detection audit storage account. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the Threat + Detection audit logs. + :type retention_days: int + :ivar creation_time: Specifies the UTC creation time of the policy. + :vartype creation_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'state': {'required': 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': 'SecurityAlertPolicyState'}, + '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, disabled_alerts=None, email_addresses=None, email_account_admins: bool=None, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, **kwargs) -> None: + super(ManagedDatabaseSecurityAlertPolicy, self).__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 diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_update.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_update.py index 4335e9b19dfa..5ce3a036dcb9 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_update.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_update.py @@ -20,8 +20,8 @@ class ManagedDatabaseUpdate(Model): :param collation: Collation of the managed database. :type collation: str - :ivar status: Status for the database. Possible values include: 'Online', - 'Offline', 'Shutdown', 'Creating', 'Inaccessible' + :ivar status: Status of the database. Possible values include: 'Online', + 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Updating' :vartype status: str or ~azure.mgmt.sql.models.ManagedDatabaseStatus :ivar creation_date: Creation date of the database. :vartype creation_date: datetime @@ -44,8 +44,11 @@ class ManagedDatabaseUpdate(Model): 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. Possible values include: - 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + 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. Possible + values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', + 'Recovery' :type create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode :param storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the @@ -54,6 +57,9 @@ class ManagedDatabaseUpdate(Model): :param source_database_id: The resource identifier of the source database associated with create operation of this database. :type source_database_id: str + :param restorable_dropped_database_id: The restorable dropped database + resource id to restore when creating this database. + :type restorable_dropped_database_id: str :param storage_container_sas_token: Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. @@ -61,6 +67,9 @@ class ManagedDatabaseUpdate(Model): :ivar failover_group_id: Instance Failover Group resource identifier that this managed database belongs to. :vartype failover_group_id: str + :param recoverable_database_id: The resource identifier of the recoverable + database associated with create operation of this database. + :type recoverable_database_id: str :param tags: Resource tags. :type tags: dict[str, str] """ @@ -84,8 +93,10 @@ class ManagedDatabaseUpdate(Model): '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_sas_token': {'key': 'properties.storageContainerSasToken', 'type': 'str'}, 'failover_group_id': {'key': 'properties.failoverGroupId', 'type': 'str'}, + 'recoverable_database_id': {'key': 'properties.recoverableDatabaseId', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -101,6 +112,8 @@ def __init__(self, **kwargs): self.create_mode = kwargs.get('create_mode', None) self.storage_container_uri = kwargs.get('storage_container_uri', None) self.source_database_id = kwargs.get('source_database_id', None) + self.restorable_dropped_database_id = kwargs.get('restorable_dropped_database_id', None) self.storage_container_sas_token = kwargs.get('storage_container_sas_token', None) self.failover_group_id = None + self.recoverable_database_id = kwargs.get('recoverable_database_id', None) self.tags = kwargs.get('tags', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_update_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_update_py3.py index 668eec38f38b..34ae1be2b3fe 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_update_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_database_update_py3.py @@ -20,8 +20,8 @@ class ManagedDatabaseUpdate(Model): :param collation: Collation of the managed database. :type collation: str - :ivar status: Status for the database. Possible values include: 'Online', - 'Offline', 'Shutdown', 'Creating', 'Inaccessible' + :ivar status: Status of the database. Possible values include: 'Online', + 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Updating' :vartype status: str or ~azure.mgmt.sql.models.ManagedDatabaseStatus :ivar creation_date: Creation date of the database. :vartype creation_date: datetime @@ -44,8 +44,11 @@ class ManagedDatabaseUpdate(Model): 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. Possible values include: - 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + 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. Possible + values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', + 'Recovery' :type create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode :param storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the @@ -54,6 +57,9 @@ class ManagedDatabaseUpdate(Model): :param source_database_id: The resource identifier of the source database associated with create operation of this database. :type source_database_id: str + :param restorable_dropped_database_id: The restorable dropped database + resource id to restore when creating this database. + :type restorable_dropped_database_id: str :param storage_container_sas_token: Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. @@ -61,6 +67,9 @@ class ManagedDatabaseUpdate(Model): :ivar failover_group_id: Instance Failover Group resource identifier that this managed database belongs to. :vartype failover_group_id: str + :param recoverable_database_id: The resource identifier of the recoverable + database associated with create operation of this database. + :type recoverable_database_id: str :param tags: Resource tags. :type tags: dict[str, str] """ @@ -84,12 +93,14 @@ class ManagedDatabaseUpdate(Model): '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_sas_token': {'key': 'properties.storageContainerSasToken', 'type': 'str'}, 'failover_group_id': {'key': 'properties.failoverGroupId', 'type': 'str'}, + 'recoverable_database_id': {'key': 'properties.recoverableDatabaseId', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, collation: str=None, restore_point_in_time=None, catalog_collation=None, create_mode=None, storage_container_uri: str=None, source_database_id: str=None, storage_container_sas_token: str=None, tags=None, **kwargs) -> None: + def __init__(self, *, collation: str=None, restore_point_in_time=None, catalog_collation=None, create_mode=None, storage_container_uri: str=None, source_database_id: str=None, restorable_dropped_database_id: str=None, storage_container_sas_token: str=None, recoverable_database_id: str=None, tags=None, **kwargs) -> None: super(ManagedDatabaseUpdate, self).__init__(**kwargs) self.collation = collation self.status = None @@ -101,6 +112,8 @@ def __init__(self, *, collation: str=None, restore_point_in_time=None, catalog_c 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_sas_token = storage_container_sas_token self.failover_group_id = None + self.recoverable_database_id = recoverable_database_id self.tags = tags diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance.py index 17714b680f60..cf680e0ddac0 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance.py @@ -63,6 +63,26 @@ class ManagedInstance(TrackedResource): :param dns_zone_partner: The resource id of another managed instance whose DNS zone this managed instance will share after creation. :type dns_zone_partner: str + :param public_data_endpoint_enabled: Whether or not the public data + endpoint is enabled. + :type public_data_endpoint_enabled: bool + :param proxy_override: Connection type used for connecting to the + instance. Possible values include: 'Proxy', 'Redirect', 'Default' + :type proxy_override: str or + ~azure.mgmt.sql.models.ManagedInstanceProxyOverride + :param 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". + :type timezone_id: str """ _validation = { @@ -94,6 +114,9 @@ class ManagedInstance(TrackedResource): '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'}, + 'proxy_override': {'key': 'properties.proxyOverride', 'type': 'str'}, + 'timezone_id': {'key': 'properties.timezoneId', 'type': 'str'}, } def __init__(self, **kwargs): @@ -111,3 +134,6 @@ def __init__(self, **kwargs): self.collation = kwargs.get('collation', None) self.dns_zone = None self.dns_zone_partner = kwargs.get('dns_zone_partner', None) + self.public_data_endpoint_enabled = kwargs.get('public_data_endpoint_enabled', None) + self.proxy_override = kwargs.get('proxy_override', None) + self.timezone_id = kwargs.get('timezone_id', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_py3.py index 604927b6d83d..9233da80dae4 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_py3.py @@ -63,6 +63,26 @@ class ManagedInstance(TrackedResource): :param dns_zone_partner: The resource id of another managed instance whose DNS zone this managed instance will share after creation. :type dns_zone_partner: str + :param public_data_endpoint_enabled: Whether or not the public data + endpoint is enabled. + :type public_data_endpoint_enabled: bool + :param proxy_override: Connection type used for connecting to the + instance. Possible values include: 'Proxy', 'Redirect', 'Default' + :type proxy_override: str or + ~azure.mgmt.sql.models.ManagedInstanceProxyOverride + :param 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". + :type timezone_id: str """ _validation = { @@ -94,9 +114,12 @@ class ManagedInstance(TrackedResource): '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'}, + 'proxy_override': {'key': 'properties.proxyOverride', 'type': 'str'}, + 'timezone_id': {'key': 'properties.timezoneId', 'type': 'str'}, } - def __init__(self, *, location: str, tags=None, identity=None, sku=None, administrator_login: str=None, administrator_login_password: str=None, subnet_id: str=None, license_type: str=None, v_cores: int=None, storage_size_in_gb: int=None, collation: str=None, dns_zone_partner: str=None, **kwargs) -> None: + def __init__(self, *, location: str, tags=None, identity=None, sku=None, administrator_login: str=None, administrator_login_password: str=None, subnet_id: str=None, license_type: str=None, v_cores: int=None, storage_size_in_gb: int=None, collation: str=None, dns_zone_partner: str=None, public_data_endpoint_enabled: bool=None, proxy_override=None, timezone_id: str=None, **kwargs) -> None: super(ManagedInstance, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.sku = sku @@ -111,3 +134,6 @@ def __init__(self, *, location: str, tags=None, identity=None, sku=None, adminis self.collation = collation self.dns_zone = None self.dns_zone_partner = dns_zone_partner + self.public_data_endpoint_enabled = public_data_endpoint_enabled + self.proxy_override = proxy_override + self.timezone_id = timezone_id diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update.py index f9b8ab34889e..e3c543f0a6b1 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update.py @@ -48,6 +48,26 @@ class ManagedInstanceUpdate(Model): :param dns_zone_partner: The resource id of another managed instance whose DNS zone this managed instance will share after creation. :type dns_zone_partner: str + :param public_data_endpoint_enabled: Whether or not the public data + endpoint is enabled. + :type public_data_endpoint_enabled: bool + :param proxy_override: Connection type used for connecting to the + instance. Possible values include: 'Proxy', 'Redirect', 'Default' + :type proxy_override: str or + ~azure.mgmt.sql.models.ManagedInstanceProxyOverride + :param 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". + :type timezone_id: str :param tags: Resource tags. :type tags: dict[str, str] """ @@ -71,6 +91,9 @@ class ManagedInstanceUpdate(Model): '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'}, + 'proxy_override': {'key': 'properties.proxyOverride', 'type': 'str'}, + 'timezone_id': {'key': 'properties.timezoneId', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -88,4 +111,7 @@ def __init__(self, **kwargs): self.collation = kwargs.get('collation', None) self.dns_zone = None self.dns_zone_partner = kwargs.get('dns_zone_partner', None) + self.public_data_endpoint_enabled = kwargs.get('public_data_endpoint_enabled', None) + self.proxy_override = kwargs.get('proxy_override', None) + self.timezone_id = kwargs.get('timezone_id', None) self.tags = kwargs.get('tags', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update_py3.py index 5445bbd5f9ce..4a2e6aa0bd78 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update_py3.py @@ -48,6 +48,26 @@ class ManagedInstanceUpdate(Model): :param dns_zone_partner: The resource id of another managed instance whose DNS zone this managed instance will share after creation. :type dns_zone_partner: str + :param public_data_endpoint_enabled: Whether or not the public data + endpoint is enabled. + :type public_data_endpoint_enabled: bool + :param proxy_override: Connection type used for connecting to the + instance. Possible values include: 'Proxy', 'Redirect', 'Default' + :type proxy_override: str or + ~azure.mgmt.sql.models.ManagedInstanceProxyOverride + :param 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". + :type timezone_id: str :param tags: Resource tags. :type tags: dict[str, str] """ @@ -71,10 +91,13 @@ class ManagedInstanceUpdate(Model): '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'}, + 'proxy_override': {'key': 'properties.proxyOverride', 'type': 'str'}, + 'timezone_id': {'key': 'properties.timezoneId', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, sku=None, administrator_login: str=None, administrator_login_password: str=None, subnet_id: str=None, license_type: str=None, v_cores: int=None, storage_size_in_gb: int=None, collation: str=None, dns_zone_partner: str=None, tags=None, **kwargs) -> None: + def __init__(self, *, sku=None, administrator_login: str=None, administrator_login_password: str=None, subnet_id: str=None, license_type: str=None, v_cores: int=None, storage_size_in_gb: int=None, collation: str=None, dns_zone_partner: str=None, public_data_endpoint_enabled: bool=None, proxy_override=None, timezone_id: str=None, tags=None, **kwargs) -> None: super(ManagedInstanceUpdate, self).__init__(**kwargs) self.sku = sku self.fully_qualified_domain_name = None @@ -88,4 +111,7 @@ def __init__(self, *, sku=None, administrator_login: str=None, administrator_log self.collation = collation self.dns_zone = None self.dns_zone_partner = dns_zone_partner + self.public_data_endpoint_enabled = public_data_endpoint_enabled + self.proxy_override = proxy_override + self.timezone_id = timezone_id self.tags = tags diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_vulnerability_assessment.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_vulnerability_assessment.py new file mode 100644 index 000000000000..78d257382e26 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_vulnerability_assessment.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class ManagedInstanceVulnerabilityAssessment(ProxyResource): + """A managed instance vulnerability assessment. + + 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 + :param storage_container_path: Required. A blob storage container path to + hold the scan results (e.g. + https://myStorage.blob.core.windows.net/VaScans/). + :type storage_container_path: str + :param 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. + :type storage_container_sas_key: str + :param 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. + :type storage_account_access_key: str + :param recurring_scans: The recurring scans settings + :type recurring_scans: + ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'storage_container_path': {'required': 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, **kwargs): + super(ManagedInstanceVulnerabilityAssessment, self).__init__(**kwargs) + self.storage_container_path = kwargs.get('storage_container_path', None) + self.storage_container_sas_key = kwargs.get('storage_container_sas_key', None) + self.storage_account_access_key = kwargs.get('storage_account_access_key', None) + self.recurring_scans = kwargs.get('recurring_scans', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_vulnerability_assessment_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_vulnerability_assessment_paged.py new file mode 100644 index 000000000000..a7322fe506bf --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_vulnerability_assessment_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ManagedInstanceVulnerabilityAssessmentPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedInstanceVulnerabilityAssessment ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedInstanceVulnerabilityAssessment]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedInstanceVulnerabilityAssessmentPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_vulnerability_assessment_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_vulnerability_assessment_py3.py new file mode 100644 index 000000000000..6f3da10fea84 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_vulnerability_assessment_py3.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource_py3 import ProxyResource + + +class ManagedInstanceVulnerabilityAssessment(ProxyResource): + """A managed instance vulnerability assessment. + + 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 + :param storage_container_path: Required. A blob storage container path to + hold the scan results (e.g. + https://myStorage.blob.core.windows.net/VaScans/). + :type storage_container_path: str + :param 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. + :type storage_container_sas_key: str + :param 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. + :type storage_account_access_key: str + :param recurring_scans: The recurring scans settings + :type recurring_scans: + ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'storage_container_path': {'required': 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: str, storage_container_sas_key: str=None, storage_account_access_key: str=None, recurring_scans=None, **kwargs) -> None: + super(ManagedInstanceVulnerabilityAssessment, self).__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 diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_server_security_alert_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_server_security_alert_policy.py new file mode 100644 index 000000000000..e3a0a5062157 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_server_security_alert_policy.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class ManagedServerSecurityAlertPolicy(ProxyResource): + """A managed server security alert 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 + :param state: Required. Specifies the state of the policy, whether it is + enabled or disabled or a policy has not been applied yet on the specific + database. Possible values include: 'New', 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState + :param disabled_alerts: Specifies an array of alerts that are disabled. + Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, + Access_Anomaly, Data_Exfiltration, Unsafe_Action + :type disabled_alerts: list[str] + :param email_addresses: Specifies an array of e-mail addresses to which + the alert is sent. + :type email_addresses: list[str] + :param email_account_admins: Specifies that the alert is sent to the + account administrators. + :type email_account_admins: bool + :param 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. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + Threat Detection audit storage account. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the Threat + Detection audit logs. + :type retention_days: int + :ivar creation_time: Specifies the UTC creation time of the policy. + :vartype creation_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'state': {'required': 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': 'SecurityAlertPolicyState'}, + '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, **kwargs): + super(ManagedServerSecurityAlertPolicy, self).__init__(**kwargs) + self.state = kwargs.get('state', None) + self.disabled_alerts = kwargs.get('disabled_alerts', None) + self.email_addresses = kwargs.get('email_addresses', None) + self.email_account_admins = kwargs.get('email_account_admins', None) + self.storage_endpoint = kwargs.get('storage_endpoint', None) + self.storage_account_access_key = kwargs.get('storage_account_access_key', None) + self.retention_days = kwargs.get('retention_days', None) + self.creation_time = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_server_security_alert_policy_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_server_security_alert_policy_paged.py new file mode 100644 index 000000000000..2d99504f4744 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_server_security_alert_policy_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ManagedServerSecurityAlertPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedServerSecurityAlertPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedServerSecurityAlertPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedServerSecurityAlertPolicyPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/managed_server_security_alert_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/managed_server_security_alert_policy_py3.py new file mode 100644 index 000000000000..b16c97c79bea --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/managed_server_security_alert_policy_py3.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource_py3 import ProxyResource + + +class ManagedServerSecurityAlertPolicy(ProxyResource): + """A managed server security alert 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 + :param state: Required. Specifies the state of the policy, whether it is + enabled or disabled or a policy has not been applied yet on the specific + database. Possible values include: 'New', 'Enabled', 'Disabled' + :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState + :param disabled_alerts: Specifies an array of alerts that are disabled. + Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, + Access_Anomaly, Data_Exfiltration, Unsafe_Action + :type disabled_alerts: list[str] + :param email_addresses: Specifies an array of e-mail addresses to which + the alert is sent. + :type email_addresses: list[str] + :param email_account_admins: Specifies that the alert is sent to the + account administrators. + :type email_account_admins: bool + :param 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. + :type storage_endpoint: str + :param storage_account_access_key: Specifies the identifier key of the + Threat Detection audit storage account. + :type storage_account_access_key: str + :param retention_days: Specifies the number of days to keep in the Threat + Detection audit logs. + :type retention_days: int + :ivar creation_time: Specifies the UTC creation time of the policy. + :vartype creation_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'state': {'required': 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': 'SecurityAlertPolicyState'}, + '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, disabled_alerts=None, email_addresses=None, email_account_admins: bool=None, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, **kwargs) -> None: + super(ManagedServerSecurityAlertPolicy, self).__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 diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/metric_definition.py b/azure-mgmt-sql/azure/mgmt/sql/models/metric_definition.py index 2ecb95dae8a7..0b760f50f3ba 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/metric_definition.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/metric_definition.py @@ -30,8 +30,8 @@ class MetricDefinition(Model): :ivar unit: The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond' :vartype unit: str or ~azure.mgmt.sql.models.UnitDefinitionType - :ivar metric_availabilities: The list of database metric availabities for - the metric. + :ivar metric_availabilities: The list of database metric availabilities + for the metric. :vartype metric_availabilities: list[~azure.mgmt.sql.models.MetricAvailability] """ diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/metric_definition_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/metric_definition_py3.py index 09e77729c411..33d5fa9e1323 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/metric_definition_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/metric_definition_py3.py @@ -30,8 +30,8 @@ class MetricDefinition(Model): :ivar unit: The unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond' :vartype unit: str or ~azure.mgmt.sql.models.UnitDefinitionType - :ivar metric_availabilities: The list of database metric availabities for - the metric. + :ivar metric_availabilities: The list of database metric availabilities + for the metric. :vartype metric_availabilities: list[~azure.mgmt.sql.models.MetricAvailability] """ diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool.py b/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool.py index 93ab96c4e2b1..0d80a9a31ac9 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool.py @@ -13,7 +13,7 @@ class RecommendedElasticPool(ProxyResource): - """Represents a recommented elastic pool. + """Represents a recommended elastic pool. Variables are only populated by the server, and will be ignored when sending a request. diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_py3.py index ee13abf5d237..2f8a14d6abfa 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_py3.py @@ -13,7 +13,7 @@ class RecommendedElasticPool(ProxyResource): - """Represents a recommented elastic pool. + """Represents a recommended elastic pool. Variables are only populated by the server, and will be ignored when sending a request. diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_managed_database.py b/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_managed_database.py new file mode 100644 index 000000000000..cd6adeaeac89 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_managed_database.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +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(RecoverableManagedDatabase, self).__init__(**kwargs) + self.last_available_backup_date = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_managed_database_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_managed_database_paged.py new file mode 100644 index 000000000000..9c3a35713275 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_managed_database_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class RecoverableManagedDatabasePaged(Paged): + """ + A paging container for iterating over a list of :class:`RecoverableManagedDatabase ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RecoverableManagedDatabase]'} + } + + def __init__(self, *args, **kwargs): + + super(RecoverableManagedDatabasePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_managed_database_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_managed_database_py3.py new file mode 100644 index 000000000000..b6f295aceffb --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_managed_database_py3.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource_py3 import ProxyResource + + +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) -> None: + super(RecoverableManagedDatabase, self).__init__(**kwargs) + self.last_available_backup_date = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_managed_database.py b/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_managed_database.py new file mode 100644 index 000000000000..e23713aa2a2d --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_managed_database.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .tracked_resource import TrackedResource + + +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 + :param location: Required. Resource location. + :type location: str + :param tags: Resource tags. + :type 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 + :ivar deletion_date: The deletion date of the database (ISO8601 format). + :vartype deletion_date: datetime + :ivar earliest_restore_date: The earliest restore date of the database + (ISO8601 format). + :vartype earliest_restore_date: 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, **kwargs): + super(RestorableDroppedManagedDatabase, self).__init__(**kwargs) + self.database_name = None + self.creation_date = None + self.deletion_date = None + self.earliest_restore_date = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_managed_database_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_managed_database_paged.py new file mode 100644 index 000000000000..d6e432c2c351 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_managed_database_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class RestorableDroppedManagedDatabasePaged(Paged): + """ + A paging container for iterating over a list of :class:`RestorableDroppedManagedDatabase ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RestorableDroppedManagedDatabase]'} + } + + def __init__(self, *args, **kwargs): + + super(RestorableDroppedManagedDatabasePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_managed_database_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_managed_database_py3.py new file mode 100644 index 000000000000..7997b13a21ce --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_managed_database_py3.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .tracked_resource_py3 import TrackedResource + + +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 + :param location: Required. Resource location. + :type location: str + :param tags: Resource tags. + :type 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 + :ivar deletion_date: The deletion date of the database (ISO8601 format). + :vartype deletion_date: datetime + :ivar earliest_restore_date: The earliest restore date of the database + (ISO8601 format). + :vartype earliest_restore_date: 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=None, **kwargs) -> None: + super(RestorableDroppedManagedDatabase, self).__init__(location=location, tags=tags, **kwargs) + self.database_name = None + self.creation_date = None + self.deletion_date = None + self.earliest_restore_date = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py new file mode 100644 index 000000000000..a076a11634e6 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class SensitivityLabel(ProxyResource): + """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 + :param label_name: The label name. + :type label_name: str + :param label_id: The label ID. + :type label_id: str + :param information_type: The information type. + :type information_type: str + :param information_type_id: The information type ID. + :type information_type_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'}, + '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'}, + } + + def __init__(self, **kwargs): + super(SensitivityLabel, self).__init__(**kwargs) + self.label_name = kwargs.get('label_name', None) + self.label_id = kwargs.get('label_id', None) + self.information_type = kwargs.get('information_type', None) + self.information_type_id = kwargs.get('information_type_id', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_paged.py new file mode 100644 index 000000000000..438bfd86f9be --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class SensitivityLabelPaged(Paged): + """ + A paging container for iterating over a list of :class:`SensitivityLabel ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SensitivityLabel]'} + } + + def __init__(self, *args, **kwargs): + + super(SensitivityLabelPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py new file mode 100644 index 000000000000..f304363d916b --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource_py3 import ProxyResource + + +class SensitivityLabel(ProxyResource): + """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 + :param label_name: The label name. + :type label_name: str + :param label_id: The label ID. + :type label_id: str + :param information_type: The information type. + :type information_type: str + :param information_type_id: The information type ID. + :type information_type_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'}, + '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'}, + } + + def __init__(self, *, label_name: str=None, label_id: str=None, information_type: str=None, information_type_id: str=None, **kwargs) -> None: + super(SensitivityLabel, self).__init__(**kwargs) + self.label_name = label_name + self.label_id = label_id + self.information_type = information_type + self.information_type_id = information_type_id diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py index 04e3ddc44869..06c40dd93125 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy.py @@ -27,7 +27,8 @@ class ServerSecurityAlertPolicy(ProxyResource): :ivar type: Resource type. :vartype type: str :param state: Required. Specifies the state of the policy, whether it is - enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled' + enabled or disabled or a policy has not been applied yet on the specific + database. Possible values include: 'New', 'Enabled', 'Disabled' :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState :param disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, @@ -49,6 +50,8 @@ class ServerSecurityAlertPolicy(ProxyResource): :param retention_days: Specifies the number of days to keep in the Threat Detection audit logs. :type retention_days: int + :ivar creation_time: Specifies the UTC creation time of the policy. + :vartype creation_time: datetime """ _validation = { @@ -56,6 +59,7 @@ class ServerSecurityAlertPolicy(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'state': {'required': True}, + 'creation_time': {'readonly': True}, } _attribute_map = { @@ -69,6 +73,7 @@ class ServerSecurityAlertPolicy(ProxyResource): '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, **kwargs): @@ -80,3 +85,4 @@ def __init__(self, **kwargs): self.storage_endpoint = kwargs.get('storage_endpoint', None) self.storage_account_access_key = kwargs.get('storage_account_access_key', None) self.retention_days = kwargs.get('retention_days', None) + self.creation_time = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_paged.py new file mode 100644 index 000000000000..3a8836b45245 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ServerSecurityAlertPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ServerSecurityAlertPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ServerSecurityAlertPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(ServerSecurityAlertPolicyPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py index 5ae9c099f3d5..38c0c87b0372 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_security_alert_policy_py3.py @@ -27,7 +27,8 @@ class ServerSecurityAlertPolicy(ProxyResource): :ivar type: Resource type. :vartype type: str :param state: Required. Specifies the state of the policy, whether it is - enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled' + enabled or disabled or a policy has not been applied yet on the specific + database. Possible values include: 'New', 'Enabled', 'Disabled' :type state: str or ~azure.mgmt.sql.models.SecurityAlertPolicyState :param disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, @@ -49,6 +50,8 @@ class ServerSecurityAlertPolicy(ProxyResource): :param retention_days: Specifies the number of days to keep in the Threat Detection audit logs. :type retention_days: int + :ivar creation_time: Specifies the UTC creation time of the policy. + :vartype creation_time: datetime """ _validation = { @@ -56,6 +59,7 @@ class ServerSecurityAlertPolicy(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'state': {'required': True}, + 'creation_time': {'readonly': True}, } _attribute_map = { @@ -69,6 +73,7 @@ class ServerSecurityAlertPolicy(ProxyResource): '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, disabled_alerts=None, email_addresses=None, email_account_admins: bool=None, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, **kwargs) -> None: @@ -80,3 +85,4 @@ def __init__(self, *, state, disabled_alerts=None, email_addresses=None, email_a self.storage_endpoint = storage_endpoint self.storage_account_access_key = storage_account_access_key self.retention_days = retention_days + self.creation_time = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_vulnerability_assessment.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_vulnerability_assessment.py new file mode 100644 index 000000000000..eecad7a9b04d --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_vulnerability_assessment.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class ServerVulnerabilityAssessment(ProxyResource): + """A server vulnerability assessment. + + 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 + :param storage_container_path: Required. A blob storage container path to + hold the scan results (e.g. + https://myStorage.blob.core.windows.net/VaScans/). + :type storage_container_path: str + :param 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. + :type storage_container_sas_key: str + :param 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. + :type storage_account_access_key: str + :param recurring_scans: The recurring scans settings + :type recurring_scans: + ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'storage_container_path': {'required': 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, **kwargs): + super(ServerVulnerabilityAssessment, self).__init__(**kwargs) + self.storage_container_path = kwargs.get('storage_container_path', None) + self.storage_container_sas_key = kwargs.get('storage_container_sas_key', None) + self.storage_account_access_key = kwargs.get('storage_account_access_key', None) + self.recurring_scans = kwargs.get('recurring_scans', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_vulnerability_assessment_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_vulnerability_assessment_paged.py new file mode 100644 index 000000000000..43c1a3b65779 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_vulnerability_assessment_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ServerVulnerabilityAssessmentPaged(Paged): + """ + A paging container for iterating over a list of :class:`ServerVulnerabilityAssessment ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ServerVulnerabilityAssessment]'} + } + + def __init__(self, *args, **kwargs): + + super(ServerVulnerabilityAssessmentPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_vulnerability_assessment_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_vulnerability_assessment_py3.py new file mode 100644 index 000000000000..bb42c3866a3f --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_vulnerability_assessment_py3.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource_py3 import ProxyResource + + +class ServerVulnerabilityAssessment(ProxyResource): + """A server vulnerability assessment. + + 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 + :param storage_container_path: Required. A blob storage container path to + hold the scan results (e.g. + https://myStorage.blob.core.windows.net/VaScans/). + :type storage_container_path: str + :param 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. + :type storage_container_sas_key: str + :param 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. + :type storage_account_access_key: str + :param recurring_scans: The recurring scans settings + :type recurring_scans: + ~azure.mgmt.sql.models.VulnerabilityAssessmentRecurringScansProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'storage_container_path': {'required': 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: str, storage_container_sas_key: str=None, storage_account_access_key: str=None, recurring_scans=None, **kwargs) -> None: + super(ServerVulnerabilityAssessment, self).__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 diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py index 90b01d122079..de1d73caf27c 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py @@ -325,6 +325,13 @@ class IdentityType(str, Enum): system_assigned = "SystemAssigned" +class ManagedInstanceProxyOverride(str, Enum): + + proxy = "Proxy" + redirect = "Redirect" + default = "Default" + + class OperationOrigin(str, Enum): user = "user" @@ -486,6 +493,7 @@ class ManagedDatabaseStatus(str, Enum): shutdown = "Shutdown" creating = "Creating" inaccessible = "Inaccessible" + updating = "Updating" class CatalogCollationType(str, Enum): @@ -499,6 +507,7 @@ class ManagedDatabaseCreateMode(str, Enum): default = "Default" restore_external_backup = "RestoreExternalBackup" point_in_time_restore = "PointInTimeRestore" + recovery = "Recovery" class AutomaticTuningServerMode(str, Enum): @@ -663,6 +672,12 @@ class VulnerabilityAssessmentPolicyBaselineName(str, Enum): default = "default" +class SensitivityLabelSource(str, Enum): + + current = "current" + recommended = "recommended" + + class CapabilityGroup(str, Enum): supported_editions = "supportedEditions" diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster.py b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster.py new file mode 100644 index 000000000000..a3c9dd04abca --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .tracked_resource import TrackedResource + + +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 + :param location: Required. Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar subnet_id: Subnet resource ID for the virtual cluster. + :vartype subnet_id: str + :param family: If the service has different generations of hardware, for + the same SKU, then that can be captured here. + :type family: 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'}, + 'family': {'key': 'properties.family', 'type': 'str'}, + 'child_resources': {'key': 'properties.childResources', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(VirtualCluster, self).__init__(**kwargs) + self.subnet_id = None + self.family = kwargs.get('family', None) + self.child_resources = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_paged.py new file mode 100644 index 000000000000..865bbd5e9f86 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class VirtualClusterPaged(Paged): + """ + A paging container for iterating over a list of :class:`VirtualCluster ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[VirtualCluster]'} + } + + def __init__(self, *args, **kwargs): + + super(VirtualClusterPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_py3.py new file mode 100644 index 000000000000..e11fb730e2be --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_py3.py @@ -0,0 +1,66 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .tracked_resource_py3 import TrackedResource + + +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 + :param location: Required. Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar subnet_id: Subnet resource ID for the virtual cluster. + :vartype subnet_id: str + :param family: If the service has different generations of hardware, for + the same SKU, then that can be captured here. + :type family: 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'}, + 'family': {'key': 'properties.family', 'type': 'str'}, + 'child_resources': {'key': 'properties.childResources', 'type': '[str]'}, + } + + def __init__(self, *, location: str, tags=None, family: str=None, **kwargs) -> None: + super(VirtualCluster, self).__init__(location=location, tags=tags, **kwargs) + self.subnet_id = None + self.family = family + self.child_resources = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update.py b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update.py new file mode 100644 index 000000000000..c6604df3568a --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class VirtualClusterUpdate(Model): + """An update request for an Azure SQL Database virtual cluster. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar subnet_id: Subnet resource ID for the virtual cluster. + :vartype subnet_id: str + :param family: If the service has different generations of hardware, for + the same SKU, then that can be captured here. + :type family: str + :ivar child_resources: List of resources in this virtual cluster. + :vartype child_resources: list[str] + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'subnet_id': {'readonly': True}, + 'child_resources': {'readonly': True}, + } + + _attribute_map = { + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'family': {'key': 'properties.family', 'type': 'str'}, + 'child_resources': {'key': 'properties.childResources', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(VirtualClusterUpdate, self).__init__(**kwargs) + self.subnet_id = None + self.family = kwargs.get('family', None) + self.child_resources = None + self.tags = kwargs.get('tags', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update_py3.py new file mode 100644 index 000000000000..ec26101b089a --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update_py3.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class VirtualClusterUpdate(Model): + """An update request for an Azure SQL Database virtual cluster. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar subnet_id: Subnet resource ID for the virtual cluster. + :vartype subnet_id: str + :param family: If the service has different generations of hardware, for + the same SKU, then that can be captured here. + :type family: str + :ivar child_resources: List of resources in this virtual cluster. + :vartype child_resources: list[str] + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'subnet_id': {'readonly': True}, + 'child_resources': {'readonly': True}, + } + + _attribute_map = { + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'family': {'key': 'properties.family', 'type': 'str'}, + 'child_resources': {'key': 'properties.childResources', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, family: str=None, tags=None, **kwargs) -> None: + super(VirtualClusterUpdate, self).__init__(**kwargs) + self.subnet_id = None + self.family = family + self.child_resources = None + self.tags = tags diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index f3a922e1722d..3db410ac9cd7 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -42,6 +42,7 @@ from .sync_groups_operations import SyncGroupsOperations from .sync_members_operations import SyncMembersOperations from .subscription_usages_operations import SubscriptionUsagesOperations +from .virtual_clusters_operations import VirtualClustersOperations from .virtual_network_rules_operations import VirtualNetworkRulesOperations from .extended_database_blob_auditing_policies_operations import ExtendedDatabaseBlobAuditingPoliciesOperations from .extended_server_blob_auditing_policies_operations import ExtendedServerBlobAuditingPoliciesOperations @@ -62,10 +63,15 @@ from .backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations from .managed_backup_short_term_retention_policies_operations import ManagedBackupShortTermRetentionPoliciesOperations from .managed_databases_operations import ManagedDatabasesOperations +from .managed_restorable_dropped_database_backup_short_term_retention_policies_operations import ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations from .server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations +from .restorable_dropped_managed_databases_operations import RestorableDroppedManagedDatabasesOperations from .restore_points_operations import RestorePointsOperations +from .managed_database_security_alert_policies_operations import ManagedDatabaseSecurityAlertPoliciesOperations +from .managed_server_security_alert_policies_operations import ManagedServerSecurityAlertPoliciesOperations +from .sensitivity_labels_operations import SensitivityLabelsOperations from .database_operations import DatabaseOperations from .elastic_pool_operations import ElasticPoolOperations from .capabilities_operations import CapabilitiesOperations @@ -79,6 +85,10 @@ from .managed_instance_tde_certificates_operations import ManagedInstanceTdeCertificatesOperations from .managed_instance_keys_operations import ManagedInstanceKeysOperations from .managed_instance_encryption_protectors_operations import ManagedInstanceEncryptionProtectorsOperations +from .recoverable_managed_databases_operations import RecoverableManagedDatabasesOperations +from .managed_instance_vulnerability_assessments_operations import ManagedInstanceVulnerabilityAssessmentsOperations +from .server_vulnerability_assessments_operations import ServerVulnerabilityAssessmentsOperations +from .managed_database_sensitivity_labels_operations import ManagedDatabaseSensitivityLabelsOperations __all__ = [ 'RecoverableDatabasesOperations', @@ -114,6 +124,7 @@ 'SyncGroupsOperations', 'SyncMembersOperations', 'SubscriptionUsagesOperations', + 'VirtualClustersOperations', 'VirtualNetworkRulesOperations', 'ExtendedDatabaseBlobAuditingPoliciesOperations', 'ExtendedServerBlobAuditingPoliciesOperations', @@ -134,10 +145,15 @@ 'BackupLongTermRetentionPoliciesOperations', 'ManagedBackupShortTermRetentionPoliciesOperations', 'ManagedDatabasesOperations', + 'ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', 'ServerSecurityAlertPoliciesOperations', + 'RestorableDroppedManagedDatabasesOperations', 'RestorePointsOperations', + 'ManagedDatabaseSecurityAlertPoliciesOperations', + 'ManagedServerSecurityAlertPoliciesOperations', + 'SensitivityLabelsOperations', 'DatabaseOperations', 'ElasticPoolOperations', 'CapabilitiesOperations', @@ -151,4 +167,8 @@ 'ManagedInstanceTdeCertificatesOperations', 'ManagedInstanceKeysOperations', 'ManagedInstanceEncryptionProtectorsOperations', + 'RecoverableManagedDatabasesOperations', + 'ManagedInstanceVulnerabilityAssessmentsOperations', + 'ServerVulnerabilityAssessmentsOperations', + 'ManagedDatabaseSensitivityLabelsOperations', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/job_executions_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/job_executions_operations.py index e883a1b6187f..f874991f8510 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/job_executions_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/job_executions_operations.py @@ -551,7 +551,7 @@ def _create_or_update_initial( def create_or_update( self, resource_group_name, server_name, job_agent_name, job_name, job_execution_id, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates or updatess a job execution. + """Creates or updates a job execution. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py index 53882edcb02e..c803786f5ff3 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py @@ -45,9 +45,9 @@ def get( :param location_name: The location of the database. :type location_name: str - :param long_term_retention_server_name: + :param long_term_retention_server_name: The name of the server :type long_term_retention_server_name: str - :param long_term_retention_database_name: + :param long_term_retention_database_name: The name of the database :type long_term_retention_database_name: str :param backup_name: The backup name. :type backup_name: str @@ -153,9 +153,9 @@ def delete( :param location_name: The location of the database :type location_name: str - :param long_term_retention_server_name: + :param long_term_retention_server_name: The name of the server :type long_term_retention_server_name: str - :param long_term_retention_database_name: + :param long_term_retention_database_name: The name of the database :type long_term_retention_database_name: str :param backup_name: The backup name. :type backup_name: str @@ -200,9 +200,9 @@ def list_by_database( :param location_name: The location of the database :type location_name: str - :param long_term_retention_server_name: + :param long_term_retention_server_name: The name of the server :type long_term_retention_server_name: str - :param long_term_retention_database_name: + :param long_term_retention_database_name: The name of the database :type long_term_retention_database_name: str :param only_latest_per_database: Whether or not to only get the latest backup for each database. @@ -364,7 +364,7 @@ def list_by_server( :param location_name: The location of the database :type location_name: str - :param long_term_retention_server_name: + :param long_term_retention_server_name: The name of the server :type long_term_retention_server_name: str :param only_latest_per_database: Whether or not to only get the latest backup for each database. diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_security_alert_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_security_alert_policies_operations.py new file mode 100644 index 000000000000..87ba42c8193a --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_security_alert_policies_operations.py @@ -0,0 +1,266 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ManagedDatabaseSecurityAlertPoliciesOperations(object): + """ManagedDatabaseSecurityAlertPoliciesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar security_alert_policy_name: The name of the security alert policy. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.security_alert_policy_name = "default" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, managed_instance_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a managed database's security alert policy. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the managed database for which the + security alert policy is defined. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManagedDatabaseSecurityAlertPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ManagedDatabaseSecurityAlertPolicy or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedDatabaseSecurityAlertPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}'} + + def create_or_update( + self, resource_group_name, managed_instance_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a database's security alert policy. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the managed database for which the + security alert policy is defined. + :type database_name: str + :param parameters: The database security alert policy. + :type parameters: + ~azure.mgmt.sql.models.ManagedDatabaseSecurityAlertPolicy + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManagedDatabaseSecurityAlertPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ManagedDatabaseSecurityAlertPolicy or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ManagedDatabaseSecurityAlertPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedDatabaseSecurityAlertPolicy', response) + if response.status_code == 201: + deserialized = self._deserialize('ManagedDatabaseSecurityAlertPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}'} + + def list_by_database( + self, resource_group_name, managed_instance_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of managed database's security alert policies. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the managed database for which the + security alert policies are defined. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of + ManagedDatabaseSecurityAlertPolicy + :rtype: + ~azure.mgmt.sql.models.ManagedDatabaseSecurityAlertPolicyPaged[~azure.mgmt.sql.models.ManagedDatabaseSecurityAlertPolicy] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ManagedDatabaseSecurityAlertPolicyPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ManagedDatabaseSecurityAlertPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_sensitivity_labels_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_sensitivity_labels_operations.py new file mode 100644 index 000000000000..1b03564854f8 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_sensitivity_labels_operations.py @@ -0,0 +1,438 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ManagedDatabaseSensitivityLabelsOperations(object): + """ManagedDatabaseSensitivityLabelsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2018-06-01-preview". + :ivar sensitivity_label_source: The source of the sensitivity label. Constant value: "current". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + self.sensitivity_label_source = "current" + + self.config = config + + def get( + self, resource_group_name, managed_instance_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers=None, raw=False, **operation_config): + """Gets the sensitivity label of a given column. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param sensitivity_label_source: The source of the sensitivity label. + Possible values include: 'current', 'recommended' + :type sensitivity_label_source: str or + ~azure.mgmt.sql.models.SensitivityLabelSource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SensitivityLabel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.SensitivityLabel or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'SensitivityLabelSource'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SensitivityLabel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} + + def create_or_update( + self, resource_group_name, managed_instance_name, database_name, schema_name, table_name, column_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the sensitivity label of a given column. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param parameters: The column sensitivity label resource. + :type parameters: ~azure.mgmt.sql.models.SensitivityLabel + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SensitivityLabel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.SensitivityLabel or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("self.sensitivity_label_source", self.sensitivity_label_source, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'SensitivityLabel') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SensitivityLabel', response) + if response.status_code == 201: + deserialized = self._deserialize('SensitivityLabel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} + + def delete( + self, resource_group_name, managed_instance_name, database_name, schema_name, table_name, column_name, custom_headers=None, raw=False, **operation_config): + """Deletes the sensitivity label of a given column. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("self.sensitivity_label_source", self.sensitivity_label_source, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} + + def list_current_by_database( + self, resource_group_name, managed_instance_name, database_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets the sensitivity labels of a given database. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param filter: An OData filter expression that filters elements in the + collection. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SensitivityLabel + :rtype: + ~azure.mgmt.sql.models.SensitivityLabelPaged[~azure.mgmt.sql.models.SensitivityLabel] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_current_by_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_current_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels'} + + def list_recommended_by_database( + self, resource_group_name, managed_instance_name, database_name, skip_token=None, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets the sensitivity labels of a given database. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param skip_token: + :type skip_token: str + :param filter: An OData filter expression that filters elements in the + collection. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SensitivityLabel + :rtype: + ~azure.mgmt.sql.models.SensitivityLabelPaged[~azure.mgmt.sql.models.SensitivityLabel] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_recommended_by_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_recommended_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/recommendedSensitivityLabels'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_databases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_databases_operations.py index 8761e7adbc83..e2b8d02ae534 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_databases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_databases_operations.py @@ -417,7 +417,7 @@ def _delete_initial( def delete( self, resource_group_name, managed_instance_name, database_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Deletes the managed database. + """Deletes a managed database. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_vulnerability_assessments_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_vulnerability_assessments_operations.py new file mode 100644 index 000000000000..601294eb6777 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_vulnerability_assessments_operations.py @@ -0,0 +1,314 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ManagedInstanceVulnerabilityAssessmentsOperations(object): + """ManagedInstanceVulnerabilityAssessmentsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar vulnerability_assessment_name: The name of the vulnerability assessment. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.vulnerability_assessment_name = "default" + self.api_version = "2018-06-01-preview" + + self.config = config + + def get( + self, resource_group_name, managed_instance_name, custom_headers=None, raw=False, **operation_config): + """Gets the managed instance's vulnerability assessment. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance for + which the vulnerability assessment is defined. + :type managed_instance_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManagedInstanceVulnerabilityAssessment or ClientRawResponse + if raw=true + :rtype: ~azure.mgmt.sql.models.ManagedInstanceVulnerabilityAssessment + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedInstanceVulnerabilityAssessment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} + + def create_or_update( + self, resource_group_name, managed_instance_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the managed instance's vulnerability assessment. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance for + which the vulnerability assessment is defined. + :type managed_instance_name: str + :param parameters: The requested resource. + :type parameters: + ~azure.mgmt.sql.models.ManagedInstanceVulnerabilityAssessment + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManagedInstanceVulnerabilityAssessment or ClientRawResponse + if raw=true + :rtype: ~azure.mgmt.sql.models.ManagedInstanceVulnerabilityAssessment + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ManagedInstanceVulnerabilityAssessment') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedInstanceVulnerabilityAssessment', response) + if response.status_code == 201: + deserialized = self._deserialize('ManagedInstanceVulnerabilityAssessment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} + + def delete( + self, resource_group_name, managed_instance_name, custom_headers=None, raw=False, **operation_config): + """Removes the managed instance's vulnerability assessment. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance for + which the vulnerability assessment is defined. + :type managed_instance_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} + + def list_by_instance( + self, resource_group_name, managed_instance_name, custom_headers=None, raw=False, **operation_config): + """Gets the managed instance's vulnerability assessment policies. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance for + which the vulnerability assessments is defined. + :type managed_instance_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of + ManagedInstanceVulnerabilityAssessment + :rtype: + ~azure.mgmt.sql.models.ManagedInstanceVulnerabilityAssessmentPaged[~azure.mgmt.sql.models.ManagedInstanceVulnerabilityAssessment] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_instance.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ManagedInstanceVulnerabilityAssessmentPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ManagedInstanceVulnerabilityAssessmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_instance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_restorable_dropped_database_backup_short_term_retention_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_restorable_dropped_database_backup_short_term_retention_policies_operations.py new file mode 100644 index 000000000000..df833033a1b9 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_restorable_dropped_database_backup_short_term_retention_policies_operations.py @@ -0,0 +1,409 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations(object): + """ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar policy_name: The policy name. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.policy_name = "default" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, managed_instance_name, restorable_dropped_database_id, custom_headers=None, raw=False, **operation_config): + """Gets a dropped database's short term retention policy. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param restorable_dropped_database_id: + :type restorable_dropped_database_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManagedBackupShortTermRetentionPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'restorableDroppedDatabaseId': self._serialize.url("restorable_dropped_database_id", restorable_dropped_database_id, 'str'), + 'policyName': self._serialize.url("self.policy_name", self.policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedBackupShortTermRetentionPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}'} + + + def _create_or_update_initial( + self, resource_group_name, managed_instance_name, restorable_dropped_database_id, retention_days=None, custom_headers=None, raw=False, **operation_config): + parameters = models.ManagedBackupShortTermRetentionPolicy(retention_days=retention_days) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'restorableDroppedDatabaseId': self._serialize.url("restorable_dropped_database_id", restorable_dropped_database_id, 'str'), + 'policyName': self._serialize.url("self.policy_name", self.policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ManagedBackupShortTermRetentionPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedBackupShortTermRetentionPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, managed_instance_name, restorable_dropped_database_id, retention_days=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Sets a database's long term retention policy. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param restorable_dropped_database_id: + :type restorable_dropped_database_id: str + :param retention_days: The backup retention period in days. This is + how many days Point-in-Time Restore will be supported. + :type retention_days: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ManagedBackupShortTermRetentionPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + restorable_dropped_database_id=restorable_dropped_database_id, + retention_days=retention_days, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ManagedBackupShortTermRetentionPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}'} + + + def _update_initial( + self, resource_group_name, managed_instance_name, restorable_dropped_database_id, retention_days=None, custom_headers=None, raw=False, **operation_config): + parameters = models.ManagedBackupShortTermRetentionPolicy(retention_days=retention_days) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'restorableDroppedDatabaseId': self._serialize.url("restorable_dropped_database_id", restorable_dropped_database_id, 'str'), + 'policyName': self._serialize.url("self.policy_name", self.policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ManagedBackupShortTermRetentionPolicy') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedBackupShortTermRetentionPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, managed_instance_name, restorable_dropped_database_id, retention_days=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Sets a database's long term retention policy. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param restorable_dropped_database_id: + :type restorable_dropped_database_id: str + :param retention_days: The backup retention period in days. This is + how many days Point-in-Time Restore will be supported. + :type retention_days: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ManagedBackupShortTermRetentionPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + restorable_dropped_database_id=restorable_dropped_database_id, + retention_days=retention_days, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ManagedBackupShortTermRetentionPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}'} + + def list_by_restorable_dropped_database( + self, resource_group_name, managed_instance_name, restorable_dropped_database_id, custom_headers=None, raw=False, **operation_config): + """Gets a dropped database's short term retention policy list. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param restorable_dropped_database_id: + :type restorable_dropped_database_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of + ManagedBackupShortTermRetentionPolicy + :rtype: + ~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicyPaged[~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_restorable_dropped_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'restorableDroppedDatabaseId': self._serialize.url("restorable_dropped_database_id", restorable_dropped_database_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ManagedBackupShortTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ManagedBackupShortTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_restorable_dropped_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/managed_server_security_alert_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_server_security_alert_policies_operations.py new file mode 100644 index 000000000000..16ad81dac173 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/managed_server_security_alert_policies_operations.py @@ -0,0 +1,285 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class ManagedServerSecurityAlertPoliciesOperations(object): + """ManagedServerSecurityAlertPoliciesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar security_alert_policy_name: The name of the security alert policy. Constant value: "Default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.security_alert_policy_name = "Default" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, managed_instance_name, custom_headers=None, raw=False, **operation_config): + """Get a managed server's threat detection policy. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManagedServerSecurityAlertPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicy or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedServerSecurityAlertPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}'} + + + def _create_or_update_initial( + self, resource_group_name, managed_instance_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ManagedServerSecurityAlertPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedServerSecurityAlertPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, managed_instance_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates a threat detection policy. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param parameters: The managed server security alert policy. + :type parameters: + ~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicy + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ManagedServerSecurityAlertPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicy]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ManagedServerSecurityAlertPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}'} + + def list_by_instance( + self, resource_group_name, managed_instance_name, custom_headers=None, raw=False, **operation_config): + """Get the managed server's threat detection policies. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ManagedServerSecurityAlertPolicy + :rtype: + ~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicyPaged[~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicy] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_instance.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ManagedServerSecurityAlertPolicyPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ManagedServerSecurityAlertPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_instance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/recommended_elastic_pools_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/recommended_elastic_pools_operations.py index c6d80bad021c..960bd52a034b 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/recommended_elastic_pools_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/recommended_elastic_pools_operations.py @@ -39,7 +39,7 @@ def __init__(self, client, config, serializer, deserializer): def get( self, resource_group_name, server_name, recommended_elastic_pool_name, custom_headers=None, raw=False, **operation_config): - """Gets a recommented elastic pool. + """Gets a recommended elastic pool. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -179,7 +179,7 @@ def internal_paging(next_link=None, raw=False): def list_metrics( self, resource_group_name, server_name, recommended_elastic_pool_name, custom_headers=None, raw=False, **operation_config): - """Returns recommented elastic pool metrics. + """Returns recommended elastic pool metrics. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/recoverable_managed_databases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/recoverable_managed_databases_operations.py new file mode 100644 index 000000000000..d8bf8cbb6665 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/recoverable_managed_databases_operations.py @@ -0,0 +1,177 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class RecoverableManagedDatabasesOperations(object): + """RecoverableManagedDatabasesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2017-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-10-01-preview" + + self.config = config + + def list_by_instance( + self, resource_group_name, managed_instance_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of recoverable managed databases. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of RecoverableManagedDatabase + :rtype: + ~azure.mgmt.sql.models.RecoverableManagedDatabasePaged[~azure.mgmt.sql.models.RecoverableManagedDatabase] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_instance.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.RecoverableManagedDatabasePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RecoverableManagedDatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_instance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/recoverableDatabases'} + + def get( + self, resource_group_name, managed_instance_name, recoverable_database_name, custom_headers=None, raw=False, **operation_config): + """Gets a recoverable managed database. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param recoverable_database_name: + :type recoverable_database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RecoverableManagedDatabase or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.RecoverableManagedDatabase or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'recoverableDatabaseName': self._serialize.url("recoverable_database_name", recoverable_database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RecoverableManagedDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/recoverableDatabases/{recoverableDatabaseName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/restorable_dropped_managed_databases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/restorable_dropped_managed_databases_operations.py new file mode 100644 index 000000000000..58e81f79908a --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/restorable_dropped_managed_databases_operations.py @@ -0,0 +1,178 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class RestorableDroppedManagedDatabasesOperations(object): + """RestorableDroppedManagedDatabasesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-03-01-preview" + + self.config = config + + def list_by_instance( + self, resource_group_name, managed_instance_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of restorable dropped managed databases. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of RestorableDroppedManagedDatabase + :rtype: + ~azure.mgmt.sql.models.RestorableDroppedManagedDatabasePaged[~azure.mgmt.sql.models.RestorableDroppedManagedDatabase] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_instance.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.RestorableDroppedManagedDatabasePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RestorableDroppedManagedDatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_instance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases'} + + def get( + self, resource_group_name, managed_instance_name, restorable_dropped_database_id, custom_headers=None, raw=False, **operation_config): + """Gets a restorable dropped managed database. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param restorable_dropped_database_id: + :type restorable_dropped_database_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RestorableDroppedManagedDatabase or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.RestorableDroppedManagedDatabase or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'restorableDroppedDatabaseId': self._serialize.url("restorable_dropped_database_id", restorable_dropped_database_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RestorableDroppedManagedDatabase', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py new file mode 100644 index 000000000000..5be551f7fd12 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py @@ -0,0 +1,438 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class SensitivityLabelsOperations(object): + """SensitivityLabelsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + :ivar sensitivity_label_source: The source of the sensitivity label. Constant value: "current". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-03-01-preview" + self.sensitivity_label_source = "current" + + self.config = config + + def list_current_by_database( + self, resource_group_name, server_name, database_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets the sensitivity labels of a given database. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param filter: An OData filter expression that filters elements in the + collection. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SensitivityLabel + :rtype: + ~azure.mgmt.sql.models.SensitivityLabelPaged[~azure.mgmt.sql.models.SensitivityLabel] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_current_by_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_current_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels'} + + def list_recommended_by_database( + self, resource_group_name, server_name, database_name, skip_token=None, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets the sensitivity labels of a given database. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param skip_token: + :type skip_token: str + :param filter: An OData filter expression that filters elements in the + collection. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SensitivityLabel + :rtype: + ~azure.mgmt.sql.models.SensitivityLabelPaged[~azure.mgmt.sql.models.SensitivityLabel] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_recommended_by_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_recommended_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels'} + + def get( + self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers=None, raw=False, **operation_config): + """Gets the sensitivity label of a given column. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param sensitivity_label_source: The source of the sensitivity label. + Possible values include: 'current', 'recommended' + :type sensitivity_label_source: str or + ~azure.mgmt.sql.models.SensitivityLabelSource + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SensitivityLabel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.SensitivityLabel or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'SensitivityLabelSource'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SensitivityLabel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} + + def create_or_update( + self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the sensitivity label of a given column. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param parameters: The column sensitivity label resource. + :type parameters: ~azure.mgmt.sql.models.SensitivityLabel + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SensitivityLabel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.SensitivityLabel or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("self.sensitivity_label_source", self.sensitivity_label_source, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'SensitivityLabel') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SensitivityLabel', response) + if response.status_code == 201: + deserialized = self._deserialize('SensitivityLabel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} + + def delete( + self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers=None, raw=False, **operation_config): + """Deletes the sensitivity label of a given column. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("self.sensitivity_label_source", self.sensitivity_label_source, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py index 878dff3ed286..95e884990da2 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_security_alert_policies_operations.py @@ -209,3 +209,75 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}'} + + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Get the server's threat detection policies. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ServerSecurityAlertPolicy + :rtype: + ~azure.mgmt.sql.models.ServerSecurityAlertPolicyPaged[~azure.mgmt.sql.models.ServerSecurityAlertPolicy] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_server.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ServerSecurityAlertPolicyPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ServerSecurityAlertPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_vulnerability_assessments_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_vulnerability_assessments_operations.py new file mode 100644 index 000000000000..ffe8dd567342 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_vulnerability_assessments_operations.py @@ -0,0 +1,311 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ServerVulnerabilityAssessmentsOperations(object): + """ServerVulnerabilityAssessmentsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar vulnerability_assessment_name: The name of the vulnerability assessment. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.vulnerability_assessment_name = "default" + self.api_version = "2018-06-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Gets the server's vulnerability assessment. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server for which the vulnerability + assessment is defined. + :type server_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ServerVulnerabilityAssessment or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ServerVulnerabilityAssessment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ServerVulnerabilityAssessment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} + + def create_or_update( + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates the server's vulnerability assessment. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server for which the vulnerability + assessment is defined. + :type server_name: str + :param parameters: The requested resource. + :type parameters: ~azure.mgmt.sql.models.ServerVulnerabilityAssessment + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ServerVulnerabilityAssessment or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ServerVulnerabilityAssessment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ServerVulnerabilityAssessment') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ServerVulnerabilityAssessment', response) + if response.status_code == 201: + deserialized = self._deserialize('ServerVulnerabilityAssessment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} + + def delete( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Removes the server's vulnerability assessment. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server for which the vulnerability + assessment is defined. + :type server_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} + + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Lists the vulnerability assessment policies associated with a server. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ServerVulnerabilityAssessment + :rtype: + ~azure.mgmt.sql.models.ServerVulnerabilityAssessmentPaged[~azure.mgmt.sql.models.ServerVulnerabilityAssessment] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_server.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ServerVulnerabilityAssessmentPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ServerVulnerabilityAssessmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_clusters_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_clusters_operations.py new file mode 100644 index 000000000000..90a685e001a5 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_clusters_operations.py @@ -0,0 +1,426 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class VirtualClustersOperations(object): + """VirtualClustersOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-05-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Gets a list of all virtualClusters in the subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of VirtualCluster + :rtype: + ~azure.mgmt.sql.models.VirtualClusterPaged[~azure.mgmt.sql.models.VirtualCluster] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.VirtualClusterPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.VirtualClusterPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of virtual clusters in a resource group. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of VirtualCluster + :rtype: + ~azure.mgmt.sql.models.VirtualClusterPaged[~azure.mgmt.sql.models.VirtualCluster] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.VirtualClusterPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.VirtualClusterPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters'} + + def get( + self, resource_group_name, virtual_cluster_name, custom_headers=None, raw=False, **operation_config): + """Gets a virtual cluster. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param virtual_cluster_name: The name of the virtual cluster. + :type virtual_cluster_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: VirtualCluster or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.VirtualCluster or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualClusterName': self._serialize.url("virtual_cluster_name", virtual_cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualCluster', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}'} + + + def _delete_initial( + self, resource_group_name, virtual_cluster_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualClusterName': self._serialize.url("virtual_cluster_name", virtual_cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_cluster_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a virtual cluster. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param virtual_cluster_name: The name of the virtual cluster. + :type virtual_cluster_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_cluster_name=virtual_cluster_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}'} + + + def _update_initial( + self, resource_group_name, virtual_cluster_name, family=None, tags=None, custom_headers=None, raw=False, **operation_config): + parameters = models.VirtualClusterUpdate(family=family, tags=tags) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualClusterName': self._serialize.url("virtual_cluster_name", virtual_cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'VirtualClusterUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualCluster', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, virtual_cluster_name, family=None, tags=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates a virtual cluster. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param virtual_cluster_name: The name of the virtual cluster. + :type virtual_cluster_name: str + :param family: If the service has different generations of hardware, + for the same SKU, then that can be captured here. + :type family: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns VirtualCluster or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.VirtualCluster] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.VirtualCluster]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + virtual_cluster_name=virtual_cluster_name, + family=family, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('VirtualCluster', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index f34fc450d02a..aae1ce917e14 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -46,6 +46,7 @@ from .operations.sync_groups_operations import SyncGroupsOperations from .operations.sync_members_operations import SyncMembersOperations from .operations.subscription_usages_operations import SubscriptionUsagesOperations +from .operations.virtual_clusters_operations import VirtualClustersOperations from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations from .operations.extended_database_blob_auditing_policies_operations import ExtendedDatabaseBlobAuditingPoliciesOperations from .operations.extended_server_blob_auditing_policies_operations import ExtendedServerBlobAuditingPoliciesOperations @@ -66,10 +67,15 @@ from .operations.backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations from .operations.managed_backup_short_term_retention_policies_operations import ManagedBackupShortTermRetentionPoliciesOperations from .operations.managed_databases_operations import ManagedDatabasesOperations +from .operations.managed_restorable_dropped_database_backup_short_term_retention_policies_operations import ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations from .operations.server_security_alert_policies_operations import ServerSecurityAlertPoliciesOperations +from .operations.restorable_dropped_managed_databases_operations import RestorableDroppedManagedDatabasesOperations from .operations.restore_points_operations import RestorePointsOperations +from .operations.managed_database_security_alert_policies_operations import ManagedDatabaseSecurityAlertPoliciesOperations +from .operations.managed_server_security_alert_policies_operations import ManagedServerSecurityAlertPoliciesOperations +from .operations.sensitivity_labels_operations import SensitivityLabelsOperations from .operations.database_operations import DatabaseOperations from .operations.elastic_pool_operations import ElasticPoolOperations from .operations.capabilities_operations import CapabilitiesOperations @@ -83,6 +89,10 @@ from .operations.managed_instance_tde_certificates_operations import ManagedInstanceTdeCertificatesOperations from .operations.managed_instance_keys_operations import ManagedInstanceKeysOperations from .operations.managed_instance_encryption_protectors_operations import ManagedInstanceEncryptionProtectorsOperations +from .operations.recoverable_managed_databases_operations import RecoverableManagedDatabasesOperations +from .operations.managed_instance_vulnerability_assessments_operations import ManagedInstanceVulnerabilityAssessmentsOperations +from .operations.server_vulnerability_assessments_operations import ServerVulnerabilityAssessmentsOperations +from .operations.managed_database_sensitivity_labels_operations import ManagedDatabaseSensitivityLabelsOperations from . import models @@ -191,6 +201,8 @@ class SqlManagementClient(SDKClient): :vartype sync_members: azure.mgmt.sql.operations.SyncMembersOperations :ivar subscription_usages: SubscriptionUsages operations :vartype subscription_usages: azure.mgmt.sql.operations.SubscriptionUsagesOperations + :ivar virtual_clusters: VirtualClusters operations + :vartype virtual_clusters: azure.mgmt.sql.operations.VirtualClustersOperations :ivar virtual_network_rules: VirtualNetworkRules operations :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations :ivar extended_database_blob_auditing_policies: ExtendedDatabaseBlobAuditingPolicies operations @@ -231,14 +243,24 @@ class SqlManagementClient(SDKClient): :vartype managed_backup_short_term_retention_policies: azure.mgmt.sql.operations.ManagedBackupShortTermRetentionPoliciesOperations :ivar managed_databases: ManagedDatabases operations :vartype managed_databases: azure.mgmt.sql.operations.ManagedDatabasesOperations + :ivar managed_restorable_dropped_database_backup_short_term_retention_policies: ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies operations + :vartype managed_restorable_dropped_database_backup_short_term_retention_policies: azure.mgmt.sql.operations.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations :ivar server_automatic_tuning: ServerAutomaticTuning operations :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations :ivar server_security_alert_policies: ServerSecurityAlertPolicies operations :vartype server_security_alert_policies: azure.mgmt.sql.operations.ServerSecurityAlertPoliciesOperations + :ivar restorable_dropped_managed_databases: RestorableDroppedManagedDatabases operations + :vartype restorable_dropped_managed_databases: azure.mgmt.sql.operations.RestorableDroppedManagedDatabasesOperations :ivar restore_points: RestorePoints operations :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations + :ivar managed_database_security_alert_policies: ManagedDatabaseSecurityAlertPolicies operations + :vartype managed_database_security_alert_policies: azure.mgmt.sql.operations.ManagedDatabaseSecurityAlertPoliciesOperations + :ivar managed_server_security_alert_policies: ManagedServerSecurityAlertPolicies operations + :vartype managed_server_security_alert_policies: azure.mgmt.sql.operations.ManagedServerSecurityAlertPoliciesOperations + :ivar sensitivity_labels: SensitivityLabels operations + :vartype sensitivity_labels: azure.mgmt.sql.operations.SensitivityLabelsOperations :ivar database_operations: DatabaseOperations operations :vartype database_operations: azure.mgmt.sql.operations.DatabaseOperations :ivar elastic_pool_operations: ElasticPoolOperations operations @@ -265,6 +287,14 @@ class SqlManagementClient(SDKClient): :vartype managed_instance_keys: azure.mgmt.sql.operations.ManagedInstanceKeysOperations :ivar managed_instance_encryption_protectors: ManagedInstanceEncryptionProtectors operations :vartype managed_instance_encryption_protectors: azure.mgmt.sql.operations.ManagedInstanceEncryptionProtectorsOperations + :ivar recoverable_managed_databases: RecoverableManagedDatabases operations + :vartype recoverable_managed_databases: azure.mgmt.sql.operations.RecoverableManagedDatabasesOperations + :ivar managed_instance_vulnerability_assessments: ManagedInstanceVulnerabilityAssessments operations + :vartype managed_instance_vulnerability_assessments: azure.mgmt.sql.operations.ManagedInstanceVulnerabilityAssessmentsOperations + :ivar server_vulnerability_assessments: ServerVulnerabilityAssessments operations + :vartype server_vulnerability_assessments: azure.mgmt.sql.operations.ServerVulnerabilityAssessmentsOperations + :ivar managed_database_sensitivity_labels: ManagedDatabaseSensitivityLabels operations + :vartype managed_database_sensitivity_labels: azure.mgmt.sql.operations.ManagedDatabaseSensitivityLabelsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -351,6 +381,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.subscription_usages = SubscriptionUsagesOperations( self._client, self.config, self._serialize, self._deserialize) + self.virtual_clusters = VirtualClustersOperations( + self._client, self.config, self._serialize, self._deserialize) self.virtual_network_rules = VirtualNetworkRulesOperations( self._client, self.config, self._serialize, self._deserialize) self.extended_database_blob_auditing_policies = ExtendedDatabaseBlobAuditingPoliciesOperations( @@ -391,14 +423,24 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.managed_databases = ManagedDatabasesOperations( self._client, self.config, self._serialize, self._deserialize) + self.managed_restorable_dropped_database_backup_short_term_retention_policies = ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.server_automatic_tuning = ServerAutomaticTuningOperations( self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( self._client, self.config, self._serialize, self._deserialize) self.server_security_alert_policies = ServerSecurityAlertPoliciesOperations( self._client, self.config, self._serialize, self._deserialize) + self.restorable_dropped_managed_databases = RestorableDroppedManagedDatabasesOperations( + self._client, self.config, self._serialize, self._deserialize) self.restore_points = RestorePointsOperations( self._client, self.config, self._serialize, self._deserialize) + self.managed_database_security_alert_policies = ManagedDatabaseSecurityAlertPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_server_security_alert_policies = ManagedServerSecurityAlertPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.sensitivity_labels = SensitivityLabelsOperations( + self._client, self.config, self._serialize, self._deserialize) self.database_operations = DatabaseOperations( self._client, self.config, self._serialize, self._deserialize) self.elastic_pool_operations = ElasticPoolOperations( @@ -425,3 +467,11 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.managed_instance_encryption_protectors = ManagedInstanceEncryptionProtectorsOperations( self._client, self.config, self._serialize, self._deserialize) + self.recoverable_managed_databases = RecoverableManagedDatabasesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_instance_vulnerability_assessments = ManagedInstanceVulnerabilityAssessmentsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.server_vulnerability_assessments = ServerVulnerabilityAssessmentsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_database_sensitivity_labels = ManagedDatabaseSensitivityLabelsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-sql/azure/mgmt/sql/version.py b/azure-mgmt-sql/azure/mgmt/sql/version.py index afa3d545c718..9cb421fb381b 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/version.py +++ b/azure-mgmt-sql/azure/mgmt/sql/version.py @@ -9,5 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.11.0" - +VERSION = "0.12.0"