diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 27b60cc35442..335e80aaf953 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -10,8 +10,10 @@ # -------------------------------------------------------------------------- from .resource import Resource -from .tracked_resource import TrackedResource from .proxy_resource import ProxyResource +from .backup_long_term_retention_policy import BackupLongTermRetentionPolicy +from .backup_long_term_retention_vault import BackupLongTermRetentionVault +from .tracked_resource import TrackedResource from .restore_point import RestorePoint from .recoverable_database import RecoverableDatabase from .restorable_dropped_database import RestorableDroppedDatabase @@ -25,9 +27,9 @@ from .server_version_capability import ServerVersionCapability from .location_capabilities import LocationCapabilities from .server_connection_policy import ServerConnectionPolicy +from .database_security_alert_policy import DatabaseSecurityAlertPolicy from .data_masking_policy import DataMaskingPolicy from .data_masking_rule import DataMaskingRule -from .sub_resource import SubResource from .firewall_rule import FirewallRule from .geo_backup_policy import GeoBackupPolicy from .import_extension_request import ImportExtensionRequest @@ -43,6 +45,9 @@ from .operation import Operation from .operation_list_result import OperationListResult from .replication_link import ReplicationLink +from .server_azure_ad_administrator import ServerAzureADAdministrator +from .server_communication_link import ServerCommunicationLink +from .service_objective import ServiceObjective from .check_name_availability_request import CheckNameAvailabilityRequest from .check_name_availability_response import CheckNameAvailabilityResponse from .recommended_elastic_pool_metric import RecommendedElasticPoolMetric @@ -54,61 +59,62 @@ from .database import Database from .recommended_elastic_pool import RecommendedElasticPool from .elastic_pool import ElasticPool +from .elastic_pool_update import ElasticPoolUpdate from .elastic_pool_activity import ElasticPoolActivity from .elastic_pool_database_activity import ElasticPoolDatabaseActivity +from .database_update import DatabaseUpdate from .transparent_data_encryption_activity import TransparentDataEncryptionActivity -from .server_azure_ad_administrator import ServerAzureADAdministrator -from .sql_sub_resource import SqlSubResource -from .server_communication_link import ServerCommunicationLink -from .database_security_alert_policy import DatabaseSecurityAlertPolicy -from .backup_long_term_retention_vault import BackupLongTermRetentionVault -from .backup_long_term_retention_policy import BackupLongTermRetentionPolicy -from .service_objective import ServiceObjective from .server_usage import ServerUsage from .database_usage import DatabaseUsage from .database_blob_auditing_policy import DatabaseBlobAuditingPolicy +from .encryption_protector import EncryptionProtector from .failover_group_read_write_endpoint import FailoverGroupReadWriteEndpoint from .failover_group_read_only_endpoint import FailoverGroupReadOnlyEndpoint from .partner_info import PartnerInfo from .failover_group import FailoverGroup -from .virtual_network_rule import VirtualNetworkRule +from .failover_group_update import FailoverGroupUpdate +from .server_key import ServerKey from .resource_identity import ResourceIdentity from .server import Server -from .server_key import ServerKey -from .encryption_protector import EncryptionProtector +from .server_update import ServerUpdate +from .virtual_network_rule import VirtualNetworkRule from .restore_point_paged import RestorePointPaged +from .recoverable_database_paged import RecoverableDatabasePaged +from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .data_masking_rule_paged import DataMaskingRulePaged +from .firewall_rule_paged import FirewallRulePaged from .geo_backup_policy_paged import GeoBackupPolicyPaged from .metric_paged import MetricPaged from .metric_definition_paged import MetricDefinitionPaged -from .replication_link_paged import ReplicationLinkPaged from .database_paged import DatabasePaged -from .service_tier_advisor_paged import ServiceTierAdvisorPaged -from .transparent_data_encryption_activity_paged import TransparentDataEncryptionActivityPaged -from .database_usage_paged import DatabaseUsagePaged -from .recoverable_database_paged import RecoverableDatabasePaged -from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged +from .elastic_pool_paged import ElasticPoolPaged +from .replication_link_paged import ReplicationLinkPaged +from .server_azure_ad_administrator_paged import ServerAzureADAdministratorPaged +from .server_communication_link_paged import ServerCommunicationLinkPaged from .service_objective_paged import ServiceObjectivePaged -from .server_usage_paged import ServerUsagePaged from .server_paged import ServerPaged -from .encryption_protector_paged import EncryptionProtectorPaged -from .firewall_rule_paged import FirewallRulePaged -from .elastic_pool_paged import ElasticPoolPaged from .elastic_pool_activity_paged import ElasticPoolActivityPaged from .elastic_pool_database_activity_paged import ElasticPoolDatabaseActivityPaged from .recommended_elastic_pool_paged import RecommendedElasticPoolPaged from .recommended_elastic_pool_metric_paged import RecommendedElasticPoolMetricPaged -from .server_azure_ad_administrator_paged import ServerAzureADAdministratorPaged -from .server_communication_link_paged import ServerCommunicationLinkPaged +from .service_tier_advisor_paged import ServiceTierAdvisorPaged +from .transparent_data_encryption_activity_paged import TransparentDataEncryptionActivityPaged +from .server_usage_paged import ServerUsagePaged +from .database_usage_paged import DatabaseUsagePaged +from .encryption_protector_paged import EncryptionProtectorPaged from .failover_group_paged import FailoverGroupPaged -from .virtual_network_rule_paged import VirtualNetworkRulePaged from .server_key_paged import ServerKeyPaged +from .virtual_network_rule_paged import VirtualNetworkRulePaged from .sql_management_client_enums import ( + BackupLongTermRetentionPolicyState, RestorePointType, CapabilityStatus, MaxSizeUnits, PerformanceLevelUnit, ServerConnectionType, + SecurityAlertPolicyState, + SecurityAlertPolicyEmailAccountAdmins, + SecurityAlertPolicyUseServerDefault, DataMaskingState, DataMaskingRuleState, DataMaskingFunction, @@ -133,22 +139,21 @@ SampleName, ElasticPoolState, TransparentDataEncryptionActivityStatus, - SecurityAlertPolicyState, - SecurityAlertPolicyEmailAccountAdmins, - SecurityAlertPolicyUseServerDefault, - BackupLongTermRetentionPolicyState, BlobAuditingPolicyState, + ServerKeyType, ReadWriteEndpointFailoverPolicy, ReadOnlyEndpointFailoverPolicy, FailoverGroupReplicationRole, IdentityType, - ServerKeyType, + VirtualNetworkRuleState, ) __all__ = [ 'Resource', - 'TrackedResource', 'ProxyResource', + 'BackupLongTermRetentionPolicy', + 'BackupLongTermRetentionVault', + 'TrackedResource', 'RestorePoint', 'RecoverableDatabase', 'RestorableDroppedDatabase', @@ -162,9 +167,9 @@ 'ServerVersionCapability', 'LocationCapabilities', 'ServerConnectionPolicy', + 'DatabaseSecurityAlertPolicy', 'DataMaskingPolicy', 'DataMaskingRule', - 'SubResource', 'FirewallRule', 'GeoBackupPolicy', 'ImportExtensionRequest', @@ -180,6 +185,9 @@ 'Operation', 'OperationListResult', 'ReplicationLink', + 'ServerAzureADAdministrator', + 'ServerCommunicationLink', + 'ServiceObjective', 'CheckNameAvailabilityRequest', 'CheckNameAvailabilityResponse', 'RecommendedElasticPoolMetric', @@ -191,60 +199,61 @@ 'Database', 'RecommendedElasticPool', 'ElasticPool', + 'ElasticPoolUpdate', 'ElasticPoolActivity', 'ElasticPoolDatabaseActivity', + 'DatabaseUpdate', 'TransparentDataEncryptionActivity', - 'ServerAzureADAdministrator', - 'SqlSubResource', - 'ServerCommunicationLink', - 'DatabaseSecurityAlertPolicy', - 'BackupLongTermRetentionVault', - 'BackupLongTermRetentionPolicy', - 'ServiceObjective', 'ServerUsage', 'DatabaseUsage', 'DatabaseBlobAuditingPolicy', + 'EncryptionProtector', 'FailoverGroupReadWriteEndpoint', 'FailoverGroupReadOnlyEndpoint', 'PartnerInfo', 'FailoverGroup', - 'VirtualNetworkRule', + 'FailoverGroupUpdate', + 'ServerKey', 'ResourceIdentity', 'Server', - 'ServerKey', - 'EncryptionProtector', + 'ServerUpdate', + 'VirtualNetworkRule', 'RestorePointPaged', + 'RecoverableDatabasePaged', + 'RestorableDroppedDatabasePaged', 'DataMaskingRulePaged', + 'FirewallRulePaged', 'GeoBackupPolicyPaged', 'MetricPaged', 'MetricDefinitionPaged', - 'ReplicationLinkPaged', 'DatabasePaged', - 'ServiceTierAdvisorPaged', - 'TransparentDataEncryptionActivityPaged', - 'DatabaseUsagePaged', - 'RecoverableDatabasePaged', - 'RestorableDroppedDatabasePaged', + 'ElasticPoolPaged', + 'ReplicationLinkPaged', + 'ServerAzureADAdministratorPaged', + 'ServerCommunicationLinkPaged', 'ServiceObjectivePaged', - 'ServerUsagePaged', 'ServerPaged', - 'EncryptionProtectorPaged', - 'FirewallRulePaged', - 'ElasticPoolPaged', 'ElasticPoolActivityPaged', 'ElasticPoolDatabaseActivityPaged', 'RecommendedElasticPoolPaged', 'RecommendedElasticPoolMetricPaged', - 'ServerAzureADAdministratorPaged', - 'ServerCommunicationLinkPaged', + 'ServiceTierAdvisorPaged', + 'TransparentDataEncryptionActivityPaged', + 'ServerUsagePaged', + 'DatabaseUsagePaged', + 'EncryptionProtectorPaged', 'FailoverGroupPaged', - 'VirtualNetworkRulePaged', 'ServerKeyPaged', + 'VirtualNetworkRulePaged', + 'BackupLongTermRetentionPolicyState', 'RestorePointType', 'CapabilityStatus', 'MaxSizeUnits', 'PerformanceLevelUnit', 'ServerConnectionType', + 'SecurityAlertPolicyState', + 'SecurityAlertPolicyEmailAccountAdmins', + 'SecurityAlertPolicyUseServerDefault', 'DataMaskingState', 'DataMaskingRuleState', 'DataMaskingFunction', @@ -269,14 +278,11 @@ 'SampleName', 'ElasticPoolState', 'TransparentDataEncryptionActivityStatus', - 'SecurityAlertPolicyState', - 'SecurityAlertPolicyEmailAccountAdmins', - 'SecurityAlertPolicyUseServerDefault', - 'BackupLongTermRetentionPolicyState', 'BlobAuditingPolicyState', + 'ServerKeyType', 'ReadWriteEndpointFailoverPolicy', 'ReadOnlyEndpointFailoverPolicy', 'FailoverGroupReplicationRole', 'IdentityType', - 'ServerKeyType', + 'VirtualNetworkRuleState', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/data_masking_rule.py b/azure-mgmt-sql/azure/mgmt/sql/models/data_masking_rule.py index 8fbd4450720e..4d23c6e91788 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/data_masking_rule.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/data_masking_rule.py @@ -47,7 +47,7 @@ class DataMaskingRule(ProxyResource): applied. :type column_name: str :param masking_function: The masking function that is used for the data - masking rule. Possible values include: 'CCN', 'Default', 'Email', + masking rule. Possible values include: 'Default', 'CCN', 'Email', 'Number', 'SSN', 'Text' :type masking_function: str or :class:`DataMaskingFunction ` diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/data_masking_rule_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/data_masking_rule_paged.py index cc50ad6d8c48..4e1eed7b9f51 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/data_masking_rule_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/data_masking_rule_paged.py @@ -14,7 +14,7 @@ class DataMaskingRulePaged(Paged): """ - A paging container for iterating over a list of DataMaskingRule object + A paging container for iterating over a list of :class:`DataMaskingRule ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py index fa8f7650bc01..44c43b43a259 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py @@ -58,6 +58,7 @@ class DatabaseBlobAuditingPolicy(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'kind': {'readonly': True}, + 'state': {'required': True}, } _attribute_map = { @@ -74,7 +75,7 @@ class DatabaseBlobAuditingPolicy(ProxyResource): 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, } - def __init__(self, state=None, storage_endpoint=None, storage_account_access_key=None, retention_days=None, audit_actions_and_groups=None, storage_account_subscription_id=None, is_storage_secondary_key_in_use=None): + def __init__(self, state, storage_endpoint=None, storage_account_access_key=None, retention_days=None, audit_actions_and_groups=None, storage_account_subscription_id=None, is_storage_secondary_key_in_use=None): super(DatabaseBlobAuditingPolicy, self).__init__() self.kind = None self.state = state diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_paged.py index 0c87f9eb2439..bc3842934a39 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_paged.py @@ -14,7 +14,7 @@ class DatabasePaged(Paged): """ - A paging container for iterating over a list of Database object + A paging container for iterating over a list of :class:`Database ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_update.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_update.py new file mode 100644 index 000000000000..695e30104112 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_update.py @@ -0,0 +1,258 @@ +# 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 .resource import Resource + + +class DatabaseUpdate(Resource): + """Represents a database update. + + 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 tags: Resource tags. + :type tags: dict + :param collation: The collation of the database. If createMode is not + Default, this value is ignored. + :type collation: str + :ivar creation_date: The creation date of the database (ISO8601 format). + :vartype creation_date: datetime + :ivar containment_state: The containment state of the database. + :vartype containment_state: long + :ivar current_service_objective_id: The current service level objective ID + of the database. This is the ID of the service level objective that is + currently active. + :vartype current_service_objective_id: str + :ivar database_id: The ID of the database. + :vartype database_id: str + :ivar earliest_restore_date: This records the earliest start date and time + that restore is available for this database (ISO8601 format). + :vartype earliest_restore_date: datetime + :param create_mode: Specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. + sourceDatabaseId must be specified as the resource ID of the source + database. + OnlineSecondary/NonReadableSecondary: creates a database as a (readable or + nonreadable) secondary replica of an existing database. sourceDatabaseId + must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup + of an existing database. sourceDatabaseId must be specified as the + resource ID of the existing database, and restorePointInTime must be + specified. + Recovery: Creates a database by restoring a geo-replicated backup. + sourceDatabaseId must be specified as the recoverable database resource ID + to restore. + Restore: Creates a database by restoring a backup of a deleted database. + sourceDatabaseId must be specified. If sourceDatabaseId is the database's + original resource ID, then sourceDatabaseDeletionDate must be specified. + Otherwise sourceDatabaseId must be the restorable dropped database + resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime + may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a + long term retention vault. recoveryServicesRecoveryPointResourceId must be + specified as the recovery point resource ID. + Copy, NonReadableSecondary, OnlineSecondary and + RestoreLongTermRetentionBackup are not supported for DataWarehouse + edition. Possible values include: 'Copy', 'Default', + 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', + 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup' + :type create_mode: str or :class:`CreateMode + ` + :param source_database_id: Conditional. If createMode is Copy, + NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or + Restore, then this value is required. Specifies the resource ID of the + source database. If createMode is NonReadableSecondary or OnlineSecondary, + the name of the source database must be the same as the new database being + created. + :type source_database_id: str + :param source_database_deletion_date: Conditional. If createMode is + Restore and sourceDatabaseId is the deleted database's original resource + id when it existed (as opposed to its current restorable dropped database + id), then this value is required. Specifies the time that the database was + deleted. + :type source_database_deletion_date: datetime + :param restore_point_in_time: Conditional. If createMode is + PointInTimeRestore, this value is required. If createMode is Restore, this + value is optional. Specifies the point in time (ISO8601 format) of the + source database that will be restored to create the new database. Must be + greater than or equal to the source database's earliestRestoreDate value. + :type restore_point_in_time: datetime + :param recovery_services_recovery_point_resource_id: Conditional. If + createMode is RestoreLongTermRetentionBackup, then this value is required. + Specifies the resource ID of the recovery point to restore from. + :type recovery_services_recovery_point_resource_id: str + :param edition: The edition of the database. The DatabaseEditions + enumeration contains all the valid editions. If createMode is + NonReadableSecondary or OnlineSecondary, this value is ignored. To see + possible values, query the capabilities API + (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + referred to by operationId: "Capabilities_ListByLocation.". Possible + values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', + 'Stretch', 'DataWarehouse', 'System', 'System2' + :type edition: str or :class:`DatabaseEdition + ` + :param max_size_bytes: The max size of the database expressed in bytes. If + createMode is not Default, this value is ignored. To see possible values, + query the capabilities API + (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + referred to by operationId: "Capabilities_ListByLocation." + :type max_size_bytes: str + :param requested_service_objective_id: The configured service level + objective ID of the database. This is the service level objective that is + in the process of being applied to the database. Once successfully + updated, it will match the value of currentServiceObjectiveId property. If + requestedServiceObjectiveId and requestedServiceObjectiveName are both + updated, the value of requestedServiceObjectiveId overrides the value of + requestedServiceObjectiveName. To see possible values, query the + capabilities API + (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + referred to by operationId: "Capabilities_ListByLocation." + :type requested_service_objective_id: str + :param requested_service_objective_name: The name of the configured + service level objective of the database. This is the service level + objective that is in the process of being applied to the database. Once + successfully updated, it will match the value of serviceLevelObjective + property. To see possible values, query the capabilities API + (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + referred to by operationId: "Capabilities_ListByLocation.". Possible + values include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', + 'P6', 'P11', 'P15', 'System', 'System2', 'ElasticPool' + :type requested_service_objective_name: str or + :class:`ServiceObjectiveName ` + :ivar service_level_objective: The current service level objective of the + database. Possible values include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', + 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', 'System2', 'ElasticPool' + :vartype service_level_objective: str or :class:`ServiceObjectiveName + ` + :ivar status: The status of the database. + :vartype status: str + :param elastic_pool_name: The name of the elastic pool the database is in. + If elasticPoolName and requestedServiceObjectiveName are both updated, the + value of requestedServiceObjectiveName is ignored. Not supported for + DataWarehouse edition. + :type elastic_pool_name: str + :ivar default_secondary_location: The default secondary region for this + database. + :vartype default_secondary_location: str + :ivar service_tier_advisors: The list of service tier advisors for this + database. Expanded property + :vartype service_tier_advisors: list of :class:`ServiceTierAdvisor + ` + :ivar transparent_data_encryption: The transparent data encryption info + for this database. + :vartype transparent_data_encryption: list of + :class:`TransparentDataEncryption + ` + :ivar recommended_index: The recommended indices for this database. + :vartype recommended_index: list of :class:`RecommendedIndex + ` + :ivar failover_group_id: The resource identifier of the failover group + containing this database. + :vartype failover_group_id: str + :param read_scale: Conditional. If the database is a geo-secondary, + readScale indicates whether read-only connections are allowed to this + database or not. Not supported for DataWarehouse edition. Possible values + include: 'Enabled', 'Disabled' + :type read_scale: str or :class:`ReadScale + ` + :param sample_name: Indicates the name of the sample schema to apply when + creating this database. If createMode is not Default, this value is + ignored. Not supported for DataWarehouse edition. Possible values include: + 'AdventureWorksLT' + :type sample_name: str or :class:`SampleName + ` + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'creation_date': {'readonly': True}, + 'containment_state': {'readonly': True}, + 'current_service_objective_id': {'readonly': True}, + 'database_id': {'readonly': True}, + 'earliest_restore_date': {'readonly': True}, + 'service_level_objective': {'readonly': True}, + 'status': {'readonly': True}, + 'default_secondary_location': {'readonly': True}, + 'service_tier_advisors': {'readonly': True}, + 'transparent_data_encryption': {'readonly': True}, + 'recommended_index': {'readonly': True}, + 'failover_group_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'collation': {'key': 'properties.collation', 'type': 'str'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + 'containment_state': {'key': 'properties.containmentState', 'type': 'long'}, + 'current_service_objective_id': {'key': 'properties.currentServiceObjectiveId', 'type': 'str'}, + 'database_id': {'key': 'properties.databaseId', 'type': 'str'}, + 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, + 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, + 'source_database_id': {'key': 'properties.sourceDatabaseId', 'type': 'str'}, + 'source_database_deletion_date': {'key': 'properties.sourceDatabaseDeletionDate', 'type': 'iso-8601'}, + 'restore_point_in_time': {'key': 'properties.restorePointInTime', 'type': 'iso-8601'}, + 'recovery_services_recovery_point_resource_id': {'key': 'properties.recoveryServicesRecoveryPointResourceId', 'type': 'str'}, + 'edition': {'key': 'properties.edition', 'type': 'str'}, + 'max_size_bytes': {'key': 'properties.maxSizeBytes', 'type': 'str'}, + 'requested_service_objective_id': {'key': 'properties.requestedServiceObjectiveId', 'type': 'str'}, + 'requested_service_objective_name': {'key': 'properties.requestedServiceObjectiveName', 'type': 'str'}, + 'service_level_objective': {'key': 'properties.serviceLevelObjective', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'elastic_pool_name': {'key': 'properties.elasticPoolName', 'type': 'str'}, + 'default_secondary_location': {'key': 'properties.defaultSecondaryLocation', 'type': 'str'}, + 'service_tier_advisors': {'key': 'properties.serviceTierAdvisors', 'type': '[ServiceTierAdvisor]'}, + 'transparent_data_encryption': {'key': 'properties.transparentDataEncryption', 'type': '[TransparentDataEncryption]'}, + 'recommended_index': {'key': 'properties.recommendedIndex', 'type': '[RecommendedIndex]'}, + 'failover_group_id': {'key': 'properties.failoverGroupId', 'type': 'str'}, + 'read_scale': {'key': 'properties.readScale', 'type': 'ReadScale'}, + 'sample_name': {'key': 'properties.sampleName', 'type': 'str'}, + } + + def __init__(self, tags=None, collation=None, create_mode=None, source_database_id=None, source_database_deletion_date=None, restore_point_in_time=None, recovery_services_recovery_point_resource_id=None, edition=None, max_size_bytes=None, requested_service_objective_id=None, requested_service_objective_name=None, elastic_pool_name=None, read_scale=None, sample_name=None): + super(DatabaseUpdate, self).__init__() + self.tags = tags + self.collation = collation + self.creation_date = None + self.containment_state = None + self.current_service_objective_id = None + self.database_id = None + self.earliest_restore_date = None + self.create_mode = create_mode + self.source_database_id = source_database_id + self.source_database_deletion_date = source_database_deletion_date + self.restore_point_in_time = restore_point_in_time + self.recovery_services_recovery_point_resource_id = recovery_services_recovery_point_resource_id + self.edition = edition + self.max_size_bytes = max_size_bytes + self.requested_service_objective_id = requested_service_objective_id + self.requested_service_objective_name = requested_service_objective_name + self.service_level_objective = None + self.status = None + self.elastic_pool_name = elastic_pool_name + self.default_secondary_location = None + self.service_tier_advisors = None + self.transparent_data_encryption = None + self.recommended_index = None + self.failover_group_id = None + self.read_scale = read_scale + self.sample_name = sample_name diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_usage.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_usage.py index 45257ff4cfe9..e91f91cde3e9 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_usage.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_usage.py @@ -9,19 +9,17 @@ # regenerated. # -------------------------------------------------------------------------- -from .sub_resource import SubResource +from msrest.serialization import Model -class DatabaseUsage(SubResource): +class DatabaseUsage(Model): """The database usages. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Resource name + :ivar name: The name of the usage metric. :vartype name: str - :ivar id: The resource ID. - :vartype id: str :ivar resource_name: The name of the resource. :vartype resource_name: str :ivar display_name: The usage metric display name. @@ -39,7 +37,6 @@ class DatabaseUsage(SubResource): _validation = { 'name': {'readonly': True}, - 'id': {'readonly': True}, 'resource_name': {'readonly': True}, 'display_name': {'readonly': True}, 'current_value': {'readonly': True}, @@ -50,7 +47,6 @@ class DatabaseUsage(SubResource): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, 'resource_name': {'key': 'resourceName', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'current_value': {'key': 'currentValue', 'type': 'float'}, @@ -60,7 +56,7 @@ class DatabaseUsage(SubResource): } def __init__(self): - super(DatabaseUsage, self).__init__() + self.name = None self.resource_name = None self.display_name = None self.current_value = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_usage_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_usage_paged.py index 44b3e958b209..9641161225df 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_usage_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_usage_paged.py @@ -14,7 +14,7 @@ class DatabaseUsagePaged(Paged): """ - A paging container for iterating over a list of DatabaseUsage object + A paging container for iterating over a list of :class:`DatabaseUsage ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_activity_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_activity_paged.py index eecdf34f9217..729a44a94bb5 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_activity_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_activity_paged.py @@ -14,7 +14,7 @@ class ElasticPoolActivityPaged(Paged): """ - A paging container for iterating over a list of ElasticPoolActivity object + A paging container for iterating over a list of :class:`ElasticPoolActivity ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_database_activity_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_database_activity_paged.py index af9e7b760698..e4d12fc20b4a 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_database_activity_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_database_activity_paged.py @@ -14,7 +14,7 @@ class ElasticPoolDatabaseActivityPaged(Paged): """ - A paging container for iterating over a list of ElasticPoolDatabaseActivity object + A paging container for iterating over a list of :class:`ElasticPoolDatabaseActivity ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_paged.py index 0ffe1f4f1963..4c391860ee2d 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_paged.py @@ -14,7 +14,7 @@ class ElasticPoolPaged(Paged): """ - A paging container for iterating over a list of ElasticPool object + A paging container for iterating over a list of :class:`ElasticPool ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_update.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_update.py new file mode 100644 index 000000000000..2dce300efe9b --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_update.py @@ -0,0 +1,81 @@ +# 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 .resource import Resource + + +class ElasticPoolUpdate(Resource): + """Represents an elastic pool update. + + 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 tags: Resource tags. + :type tags: dict + :ivar creation_date: The creation date of the elastic pool (ISO8601 + format). + :vartype creation_date: datetime + :ivar state: The state of the elastic pool. Possible values include: + 'Creating', 'Ready', 'Disabled' + :vartype state: str or :class:`ElasticPoolState + ` + :param edition: The edition of the elastic pool. Possible values include: + 'Basic', 'Standard', 'Premium' + :type edition: str or :class:`ElasticPoolEdition + ` + :param dtu: The total shared DTU for the database elastic pool. + :type dtu: int + :param database_dtu_max: The maximum DTU any one database can consume. + :type database_dtu_max: int + :param database_dtu_min: The minimum DTU all databases are guaranteed. + :type database_dtu_min: int + :param storage_mb: Gets storage limit for the database elastic pool in MB. + :type storage_mb: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'creation_date': {'readonly': True}, + 'state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'edition': {'key': 'properties.edition', 'type': 'str'}, + 'dtu': {'key': 'properties.dtu', 'type': 'int'}, + 'database_dtu_max': {'key': 'properties.databaseDtuMax', 'type': 'int'}, + 'database_dtu_min': {'key': 'properties.databaseDtuMin', 'type': 'int'}, + 'storage_mb': {'key': 'properties.storageMB', 'type': 'int'}, + } + + def __init__(self, tags=None, edition=None, dtu=None, database_dtu_max=None, database_dtu_min=None, storage_mb=None): + super(ElasticPoolUpdate, self).__init__() + self.tags = tags + self.creation_date = None + self.state = None + self.edition = edition + self.dtu = dtu + self.database_dtu_max = database_dtu_max + self.database_dtu_min = database_dtu_min + self.storage_mb = storage_mb diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/encryption_protector.py b/azure-mgmt-sql/azure/mgmt/sql/models/encryption_protector.py index abf83f1630b9..28b7ccfc2132 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/encryption_protector.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/encryption_protector.py @@ -25,9 +25,8 @@ class EncryptionProtector(ProxyResource): :ivar type: Resource type. :vartype type: str :param kind: Kind of encryption protector. This is metadata used for the - Azure portal experience. Possible values include: '', 'azurekeyvault', - 'servicemanaged' - :type kind: str or :class:`enum ` + Azure portal experience. + :type kind: str :ivar location: Resource location. :vartype location: str :ivar subregion: Subregion of the encryption protector. @@ -51,6 +50,7 @@ class EncryptionProtector(ProxyResource): 'type': {'readonly': True}, 'location': {'readonly': True}, 'subregion': {'readonly': True}, + 'server_key_type': {'required': True}, 'uri': {'readonly': True}, 'thumbprint': {'readonly': True}, } @@ -68,7 +68,7 @@ class EncryptionProtector(ProxyResource): 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, } - def __init__(self, kind=None, server_key_name=None, server_key_type=None): + def __init__(self, server_key_type, kind=None, server_key_name=None): super(EncryptionProtector, self).__init__() self.kind = kind self.location = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/encryption_protector_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/encryption_protector_paged.py index 176cd2067fff..afb096561566 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/encryption_protector_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/encryption_protector_paged.py @@ -14,7 +14,7 @@ class EncryptionProtectorPaged(Paged): """ - A paging container for iterating over a list of EncryptionProtector object + A paging container for iterating over a list of :class:`EncryptionProtector ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/failover_group.py b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group.py index b2a70b6c07f0..b95e3251267b 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/failover_group.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group.py @@ -55,8 +55,10 @@ class FailoverGroup(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'readonly': True}, + 'read_write_endpoint': {'required': True}, 'replication_role': {'readonly': True}, 'replication_state': {'readonly': True}, + 'partner_servers': {'required': True}, } _attribute_map = { @@ -73,7 +75,7 @@ class FailoverGroup(ProxyResource): 'databases': {'key': 'properties.databases', 'type': '[str]'}, } - def __init__(self, tags=None, read_write_endpoint=None, read_only_endpoint=None, partner_servers=None, databases=None): + def __init__(self, read_write_endpoint, partner_servers, tags=None, read_only_endpoint=None, databases=None): super(FailoverGroup, self).__init__() self.location = None self.tags = tags diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_paged.py index 739bc93f915a..5bdb8723cdc3 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_paged.py @@ -14,7 +14,7 @@ class FailoverGroupPaged(Paged): """ - A paging container for iterating over a list of FailoverGroup object + A paging container for iterating over a list of :class:`FailoverGroup ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_read_write_endpoint.py b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_read_write_endpoint.py index d71732ca8146..fdfd1593b5be 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_read_write_endpoint.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_read_write_endpoint.py @@ -16,19 +16,27 @@ class FailoverGroupReadWriteEndpoint(Model): """Read-write endpoint of the failover group instance. :param failover_policy: Failover policy of the read-write endpoint for the - failover group. Possible values include: 'Manual', 'Automatic' + failover group. If failoverPolicy is Automatic then + failoverWithDataLossGracePeriodMinutes is required. Possible values + include: 'Manual', 'Automatic' :type failover_policy: str or :class:`ReadWriteEndpointFailoverPolicy ` :param failover_with_data_loss_grace_period_minutes: Grace period before - failover with data loss is attempted for the read-write endpoint. + failover with data loss is attempted for the read-write endpoint. If + failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is + required. :type failover_with_data_loss_grace_period_minutes: int """ + _validation = { + 'failover_policy': {'required': True}, + } + _attribute_map = { 'failover_policy': {'key': 'failoverPolicy', 'type': 'str'}, 'failover_with_data_loss_grace_period_minutes': {'key': 'failoverWithDataLossGracePeriodMinutes', 'type': 'int'}, } - def __init__(self, failover_policy=None, failover_with_data_loss_grace_period_minutes=None): + def __init__(self, failover_policy, failover_with_data_loss_grace_period_minutes=None): self.failover_policy = failover_policy self.failover_with_data_loss_grace_period_minutes = failover_with_data_loss_grace_period_minutes diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_update.py b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_update.py new file mode 100644 index 000000000000..55e4307dc2c2 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/failover_group_update.py @@ -0,0 +1,43 @@ +# 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 FailoverGroupUpdate(Model): + """A failover group update request. + + :param read_write_endpoint: Read-write endpoint of the failover group + instance. + :type read_write_endpoint: :class:`FailoverGroupReadWriteEndpoint + ` + :param read_only_endpoint: Read-only endpoint of the failover group + instance. + :type read_only_endpoint: :class:`FailoverGroupReadOnlyEndpoint + ` + :param databases: List of databases in the failover group. + :type databases: list of str + :param tags: Resource tags. + :type tags: dict + """ + + _attribute_map = { + 'read_write_endpoint': {'key': 'properties.readWriteEndpoint', 'type': 'FailoverGroupReadWriteEndpoint'}, + 'read_only_endpoint': {'key': 'properties.readOnlyEndpoint', 'type': 'FailoverGroupReadOnlyEndpoint'}, + 'databases': {'key': 'properties.databases', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, read_write_endpoint=None, read_only_endpoint=None, databases=None, tags=None): + self.read_write_endpoint = read_write_endpoint + self.read_only_endpoint = read_only_endpoint + self.databases = databases + self.tags = tags diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/firewall_rule.py b/azure-mgmt-sql/azure/mgmt/sql/models/firewall_rule.py index 69ffdb45c3e0..67c85e77292f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/firewall_rule.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/firewall_rule.py @@ -9,25 +9,25 @@ # regenerated. # -------------------------------------------------------------------------- -from .sub_resource import SubResource +from .proxy_resource import ProxyResource -class FirewallRule(SubResource): +class FirewallRule(ProxyResource): """Represents a server firewall rule. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Resource name - :vartype name: str - :ivar id: The resource ID. + :ivar id: Resource ID. :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str :ivar kind: Kind of server that contains this firewall rule. :vartype kind: str :ivar location: Location of the server that contains this firewall rule. :vartype location: str - :ivar type: Type of resource this is. - :vartype type: str :param start_ip_address: The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. @@ -39,21 +39,21 @@ class FirewallRule(SubResource): """ _validation = { - 'name': {'readonly': True}, 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, 'kind': {'readonly': True}, 'location': {'readonly': True}, - 'type': {'readonly': True}, 'start_ip_address': {'required': True}, 'end_ip_address': {'required': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, } @@ -62,6 +62,5 @@ def __init__(self, start_ip_address, end_ip_address): super(FirewallRule, self).__init__() self.kind = None self.location = None - self.type = None self.start_ip_address = start_ip_address self.end_ip_address = end_ip_address diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/firewall_rule_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/firewall_rule_paged.py index 90cd653ec5f8..07586a09287a 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/firewall_rule_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/firewall_rule_paged.py @@ -14,7 +14,7 @@ class FirewallRulePaged(Paged): """ - A paging container for iterating over a list of FirewallRule object + A paging container for iterating over a list of :class:`FirewallRule ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/geo_backup_policy_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/geo_backup_policy_paged.py index 19104e7f80ab..7a207daa100e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/geo_backup_policy_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/geo_backup_policy_paged.py @@ -14,7 +14,7 @@ class GeoBackupPolicyPaged(Paged): """ - A paging container for iterating over a list of GeoBackupPolicy object + A paging container for iterating over a list of :class:`GeoBackupPolicy ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/metric_definition_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/metric_definition_paged.py index 8771cfa7a53c..95a01ebf4e85 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/metric_definition_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/metric_definition_paged.py @@ -14,7 +14,7 @@ class MetricDefinitionPaged(Paged): """ - A paging container for iterating over a list of MetricDefinition object + A paging container for iterating over a list of :class:`MetricDefinition ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/metric_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/metric_paged.py index 83ecbca49e80..61aa43a2fced 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/metric_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/metric_paged.py @@ -14,7 +14,7 @@ class MetricPaged(Paged): """ - A paging container for iterating over a list of Metric object + A paging container for iterating over a list of :class:`Metric ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/metric_value.py b/azure-mgmt-sql/azure/mgmt/sql/models/metric_value.py index 6c4f0333299b..258055cd869f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/metric_value.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/metric_value.py @@ -9,19 +9,15 @@ # regenerated. # -------------------------------------------------------------------------- -from .sub_resource import SubResource +from msrest.serialization import Model -class MetricValue(SubResource): +class MetricValue(Model): """Represents database metrics. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Resource name - :vartype name: str - :ivar id: The resource ID. - :vartype id: str :ivar count: The number of values for the metric. :vartype count: float :ivar average: The average value of the metric. @@ -37,8 +33,6 @@ class MetricValue(SubResource): """ _validation = { - 'name': {'readonly': True}, - 'id': {'readonly': True}, 'count': {'readonly': True}, 'average': {'readonly': True}, 'maximum': {'readonly': True}, @@ -48,8 +42,6 @@ class MetricValue(SubResource): } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, 'count': {'key': 'count', 'type': 'float'}, 'average': {'key': 'average', 'type': 'float'}, 'maximum': {'key': 'maximum', 'type': 'float'}, @@ -59,7 +51,6 @@ class MetricValue(SubResource): } def __init__(self): - super(MetricValue, self).__init__() self.count = None self.average = None self.maximum = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/partner_info.py b/azure-mgmt-sql/azure/mgmt/sql/models/partner_info.py index 64fe959d1bd7..861b7583d8fe 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/partner_info.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/partner_info.py @@ -29,6 +29,7 @@ class PartnerInfo(Model): """ _validation = { + 'id': {'required': True}, 'location': {'readonly': True}, 'replication_role': {'readonly': True}, } @@ -39,7 +40,7 @@ class PartnerInfo(Model): 'replication_role': {'key': 'replicationRole', 'type': 'str'}, } - def __init__(self, id=None): + def __init__(self, id): self.id = id self.location = None self.replication_role = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_metric_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_metric_paged.py index 17f989b862af..a5106f989535 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_metric_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_metric_paged.py @@ -14,7 +14,7 @@ class RecommendedElasticPoolMetricPaged(Paged): """ - A paging container for iterating over a list of RecommendedElasticPoolMetric object + A paging container for iterating over a list of :class:`RecommendedElasticPoolMetric ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_paged.py index 312fcedfc946..ceb235126fbe 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_paged.py @@ -14,7 +14,7 @@ class RecommendedElasticPoolPaged(Paged): """ - A paging container for iterating over a list of RecommendedElasticPool object + A paging container for iterating over a list of :class:`RecommendedElasticPool ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_database_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_database_paged.py index e4c4ed1c7706..cf4cde8ae7e0 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_database_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/recoverable_database_paged.py @@ -14,7 +14,7 @@ class RecoverableDatabasePaged(Paged): """ - A paging container for iterating over a list of RecoverableDatabase object + A paging container for iterating over a list of :class:`RecoverableDatabase ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/replication_link.py b/azure-mgmt-sql/azure/mgmt/sql/models/replication_link.py index aea6e046979b..f052997841ba 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/replication_link.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/replication_link.py @@ -9,23 +9,23 @@ # regenerated. # -------------------------------------------------------------------------- -from .sub_resource import SubResource +from .proxy_resource import ProxyResource -class ReplicationLink(SubResource): +class ReplicationLink(ProxyResource): """Represents a database replication link. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Resource name - :vartype name: str - :ivar id: The resource ID. + :ivar id: Resource ID. :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str :ivar location: Location of the server that contains this firewall rule. :vartype location: str - :ivar type: Type of resource this is. - :vartype type: str :ivar is_termination_allowed: Legacy value indicating whether termination is allowed. Currently always returns true. :vartype is_termination_allowed: bool @@ -59,10 +59,10 @@ class ReplicationLink(SubResource): """ _validation = { - 'name': {'readonly': True}, 'id': {'readonly': True}, - 'location': {'readonly': True}, + 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'readonly': True}, 'is_termination_allowed': {'readonly': True}, 'replication_mode': {'readonly': True}, 'partner_server': {'readonly': True}, @@ -76,10 +76,10 @@ class ReplicationLink(SubResource): } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, 'is_termination_allowed': {'key': 'properties.isTerminationAllowed', 'type': 'bool'}, 'replication_mode': {'key': 'properties.replicationMode', 'type': 'str'}, 'partner_server': {'key': 'properties.partnerServer', 'type': 'str'}, @@ -95,7 +95,6 @@ class ReplicationLink(SubResource): def __init__(self): super(ReplicationLink, self).__init__() self.location = None - self.type = None self.is_termination_allowed = None self.replication_mode = None self.partner_server = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/replication_link_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/replication_link_paged.py index a76df47020e8..18b96c9e0e3c 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/replication_link_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/replication_link_paged.py @@ -14,7 +14,7 @@ class ReplicationLinkPaged(Paged): """ - A paging container for iterating over a list of ReplicationLink object + A paging container for iterating over a list of :class:`ReplicationLink ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_database_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_database_paged.py index 67a9aad834fe..b0eb93010942 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_database_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/restorable_dropped_database_paged.py @@ -14,7 +14,7 @@ class RestorableDroppedDatabasePaged(Paged): """ - A paging container for iterating over a list of RestorableDroppedDatabase object + A paging container for iterating over a list of :class:`RestorableDroppedDatabase ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/restore_point_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/restore_point_paged.py index 12fbd752f30b..b77cde666dd0 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/restore_point_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/restore_point_paged.py @@ -14,7 +14,7 @@ class RestorePointPaged(Paged): """ - A paging container for iterating over a list of RestorePoint object + A paging container for iterating over a list of :class:`RestorePoint ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server.py b/azure-mgmt-sql/azure/mgmt/sql/models/server.py index 4f5e4f2401a7..910e88550524 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server.py @@ -32,9 +32,8 @@ class Server(TrackedResource): :type identity: :class:`ResourceIdentity ` :ivar kind: Kind of sql server. This is metadata used for the Azure portal - experience. Possible values include: '', 'v2.0', 'v12.0', 'user', - 'system', 'datawarehouse' - :vartype kind: str or :class:`enum ` + experience. + :vartype kind: str :param administrator_login: Administrator username for the server. Once created it cannot be changed. :type administrator_login: str diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator.py index 29a8f3da46da..306f20891caa 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator.py @@ -9,19 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- -from .sql_sub_resource import SqlSubResource +from .proxy_resource import ProxyResource -class ServerAzureADAdministrator(SqlSubResource): +class ServerAzureADAdministrator(ProxyResource): """An server Active Directory Administrator. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Resource name - :vartype name: str - :ivar id: Resource Id + :ivar id: Resource ID. :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str :ivar administrator_type: The type of administrator. Default value: "ActiveDirectory" . :vartype administrator_type: str @@ -34,8 +36,9 @@ class ServerAzureADAdministrator(SqlSubResource): """ _validation = { - 'name': {'readonly': True}, 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, 'administrator_type': {'required': True, 'constant': True}, 'login': {'required': True}, 'sid': {'required': True}, @@ -43,8 +46,9 @@ class ServerAzureADAdministrator(SqlSubResource): } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'administrator_type': {'key': 'properties.administratorType', 'type': 'str'}, 'login': {'key': 'properties.login', 'type': 'str'}, 'sid': {'key': 'properties.sid', 'type': 'str'}, diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator_paged.py index a7a532069db6..519adc226385 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_azure_ad_administrator_paged.py @@ -14,7 +14,7 @@ class ServerAzureADAdministratorPaged(Paged): """ - A paging container for iterating over a list of ServerAzureADAdministrator object + A paging container for iterating over a list of :class:`ServerAzureADAdministrator ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_communication_link_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_communication_link_paged.py index 5bc576fcfe72..6e2fef5d7ce0 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_communication_link_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_communication_link_paged.py @@ -14,7 +14,7 @@ class ServerCommunicationLinkPaged(Paged): """ - A paging container for iterating over a list of ServerCommunicationLink object + A paging container for iterating over a list of :class:`ServerCommunicationLink ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_key.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_key.py index 2866e9efa75a..a9ca69615a35 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_key.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_key.py @@ -25,9 +25,8 @@ class ServerKey(ProxyResource): :ivar type: Resource type. :vartype type: str :param kind: Kind of encryption protector. This is metadata used for the - Azure portal experience. Possible values include: '', 'azurekeyvault', - 'servicemanaged' - :type kind: str or :class:`enum ` + Azure portal experience. + :type kind: str :ivar location: Resource location. :vartype location: str :ivar subregion: Subregion of the server key. @@ -51,6 +50,7 @@ class ServerKey(ProxyResource): 'type': {'readonly': True}, 'location': {'readonly': True}, 'subregion': {'readonly': True}, + 'server_key_type': {'required': True}, } _attribute_map = { @@ -66,7 +66,7 @@ class ServerKey(ProxyResource): 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, } - def __init__(self, kind=None, server_key_type=None, uri=None, thumbprint=None, creation_date=None): + def __init__(self, server_key_type, kind=None, uri=None, thumbprint=None, creation_date=None): super(ServerKey, self).__init__() self.kind = kind self.location = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_key_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_key_paged.py index 22bb6a5830e2..1d5e262c9c89 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_key_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_key_paged.py @@ -14,7 +14,7 @@ class ServerKeyPaged(Paged): """ - A paging container for iterating over a list of ServerKey object + A paging container for iterating over a list of :class:`ServerKey ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_paged.py index bd1b9cf5c28e..2d6e6fe0e114 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_paged.py @@ -14,7 +14,7 @@ class ServerPaged(Paged): """ - A paging container for iterating over a list of Server object + A paging container for iterating over a list of :class:`Server ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_update.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_update.py new file mode 100644 index 000000000000..ff084ab979fb --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_update.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 msrest.serialization import Model + + +class ServerUpdate(Model): + """An update request for an Azure SQL Database server. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param administrator_login: Administrator username for the server. Once + created it cannot be changed. + :type administrator_login: str + :param administrator_login_password: The administrator login password + (required for server creation). + :type administrator_login_password: str + :param version: The version of the server. + :type version: str + :ivar state: The state of the server. + :vartype state: str + :ivar fully_qualified_domain_name: The fully qualified domain name of the + server. + :vartype fully_qualified_domain_name: str + :param tags: Resource tags. + :type tags: dict + """ + + _validation = { + 'state': {'readonly': True}, + 'fully_qualified_domain_name': {'readonly': True}, + } + + _attribute_map = { + 'administrator_login': {'key': 'properties.administratorLogin', 'type': 'str'}, + 'administrator_login_password': {'key': 'properties.administratorLoginPassword', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'fully_qualified_domain_name': {'key': 'properties.fullyQualifiedDomainName', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, administrator_login=None, administrator_login_password=None, version=None, tags=None): + self.administrator_login = administrator_login + self.administrator_login_password = administrator_login_password + self.version = version + self.state = None + self.fully_qualified_domain_name = None + self.tags = tags diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_usage_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_usage_paged.py index 5f73ceb81869..688d3b408383 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_usage_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_usage_paged.py @@ -14,7 +14,7 @@ class ServerUsagePaged(Paged): """ - A paging container for iterating over a list of ServerUsage object + A paging container for iterating over a list of :class:`ServerUsage ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/service_objective.py b/azure-mgmt-sql/azure/mgmt/sql/models/service_objective.py index 61b40ef2e8d1..8fc2b8a95300 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/service_objective.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/service_objective.py @@ -9,19 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- -from .sub_resource import SubResource +from .proxy_resource import ProxyResource -class ServiceObjective(SubResource): +class ServiceObjective(ProxyResource): """Represents a database service objective. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Resource name - :vartype name: str - :ivar id: The resource ID. + :ivar id: Resource ID. :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str :ivar service_objective_name: The name for the service objective. :vartype service_objective_name: str :ivar is_default: Gets whether the service level objective is the default @@ -37,8 +39,9 @@ class ServiceObjective(SubResource): """ _validation = { - 'name': {'readonly': True}, 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, 'service_objective_name': {'readonly': True}, 'is_default': {'readonly': True}, 'is_system': {'readonly': True}, @@ -47,8 +50,9 @@ class ServiceObjective(SubResource): } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'service_objective_name': {'key': 'properties.serviceObjectiveName', 'type': 'str'}, 'is_default': {'key': 'properties.isDefault', 'type': 'bool'}, 'is_system': {'key': 'properties.isSystem', 'type': 'bool'}, diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/service_objective_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/service_objective_paged.py index e6d0071271ed..7afe16629d1d 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/service_objective_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/service_objective_paged.py @@ -14,7 +14,7 @@ class ServiceObjectivePaged(Paged): """ - A paging container for iterating over a list of ServiceObjective object + A paging container for iterating over a list of :class:`ServiceObjective ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/service_tier_advisor.py b/azure-mgmt-sql/azure/mgmt/sql/models/service_tier_advisor.py index 1d5d417ef1a7..923caa81b035 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/service_tier_advisor.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/service_tier_advisor.py @@ -9,19 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- -from .sub_resource import SubResource +from .proxy_resource import ProxyResource -class ServiceTierAdvisor(SubResource): +class ServiceTierAdvisor(ProxyResource): """Represents a Service Tier Advisor. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Resource name - :vartype name: str - :ivar id: The resource ID. + :ivar id: Resource ID. :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str :ivar observation_period_start: The observation period start (ISO8601 format). :vartype observation_period_start: datetime @@ -83,8 +85,9 @@ class ServiceTierAdvisor(SubResource): """ _validation = { - 'name': {'readonly': True}, 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, 'observation_period_start': {'readonly': True}, 'observation_period_end': {'readonly': True}, 'active_time_ratio': {'readonly': True}, @@ -107,8 +110,9 @@ class ServiceTierAdvisor(SubResource): } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'observation_period_start': {'key': 'properties.observationPeriodStart', 'type': 'iso-8601'}, 'observation_period_end': {'key': 'properties.observationPeriodEnd', 'type': 'iso-8601'}, 'active_time_ratio': {'key': 'properties.activeTimeRatio', 'type': 'float'}, diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/service_tier_advisor_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/service_tier_advisor_paged.py index 1f6b99f4ccd5..8275906eb639 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/service_tier_advisor_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/service_tier_advisor_paged.py @@ -14,7 +14,7 @@ class ServiceTierAdvisorPaged(Paged): """ - A paging container for iterating over a list of ServiceTierAdvisor object + A paging container for iterating over a list of :class:`ServiceTierAdvisor ` object """ _attribute_map = { 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 8bb63dd55064..ed42196d6fe8 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 @@ -12,6 +12,12 @@ from enum import Enum +class BackupLongTermRetentionPolicyState(Enum): + + disabled = "Disabled" + enabled = "Enabled" + + class RestorePointType(Enum): discrete = "DISCRETE" @@ -46,6 +52,25 @@ class ServerConnectionType(Enum): redirect = "Redirect" +class SecurityAlertPolicyState(Enum): + + new = "New" + enabled = "Enabled" + disabled = "Disabled" + + +class SecurityAlertPolicyEmailAccountAdmins(Enum): + + enabled = "Enabled" + disabled = "Disabled" + + +class SecurityAlertPolicyUseServerDefault(Enum): + + enabled = "Enabled" + disabled = "Disabled" + + class DataMaskingState(Enum): disabled = "Disabled" @@ -60,8 +85,8 @@ class DataMaskingRuleState(Enum): class DataMaskingFunction(Enum): - ccn = "CCN" default = "Default" + ccn = "CCN" email = "Email" number = "Number" ssn = "SSN" @@ -251,35 +276,16 @@ class TransparentDataEncryptionActivityStatus(Enum): decrypting = "Decrypting" -class SecurityAlertPolicyState(Enum): - - new = "New" - enabled = "Enabled" - disabled = "Disabled" - - -class SecurityAlertPolicyEmailAccountAdmins(Enum): - - enabled = "Enabled" - disabled = "Disabled" - - -class SecurityAlertPolicyUseServerDefault(Enum): +class BlobAuditingPolicyState(Enum): enabled = "Enabled" disabled = "Disabled" -class BackupLongTermRetentionPolicyState(Enum): - - disabled = "Disabled" - enabled = "Enabled" - - -class BlobAuditingPolicyState(Enum): +class ServerKeyType(Enum): - enabled = "Enabled" - disabled = "Disabled" + service_managed = "ServiceManaged" + azure_key_vault = "AzureKeyVault" class ReadWriteEndpointFailoverPolicy(Enum): @@ -305,7 +311,10 @@ class IdentityType(Enum): system_assigned = "SystemAssigned" -class ServerKeyType(Enum): +class VirtualNetworkRuleState(Enum): - service_managed = "ServiceManaged" - azure_key_vault = "AzureKeyVault" + initializing = "Initializing" + in_progress = "InProgress" + ready = "Ready" + deleting = "Deleting" + unknown = "Unknown" diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sql_sub_resource.py b/azure-mgmt-sql/azure/mgmt/sql/models/sql_sub_resource.py deleted file mode 100644 index f4625c6bbcb7..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sql_sub_resource.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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 SqlSubResource(Model): - """Subresource properties. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar name: Resource name - :vartype name: str - :ivar id: Resource Id - :vartype id: str - """ - - _validation = { - 'name': {'readonly': True}, - 'id': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__(self): - self.name = None - self.id = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sub_resource.py b/azure-mgmt-sql/azure/mgmt/sql/models/sub_resource.py deleted file mode 100644 index fa3edc4e01f1..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sub_resource.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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 SubResource(Model): - """Subresource properties. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar name: Resource name - :vartype name: str - :ivar id: The resource ID. - :vartype id: str - """ - - _validation = { - 'name': {'readonly': True}, - 'id': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__(self): - self.name = None - self.id = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/transparent_data_encryption.py b/azure-mgmt-sql/azure/mgmt/sql/models/transparent_data_encryption.py index 022ff5c129d0..e2fdd93a2fe0 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/transparent_data_encryption.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/transparent_data_encryption.py @@ -9,19 +9,23 @@ # regenerated. # -------------------------------------------------------------------------- -from .sub_resource import SubResource +from .proxy_resource import ProxyResource -class TransparentDataEncryption(SubResource): - """Represents a database transparent data encryption . +class TransparentDataEncryption(ProxyResource): + """Represents a database transparent data encryption configuration. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Resource name - :vartype name: str - :ivar id: The resource ID. + :ivar id: Resource ID. :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str :param status: The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' :type status: str or :class:`TransparentDataEncryptionStatus @@ -29,16 +33,21 @@ class TransparentDataEncryption(SubResource): """ _validation = { - 'name': {'readonly': True}, 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'TransparentDataEncryptionStatus'}, } def __init__(self, status=None): super(TransparentDataEncryption, self).__init__() + self.location = None self.status = status diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/transparent_data_encryption_activity.py b/azure-mgmt-sql/azure/mgmt/sql/models/transparent_data_encryption_activity.py index b4bbcaa2b3da..11454756e1d8 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/transparent_data_encryption_activity.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/transparent_data_encryption_activity.py @@ -9,19 +9,23 @@ # regenerated. # -------------------------------------------------------------------------- -from .sub_resource import SubResource +from .proxy_resource import ProxyResource -class TransparentDataEncryptionActivity(SubResource): +class TransparentDataEncryptionActivity(ProxyResource): """Represents a database transparent data encryption Scan. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Resource name - :vartype name: str - :ivar id: The resource ID. + :ivar id: Resource ID. :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str :ivar status: The status of the database. Possible values include: 'Encrypting', 'Decrypting' :vartype status: str or :class:`TransparentDataEncryptionActivityStatus @@ -32,20 +36,25 @@ class TransparentDataEncryptionActivity(SubResource): """ _validation = { - 'name': {'readonly': True}, 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, 'status': {'readonly': True}, 'percent_complete': {'readonly': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'percent_complete': {'key': 'properties.percentComplete', 'type': 'float'}, } def __init__(self): super(TransparentDataEncryptionActivity, self).__init__() + self.location = None self.status = None self.percent_complete = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/transparent_data_encryption_activity_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/transparent_data_encryption_activity_paged.py index 9c077a7b8393..b86dce24923c 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/transparent_data_encryption_activity_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/transparent_data_encryption_activity_paged.py @@ -14,7 +14,7 @@ class TransparentDataEncryptionActivityPaged(Paged): """ - A paging container for iterating over a list of TransparentDataEncryptionActivity object + A paging container for iterating over a list of :class:`TransparentDataEncryptionActivity ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_network_rule.py b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_network_rule.py index e31536906526..823258bd6529 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_network_rule.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_network_rule.py @@ -24,15 +24,24 @@ class VirtualNetworkRule(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param virtual_network_subnet_id: The resource ID of the virtual network - subnet + :param virtual_network_subnet_id: The ARM resource id of the virtual + network subnet. :type virtual_network_subnet_id: str + :param ignore_vnet_private_access_configuration: Create firewall rule + before the virtual network has private access enabled. + :type ignore_vnet_private_access_configuration: bool + :ivar state: Virtual network rule state. Possible values include: + 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown' + :vartype state: str or :class:`VirtualNetworkRuleState + ` """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'virtual_network_subnet_id': {'required': True}, + 'state': {'readonly': True}, } _attribute_map = { @@ -40,8 +49,12 @@ class VirtualNetworkRule(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'virtual_network_subnet_id': {'key': 'properties.virtualNetworkSubnetId', 'type': 'str'}, + 'ignore_vnet_private_access_configuration': {'key': 'properties.ignoreVnetPrivateAccessConfiguration', 'type': 'bool'}, + 'state': {'key': 'properties.state', 'type': 'str'}, } - def __init__(self, virtual_network_subnet_id=None): + def __init__(self, virtual_network_subnet_id, ignore_vnet_private_access_configuration=None): super(VirtualNetworkRule, self).__init__() self.virtual_network_subnet_id = virtual_network_subnet_id + self.ignore_vnet_private_access_configuration = ignore_vnet_private_access_configuration + self.state = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_network_rule_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_network_rule_paged.py index 994b714832f0..1cc23039a558 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_network_rule_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_network_rule_paged.py @@ -14,7 +14,7 @@ class VirtualNetworkRulePaged(Paged): """ - A paging container for iterating over a list of VirtualNetworkRule object + A paging container for iterating over a list of :class:`VirtualNetworkRule ` object """ _attribute_map = { diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 9994a9c6cea6..238e692a7430 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -9,34 +9,72 @@ # regenerated. # -------------------------------------------------------------------------- -from .databases_operations import DatabasesOperations +from .backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations +from .backup_long_term_retention_vaults_operations import BackupLongTermRetentionVaultsOperations +from .restore_points_operations import RestorePointsOperations from .recoverable_databases_operations import RecoverableDatabasesOperations from .restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations from .capabilities_operations import CapabilitiesOperations -from .servers_operations import ServersOperations +from .server_connection_policies_operations import ServerConnectionPoliciesOperations +from .database_threat_detection_policies_operations import DatabaseThreatDetectionPoliciesOperations +from .data_masking_policies_operations import DataMaskingPoliciesOperations +from .data_masking_rules_operations import DataMaskingRulesOperations from .firewall_rules_operations import FirewallRulesOperations +from .geo_backup_policies_operations import GeoBackupPoliciesOperations +from .databases_operations import DatabasesOperations from .elastic_pools_operations import ElasticPoolsOperations from .operations import Operations -from .recommended_elastic_pools_operations import RecommendedElasticPoolsOperations +from .replication_links_operations import ReplicationLinksOperations from .server_azure_ad_administrators_operations import ServerAzureADAdministratorsOperations from .server_communication_links_operations import ServerCommunicationLinksOperations +from .service_objectives_operations import ServiceObjectivesOperations +from .servers_operations import ServersOperations +from .elastic_pool_activities_operations import ElasticPoolActivitiesOperations +from .elastic_pool_database_activities_operations import ElasticPoolDatabaseActivitiesOperations +from .recommended_elastic_pools_operations import RecommendedElasticPoolsOperations +from .service_tier_advisors_operations import ServiceTierAdvisorsOperations +from .transparent_data_encryptions_operations import TransparentDataEncryptionsOperations +from .transparent_data_encryption_activities_operations import TransparentDataEncryptionActivitiesOperations +from .server_usages_operations import ServerUsagesOperations +from .database_usages_operations import DatabaseUsagesOperations +from .database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations +from .encryption_protectors_operations import EncryptionProtectorsOperations from .failover_groups_operations import FailoverGroupsOperations -from .virtual_network_rules_operations import VirtualNetworkRulesOperations from .server_keys_operations import ServerKeysOperations +from .virtual_network_rules_operations import VirtualNetworkRulesOperations __all__ = [ - 'DatabasesOperations', + 'BackupLongTermRetentionPoliciesOperations', + 'BackupLongTermRetentionVaultsOperations', + 'RestorePointsOperations', 'RecoverableDatabasesOperations', 'RestorableDroppedDatabasesOperations', 'CapabilitiesOperations', - 'ServersOperations', + 'ServerConnectionPoliciesOperations', + 'DatabaseThreatDetectionPoliciesOperations', + 'DataMaskingPoliciesOperations', + 'DataMaskingRulesOperations', 'FirewallRulesOperations', + 'GeoBackupPoliciesOperations', + 'DatabasesOperations', 'ElasticPoolsOperations', 'Operations', - 'RecommendedElasticPoolsOperations', + 'ReplicationLinksOperations', 'ServerAzureADAdministratorsOperations', 'ServerCommunicationLinksOperations', + 'ServiceObjectivesOperations', + 'ServersOperations', + 'ElasticPoolActivitiesOperations', + 'ElasticPoolDatabaseActivitiesOperations', + 'RecommendedElasticPoolsOperations', + 'ServiceTierAdvisorsOperations', + 'TransparentDataEncryptionsOperations', + 'TransparentDataEncryptionActivitiesOperations', + 'ServerUsagesOperations', + 'DatabaseUsagesOperations', + 'DatabaseBlobAuditingPoliciesOperations', + 'EncryptionProtectorsOperations', 'FailoverGroupsOperations', - 'VirtualNetworkRulesOperations', 'ServerKeysOperations', + 'VirtualNetworkRulesOperations', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_policies_operations.py new file mode 100644 index 000000000000..c32d72cad356 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_policies_operations.py @@ -0,0 +1,219 @@ +# 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 msrestazure.azure_operation import AzureOperationPoller + +from .. import models + + +class BackupLongTermRetentionPoliciesOperations(object): + """BackupLongTermRetentionPoliciesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + :ivar backup_long_term_retention_policy_name: The name of the backup long term retention policy. Constant value: "Default". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + self.backup_long_term_retention_policy_name = "Default" + + self.config = config + + def get( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Returns a database backup 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 server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :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: :class:`BackupLongTermRetentionPolicy + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`BackupLongTermRetentionPolicy + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'backupLongTermRetentionPolicyName': self._serialize.url("self.backup_long_term_retention_policy_name", self.backup_long_term_retention_policy_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('BackupLongTermRetentionPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, server_name, database_name, state, recovery_services_backup_policy_resource_id, custom_headers=None, raw=False, **operation_config): + """Creates or updates a database backup 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 server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database + :type database_name: str + :param state: The status of the backup long term retention policy. + Possible values include: 'Disabled', 'Enabled' + :type state: str or :class:`BackupLongTermRetentionPolicyState + ` + :param recovery_services_backup_policy_resource_id: The azure recovery + services backup protection policy resource id + :type recovery_services_backup_policy_resource_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 + :return: + :class:`AzureOperationPoller` + instance that returns :class:`BackupLongTermRetentionPolicy + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + parameters = models.BackupLongTermRetentionPolicy(state=state, recovery_services_backup_policy_resource_id=recovery_services_backup_policy_resource_id) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'backupLongTermRetentionPolicyName': self._serialize.url("self.backup_long_term_retention_policy_name", self.backup_long_term_retention_policy_name, '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['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, 'BackupLongTermRetentionPolicy') + + # Construct and send request + def long_running_send(): + + request = self._client.put(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 201, 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('BackupLongTermRetentionPolicy', response) + if response.status_code == 201: + deserialized = self._deserialize('BackupLongTermRetentionPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_vaults_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_vaults_operations.py new file mode 100644 index 000000000000..8ebe60b3f1f1 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_vaults_operations.py @@ -0,0 +1,209 @@ +# 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 msrestazure.azure_operation import AzureOperationPoller + +from .. import models + + +class BackupLongTermRetentionVaultsOperations(object): + """BackupLongTermRetentionVaultsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + :ivar backup_long_term_retention_vault_name: The name of the Azure SQL Server backup LongTermRetention vault. Constant value: "RegisteredVault". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + self.backup_long_term_retention_vault_name = "RegisteredVault" + + self.config = config + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Gets a server backup long term retention vault. + + :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: :class:`BackupLongTermRetentionVault + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`BackupLongTermRetentionVault + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'backupLongTermRetentionVaultName': self._serialize.url("self.backup_long_term_retention_vault_name", self.backup_long_term_retention_vault_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('BackupLongTermRetentionVault', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, server_name, recovery_services_vault_resource_id, custom_headers=None, raw=False, **operation_config): + """Updates a server backup long term retention vault. + + :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 recovery_services_vault_resource_id: The azure recovery + services vault resource id + :type recovery_services_vault_resource_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 + :return: + :class:`AzureOperationPoller` + instance that returns :class:`BackupLongTermRetentionVault + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + parameters = models.BackupLongTermRetentionVault(recovery_services_vault_resource_id=recovery_services_vault_resource_id) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'backupLongTermRetentionVaultName': self._serialize.url("self.backup_long_term_retention_vault_name", self.backup_long_term_retention_vault_name, '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['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, 'BackupLongTermRetentionVault') + + # Construct and send request + def long_running_send(): + + request = self._client.put(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 201, 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('BackupLongTermRetentionVault', response) + if response.status_code == 201: + deserialized = self._deserialize('BackupLongTermRetentionVault', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py index f6c328a6da9b..e9957daa3062 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py @@ -9,9 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -import uuid from .. import models @@ -46,10 +46,13 @@ def list_by_location( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`LocationCapabilities + ` or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`LocationCapabilities - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_policies_operations.py new file mode 100644 index 000000000000..f3eb82d42394 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_policies_operations.py @@ -0,0 +1,195 @@ +# 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 DataMaskingPoliciesOperations(object): + """DataMaskingPoliciesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + :ivar data_masking_policy_name: The name of the database for which the data masking rule applies. Constant value: "Default". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + self.data_masking_policy_name = "Default" + + self.config = config + + def create_or_update( + self, resource_group_name, server_name, database_name, data_masking_state, exempt_principals=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates a database data masking 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 server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param data_masking_state: The state of the data masking policy. + Possible values include: 'Disabled', 'Enabled' + :type data_masking_state: str or :class:`DataMaskingState + ` + :param exempt_principals: The list of the exempt principals. Specifies + the semicolon-separated list of database users for which the data + masking policy does not apply. The specified users receive data + results without masking for all of the database queries. + :type exempt_principals: 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: :class:`DataMaskingPolicy + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`DataMaskingPolicy + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + parameters = models.DataMaskingPolicy(data_masking_state=data_masking_state, exempt_principals=exempt_principals) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'dataMaskingPolicyName': self._serialize.url("self.data_masking_policy_name", self.data_masking_policy_name, '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['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, 'DataMaskingPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **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('DataMaskingPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a database data masking 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 server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :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: :class:`DataMaskingPolicy + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`DataMaskingPolicy + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'dataMaskingPolicyName': self._serialize.url("self.data_masking_policy_name", self.data_masking_policy_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('DataMaskingPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_rules_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_rules_operations.py new file mode 100644 index 000000000000..25c99e0bedda --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/data_masking_rules_operations.py @@ -0,0 +1,199 @@ +# 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 DataMaskingRulesOperations(object): + """DataMaskingRulesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + :ivar data_masking_policy_name: The name of the database for which the data masking rule applies. Constant value: "Default". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + self.data_masking_policy_name = "Default" + + self.config = config + + def create_or_update( + self, resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a database data masking rule. + + :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 data_masking_rule_name: The name of the data masking rule. + :type data_masking_rule_name: str + :param parameters: The required parameters for creating or updating a + data masking rule. + :type parameters: :class:`DataMaskingRule + ` + :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: :class:`DataMaskingRule + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`DataMaskingRule + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'dataMaskingPolicyName': self._serialize.url("self.data_masking_policy_name", self.data_masking_policy_name, 'str'), + 'dataMaskingRuleName': self._serialize.url("data_masking_rule_name", data_masking_rule_name, '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['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, 'DataMaskingRule') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **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('DataMaskingRule', response) + if response.status_code == 201: + deserialized = self._deserialize('DataMaskingRule', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_by_database( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of database data masking rules. + + :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 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 :class:`DataMaskingRule + ` + :rtype: :class:`DataMaskingRulePaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'dataMaskingPolicyName': self._serialize.url("self.data_masking_policy_name", self.data_masking_policy_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.DataMaskingRulePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.DataMaskingRulePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py new file mode 100644 index 000000000000..281d2f14efe4 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_blob_auditing_policies_operations.py @@ -0,0 +1,191 @@ +# 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 DatabaseBlobAuditingPoliciesOperations(object): + """DatabaseBlobAuditingPoliciesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.blob_auditing_policy_name = "default" + self.api_version = "2015-05-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a database's blob auditing 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 server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database for which the blob + audit 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: :class:`DatabaseBlobAuditingPolicy + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`DatabaseBlobAuditingPolicy + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}' + 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'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('DatabaseBlobAuditingPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a database's blob auditing 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 server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database for which the blob + auditing policy will be defined. + :type database_name: str + :param parameters: The database blob auditing policy. + :type parameters: :class:`DatabaseBlobAuditingPolicy + ` + :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: :class:`DatabaseBlobAuditingPolicy + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`DatabaseBlobAuditingPolicy + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}' + 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'), + 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_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['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, 'DatabaseBlobAuditingPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **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('DatabaseBlobAuditingPolicy', response) + if response.status_code == 201: + deserialized = self._deserialize('DatabaseBlobAuditingPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_threat_detection_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_threat_detection_policies_operations.py new file mode 100644 index 000000000000..24a1ff5bd49d --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_threat_detection_policies_operations.py @@ -0,0 +1,191 @@ +# 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 DatabaseThreatDetectionPoliciesOperations(object): + """DatabaseThreatDetectionPoliciesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec 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: "2014-04-01". + """ + + 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 = "2014-04-01" + + self.config = config + + def get( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a database'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 server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database for which database + Threat Detection 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: :class:`DatabaseSecurityAlertPolicy + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`DatabaseSecurityAlertPolicy + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('DatabaseSecurityAlertPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a database'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 server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database for which database + Threat Detection policy is defined. + :type database_name: str + :param parameters: The database Threat Detection policy. + :type parameters: :class:`DatabaseSecurityAlertPolicy + ` + :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: :class:`DatabaseSecurityAlertPolicy + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`DatabaseSecurityAlertPolicy + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_name, '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['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, 'DatabaseSecurityAlertPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **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('DatabaseSecurityAlertPolicy', response) + if response.status_code == 201: + deserialized = self._deserialize('DatabaseSecurityAlertPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_usages_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_usages_operations.py new file mode 100644 index 000000000000..c37adf806658 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_usages_operations.py @@ -0,0 +1,112 @@ +# 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 DatabaseUsagesOperations(object): + """DatabaseUsagesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + + self.config = config + + def list_by_database( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Returns database usages. + + :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 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 :class:`DatabaseUsage + ` + :rtype: :class:`DatabaseUsagePaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + } + 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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.DatabaseUsagePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.DatabaseUsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py index 0113da40fa3b..9cc2046b10ab 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller -import uuid from .. import models @@ -24,12 +24,8 @@ class DatabasesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An objec model deserializer. - :ivar data_masking_policy_name: The name of the database for which the data masking rule applies. Constant value: "Default". - :ivar geo_backup_policy_name: The name of the geo backup policy. Constant value: "Default". + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". :ivar extension_name: The name of the operation to perform. Constant value: "import". - :ivar security_alert_policy_name: The name of the security alert policy. Constant value: "default". - :ivar backup_long_term_retention_policy_name: The name of the backup long term retention policy. Constant value: "Default". - :ivar blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". """ def __init__(self, client, config, serializer, deserializer): @@ -37,18 +33,14 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.data_masking_policy_name = "Default" - self.geo_backup_policy_name = "Default" + self.api_version = "2014-04-01" self.extension_name = "import" - self.security_alert_policy_name = "default" - self.backup_long_term_retention_policy_name = "Default" - self.blob_auditing_policy_name = "default" self.config = config - def list_restore_points( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets a list of database restore points. + def import_method( + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): + """Imports a bacpac into a new database. . :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -56,76 +48,98 @@ def list_restore_points( :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 to get available - restore points. - :type database_name: str + :param parameters: The required parameters for importing a Bacpac into + a database. + :type parameters: :class:`ImportRequest + ` :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`. - :rtype: :class:`RestorePointPaged - ` + :return: + :class:`AzureOperationPoller` + instance that returns :class:`ImportExportResponse + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ - api_version = "2014-04-01" + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) - def internal_paging(next_link=None, raw=False): + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) + # Construct headers + header_parameters = {} + 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 parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + # Construct body + body_content = self._serialize.body(parameters, 'ImportRequest') - else: - url = next_link - query_parameters = {} + # Construct and send request + def long_running_send(): - # Construct headers - header_parameters = {} - 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') + request = self._client.post(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( request, header_parameters, **operation_config) - if response.status_code not in [200]: + def get_long_running_output(response): + + if response.status_code not in [200, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp - return response + deserialized = None - # Deserialize response - deserialized = models.RestorePointPaged(internal_paging, self._deserialize.dependencies) + if response.status_code == 200: + deserialized = self._deserialize('ImportExportResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized if raw: - header_dict = {} - client_raw_response = models.RestorePointPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response + response = long_running_send() + return get_long_running_output(response) - return deserialized + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) - def create_or_update_data_masking_policy( - self, resource_group_name, server_name, database_name, data_masking_state, exempt_principals=None, custom_headers=None, raw=False, **operation_config): - """Creates or updates a database data masking policy. + def create_import_operation( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates an import operation that imports a bacpac into an existing + database. The existing database must be empty. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -133,46 +147,40 @@ def create_or_update_data_masking_policy( :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. + :param database_name: The name of the database to import into :type database_name: str - :param data_masking_state: The state of the data masking policy. - Possible values include: 'Disabled', 'Enabled' - :type data_masking_state: str or :class:`DataMaskingState - ` - :param exempt_principals: The list of the exempt principals. Specifies - the semicolon-separated list of database users for which the data - masking policy does not apply. The specified users receive data - results without masking for all of the database queries. - :type exempt_principals: str + :param parameters: The required parameters for importing a Bacpac into + a database. + :type parameters: :class:`ImportExtensionRequest + ` :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`. - :rtype: :class:`DataMaskingPolicy - ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: + :class:`AzureOperationPoller` + instance that returns :class:`ImportExportResponse + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ - parameters = models.DataMaskingPolicy(data_masking_state=data_masking_state, exempt_principals=exempt_principals) - - api_version = "2014-04-01" - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), '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'), - 'dataMaskingPolicyName': self._serialize.url("self.data_masking_policy_name", self.data_masking_policy_name, 'str') + 'extensionName': self._serialize.url("self.extension_name", self.extension_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -185,32 +193,55 @@ def create_or_update_data_masking_policy( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'DataMaskingPolicy') + body_content = self._serialize.body(parameters, 'ImportExtensionRequest') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, **operation_config) + def long_running_send(): - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + request = self._client.put(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) - deserialized = None + def get_long_running_status(status_link, headers=None): - if response.status_code == 200: - deserialized = self._deserialize('DataMaskingPolicy', response) + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [201, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('ImportExportResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + response = long_running_send() + return get_long_running_output(response) - return deserialized + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) - def get_data_masking_policy( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets a database data masking policy. + def export( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + """Exports a database to a bacpac. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -218,35 +249,38 @@ def get_data_masking_policy( :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. + :param database_name: The name of the database to be exported. :type database_name: str + :param parameters: The required parameters for exporting a database. + :type parameters: :class:`ExportRequest + ` :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`. - :rtype: :class:`DataMaskingPolicy - ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: + :class:`AzureOperationPoller` + instance that returns :class:`ImportExportResponse + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ - api_version = "2014-04-01" - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), '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'), - 'dataMaskingPolicyName': self._serialize.url("self.data_masking_policy_name", self.data_masking_policy_name, 'str') + 'databaseName': self._serialize.url("database_name", database_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -258,29 +292,56 @@ def get_data_masking_policy( 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, 'ExportRequest') + # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + def long_running_send(): - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + request = self._client.post(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) - deserialized = None + def get_long_running_status(status_link, headers=None): - if response.status_code == 200: - deserialized = self._deserialize('DataMaskingPolicy', response) + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + 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('ImportExportResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + response = long_running_send() + return get_long_running_output(response) - return deserialized + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) - def create_or_update_data_masking_rule( - self, resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a database data masking rule. + def list_metrics( + self, resource_group_name, server_name, database_name, filter, custom_headers=None, raw=False, **operation_config): + """Returns database metrics. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -290,117 +351,36 @@ def create_or_update_data_masking_rule( :type server_name: str :param database_name: The name of the database. :type database_name: str - :param data_masking_rule_name: The name of the data masking rule. - :type data_masking_rule_name: str - :param parameters: The required parameters for creating or updating a - data masking rule. - :type parameters: :class:`DataMaskingRule - ` + :param filter: An OData filter expression that describes a subset of + metrics to return. + :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`. - :rtype: :class:`DataMaskingRule - ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: An iterator like instance of :class:`Metric + ` + :rtype: :class:`MetricPaged ` :raises: :class:`CloudError` """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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'), - 'dataMaskingPolicyName': self._serialize.url("self.data_masking_policy_name", self.data_masking_policy_name, 'str'), - 'dataMaskingRuleName': self._serialize.url("data_masking_rule_name", data_masking_rule_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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, 'DataMaskingRule') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, **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('DataMaskingRule', response) - if response.status_code == 201: - deserialized = self._deserialize('DataMaskingRule', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def list_data_masking_rules( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets a list of database data masking rules. - - :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 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`. - :rtype: :class:`DataMaskingRulePaged - ` - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - def internal_paging(next_link=None, raw=False): + def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metrics' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), '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'), - 'dataMaskingPolicyName': self._serialize.url("self.data_masking_policy_name", self.data_masking_policy_name, 'str') + 'databaseName': self._serialize.url("database_name", database_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') else: url = next_link @@ -429,170 +409,18 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.DataMaskingRulePaged(internal_paging, self._deserialize.dependencies) + deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies) if raw: header_dict = {} - client_raw_response = models.DataMaskingRulePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def create_or_update_geo_backup_policy( - self, resource_group_name, server_name, database_name, state, custom_headers=None, raw=False, **operation_config): - """Updates a database geo backup 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 server_name: The name of the server. - :type server_name: str - :param database_name: The name of the database. - :type database_name: str - :param state: The state of the geo backup policy. Possible values - include: 'Disabled', 'Enabled' - :type state: str or :class:`GeoBackupPolicyState - ` - :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`. - :rtype: :class:`GeoBackupPolicy - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - parameters = models.GeoBackupPolicy(state=state) - - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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'), - 'geoBackupPolicyName': self._serialize.url("self.geo_backup_policy_name", self.geo_backup_policy_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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, 'GeoBackupPolicy') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, **operation_config) - - if response.status_code not in [201, 200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('GeoBackupPolicy', response) - if response.status_code == 200: - deserialized = self._deserialize('GeoBackupPolicy', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def get_geo_backup_policy( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets a geo backup 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 server_name: The name of the server. - :type server_name: str - :param database_name: The name of the database. - :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`. - :rtype: :class:`GeoBackupPolicy - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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'), - 'geoBackupPolicyName': self._serialize.url("self.geo_backup_policy_name", self.geo_backup_policy_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **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('GeoBackupPolicy', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized - def list_geo_backup_policies( + def list_metric_definitions( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Returns a list of geo backup policies. + """Returns database metric definitions. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -607,17 +435,17 @@ def list_geo_backup_policies( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: :class:`GeoBackupPolicyPaged - ` + :return: An iterator like instance of :class:`MetricDefinition + ` + :rtype: :class:`MetricDefinitionPaged + ` :raises: :class:`CloudError` """ - api_version = "2014-04-01" - def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metricDefinitions' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -628,7 +456,7 @@ def internal_paging(next_link=None, raw=False): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link @@ -657,18 +485,18 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.GeoBackupPolicyPaged(internal_paging, self._deserialize.dependencies) + deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies) if raw: header_dict = {} - client_raw_response = models.GeoBackupPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized - def import_method( - self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): - """Imports a bacpac into a new database. . + def pause( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Pauses a data warehouse. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -676,35 +504,34 @@ def import_method( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param parameters: The required parameters for importing a Bacpac into - a database. - :type parameters: :class:`ImportRequest - ` + :param database_name: The name of the data warehouse to pause. + :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 + :return: + :class:`AzureOperationPoller` + instance that returns None or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`AzureOperationPoller` - instance that returns :class:`ImportExportResponse - ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ - api_version = "2014-04-01" - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str') + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -716,15 +543,11 @@ def import_method( 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, 'ImportRequest') - # Construct and send request def long_running_send(): request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + return self._client.send(request, header_parameters, **operation_config) def get_long_running_status(status_link, headers=None): @@ -741,17 +564,10 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ImportExportResponse', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response = ClientRawResponse(None, response) return client_raw_response - return deserialized - if raw: response = long_running_send() return get_long_running_output(response) @@ -763,10 +579,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def create_import_operation( - self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates an import operation that imports a bacpac into an existing - database. The existing database must be empty. + def resume( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Resumes a data warehouse. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -774,39 +589,34 @@ def create_import_operation( :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 to import into + :param database_name: The name of the data warehouse to resume. :type database_name: str - :param parameters: The required parameters for importing a Bacpac into - a database. - :type parameters: :class:`ImportExtensionRequest - ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :return: + :class:`AzureOperationPoller` + instance that returns None or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`AzureOperationPoller` - instance that returns :class:`ImportExportResponse - ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ - api_version = "2014-04-01" - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), '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'), - 'extensionName': self._serialize.url("self.extension_name", self.extension_name, 'str') + 'databaseName': self._serialize.url("database_name", database_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -818,15 +628,11 @@ def create_import_operation( 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, 'ImportExtensionRequest') - # Construct and send request def long_running_send(): - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + request = self._client.post(url, query_parameters) + return self._client.send(request, header_parameters, **operation_config) def get_long_running_status(status_link, headers=None): @@ -838,22 +644,15 @@ def get_long_running_status(status_link, headers=None): def get_long_running_output(response): - if response.status_code not in [201, 202]: + if response.status_code not in [202, 200]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('ImportExportResponse', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response = ClientRawResponse(None, response) return client_raw_response - return deserialized - if raw: response = long_running_send() return get_long_running_output(response) @@ -865,9 +664,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def export( + def create_or_update( self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): - """Exports a database to a bacpac. + """Creates a new database or updates an existing database. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -875,26 +674,28 @@ def export( :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 to be exported. + :param database_name: The name of the database to be operated on + (updated or created). :type database_name: str - :param parameters: The required parameters for exporting a database. - :type parameters: :class:`ExportRequest - ` + :param parameters: The required parameters for creating or updating a + database. + :type parameters: :class:`Database ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :return: + :class:`AzureOperationPoller` + instance that returns :class:`Database + ` or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`AzureOperationPoller` - instance that returns :class:`ImportExportResponse - ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ - api_version = "2014-04-01" - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -905,7 +706,7 @@ def export( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -918,12 +719,12 @@ def export( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'ExportRequest') + body_content = self._serialize.body(parameters, 'Database') # Construct and send request def long_running_send(): - request = self._client.post(url, query_parameters) + request = self._client.put(url, query_parameters) return self._client.send( request, header_parameters, body_content, **operation_config) @@ -937,7 +738,7 @@ def get_long_running_status(status_link, headers=None): def get_long_running_output(response): - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp @@ -945,7 +746,9 @@ def get_long_running_output(response): deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ImportExportResponse', response) + deserialized = self._deserialize('Database', response) + if response.status_code == 201: + deserialized = self._deserialize('Database', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -964,164 +767,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_metrics( - self, resource_group_name, server_name, database_name, filter, custom_headers=None, raw=False, **operation_config): - """Returns database metrics. - - :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 describes a subset of - metrics to return. - :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`. - :rtype: :class:`MetricPaged ` - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metrics' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **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.MetricPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def list_metric_definitions( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Returns database metric definitions. - - :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 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`. - :rtype: :class:`MetricDefinitionPaged - ` - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metricDefinitions' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **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.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def delete_replication_link( - self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): - """Deletes a database replication link. Cannot be done during failover. + def update( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + """Updates an existing database. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -1129,37 +777,38 @@ def delete_replication_link( :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 that has the - replication link to be dropped. + :param database_name: The name of the database to be updated. :type database_name: str - :param link_id: The ID of the replication link to be deleted. - :type link_id: str + :param parameters: The required parameters for updating a database. + :type parameters: :class:`DatabaseUpdate + ` :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`. - :rtype: None - :rtype: :class:`ClientRawResponse` - if raw=true + :return: + :class:`AzureOperationPoller` + instance that returns :class:`Database + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ - api_version = "2014-04-01" - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), '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'), - 'linkId': self._serialize.url("link_id", link_id, 'str') + 'databaseName': self._serialize.url("database_name", database_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -1171,257 +820,41 @@ def delete_replication_link( 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, 'DatabaseUpdate') + # Construct and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + def long_running_send(): - if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + request = self._client.patch(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + def get_long_running_status(status_link, headers=None): - def get_replication_link( - self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): - """Gets a database replication link. + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) - :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 to get the link for. - :type database_name: str - :param link_id: The replication link ID to be retrieved. - :type link_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`. - :rtype: :class:`ReplicationLink - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" + def get_long_running_output(response): - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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'), - 'linkId': self._serialize.url("link_id", link_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + deserialized = None - # Construct headers - header_parameters = {} - 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') + if response.status_code == 200: + deserialized = self._deserialize('Database', response) - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response - 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('ReplicationLink', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def failover_replication_link( - self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): - """Sets which replica database is primary by failing over from the current - primary replica 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 that has the - replication link to be failed over. - :type database_name: str - :param link_id: The ID of the replication link to be failed over. - :type link_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 - :rtype: - :class:`AzureOperationPoller` - instance that returns None - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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'), - 'linkId': self._serialize.url("link_id", link_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): - - if response.status_code not in [204, 202]: - 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 - - if raw: - response = long_running_send() - return get_long_running_output(response) - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) - - def failover_replication_link_allow_data_loss( - self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): - """Sets which replica database is primary by failing over from the current - primary replica database. This operation might result in data loss. - - :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 that has the - replication link to be failed over. - :type database_name: str - :param link_id: The ID of the replication link to be failed over. - :type link_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 - :rtype: - :class:`AzureOperationPoller` - instance that returns None - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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'), - 'linkId': self._serialize.url("link_id", link_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): - - if response.status_code not in [204, 202]: - 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 + return deserialized if raw: response = long_running_send() @@ -1434,1024 +867,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_replication_links( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Lists a database's replication links. - - :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 to retrieve links for. - :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`. - :rtype: :class:`ReplicationLinkPaged - ` - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **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.ReplicationLinkPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ReplicationLinkPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def pause( + def delete( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Pauses a data warehouse. - - :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 data warehouse to pause. - :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 - :rtype: - :class:`AzureOperationPoller` - instance that returns None - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): - - if response.status_code not in [200, 202]: - 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 - - if raw: - response = long_running_send() - return get_long_running_output(response) - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) - - def resume( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Resumes a data warehouse. - - :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 data warehouse to resume. - :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 - :rtype: - :class:`AzureOperationPoller` - instance that returns None - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): - - if response.status_code not in [202, 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 - - if raw: - response = long_running_send() - return get_long_running_output(response) - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) - - def create_or_update( - self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates a new database or updates an existing database. Location is a - required property in the request body, and it must be the same as the - location of the SQL 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 database_name: The name of the database to be operated on - (updated or created). - :type database_name: str - :param parameters: The required parameters for creating or updating a - database. - :type parameters: :class:`Database ` - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :rtype: - :class:`AzureOperationPoller` - instance that returns :class:`Database - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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, 'Database') - - # Construct and send request - def long_running_send(): - - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): - - if response.status_code not in [200, 201, 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('Database', response) - if response.status_code == 201: - deserialized = self._deserialize('Database', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - if raw: - response = long_running_send() - return get_long_running_output(response) - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) - - def delete( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Deletes a 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 to be deleted. - :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`. - :rtype: None - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) - - if response.status_code not in [200, 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 get( - self, resource_group_name, server_name, database_name, expand=None, custom_headers=None, raw=False, **operation_config): - """Gets a 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 to be retrieved. - :type database_name: str - :param expand: A comma separated list of child objects to expand in - the response. Possible properties: serviceTierAdvisors, - transparentDataEncryption. - :type expand: 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`. - :rtype: :class:`Database ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **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('Database', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def list_by_server( - self, resource_group_name, server_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): - """Returns a list of databases in 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 expand: A comma separated list of child objects to expand in - the response. Possible properties: serviceTierAdvisors, - transparentDataEncryption. - :type expand: str - :param filter: An OData filter expression that describes a subset of - databases to return. - :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`. - :rtype: :class:`DatabasePaged ` - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if expand is not None: - query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **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.DatabasePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.DatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def get_service_tier_advisor( - self, resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers=None, raw=False, **operation_config): - """Gets a service tier advisor. - - :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 database. - :type database_name: str - :param service_tier_advisor_name: The name of service tier advisor. - :type service_tier_advisor_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`. - :rtype: :class:`ServiceTierAdvisor - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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'), - 'serviceTierAdvisorName': self._serialize.url("service_tier_advisor_name", service_tier_advisor_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **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('ServiceTierAdvisor', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def list_service_tier_advisors( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Returns service tier advisors for specified 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 database. - :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`. - :rtype: :class:`ServiceTierAdvisorPaged - ` - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **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.ServiceTierAdvisorPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ServiceTierAdvisorPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def create_or_update_transparent_data_encryption_configuration( - self, resource_group_name, server_name, database_name, status=None, custom_headers=None, raw=False, **operation_config): - """Creates or updates a database's transparent data encryption - configuration. - - :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 for which setting the - transparent data encryption applies. - :type database_name: str - :param status: The status of the database transparent data encryption. - Possible values include: 'Enabled', 'Disabled' - :type status: str or :class:`TransparentDataEncryptionStatus - ` - :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`. - :rtype: :class:`TransparentDataEncryption - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - parameters = models.TransparentDataEncryption(status=status) - - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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, 'TransparentDataEncryption') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, **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('TransparentDataEncryption', response) - if response.status_code == 201: - deserialized = self._deserialize('TransparentDataEncryption', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def get_transparent_data_encryption_configuration( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets a database's transparent data encryption configuration. - - :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 for which the - transparent data encryption applies. - :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`. - :rtype: :class:`TransparentDataEncryption - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **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('TransparentDataEncryption', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def list_transparent_data_encryption_activity( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Returns a database's transparent data encryption operation result. - - :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 for which the - transparent data encryption applies. - :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`. - :rtype: :class:`TransparentDataEncryptionActivityPaged - ` - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current/operationResults' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **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.TransparentDataEncryptionActivityPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.TransparentDataEncryptionActivityPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def get_threat_detection_policy( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets a database'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 server_name: The name of the server. - :type server_name: str - :param database_name: The name of the database for which database - Threat Detection 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`. - :rtype: :class:`DatabaseSecurityAlertPolicy - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - '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'), - 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **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('DatabaseSecurityAlertPolicy', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_or_update_threat_detection_policy( - self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a database's threat detection policy. + """Deletes a database. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -2459,39 +877,33 @@ def create_or_update_threat_detection_policy( :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 for which database - Threat Detection policy is defined. + :param database_name: The name of the database to be deleted. :type database_name: str - :param parameters: The database Threat Detection policy. - :type parameters: :class:`DatabaseSecurityAlertPolicy - ` :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`. - :rtype: :class:`DatabaseSecurityAlertPolicy - ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: None or + :class:`ClientRawResponse` if + raw=true + :rtype: None or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ - api_version = "2014-04-01" - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), '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'), - 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_name, 'str') + 'databaseName': self._serialize.url("database_name", database_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -2503,35 +915,22 @@ def create_or_update_threat_detection_policy( 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, 'DatabaseSecurityAlertPolicy') - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, **operation_config) + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) - if response.status_code not in [200, 201]: + if response.status_code not in [200, 204]: 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('DatabaseSecurityAlertPolicy', response) - if response.status_code == 201: - deserialized = self._deserialize('DatabaseSecurityAlertPolicy', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response = ClientRawResponse(None, response) return client_raw_response - return deserialized - - def get_backup_long_term_retention_policy( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Returns a database backup long term retention policy. + def get( + self, resource_group_name, server_name, database_name, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets a database. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -2539,35 +938,39 @@ def get_backup_long_term_retention_policy( :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. + :param database_name: The name of the database to be retrieved. :type database_name: str + :param expand: A comma separated list of child objects to expand in + the response. Possible properties: serviceTierAdvisors, + transparentDataEncryption. + :type expand: 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`. - :rtype: :class:`BackupLongTermRetentionPolicy - ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: :class:`Database ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`Database ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ - api_version = "2014-04-01" - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), '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'), - 'backupLongTermRetentionPolicyName': self._serialize.url("self.backup_long_term_retention_policy_name", self.backup_long_term_retention_policy_name, 'str') + 'databaseName': self._serialize.url("database_name", database_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') # Construct headers header_parameters = {} @@ -2591,7 +994,7 @@ def get_backup_long_term_retention_policy( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('BackupLongTermRetentionPolicy', response) + deserialized = self._deserialize('Database', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -2599,9 +1002,9 @@ def get_backup_long_term_retention_policy( return deserialized - def create_or_update_long_term_retention_policy( - self, resource_group_name, server_name, database_name, state, recovery_services_backup_policy_resource_id, custom_headers=None, raw=False, **operation_config): - """Creates or updates a database backup long term retention policy. + def list_by_server( + self, resource_group_name, server_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): + """Returns a list of databases in a server. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -2609,44 +1012,120 @@ def create_or_update_long_term_retention_policy( :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 state: The status of the backup long term retention policy. - Possible values include: 'Disabled', 'Enabled' - :type state: str or :class:`BackupLongTermRetentionPolicyState - ` - :param recovery_services_backup_policy_resource_id: The azure recovery - services backup protection policy resource id - :type recovery_services_backup_policy_resource_id: str + :param expand: A comma separated list of child objects to expand in + the response. Possible properties: serviceTierAdvisors, + transparentDataEncryption. + :type expand: str + :param filter: An OData filter expression that describes a subset of + databases to return. + :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 - :rtype: - :class:`AzureOperationPoller` - instance that returns :class:`BackupLongTermRetentionPolicy - ` - :rtype: :class:`ClientRawResponse` - if raw=true + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of :class:`Database + ` + :rtype: :class:`DatabasePaged ` :raises: :class:`CloudError` """ - parameters = models.BackupLongTermRetentionPolicy(state=state, recovery_services_backup_policy_resource_id=recovery_services_backup_policy_resource_id) + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) - api_version = "2014-04-01" + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + 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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.DatabasePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.DatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def get_by_elastic_pool( + self, resource_group_name, server_name, elastic_pool_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a database inside of an elastic pool. + + :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 elastic_pool_name: The name of the elastic pool to be + retrieved. + :type elastic_pool_name: str + :param database_name: The name of the database to be retrieved. + :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: :class:`Database ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`Database ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), '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'), - 'backupLongTermRetentionPolicyName': self._serialize.url("self.backup_long_term_retention_policy_name", self.backup_long_term_retention_policy_name, 'str') + 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -2658,58 +1137,29 @@ def create_or_update_long_term_retention_policy( 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, 'BackupLongTermRetentionPolicy') - # Construct and send request - def long_running_send(): - - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): - - if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) - if response.status_code == 200: - deserialized = self._deserialize('BackupLongTermRetentionPolicy', response) - if response.status_code == 201: - deserialized = self._deserialize('BackupLongTermRetentionPolicy', response) + 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(deserialized, response) - return client_raw_response + deserialized = None - return deserialized + if response.status_code == 200: + deserialized = self._deserialize('Database', response) if raw: - response = long_running_send() - return get_long_running_output(response) + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) + return deserialized - def list_usages( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Returns database usages. + def list_by_elastic_pool( + self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): + """Returns a list of databases in an elastic pool. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -2717,35 +1167,35 @@ def list_usages( :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 elastic_pool_name: The name of the elastic pool to be + retrieved. + :type elastic_pool_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`. - :rtype: :class:`DatabaseUsagePaged - ` + :return: An iterator like instance of :class:`Database + ` + :rtype: :class:`DatabasePaged ` :raises: :class:`CloudError` """ - api_version = "2014-04-01" - def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), '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') + 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link @@ -2774,18 +1224,18 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.DatabaseUsagePaged(internal_paging, self._deserialize.dependencies) + deserialized = models.DatabasePaged(internal_paging, self._deserialize.dependencies) if raw: header_dict = {} - client_raw_response = models.DatabaseUsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = models.DatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized - def get_blob_auditing_policy( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets a database's blob auditing policy. + def get_by_recommended_elastic_pool( + self, resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a database inside of a recommented elastic pool. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -2793,36 +1243,37 @@ def get_blob_auditing_policy( :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 for which the blob - audit policy is defined. + :param recommended_elastic_pool_name: The name of the elastic pool to + be retrieved. + :type recommended_elastic_pool_name: str + :param database_name: The name of the database to be retrieved. :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`. - :rtype: :class:`DatabaseBlobAuditingPolicy - ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: :class:`Database ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`Database ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ - api_version = "2015-05-01-preview" - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), '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'), - 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'recommendedElasticPoolName': self._serialize.url("recommended_elastic_pool_name", recommended_elastic_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -2846,7 +1297,7 @@ def get_blob_auditing_policy( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('DatabaseBlobAuditingPolicy', response) + deserialized = self._deserialize('Database', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -2854,9 +1305,9 @@ def get_blob_auditing_policy( return deserialized - def create_or_update_blob_auditing_policy( - self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a database's blob auditing policy. + def list_by_recommended_elastic_pool( + self, resource_group_name, server_name, recommended_elastic_pool_name, custom_headers=None, raw=False, **operation_config): + """Returns a list of databases inside a recommented elastic pool. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -2864,72 +1315,68 @@ def create_or_update_blob_auditing_policy( :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 for which the blob - auditing policy will be defined. - :type database_name: str - :param parameters: The database blob auditing policy. - :type parameters: :class:`DatabaseBlobAuditingPolicy - ` + :param recommended_elastic_pool_name: The name of the recommended + elastic pool to be retrieved. + :type recommended_elastic_pool_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`. - :rtype: :class:`DatabaseBlobAuditingPolicy - ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: An iterator like instance of :class:`Database + ` + :rtype: :class:`DatabasePaged ` :raises: :class:`CloudError` """ - api_version = "2015-05-01-preview" + def internal_paging(next_link=None, raw=False): - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}' - 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'), - 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_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) + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'recommendedElasticPoolName': self._serialize.url("recommended_elastic_pool_name", recommended_elastic_pool_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - # Construct headers - header_parameters = {} - 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') + else: + url = next_link + query_parameters = {} - # Construct body - body_content = self._serialize.body(parameters, 'DatabaseBlobAuditingPolicy') + # Construct headers + header_parameters = {} + 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 and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, **operation_config) + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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 + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - deserialized = None + return response - if response.status_code == 200: - deserialized = self._deserialize('DatabaseBlobAuditingPolicy', response) - if response.status_code == 201: - deserialized = self._deserialize('DatabaseBlobAuditingPolicy', response) + # Deserialize response + deserialized = models.DatabasePaged(internal_paging, self._deserialize.dependencies) if raw: - client_raw_response = ClientRawResponse(deserialized, response) + header_dict = {} + client_raw_response = models.DatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_activities_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_activities_operations.py new file mode 100644 index 000000000000..f88949ba1147 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_activities_operations.py @@ -0,0 +1,113 @@ +# 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 ElasticPoolActivitiesOperations(object): + """ElasticPoolActivitiesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + + self.config = config + + def list_by_elastic_pool( + self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): + """Returns elastic pool activities. + + :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 elastic_pool_name: The name of the elastic pool for which to + get the current activity. + :type elastic_pool_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 :class:`ElasticPoolActivity + ` + :rtype: :class:`ElasticPoolActivityPaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.ElasticPoolActivityPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ElasticPoolActivityPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_database_activities_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_database_activities_operations.py new file mode 100644 index 000000000000..99451488a2b4 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_database_activities_operations.py @@ -0,0 +1,113 @@ +# 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 ElasticPoolDatabaseActivitiesOperations(object): + """ElasticPoolDatabaseActivitiesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + + self.config = config + + def list_by_elastic_pool( + self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): + """Returns activity on databases inside of an elastic pool. + + :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 elastic_pool_name: The name of the elastic pool. + :type elastic_pool_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 + :class:`ElasticPoolDatabaseActivity + ` + :rtype: :class:`ElasticPoolDatabaseActivityPaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.ElasticPoolDatabaseActivityPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ElasticPoolDatabaseActivityPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pools_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pools_operations.py index 29b0d7a2a031..b2ba49d03733 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pools_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pools_operations.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller -import uuid from .. import models @@ -56,6 +56,8 @@ def list_metrics( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`Metric + ` :rtype: :class:`MetricPaged ` :raises: :class:`CloudError` """ @@ -130,6 +132,8 @@ def list_metric_definitions( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`MetricDefinition + ` :rtype: :class:`MetricDefinitionPaged ` :raises: :class:`CloudError` @@ -207,12 +211,15 @@ def create_or_update( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`ElasticPool - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -288,9 +295,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def delete( - self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): - """Deletes the elastic pool. + def update( + self, resource_group_name, server_name, elastic_pool_name, parameters, custom_headers=None, raw=False, **operation_config): + """Updates an existing elastic pool. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -298,16 +305,24 @@ def delete( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param elastic_pool_name: The name of the elastic pool to be deleted. + :param elastic_pool_name: The name of the elastic pool to be updated. :type elastic_pool_name: str + :param parameters: The required parameters for updating an elastic + pool. + :type parameters: :class:`ElasticPoolUpdate + ` :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`. - :rtype: None - :rtype: :class:`ClientRawResponse` - if raw=true + :return: + :class:`AzureOperationPoller` + instance that returns :class:`ElasticPool + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -334,22 +349,56 @@ def delete( 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, 'ElasticPoolUpdate') + # Construct and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + def long_running_send(): - if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + request = self._client.patch(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + 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('ElasticPool', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + response = long_running_send() + return get_long_running_output(response) - def get( + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def delete( self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): - """Gets an elastic pool. + """Deletes the elastic pool. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -357,17 +406,18 @@ def get( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param elastic_pool_name: The name of the elastic pool to be - retrieved. + :param elastic_pool_name: The name of the elastic pool to be deleted. :type elastic_pool_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`. - :rtype: :class:`ElasticPool ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: None or + :class:`ClientRawResponse` if + raw=true + :rtype: None or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -395,248 +445,21 @@ def get( 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) + request = self._client.delete(url, query_parameters) response = self._client.send(request, header_parameters, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [200, 204]: 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('ElasticPool', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def list_by_server( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Returns a list of elastic pools in 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`. - :rtype: :class:`ElasticPoolPaged - ` - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, '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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **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.ElasticPoolPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ElasticPoolPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def list_activity( - self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): - """Returns elastic pool activities. - - :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 elastic_pool_name: The name of the elastic pool for which to - get the current activity. - :type elastic_pool_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`. - :rtype: :class:`ElasticPoolActivityPaged - ` - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, '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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **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.ElasticPoolActivityPaged(internal_paging, self._deserialize.dependencies) - if raw: - header_dict = {} - client_raw_response = models.ElasticPoolActivityPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = ClientRawResponse(None, response) return client_raw_response - return deserialized - - def list_database_activity( + def get( self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): - """Returns activity on databases inside of an elastic pool. - - :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 elastic_pool_name: The name of the elastic pool. - :type elastic_pool_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`. - :rtype: :class:`ElasticPoolDatabaseActivityPaged - ` - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, '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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **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.ElasticPoolDatabaseActivityPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ElasticPoolDatabaseActivityPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def get_database( - self, resource_group_name, server_name, elastic_pool_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets a database inside of an elastic pool. + """Gets an elastic pool. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -647,26 +470,25 @@ def get_database( :param elastic_pool_name: The name of the elastic pool to be retrieved. :type elastic_pool_name: str - :param database_name: The name of the database to be retrieved. - :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`. - :rtype: :class:`Database ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: :class:`ElasticPool ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`ElasticPool ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str') + 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -696,7 +518,7 @@ def get_database( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Database', response) + deserialized = self._deserialize('ElasticPool', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -704,9 +526,9 @@ def get_database( return deserialized - def list_databases( - self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): - """Returns a list of databases in an elastic pool. + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Returns a list of elastic pools in a server. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -714,27 +536,26 @@ def list_databases( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :param elastic_pool_name: The name of the elastic pool to be - retrieved. - :type elastic_pool_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`. - :rtype: :class:`DatabasePaged ` + :return: An iterator like instance of :class:`ElasticPool + ` + :rtype: :class:`ElasticPoolPaged + ` :raises: :class:`CloudError` """ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools' path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, 'str') + 'serverName': self._serialize.url("server_name", server_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -769,11 +590,11 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.DatabasePaged(internal_paging, self._deserialize.dependencies) + deserialized = models.ElasticPoolPaged(internal_paging, self._deserialize.dependencies) if raw: header_dict = {} - client_raw_response = models.DatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = models.ElasticPoolPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/encryption_protectors_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/encryption_protectors_operations.py new file mode 100644 index 000000000000..713dd2a5c862 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/encryption_protectors_operations.py @@ -0,0 +1,278 @@ +# 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 msrestazure.azure_operation import AzureOperationPoller + +from .. import models + + +class EncryptionProtectorsOperations(object): + """EncryptionProtectorsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". + :ivar encryption_protector_name: The name of the encryption protector to be retrieved. Constant value: "current". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-05-01-preview" + self.encryption_protector_name = "current" + + self.config = config + + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of server encryption protectors. + + :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 :class:`EncryptionProtector + ` + :rtype: :class:`EncryptionProtectorPaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector' + 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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.EncryptionProtectorPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.EncryptionProtectorPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Gets a server encryption protector. + + :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: :class:`EncryptionProtector + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`EncryptionProtector + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'encryptionProtectorName': self._serialize.url("self.encryption_protector_name", self.encryption_protector_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('EncryptionProtector', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): + """Updates an existing encryption protector. + + :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 parameters: The requested encryption protector resource state. + :type parameters: :class:`EncryptionProtector + ` + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: + :class:`AzureOperationPoller` + instance that returns :class:`EncryptionProtector + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'encryptionProtectorName': self._serialize.url("self.encryption_protector_name", self.encryption_protector_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['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, 'EncryptionProtector') + + # Construct and send request + def long_running_send(): + + request = self._client.put(url, query_parameters) + return self._client.send( + request, header_parameters, body_content, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + 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('EncryptionProtector', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/failover_groups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/failover_groups_operations.py index a1bbbda8bf8b..41859d45c41c 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/failover_groups_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/failover_groups_operations.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller -import uuid from .. import models @@ -54,9 +54,11 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`FailoverGroup ` + or :class:`ClientRawResponse` if + raw=true :rtype: :class:`FailoverGroup ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -122,12 +124,15 @@ def create_or_update( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`FailoverGroup - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -219,11 +224,14 @@ def delete( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :return: + :class:`AzureOperationPoller` + instance that returns None or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`AzureOperationPoller` - instance that returns None - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -300,17 +308,20 @@ def update( :param failover_group_name: The name of the failover group. :type failover_group_name: str :param parameters: The failover group parameters. - :type parameters: :class:`FailoverGroup - ` + :type parameters: :class:`FailoverGroupUpdate + ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`FailoverGroup - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -338,7 +349,7 @@ def update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'FailoverGroup') + body_content = self._serialize.body(parameters, 'FailoverGroupUpdate') # Construct and send request def long_running_send(): @@ -400,6 +411,8 @@ def list_by_server( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`FailoverGroup + ` :rtype: :class:`FailoverGroupPaged ` :raises: :class:`CloudError` @@ -472,12 +485,15 @@ def failover( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`FailoverGroup - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -564,12 +580,15 @@ def force_failover_allow_data_loss( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`FailoverGroup - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/firewall_rules_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/firewall_rules_operations.py index 34b6ad8132e0..eab34af257c9 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/firewall_rules_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/firewall_rules_operations.py @@ -9,9 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -import uuid from .. import models @@ -60,9 +60,11 @@ def create_or_update( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: :class:`FirewallRule ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: :class:`FirewallRule ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`FirewallRule ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ parameters = models.FirewallRule(start_ip_address=start_ip_address, end_ip_address=end_ip_address) @@ -134,9 +136,11 @@ def delete( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: None - :rtype: :class:`ClientRawResponse` - if raw=true + :return: None or + :class:`ClientRawResponse` if + raw=true + :rtype: None or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -193,9 +197,11 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: :class:`FirewallRule ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: :class:`FirewallRule ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`FirewallRule ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -257,6 +263,8 @@ def list_by_server( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`FirewallRule + ` :rtype: :class:`FirewallRulePaged ` :raises: :class:`CloudError` diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/geo_backup_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/geo_backup_policies_operations.py new file mode 100644 index 000000000000..c92d279872ef --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/geo_backup_policies_operations.py @@ -0,0 +1,268 @@ +# 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 GeoBackupPoliciesOperations(object): + """GeoBackupPoliciesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + :ivar geo_backup_policy_name: The name of the geo backup policy. Constant value: "Default". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + self.geo_backup_policy_name = "Default" + + self.config = config + + def create_or_update( + self, resource_group_name, server_name, database_name, state, custom_headers=None, raw=False, **operation_config): + """Updates a database geo backup 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 server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param state: The state of the geo backup policy. Possible values + include: 'Disabled', 'Enabled' + :type state: str or :class:`GeoBackupPolicyState + ` + :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: :class:`GeoBackupPolicy + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`GeoBackupPolicy + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + parameters = models.GeoBackupPolicy(state=state) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'geoBackupPolicyName': self._serialize.url("self.geo_backup_policy_name", self.geo_backup_policy_name, '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['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, 'GeoBackupPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [201, 200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('GeoBackupPolicy', response) + if response.status_code == 200: + deserialized = self._deserialize('GeoBackupPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a geo backup 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 server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :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: :class:`GeoBackupPolicy + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`GeoBackupPolicy + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'geoBackupPolicyName': self._serialize.url("self.geo_backup_policy_name", self.geo_backup_policy_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('GeoBackupPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_by_database( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Returns a list of geo backup 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 database_name: The name of the database. + :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 :class:`GeoBackupPolicy + ` + :rtype: :class:`GeoBackupPolicyPaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + } + 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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.GeoBackupPolicyPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.GeoBackupPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py index e346b121624c..1df86c261fcb 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py @@ -9,9 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -import uuid from .. import models @@ -44,10 +44,13 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`OperationListResult + ` or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`OperationListResult - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL 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 a0f644199858..c77efacebe23 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 @@ -9,9 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -import uuid from .. import models @@ -53,10 +53,13 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`RecommendedElasticPool + ` or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`RecommendedElasticPool - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -103,76 +106,6 @@ def get( return deserialized - def get_databases( - self, resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets a database inside of a recommented elastic pool. - - :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 recommended_elastic_pool_name: The name of the elastic pool to - be retrieved. - :type recommended_elastic_pool_name: str - :param database_name: The name of the database to be retrieved. - :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`. - :rtype: :class:`Database ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'recommendedElasticPoolName': self._serialize.url("recommended_elastic_pool_name", recommended_elastic_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, '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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **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('Database', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): """Returns recommended elastic pools. @@ -188,6 +121,8 @@ def list_by_server( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`RecommendedElasticPool + ` :rtype: :class:`RecommendedElasticPoolPaged ` :raises: :class:`CloudError` @@ -244,83 +179,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def list_databases( - self, resource_group_name, server_name, recommended_elastic_pool_name, custom_headers=None, raw=False, **operation_config): - """Returns a list of databases inside a recommented elastic pool. - - :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 recommended_elastic_pool_name: The name of the recommended - elastic pool to be retrieved. - :type recommended_elastic_pool_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`. - :rtype: :class:`DatabasePaged ` - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'recommendedElasticPoolName': self._serialize.url("recommended_elastic_pool_name", recommended_elastic_pool_name, '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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **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.DatabasePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.DatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - def list_metrics( self, resource_group_name, server_name, recommended_elastic_pool_name, custom_headers=None, raw=False, **operation_config): - """Returns a recommented elastic pool metrics. + """Returns recommented 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 @@ -336,6 +197,9 @@ def list_metrics( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of + :class:`RecommendedElasticPoolMetric + ` :rtype: :class:`RecommendedElasticPoolMetricPaged ` :raises: :class:`CloudError` diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/recoverable_databases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/recoverable_databases_operations.py index ad1a898f8ce5..bb93996d9e6b 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/recoverable_databases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/recoverable_databases_operations.py @@ -9,9 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -import uuid from .. import models @@ -53,10 +53,13 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`RecoverableDatabase + ` or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`RecoverableDatabase - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -118,6 +121,8 @@ def list_by_server( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`RecoverableDatabase + ` :rtype: :class:`RecoverableDatabasePaged ` :raises: :class:`CloudError` diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/replication_links_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/replication_links_operations.py new file mode 100644 index 000000000000..8c89ce2d6028 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/replication_links_operations.py @@ -0,0 +1,431 @@ +# 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 msrestazure.azure_operation import AzureOperationPoller + +from .. import models + + +class ReplicationLinksOperations(object): + """ReplicationLinksOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + + self.config = config + + def delete( + self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): + """Deletes a database replication link. Cannot be done during failover. + + :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 that has the + replication link to be dropped. + :type database_name: str + :param link_id: The ID of the replication link to be deleted. + :type link_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: None or + :class:`ClientRawResponse` if + raw=true + :rtype: None or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'linkId': self._serialize.url("link_id", link_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['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 and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200, 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 get( + self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): + """Gets a database replication link. + + :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 to get the link for. + :type database_name: str + :param link_id: The replication link ID to be retrieved. + :type link_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: :class:`ReplicationLink + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`ReplicationLink + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'linkId': self._serialize.url("link_id", link_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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('ReplicationLink', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def failover( + self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): + """Sets which replica database is primary by failing over from the current + primary replica 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 that has the + replication link to be failed over. + :type database_name: str + :param link_id: The ID of the replication link to be failed over. + :type link_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 + :return: + :class:`AzureOperationPoller` + instance that returns None or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'linkId': self._serialize.url("link_id", link_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['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 and send request + def long_running_send(): + + request = self._client.post(url, query_parameters) + return self._client.send(request, header_parameters, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [204, 202]: + 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 + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def failover_allow_data_loss( + self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): + """Sets which replica database is primary by failing over from the current + primary replica database. This operation might result in data loss. + + :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 that has the + replication link to be failed over. + :type database_name: str + :param link_id: The ID of the replication link to be failed over. + :type link_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 + :return: + :class:`AzureOperationPoller` + instance that returns None or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'linkId': self._serialize.url("link_id", link_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['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 and send request + def long_running_send(): + + request = self._client.post(url, query_parameters) + return self._client.send(request, header_parameters, **operation_config) + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + return self._client.send( + request, header_parameters, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [204, 202]: + 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 + + if raw: + response = long_running_send() + return get_long_running_output(response) + + long_running_operation_timeout = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + + def list_by_database( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists a database's replication links. + + :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 to retrieve links for. + :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 :class:`ReplicationLink + ` + :rtype: :class:`ReplicationLinkPaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + } + 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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.ReplicationLinkPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ReplicationLinkPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/restorable_dropped_databases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/restorable_dropped_databases_operations.py index d5c8c6be369e..77e2dba4c09e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/restorable_dropped_databases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/restorable_dropped_databases_operations.py @@ -9,9 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -import uuid from .. import models @@ -53,10 +53,13 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`RestorableDroppedDatabase + ` or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`RestorableDroppedDatabase - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -118,6 +121,9 @@ def list_by_server( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of + :class:`RestorableDroppedDatabase + ` :rtype: :class:`RestorableDroppedDatabasePaged ` :raises: :class:`CloudError` diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py new file mode 100644 index 000000000000..9f093fd5f21b --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py @@ -0,0 +1,113 @@ +# 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 RestorePointsOperations(object): + """RestorePointsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + + self.config = config + + def list_by_database( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of database restore points. + + :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 to get available + restore points. + :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 :class:`RestorePoint + ` + :rtype: :class:`RestorePointPaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + } + 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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.RestorePointPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RestorePointPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_azure_ad_administrators_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_azure_ad_administrators_operations.py index 8d8f3cf1b6a1..c4a623d0c738 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_azure_ad_administrators_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_azure_ad_administrators_operations.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller -import uuid from .. import models @@ -56,12 +56,15 @@ def create_or_update( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`ServerAzureADAdministrator - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -152,12 +155,15 @@ def delete( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`ServerAzureADAdministrator - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -246,10 +252,13 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`ServerAzureADAdministrator + ` or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`ServerAzureADAdministrator - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -257,7 +266,8 @@ def get( path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str') + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'administratorName': self._serialize.url("self.administrator_name", self.administrator_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -295,7 +305,7 @@ def get( return deserialized - def list( + def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): """Returns a list of server Administrators. @@ -310,6 +320,9 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of + :class:`ServerAzureADAdministrator + ` :rtype: :class:`ServerAzureADAdministratorPaged ` :raises: :class:`CloudError` diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_communication_links_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_communication_links_operations.py index 007c79f97f13..ba130f33e28c 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_communication_links_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_communication_links_operations.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller -import uuid from .. import models @@ -54,9 +54,11 @@ def delete( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: None - :rtype: :class:`ClientRawResponse` - if raw=true + :return: None or + :class:`ClientRawResponse` if + raw=true + :rtype: None or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -114,10 +116,13 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`ServerCommunicationLink + ` or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`ServerCommunicationLink - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -182,12 +187,15 @@ def create_or_update( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`ServerCommunicationLink - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ parameters = models.ServerCommunicationLink(partner_server=partner_server) @@ -278,6 +286,8 @@ def list_by_server( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`ServerCommunicationLink + ` :rtype: :class:`ServerCommunicationLinkPaged ` :raises: :class:`CloudError` diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_connection_policies_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_connection_policies_operations.py new file mode 100644 index 000000000000..bb700425b594 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_connection_policies_operations.py @@ -0,0 +1,186 @@ +# 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 ServerConnectionPoliciesOperations(object): + """ServerConnectionPoliciesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + :ivar connection_policy_name: The name of the connection policy. Constant value: "default". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + self.connection_policy_name = "default" + + self.config = config + + def create_or_update( + self, resource_group_name, server_name, connection_type, custom_headers=None, raw=False, **operation_config): + """Creates or updates the server's connection 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 server_name: The name of the server. + :type server_name: str + :param connection_type: The server connection type. Possible values + include: 'Default', 'Proxy', 'Redirect' + :type connection_type: str or :class:`ServerConnectionType + ` + :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: :class:`ServerConnectionPolicy + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`ServerConnectionPolicy + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + parameters = models.ServerConnectionPolicy(connection_type=connection_type) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'connectionPolicyName': self._serialize.url("self.connection_policy_name", self.connection_policy_name, '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['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, 'ServerConnectionPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **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('ServerConnectionPolicy', response) + if response.status_code == 201: + deserialized = self._deserialize('ServerConnectionPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Gets the server's secure connection 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 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: :class:`ServerConnectionPolicy + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`ServerConnectionPolicy + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'connectionPolicyName': self._serialize.url("self.connection_policy_name", self.connection_policy_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('ServerConnectionPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_keys_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_keys_operations.py index c29a0e37361b..28e420dcc3e1 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_keys_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_keys_operations.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller -import uuid from .. import models @@ -38,7 +38,7 @@ def __init__(self, client, config, serializer, deserializer): def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Returns a list of server keys. + """Gets a list of server keys. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -51,6 +51,8 @@ def list_by_server( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`ServerKey + ` :rtype: :class:`ServerKeyPaged ` :raises: :class:`CloudError` """ @@ -108,7 +110,7 @@ def internal_paging(next_link=None, raw=False): def get( self, resource_group_name, server_name, key_name, custom_headers=None, raw=False, **operation_config): - """Returns a server key. + """Gets a server key. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -123,9 +125,11 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: :class:`ServerKey ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: :class:`ServerKey ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`ServerKey ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -194,12 +198,15 @@ def create_or_update( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`ServerKey - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -290,11 +297,14 @@ def delete( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :return: + :class:`AzureOperationPoller` + instance that returns None or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`AzureOperationPoller` - instance that returns None - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_usages_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_usages_operations.py new file mode 100644 index 000000000000..757cc6655947 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_usages_operations.py @@ -0,0 +1,109 @@ +# 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 ServerUsagesOperations(object): + """ServerUsagesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + + self.config = config + + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Returns server usages. + + :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 :class:`ServerUsage + ` + :rtype: :class:`ServerUsagePaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.ServerUsagePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ServerUsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/servers_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/servers_operations.py index fcdb4e55588e..b5ed4c8661d8 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/servers_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/servers_operations.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller -import uuid from .. import models @@ -24,9 +24,6 @@ class ServersOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An objec model deserializer. - :ivar connection_policy_name: The name of the connection policy. Constant value: "default". - :ivar backup_long_term_retention_vault_name: The name of the Azure SQL Server backup LongTermRetention vault. Constant value: "RegisteredVault". - :ivar encryption_protector_name: The name of the encryption protector to be retrieved. Constant value: "current". """ def __init__(self, client, config, serializer, deserializer): @@ -34,158 +31,9 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.connection_policy_name = "default" - self.backup_long_term_retention_vault_name = "RegisteredVault" - self.encryption_protector_name = "current" self.config = config - def create_or_update_connection_policy( - self, resource_group_name, server_name, connection_type, custom_headers=None, raw=False, **operation_config): - """Creates or updates the server's connection 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 server_name: The name of the server. - :type server_name: str - :param connection_type: The server connection type. Possible values - include: 'Default', 'Proxy', 'Redirect' - :type connection_type: str or :class:`ServerConnectionType - ` - :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`. - :rtype: :class:`ServerConnectionPolicy - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - parameters = models.ServerConnectionPolicy(connection_type=connection_type) - - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'connectionPolicyName': self._serialize.url("self.connection_policy_name", self.connection_policy_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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, 'ServerConnectionPolicy') - - # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, **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('ServerConnectionPolicy', response) - if response.status_code == 201: - deserialized = self._deserialize('ServerConnectionPolicy', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def get_connection_policy( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Gets the server's secure connection 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 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`. - :rtype: :class:`ServerConnectionPolicy - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'connectionPolicyName': self._serialize.url("self.connection_policy_name", self.connection_policy_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **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('ServerConnectionPolicy', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - def check_name_availability( self, name, custom_headers=None, raw=False, **operation_config): """Determines whether a resource can be created with the specified name. @@ -197,10 +45,13 @@ def check_name_availability( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`CheckNameAvailabilityResponse + ` or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`CheckNameAvailabilityResponse - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ parameters = models.CheckNameAvailabilityRequest(name=name) @@ -221,430 +72,48 @@ def check_name_availability( # Construct headers header_parameters = {} 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, 'CheckNameAvailabilityRequest') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, **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('CheckNameAvailabilityResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def get_backup_long_term_retention_vault( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Gets a server backup long term retention vault. - - :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`. - :rtype: :class:`BackupLongTermRetentionVault - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'backupLongTermRetentionVaultName': self._serialize.url("self.backup_long_term_retention_vault_name", self.backup_long_term_retention_vault_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **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('BackupLongTermRetentionVault', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_backup_long_term_retention_vault( - self, resource_group_name, server_name, recovery_services_vault_resource_id, custom_headers=None, raw=False, **operation_config): - """Updates a server backup long term retention vault. - - :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 recovery_services_vault_resource_id: The azure recovery - services vault resource id - :type recovery_services_vault_resource_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 - :rtype: - :class:`AzureOperationPoller` - instance that returns :class:`BackupLongTermRetentionVault - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - parameters = models.BackupLongTermRetentionVault(recovery_services_vault_resource_id=recovery_services_vault_resource_id) - - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'backupLongTermRetentionVaultName': self._serialize.url("self.backup_long_term_retention_vault_name", self.backup_long_term_retention_vault_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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, 'BackupLongTermRetentionVault') - - # Construct and send request - def long_running_send(): - - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): - - if response.status_code not in [200, 201, 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('BackupLongTermRetentionVault', response) - if response.status_code == 201: - deserialized = self._deserialize('BackupLongTermRetentionVault', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - if raw: - response = long_running_send() - return get_long_running_output(response) - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) - - def get_service_objective( - self, resource_group_name, server_name, service_objective_name, custom_headers=None, raw=False, **operation_config): - """Gets a database service objective. - - :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 service_objective_name: The name of the service objective to - retrieve. - :type service_objective_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`. - :rtype: :class:`ServiceObjective - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'serviceObjectiveName': self._serialize.url("service_objective_name", service_objective_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **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('ServiceObjective', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def list_service_objectives( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Returns database service objectives. - - :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`. - :rtype: :class:`ServiceObjectivePaged - ` - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **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.ServiceObjectivePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ServiceObjectivePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def list_usages( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Returns server usages. - - :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`. - :rtype: :class:`ServerUsagePaged - ` - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages' - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - else: - url = next_link - query_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 headers - header_parameters = {} - 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, 'CheckNameAvailabilityRequest') - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **operation_config) + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **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 response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - return response + deserialized = None - # Deserialize response - deserialized = models.ServerUsagePaged(internal_paging, self._deserialize.dependencies) + if response.status_code == 200: + deserialized = self._deserialize('CheckNameAvailabilityResponse', response) if raw: - header_dict = {} - client_raw_response = models.ServerUsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized def list( self, custom_headers=None, raw=False, **operation_config): - """Returns a list of servers. + """Gets a list of all servers 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 :class:`Server + ` :rtype: :class:`ServerPaged ` :raises: :class:`CloudError` """ @@ -713,6 +182,8 @@ def list_by_resource_group( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`Server + ` :rtype: :class:`ServerPaged ` :raises: :class:`CloudError` """ @@ -784,9 +255,11 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: :class:`Server ` - :rtype: :class:`ClientRawResponse` - if raw=true + :return: :class:`Server ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`Server ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ api_version = "2015-05-01-preview" @@ -849,11 +322,14 @@ def create_or_update( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`Server ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ api_version = "2015-05-01-preview" @@ -943,11 +419,14 @@ def delete( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :return: + :class:`AzureOperationPoller` + instance that returns None or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`AzureOperationPoller` - instance that returns None - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ api_version = "2015-05-01-preview" @@ -1022,15 +501,19 @@ def update( :param server_name: The name of the server. :type server_name: str :param parameters: The requested server resource state. - :type parameters: :class:`Server ` + :type parameters: :class:`ServerUpdate + ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`Server ` - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ api_version = "2015-05-01-preview" @@ -1059,7 +542,7 @@ def update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'Server') + body_content = self._serialize.body(parameters, 'ServerUpdate') # Construct and send request def long_running_send(): @@ -1104,240 +587,3 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - - def list_encryption_protectors( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Returns a list of the server encryption protectors. - - :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`. - :rtype: :class:`EncryptionProtectorPaged - ` - :raises: :class:`CloudError` - """ - api_version = "2015-05-01-preview" - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector' - 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("api_version", api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **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.EncryptionProtectorPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.EncryptionProtectorPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def get_encryption_protector( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Returns the server encryption protector. - - :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`. - :rtype: :class:`EncryptionProtector - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2015-05-01-preview" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}' - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'encryptionProtectorName': self._serialize.url("self.encryption_protector_name", self.encryption_protector_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("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **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('EncryptionProtector', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_or_update_encryption_protector( - self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): - """Updates an existing encryption protector. - - :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 parameters: The requested encryption protector resource state. - :type parameters: :class:`EncryptionProtector - ` - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :rtype: - :class:`AzureOperationPoller` - instance that returns :class:`EncryptionProtector - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2015-05-01-preview" - - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}' - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'encryptionProtectorName': self._serialize.url("self.encryption_protector_name", self.encryption_protector_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("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - 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, 'EncryptionProtector') - - # Construct and send request - def long_running_send(): - - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): - - 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('EncryptionProtector', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - if raw: - response = long_running_send() - return get_long_running_output(response) - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/service_objectives_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/service_objectives_operations.py new file mode 100644 index 000000000000..49f891a3c6b1 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/service_objectives_operations.py @@ -0,0 +1,180 @@ +# 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 ServiceObjectivesOperations(object): + """ServiceObjectivesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + + self.config = config + + def get( + self, resource_group_name, server_name, service_objective_name, custom_headers=None, raw=False, **operation_config): + """Gets a database service objective. + + :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 service_objective_name: The name of the service objective to + retrieve. + :type service_objective_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: :class:`ServiceObjective + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`ServiceObjective + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'serviceObjectiveName': self._serialize.url("service_objective_name", service_objective_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('ServiceObjective', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Returns database service objectives. + + :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 :class:`ServiceObjective + ` + :rtype: :class:`ServiceObjectivePaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.ServiceObjectivePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ServiceObjectivePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/service_tier_advisors_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/service_tier_advisors_operations.py new file mode 100644 index 000000000000..730011481ba4 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/service_tier_advisors_operations.py @@ -0,0 +1,185 @@ +# 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 ServiceTierAdvisorsOperations(object): + """ServiceTierAdvisorsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + + self.config = config + + def get( + self, resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers=None, raw=False, **operation_config): + """Gets a service tier advisor. + + :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 database. + :type database_name: str + :param service_tier_advisor_name: The name of service tier advisor. + :type service_tier_advisor_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: :class:`ServiceTierAdvisor + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`ServiceTierAdvisor + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'serviceTierAdvisorName': self._serialize.url("service_tier_advisor_name", service_tier_advisor_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('ServiceTierAdvisor', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_by_database( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Returns service tier advisors for specified 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 database. + :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 :class:`ServiceTierAdvisor + ` + :rtype: :class:`ServiceTierAdvisorPaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + } + 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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.ServiceTierAdvisorPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ServiceTierAdvisorPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryption_activities_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryption_activities_operations.py new file mode 100644 index 000000000000..66dc5d62213f --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryption_activities_operations.py @@ -0,0 +1,117 @@ +# 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 TransparentDataEncryptionActivitiesOperations(object): + """TransparentDataEncryptionActivitiesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + :ivar transparent_data_encryption_name: The name of the transparent data encryption configuration. Constant value: "current". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + self.transparent_data_encryption_name = "current" + + self.config = config + + def list_by_configuration( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Returns a database's transparent data encryption operation result. + + :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 for which the + transparent data encryption applies. + :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 + :class:`TransparentDataEncryptionActivity + ` + :rtype: :class:`TransparentDataEncryptionActivityPaged + ` + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}/operationResults' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'transparentDataEncryptionName': self._serialize.url("self.transparent_data_encryption_name", self.transparent_data_encryption_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **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.TransparentDataEncryptionActivityPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.TransparentDataEncryptionActivityPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryptions_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryptions_operations.py new file mode 100644 index 000000000000..95845cffb79f --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/transparent_data_encryptions_operations.py @@ -0,0 +1,195 @@ +# 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 TransparentDataEncryptionsOperations(object): + """TransparentDataEncryptionsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + :ivar transparent_data_encryption_name: The name of the transparent data encryption configuration. Constant value: "current". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + self.transparent_data_encryption_name = "current" + + self.config = config + + def create_or_update( + self, resource_group_name, server_name, database_name, status=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates a database's transparent data encryption + configuration. + + :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 for which setting the + transparent data encryption applies. + :type database_name: str + :param status: The status of the database transparent data encryption. + Possible values include: 'Enabled', 'Disabled' + :type status: str or :class:`TransparentDataEncryptionStatus + ` + :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: :class:`TransparentDataEncryption + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`TransparentDataEncryption + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + parameters = models.TransparentDataEncryption(status=status) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'transparentDataEncryptionName': self._serialize.url("self.transparent_data_encryption_name", self.transparent_data_encryption_name, '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['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, 'TransparentDataEncryption') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **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('TransparentDataEncryption', response) + if response.status_code == 201: + deserialized = self._deserialize('TransparentDataEncryption', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a database's transparent data encryption configuration. + + :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 for which the + transparent data encryption applies. + :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: :class:`TransparentDataEncryption + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`TransparentDataEncryption + ` or + :class:`ClientRawResponse` + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'transparentDataEncryptionName': self._serialize.url("self.transparent_data_encryption_name", self.transparent_data_encryption_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **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('TransparentDataEncryption', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_network_rules_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_network_rules_operations.py index 56e7894ff95c..8a5865f140bb 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_network_rules_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_network_rules_operations.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- +import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller -import uuid from .. import models @@ -54,10 +54,13 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: :class:`VirtualNetworkRule + ` or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`VirtualNetworkRule - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -105,7 +108,7 @@ def get( return deserialized def create_or_update( - self, resource_group_name, server_name, virtual_network_rule_name, virtual_network_subnet_id=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, virtual_network_rule_name, virtual_network_subnet_id, ignore_vnet_private_access_configuration=None, custom_headers=None, raw=False, **operation_config): """Creates or updates an existing virtual network rule. :param resource_group_name: The name of the resource group that @@ -117,21 +120,27 @@ def create_or_update( :param virtual_network_rule_name: The name of the virtual network rule. :type virtual_network_rule_name: str - :param virtual_network_subnet_id: The resource ID of the virtual - network subnet + :param virtual_network_subnet_id: The ARM resource id of the virtual + network subnet. :type virtual_network_subnet_id: str + :param ignore_vnet_private_access_configuration: Create firewall rule + before the virtual network has private access enabled. + :type ignore_vnet_private_access_configuration: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :rtype: + :return: :class:`AzureOperationPoller` instance that returns :class:`VirtualNetworkRule - ` - :rtype: :class:`ClientRawResponse` - if raw=true + ` or + :class:`ClientRawResponse` if + raw=true + :rtype: + :class:`AzureOperationPoller` + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ - parameters = models.VirtualNetworkRule(virtual_network_subnet_id=virtual_network_subnet_id) + parameters = models.VirtualNetworkRule(virtual_network_subnet_id=virtual_network_subnet_id, ignore_vnet_private_access_configuration=ignore_vnet_private_access_configuration) # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}' @@ -222,11 +231,14 @@ def delete( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :return: + :class:`AzureOperationPoller` + instance that returns None or + :class:`ClientRawResponse` if + raw=true :rtype: :class:`AzureOperationPoller` - instance that returns None - :rtype: :class:`ClientRawResponse` - if raw=true + or :class:`ClientRawResponse` :raises: :class:`CloudError` """ # Construct URL @@ -304,6 +316,8 @@ def list_by_server( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`VirtualNetworkRule + ` :rtype: :class:`VirtualNetworkRulePaged ` :raises: :class:`CloudError` 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 85a49c31adc5..85d2bcb4d648 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -13,20 +13,39 @@ from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION -from .operations.databases_operations import DatabasesOperations +from .operations.backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations +from .operations.backup_long_term_retention_vaults_operations import BackupLongTermRetentionVaultsOperations +from .operations.restore_points_operations import RestorePointsOperations from .operations.recoverable_databases_operations import RecoverableDatabasesOperations from .operations.restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations from .operations.capabilities_operations import CapabilitiesOperations -from .operations.servers_operations import ServersOperations +from .operations.server_connection_policies_operations import ServerConnectionPoliciesOperations +from .operations.database_threat_detection_policies_operations import DatabaseThreatDetectionPoliciesOperations +from .operations.data_masking_policies_operations import DataMaskingPoliciesOperations +from .operations.data_masking_rules_operations import DataMaskingRulesOperations from .operations.firewall_rules_operations import FirewallRulesOperations +from .operations.geo_backup_policies_operations import GeoBackupPoliciesOperations +from .operations.databases_operations import DatabasesOperations from .operations.elastic_pools_operations import ElasticPoolsOperations from .operations.operations import Operations -from .operations.recommended_elastic_pools_operations import RecommendedElasticPoolsOperations +from .operations.replication_links_operations import ReplicationLinksOperations from .operations.server_azure_ad_administrators_operations import ServerAzureADAdministratorsOperations from .operations.server_communication_links_operations import ServerCommunicationLinksOperations +from .operations.service_objectives_operations import ServiceObjectivesOperations +from .operations.servers_operations import ServersOperations +from .operations.elastic_pool_activities_operations import ElasticPoolActivitiesOperations +from .operations.elastic_pool_database_activities_operations import ElasticPoolDatabaseActivitiesOperations +from .operations.recommended_elastic_pools_operations import RecommendedElasticPoolsOperations +from .operations.service_tier_advisors_operations import ServiceTierAdvisorsOperations +from .operations.transparent_data_encryptions_operations import TransparentDataEncryptionsOperations +from .operations.transparent_data_encryption_activities_operations import TransparentDataEncryptionActivitiesOperations +from .operations.server_usages_operations import ServerUsagesOperations +from .operations.database_usages_operations import DatabaseUsagesOperations +from .operations.database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations +from .operations.encryption_protectors_operations import EncryptionProtectorsOperations from .operations.failover_groups_operations import FailoverGroupsOperations -from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations from .operations.server_keys_operations import ServerKeysOperations +from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations from . import models @@ -71,34 +90,72 @@ class SqlManagementClient(object): :ivar config: Configuration for client. :vartype config: SqlManagementClientConfiguration - :ivar databases: Databases operations - :vartype databases: azure.mgmt.sql.operations.DatabasesOperations + :ivar backup_long_term_retention_policies: BackupLongTermRetentionPolicies operations + :vartype backup_long_term_retention_policies: azure.mgmt.sql.operations.BackupLongTermRetentionPoliciesOperations + :ivar backup_long_term_retention_vaults: BackupLongTermRetentionVaults operations + :vartype backup_long_term_retention_vaults: azure.mgmt.sql.operations.BackupLongTermRetentionVaultsOperations + :ivar restore_points: RestorePoints operations + :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations :ivar recoverable_databases: RecoverableDatabases operations :vartype recoverable_databases: azure.mgmt.sql.operations.RecoverableDatabasesOperations :ivar restorable_dropped_databases: RestorableDroppedDatabases operations :vartype restorable_dropped_databases: azure.mgmt.sql.operations.RestorableDroppedDatabasesOperations :ivar capabilities: Capabilities operations :vartype capabilities: azure.mgmt.sql.operations.CapabilitiesOperations - :ivar servers: Servers operations - :vartype servers: azure.mgmt.sql.operations.ServersOperations + :ivar server_connection_policies: ServerConnectionPolicies operations + :vartype server_connection_policies: azure.mgmt.sql.operations.ServerConnectionPoliciesOperations + :ivar database_threat_detection_policies: DatabaseThreatDetectionPolicies operations + :vartype database_threat_detection_policies: azure.mgmt.sql.operations.DatabaseThreatDetectionPoliciesOperations + :ivar data_masking_policies: DataMaskingPolicies operations + :vartype data_masking_policies: azure.mgmt.sql.operations.DataMaskingPoliciesOperations + :ivar data_masking_rules: DataMaskingRules operations + :vartype data_masking_rules: azure.mgmt.sql.operations.DataMaskingRulesOperations :ivar firewall_rules: FirewallRules operations :vartype firewall_rules: azure.mgmt.sql.operations.FirewallRulesOperations + :ivar geo_backup_policies: GeoBackupPolicies operations + :vartype geo_backup_policies: azure.mgmt.sql.operations.GeoBackupPoliciesOperations + :ivar databases: Databases operations + :vartype databases: azure.mgmt.sql.operations.DatabasesOperations :ivar elastic_pools: ElasticPools operations :vartype elastic_pools: azure.mgmt.sql.operations.ElasticPoolsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.sql.operations.Operations - :ivar recommended_elastic_pools: RecommendedElasticPools operations - :vartype recommended_elastic_pools: azure.mgmt.sql.operations.RecommendedElasticPoolsOperations + :ivar replication_links: ReplicationLinks operations + :vartype replication_links: azure.mgmt.sql.operations.ReplicationLinksOperations :ivar server_azure_ad_administrators: ServerAzureADAdministrators operations :vartype server_azure_ad_administrators: azure.mgmt.sql.operations.ServerAzureADAdministratorsOperations :ivar server_communication_links: ServerCommunicationLinks operations :vartype server_communication_links: azure.mgmt.sql.operations.ServerCommunicationLinksOperations + :ivar service_objectives: ServiceObjectives operations + :vartype service_objectives: azure.mgmt.sql.operations.ServiceObjectivesOperations + :ivar servers: Servers operations + :vartype servers: azure.mgmt.sql.operations.ServersOperations + :ivar elastic_pool_activities: ElasticPoolActivities operations + :vartype elastic_pool_activities: azure.mgmt.sql.operations.ElasticPoolActivitiesOperations + :ivar elastic_pool_database_activities: ElasticPoolDatabaseActivities operations + :vartype elastic_pool_database_activities: azure.mgmt.sql.operations.ElasticPoolDatabaseActivitiesOperations + :ivar recommended_elastic_pools: RecommendedElasticPools operations + :vartype recommended_elastic_pools: azure.mgmt.sql.operations.RecommendedElasticPoolsOperations + :ivar service_tier_advisors: ServiceTierAdvisors operations + :vartype service_tier_advisors: azure.mgmt.sql.operations.ServiceTierAdvisorsOperations + :ivar transparent_data_encryptions: TransparentDataEncryptions operations + :vartype transparent_data_encryptions: azure.mgmt.sql.operations.TransparentDataEncryptionsOperations + :ivar transparent_data_encryption_activities: TransparentDataEncryptionActivities operations + :vartype transparent_data_encryption_activities: azure.mgmt.sql.operations.TransparentDataEncryptionActivitiesOperations + :ivar server_usages: ServerUsages operations + :vartype server_usages: azure.mgmt.sql.operations.ServerUsagesOperations + :ivar database_usages: DatabaseUsages operations + :vartype database_usages: azure.mgmt.sql.operations.DatabaseUsagesOperations + :ivar database_blob_auditing_policies: DatabaseBlobAuditingPolicies operations + :vartype database_blob_auditing_policies: azure.mgmt.sql.operations.DatabaseBlobAuditingPoliciesOperations + :ivar encryption_protectors: EncryptionProtectors operations + :vartype encryption_protectors: azure.mgmt.sql.operations.EncryptionProtectorsOperations :ivar failover_groups: FailoverGroups operations :vartype failover_groups: azure.mgmt.sql.operations.FailoverGroupsOperations - :ivar virtual_network_rules: VirtualNetworkRules operations - :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations :ivar server_keys: ServerKeys operations :vartype server_keys: azure.mgmt.sql.operations.ServerKeysOperations + :ivar virtual_network_rules: VirtualNetworkRules operations + :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -119,7 +176,11 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.databases = DatabasesOperations( + self.backup_long_term_retention_policies = BackupLongTermRetentionPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.backup_long_term_retention_vaults = BackupLongTermRetentionVaultsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.restore_points = RestorePointsOperations( self._client, self.config, self._serialize, self._deserialize) self.recoverable_databases = RecoverableDatabasesOperations( self._client, self.config, self._serialize, self._deserialize) @@ -127,23 +188,57 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.capabilities = CapabilitiesOperations( self._client, self.config, self._serialize, self._deserialize) - self.servers = ServersOperations( + self.server_connection_policies = ServerConnectionPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.database_threat_detection_policies = DatabaseThreatDetectionPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.data_masking_policies = DataMaskingPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.data_masking_rules = DataMaskingRulesOperations( self._client, self.config, self._serialize, self._deserialize) self.firewall_rules = FirewallRulesOperations( self._client, self.config, self._serialize, self._deserialize) + self.geo_backup_policies = GeoBackupPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.databases = DatabasesOperations( + self._client, self.config, self._serialize, self._deserialize) self.elastic_pools = ElasticPoolsOperations( self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) - self.recommended_elastic_pools = RecommendedElasticPoolsOperations( + self.replication_links = ReplicationLinksOperations( self._client, self.config, self._serialize, self._deserialize) self.server_azure_ad_administrators = ServerAzureADAdministratorsOperations( self._client, self.config, self._serialize, self._deserialize) self.server_communication_links = ServerCommunicationLinksOperations( self._client, self.config, self._serialize, self._deserialize) - self.failover_groups = FailoverGroupsOperations( + self.service_objectives = ServiceObjectivesOperations( self._client, self.config, self._serialize, self._deserialize) - self.virtual_network_rules = VirtualNetworkRulesOperations( + self.servers = ServersOperations( + self._client, self.config, self._serialize, self._deserialize) + self.elastic_pool_activities = ElasticPoolActivitiesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.elastic_pool_database_activities = ElasticPoolDatabaseActivitiesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.recommended_elastic_pools = RecommendedElasticPoolsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.service_tier_advisors = ServiceTierAdvisorsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.transparent_data_encryptions = TransparentDataEncryptionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.transparent_data_encryption_activities = TransparentDataEncryptionActivitiesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.server_usages = ServerUsagesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.database_usages = DatabaseUsagesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.database_blob_auditing_policies = DatabaseBlobAuditingPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.encryption_protectors = EncryptionProtectorsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.failover_groups = FailoverGroupsOperations( self._client, self.config, self._serialize, self._deserialize) self.server_keys = ServerKeysOperations( self._client, self.config, self._serialize, self._deserialize) + self.virtual_network_rules = VirtualNetworkRulesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-sql/build.json b/azure-mgmt-sql/build.json index 646a907851f9..d7abecc6b165 100644 --- a/azure-mgmt-sql/build.json +++ b/azure-mgmt-sql/build.json @@ -1 +1 @@ -{"autorest": "1.1.0", "date": "2017-07-03T18:31:51Z", "version": ""} \ No newline at end of file +{"autorest": "1.2.2", "date": "2017-07-31T23:05:43Z", "version": ""} \ No newline at end of file