From fcaf57721b600aa6b13acb1eb93492f08e052428 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 9 Feb 2018 10:51:22 -0800 Subject: [PATCH 01/11] Extract databases, elastic pools, and check name availability from sql.core.json (#1829) * Generated from 5a6fe19cfbfc33daf461404f3e77978e398bec49 Extract checkNameAvailability.json from sql.core.json * Generated from b1f5dd6f842a458a6c117a2a5da68a7f5d895d77 Fixed cross-file references * Update version.py --- .../azure/mgmt/sql/models/__init__.py | 136 +- .../sql/models/sql_management_client_enums.py | 256 +-- .../azure/mgmt/sql/operations/__init__.py | 12 +- ...long_term_retention_policies_operations.py | 120 +- ...p_long_term_retention_vaults_operations.py | 106 +- .../sql/operations/capabilities_operations.py | 2 +- .../data_masking_policies_operations.py | 4 +- .../data_masking_rules_operations.py | 4 +- ...abase_blob_auditing_policies_operations.py | 4 +- .../sql/operations/database_operations.py | 4 +- ...se_threat_detection_policies_operations.py | 4 +- .../operations/database_usages_operations.py | 2 +- .../sql/operations/databases_operations.py | 1438 ++++++++++------- .../elastic_pool_activities_operations.py | 2 +- ...tic_pool_database_activities_operations.py | 2 +- .../operations/elastic_pools_operations.py | 493 +++--- .../encryption_protectors_operations.py | 100 +- .../operations/failover_groups_operations.py | 486 ++++-- .../operations/firewall_rules_operations.py | 8 +- .../geo_backup_policies_operations.py | 6 +- .../azure/mgmt/sql/operations/operations.py | 2 +- .../recommended_elastic_pools_operations.py | 6 +- .../recoverable_databases_operations.py | 4 +- .../replication_links_operations.py | 183 ++- ...restorable_dropped_databases_operations.py | 4 +- .../operations/restore_points_operations.py | 2 +- ...rver_azure_ad_administrators_operations.py | 208 ++- .../server_communication_links_operations.py | 109 +- .../server_connection_policies_operations.py | 4 +- .../server_dns_aliases_operations.py | 275 ++-- .../sql/operations/server_keys_operations.py | 194 ++- .../operations/server_usages_operations.py | 2 +- .../mgmt/sql/operations/servers_operations.py | 277 ++-- .../service_objectives_operations.py | 4 +- .../service_tier_advisors_operations.py | 4 +- .../subscription_usages_operations.py | 4 +- .../sql/operations/sync_agents_operations.py | 198 ++- .../sql/operations/sync_groups_operations.py | 401 +++-- .../sql/operations/sync_members_operations.py | 407 +++-- ...t_data_encryption_activities_operations.py | 2 +- ...transparent_data_encryptions_operations.py | 4 +- .../virtual_network_rules_operations.py | 201 ++- .../azure/mgmt/sql/sql_management_client.py | 30 +- 43 files changed, 3418 insertions(+), 2296 deletions(-) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 531a679a81b5..fffd1dfc5d5f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -26,10 +26,26 @@ from .elastic_pool_edition_capability import ElasticPoolEditionCapability from .server_version_capability import ServerVersionCapability from .location_capabilities import LocationCapabilities +from .check_name_availability_request import CheckNameAvailabilityRequest +from .check_name_availability_response import CheckNameAvailabilityResponse from .server_connection_policy import ServerConnectionPolicy +from .slo_usage_metric import SloUsageMetric +from .service_tier_advisor import ServiceTierAdvisor +from .transparent_data_encryption import TransparentDataEncryption +from .operation_impact import OperationImpact +from .recommended_index import RecommendedIndex +from .database import Database +from .database_update import DatabaseUpdate +from .transparent_data_encryption_activity import TransparentDataEncryptionActivity +from .elastic_pool_database_activity import ElasticPoolDatabaseActivity +from .elastic_pool_activity import ElasticPoolActivity +from .recommended_elastic_pool_metric import RecommendedElasticPoolMetric +from .recommended_elastic_pool import RecommendedElasticPool from .database_security_alert_policy import DatabaseSecurityAlertPolicy from .data_masking_policy import DataMaskingPolicy from .data_masking_rule import DataMaskingRule +from .elastic_pool import ElasticPool +from .elastic_pool_update import ElasticPoolUpdate from .firewall_rule import FirewallRule from .geo_backup_policy import GeoBackupPolicy from .import_extension_request import ImportExtensionRequest @@ -45,22 +61,6 @@ 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 -from .slo_usage_metric import SloUsageMetric -from .service_tier_advisor import ServiceTierAdvisor -from .transparent_data_encryption import TransparentDataEncryption -from .operation_impact import OperationImpact -from .recommended_index import RecommendedIndex -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_usage import ServerUsage from .database_usage import DatabaseUsage from .database_blob_auditing_policy import DatabaseBlobAuditingPolicy @@ -100,18 +100,18 @@ 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 .server_paged import ServerPaged +from .database_paged import DatabasePaged from .metric_paged import MetricPaged from .metric_definition_paged import MetricDefinitionPaged -from .database_paged import DatabasePaged +from .data_masking_rule_paged import DataMaskingRulePaged from .elastic_pool_paged import ElasticPoolPaged +from .firewall_rule_paged import FirewallRulePaged +from .geo_backup_policy_paged import GeoBackupPolicyPaged 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_paged import ServerPaged from .elastic_pool_activity_paged import ElasticPoolActivityPaged from .elastic_pool_database_activity_paged import ElasticPoolDatabaseActivityPaged from .recommended_elastic_pool_paged import RecommendedElasticPoolPaged @@ -141,16 +141,27 @@ CapabilityStatus, MaxSizeUnits, PerformanceLevelUnit, + CheckNameAvailabilityReason, ServerConnectionType, + CreateMode, + DatabaseEdition, + ServiceObjectiveName, + TransparentDataEncryptionStatus, + RecommendedIndexAction, + RecommendedIndexState, + RecommendedIndexType, + ReadScale, + SampleName, + TransparentDataEncryptionActivityStatus, + ElasticPoolEdition, SecurityAlertPolicyState, SecurityAlertPolicyEmailAccountAdmins, SecurityAlertPolicyUseServerDefault, DataMaskingState, DataMaskingRuleState, DataMaskingFunction, + ElasticPoolState, GeoBackupPolicyState, - DatabaseEdition, - ServiceObjectiveName, StorageKeyType, AuthenticationType, UnitType, @@ -158,17 +169,6 @@ UnitDefinitionType, ReplicationRole, ReplicationState, - CheckNameAvailabilityReason, - ElasticPoolEdition, - CreateMode, - TransparentDataEncryptionStatus, - RecommendedIndexAction, - RecommendedIndexState, - RecommendedIndexType, - ReadScale, - SampleName, - ElasticPoolState, - TransparentDataEncryptionActivityStatus, BlobAuditingPolicyState, ServerKeyType, ReadWriteEndpointFailoverPolicy, @@ -205,10 +205,26 @@ 'ElasticPoolEditionCapability', 'ServerVersionCapability', 'LocationCapabilities', + 'CheckNameAvailabilityRequest', + 'CheckNameAvailabilityResponse', 'ServerConnectionPolicy', + 'SloUsageMetric', + 'ServiceTierAdvisor', + 'TransparentDataEncryption', + 'OperationImpact', + 'RecommendedIndex', + 'Database', + 'DatabaseUpdate', + 'TransparentDataEncryptionActivity', + 'ElasticPoolDatabaseActivity', + 'ElasticPoolActivity', + 'RecommendedElasticPoolMetric', + 'RecommendedElasticPool', 'DatabaseSecurityAlertPolicy', 'DataMaskingPolicy', 'DataMaskingRule', + 'ElasticPool', + 'ElasticPoolUpdate', 'FirewallRule', 'GeoBackupPolicy', 'ImportExtensionRequest', @@ -224,22 +240,6 @@ 'ServerAzureADAdministrator', 'ServerCommunicationLink', 'ServiceObjective', - 'CheckNameAvailabilityRequest', - 'CheckNameAvailabilityResponse', - 'RecommendedElasticPoolMetric', - 'SloUsageMetric', - 'ServiceTierAdvisor', - 'TransparentDataEncryption', - 'OperationImpact', - 'RecommendedIndex', - 'Database', - 'RecommendedElasticPool', - 'ElasticPool', - 'ElasticPoolUpdate', - 'ElasticPoolActivity', - 'ElasticPoolDatabaseActivity', - 'DatabaseUpdate', - 'TransparentDataEncryptionActivity', 'ServerUsage', 'DatabaseUsage', 'DatabaseBlobAuditingPolicy', @@ -279,18 +279,18 @@ 'RestorePointPaged', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', - 'DataMaskingRulePaged', - 'FirewallRulePaged', - 'GeoBackupPolicyPaged', + 'ServerPaged', + 'DatabasePaged', 'MetricPaged', 'MetricDefinitionPaged', - 'DatabasePaged', + 'DataMaskingRulePaged', 'ElasticPoolPaged', + 'FirewallRulePaged', + 'GeoBackupPolicyPaged', 'ReplicationLinkPaged', 'ServerAzureADAdministratorPaged', 'ServerCommunicationLinkPaged', 'ServiceObjectivePaged', - 'ServerPaged', 'ElasticPoolActivityPaged', 'ElasticPoolDatabaseActivityPaged', 'RecommendedElasticPoolPaged', @@ -319,16 +319,27 @@ 'CapabilityStatus', 'MaxSizeUnits', 'PerformanceLevelUnit', + 'CheckNameAvailabilityReason', 'ServerConnectionType', + 'CreateMode', + 'DatabaseEdition', + 'ServiceObjectiveName', + 'TransparentDataEncryptionStatus', + 'RecommendedIndexAction', + 'RecommendedIndexState', + 'RecommendedIndexType', + 'ReadScale', + 'SampleName', + 'TransparentDataEncryptionActivityStatus', + 'ElasticPoolEdition', 'SecurityAlertPolicyState', 'SecurityAlertPolicyEmailAccountAdmins', 'SecurityAlertPolicyUseServerDefault', 'DataMaskingState', 'DataMaskingRuleState', 'DataMaskingFunction', + 'ElasticPoolState', 'GeoBackupPolicyState', - 'DatabaseEdition', - 'ServiceObjectiveName', 'StorageKeyType', 'AuthenticationType', 'UnitType', @@ -336,17 +347,6 @@ 'UnitDefinitionType', 'ReplicationRole', 'ReplicationState', - 'CheckNameAvailabilityReason', - 'ElasticPoolEdition', - 'CreateMode', - 'TransparentDataEncryptionStatus', - 'RecommendedIndexAction', - 'RecommendedIndexState', - 'RecommendedIndexType', - 'ReadScale', - 'SampleName', - 'ElasticPoolState', - 'TransparentDataEncryptionActivityStatus', 'BlobAuditingPolicyState', 'ServerKeyType', 'ReadWriteEndpointFailoverPolicy', 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 9a91fbb9da44..2a19493bc5e7 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 @@ -45,6 +45,12 @@ class PerformanceLevelUnit(Enum): dtu = "DTU" +class CheckNameAvailabilityReason(Enum): + + invalid = "Invalid" + already_exists = "AlreadyExists" + + class ServerConnectionType(Enum): default = "Default" @@ -52,51 +58,16 @@ 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" - enabled = "Enabled" - - -class DataMaskingRuleState(Enum): - - disabled = "Disabled" - enabled = "Enabled" - - -class DataMaskingFunction(Enum): +class CreateMode(Enum): + copy = "Copy" default = "Default" - ccn = "CCN" - email = "Email" - number = "Number" - ssn = "SSN" - text = "Text" - - -class GeoBackupPolicyState(Enum): - - disabled = "Disabled" - enabled = "Enabled" + non_readable_secondary = "NonReadableSecondary" + online_secondary = "OnlineSecondary" + point_in_time_restore = "PointInTimeRestore" + recovery = "Recovery" + restore = "Restore" + restore_long_term_retention_backup = "RestoreLongTermRetentionBackup" class DatabaseEdition(Enum): @@ -183,69 +154,57 @@ class ServiceObjectiveName(Enum): elastic_pool = "ElasticPool" -class StorageKeyType(Enum): - - storage_access_key = "StorageAccessKey" - shared_access_key = "SharedAccessKey" - - -class AuthenticationType(Enum): +class TransparentDataEncryptionStatus(Enum): - sql = "SQL" - ad_password = "ADPassword" + enabled = "Enabled" + disabled = "Disabled" -class UnitType(Enum): +class RecommendedIndexAction(Enum): - count = "count" - bytes = "bytes" - seconds = "seconds" - percent = "percent" - count_per_second = "countPerSecond" - bytes_per_second = "bytesPerSecond" + create = "Create" + drop = "Drop" + rebuild = "Rebuild" -class PrimaryAggregationType(Enum): +class RecommendedIndexState(Enum): - none = "None" - average = "Average" - count = "Count" - minimum = "Minimum" - maximum = "Maximum" - total = "Total" + active = "Active" + pending = "Pending" + executing = "Executing" + verifying = "Verifying" + pending_revert = "Pending Revert" + reverting = "Reverting" + reverted = "Reverted" + ignored = "Ignored" + expired = "Expired" + blocked = "Blocked" + success = "Success" -class UnitDefinitionType(Enum): +class RecommendedIndexType(Enum): - count = "Count" - bytes = "Bytes" - seconds = "Seconds" - percent = "Percent" - count_per_second = "CountPerSecond" - bytes_per_second = "BytesPerSecond" + clustered = "CLUSTERED" + nonclustered = "NONCLUSTERED" + columnstore = "COLUMNSTORE" + clusteredcolumnstore = "CLUSTERED COLUMNSTORE" -class ReplicationRole(Enum): +class ReadScale(Enum): - primary = "Primary" - secondary = "Secondary" - non_readable_secondary = "NonReadableSecondary" - source = "Source" - copy = "Copy" + enabled = "Enabled" + disabled = "Disabled" -class ReplicationState(Enum): +class SampleName(Enum): - pending = "PENDING" - seeding = "SEEDING" - catch_up = "CATCH_UP" - suspended = "SUSPENDED" + adventure_works_lt = "AdventureWorksLT" -class CheckNameAvailabilityReason(Enum): +class TransparentDataEncryptionActivityStatus(Enum): - invalid = "Invalid" - already_exists = "AlreadyExists" + encrypting = "Encrypting" + decrypting = "Decrypting" class ElasticPoolEdition(Enum): @@ -255,63 +214,45 @@ class ElasticPoolEdition(Enum): premium = "Premium" -class CreateMode(Enum): - - copy = "Copy" - default = "Default" - non_readable_secondary = "NonReadableSecondary" - online_secondary = "OnlineSecondary" - point_in_time_restore = "PointInTimeRestore" - recovery = "Recovery" - restore = "Restore" - restore_long_term_retention_backup = "RestoreLongTermRetentionBackup" - - -class TransparentDataEncryptionStatus(Enum): +class SecurityAlertPolicyState(Enum): + new = "New" enabled = "Enabled" disabled = "Disabled" -class RecommendedIndexAction(Enum): +class SecurityAlertPolicyEmailAccountAdmins(Enum): - create = "Create" - drop = "Drop" - rebuild = "Rebuild" + enabled = "Enabled" + disabled = "Disabled" -class RecommendedIndexState(Enum): +class SecurityAlertPolicyUseServerDefault(Enum): - active = "Active" - pending = "Pending" - executing = "Executing" - verifying = "Verifying" - pending_revert = "Pending Revert" - reverting = "Reverting" - reverted = "Reverted" - ignored = "Ignored" - expired = "Expired" - blocked = "Blocked" - success = "Success" + enabled = "Enabled" + disabled = "Disabled" -class RecommendedIndexType(Enum): +class DataMaskingState(Enum): - clustered = "CLUSTERED" - nonclustered = "NONCLUSTERED" - columnstore = "COLUMNSTORE" - clusteredcolumnstore = "CLUSTERED COLUMNSTORE" + disabled = "Disabled" + enabled = "Enabled" -class ReadScale(Enum): +class DataMaskingRuleState(Enum): - enabled = "Enabled" disabled = "Disabled" + enabled = "Enabled" -class SampleName(Enum): +class DataMaskingFunction(Enum): - adventure_works_lt = "AdventureWorksLT" + default = "Default" + ccn = "CCN" + email = "Email" + number = "Number" + ssn = "SSN" + text = "Text" class ElasticPoolState(Enum): @@ -321,10 +262,69 @@ class ElasticPoolState(Enum): disabled = "Disabled" -class TransparentDataEncryptionActivityStatus(Enum): +class GeoBackupPolicyState(Enum): - encrypting = "Encrypting" - decrypting = "Decrypting" + disabled = "Disabled" + enabled = "Enabled" + + +class StorageKeyType(Enum): + + storage_access_key = "StorageAccessKey" + shared_access_key = "SharedAccessKey" + + +class AuthenticationType(Enum): + + sql = "SQL" + ad_password = "ADPassword" + + +class UnitType(Enum): + + count = "count" + bytes = "bytes" + seconds = "seconds" + percent = "percent" + count_per_second = "countPerSecond" + bytes_per_second = "bytesPerSecond" + + +class PrimaryAggregationType(Enum): + + none = "None" + average = "Average" + count = "Count" + minimum = "Minimum" + maximum = "Maximum" + total = "Total" + + +class UnitDefinitionType(Enum): + + count = "Count" + bytes = "Bytes" + seconds = "Seconds" + percent = "Percent" + count_per_second = "CountPerSecond" + bytes_per_second = "BytesPerSecond" + + +class ReplicationRole(Enum): + + primary = "Primary" + secondary = "Secondary" + non_readable_secondary = "NonReadableSecondary" + source = "Source" + copy = "Copy" + + +class ReplicationState(Enum): + + pending = "PENDING" + seeding = "SEEDING" + catch_up = "CATCH_UP" + suspended = "SUSPENDED" class BlobAuditingPolicyState(Enum): diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 59b50f000e0a..f6cf50e2157e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -15,19 +15,19 @@ 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 .databases_operations import DatabasesOperations from .database_threat_detection_policies_operations import DatabaseThreatDetectionPoliciesOperations from .data_masking_policies_operations import DataMaskingPoliciesOperations from .data_masking_rules_operations import DataMaskingRulesOperations +from .elastic_pools_operations import ElasticPoolsOperations 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 .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 @@ -56,19 +56,19 @@ 'RecoverableDatabasesOperations', 'RestorableDroppedDatabasesOperations', 'CapabilitiesOperations', + 'ServersOperations', 'ServerConnectionPoliciesOperations', + 'DatabasesOperations', 'DatabaseThreatDetectionPoliciesOperations', 'DataMaskingPoliciesOperations', 'DataMaskingRulesOperations', + 'ElasticPoolsOperations', 'FirewallRulesOperations', 'GeoBackupPoliciesOperations', - 'DatabasesOperations', - 'ElasticPoolsOperations', 'ReplicationLinksOperations', 'ServerAzureADAdministratorsOperations', 'ServerCommunicationLinksOperations', 'ServiceObjectivesOperations', - 'ServersOperations', 'ElasticPoolActivitiesOperations', 'ElasticPoolDatabaseActivitiesOperations', 'RecommendedElasticPoolsOperations', 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 index 7e9bd57ac0e7..88393489350a 100644 --- 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 @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -90,7 +91,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -108,35 +109,9 @@ def get( 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 - ~azure.mgmt.sql.models.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: An instance of AzureOperationPoller that returns - BackupLongTermRetentionPolicy or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.BackupLongTermRetentionPolicy] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, server_name, database_name, state, recovery_services_backup_policy_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.BackupLongTermRetentionPolicy(state=state, recovery_services_backup_policy_resource_id=recovery_services_backup_policy_resource_id) # Construct URL @@ -168,19 +143,83 @@ def create_or_update( body_content = self._serialize.body(parameters, 'BackupLongTermRetentionPolicy') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + 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 + + 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 + ~azure.mgmt.sql.models.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: An instance of AzureOperationPoller that returns + BackupLongTermRetentionPolicy or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.BackupLongTermRetentionPolicy] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + state=state, + recovery_services_backup_policy_resource_id=recovery_services_backup_policy_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -189,12 +228,7 @@ 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('BackupLongTermRetentionPolicy', response) - if response.status_code == 201: - deserialized = self._deserialize('BackupLongTermRetentionPolicy', response) + deserialized = self._deserialize('BackupLongTermRetentionPolicy', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -202,10 +236,6 @@ def get_long_running_output(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) @@ -269,7 +299,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index f8d54e622b8f..643317a5201c 100644 --- 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 @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -86,7 +87,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -104,29 +105,9 @@ def get( 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: An instance of AzureOperationPoller that returns - BackupLongTermRetentionVault or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.BackupLongTermRetentionVault] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, server_name, recovery_services_vault_resource_id, custom_headers=None, raw=False, **operation_config): parameters = models.BackupLongTermRetentionVault(recovery_services_vault_resource_id=recovery_services_vault_resource_id) # Construct URL @@ -157,19 +138,75 @@ def create_or_update( body_content = self._serialize.body(parameters, 'BackupLongTermRetentionVault') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + 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 + + 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: An instance of AzureOperationPoller that returns + BackupLongTermRetentionVault or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.BackupLongTermRetentionVault] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + recovery_services_vault_resource_id=recovery_services_vault_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -178,12 +215,7 @@ 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('BackupLongTermRetentionVault', response) - if response.status_code == 201: - deserialized = self._deserialize('BackupLongTermRetentionVault', response) + deserialized = self._deserialize('BackupLongTermRetentionVault', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -191,10 +223,6 @@ def get_long_running_output(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) @@ -255,7 +283,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 d9eaf1875d80..fd3384b788eb 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py @@ -77,7 +77,7 @@ def list_by_location( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index ecc0d06a1860..ae84e8595721 100644 --- 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 @@ -103,7 +103,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -170,7 +170,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index 2d1b9549a56c..d1acc61f6fba 100644 --- 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 @@ -98,7 +98,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -175,7 +175,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index 4c88d85cfb83..6e59884297e3 100644 --- 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 @@ -89,7 +89,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -163,7 +163,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py index 1a86839a893d..72d8b47a341d 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py @@ -87,7 +87,7 @@ def cancel( # Construct and send request request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -154,7 +154,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index a66f523450a1..64a79fda1606 100644 --- 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 @@ -89,7 +89,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -163,7 +163,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) 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 index 5667c93847af..312436098cb5 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_usages_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_usages_operations.py @@ -93,7 +93,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 d6401857ce61..7548052ffbb8 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,37 +39,18 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - 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 - 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 required parameters for importing a Bacpac into - a database. - :type parameters: ~azure.mgmt.sql.models.ImportRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ImportExportResponse or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ImportExportResponse] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _pause_initial( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): 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) @@ -86,23 +68,64 @@ 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 + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + 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 + 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 + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._pause_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result # 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 raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -111,21 +134,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) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -133,42 +145,18 @@ 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. - :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 import into - :type database_name: str - :param parameters: The required parameters for importing a Bacpac into - a database. - :type parameters: ~azure.mgmt.sql.models.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: An instance of AzureOperationPoller that returns - ImportExportResponse or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ImportExportResponse] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _resume_initial( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): 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) @@ -186,46 +174,76 @@ 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 + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + 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 + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._resume_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result # 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) + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): - if response.status_code not in [201, 202]: + 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 == 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) - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -233,34 +251,13 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - 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 - 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 exported. - :type database_name: str - :param parameters: The required parameters for exporting a database. - :type parameters: ~azure.mgmt.sql.models.ExportRequest - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ImportExportResponse or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ImportExportResponse] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): 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'), @@ -284,34 +281,91 @@ 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.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + 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 + + 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. + + :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: ~azure.mgmt.sql.models.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: An instance of AzureOperationPoller that returns Database or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.Database] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) 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 - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ImportExportResponse', response) + deserialized = self._deserialize('Database', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -319,10 +373,6 @@ def get_long_running_output(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) @@ -330,90 +380,62 @@ 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`. - :return: An iterator like instance of Metric - :rtype: - ~azure.mgmt.sql.models.MetricPaged[~azure.mgmt.sql.models.Metric] - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): 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 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') - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + # 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 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, 'DatabaseUpdate') - # 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.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + if 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.MetricPaged(internal_paging, self._deserialize.dependencies) + if response.status_code == 200: + deserialized = self._deserialize('Database', response) if raw: - header_dict = {} - client_raw_response = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = ClientRawResponse(deserialized, response) 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. + 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 @@ -421,76 +443,71 @@ def list_metric_definitions( :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 updated. :type database_name: str + :param parameters: The required parameters for updating a database. + :type parameters: ~azure.mgmt.sql.models.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`. - :return: An iterator like instance of MetricDefinition + :return: An instance of AzureOperationPoller that returns Database or + ClientRawResponse if raw=true :rtype: - ~azure.mgmt.sql.models.MetricDefinitionPaged[~azure.mgmt.sql.models.MetricDefinition] + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.Database] + or ~msrest.pipeline.ClientRawResponse :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) + raw_result = self._update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + # Construct and send request + def long_running_send(): + return raw_result.response - else: - url = next_link - query_parameters = {} + def get_long_running_status(status_link, headers=None): - # Construct headers + request = self._client.get(status_link) + if headers: + request.headers.update(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') + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **operation_config) + def get_long_running_output(response): - if response.status_code not in [200]: + 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 = self._deserialize('Database', response) - # Deserialize response - deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies) + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response - if raw: - header_dict = {} - client_raw_response = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response + return deserialized - 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 pause( + def delete( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Pauses a data warehouse. + """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 @@ -498,21 +515,21 @@ def pause( :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. + :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 - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause' + 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'), @@ -536,44 +553,21 @@ def pause( 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 + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + 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: - 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) + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - def resume( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Resumes a data warehouse. + 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 @@ -581,21 +575,26 @@ def resume( :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. + :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 - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Database or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.Database or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume' + 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'), @@ -607,6 +606,8 @@ def resume( # 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 = {} @@ -619,44 +620,28 @@ def resume( 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) + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - def get_long_running_output(response): + 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, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + deserialized = None - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + 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 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. + 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 @@ -664,100 +649,84 @@ def create_or_update( :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: ~azure.mgmt.sql.models.Database + :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 - :return: An instance of AzureOperationPoller that returns Database or - ClientRawResponse if raw=true + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Database :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.Database] - or ~msrest.pipeline.ClientRawResponse + ~azure.mgmt.sql.models.DatabasePaged[~azure.mgmt.sql.models.Database] :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') + def internal_paging(next_link=None, raw=False): - # Construct and send request - def long_running_send(): + 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) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + # 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') - def get_long_running_status(status_link, headers=None): + else: + url = next_link + query_parameters = {} - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) + # 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') - def get_long_running_output(response): + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) - if response.status_code not in [200, 201, 202]: + 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 response.status_code == 201: - deserialized = self._deserialize('Database', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + return response - return deserialized + # Deserialize response + deserialized = models.DatabasePaged(internal_paging, self._deserialize.dependencies) if raw: - response = long_running_send() - return get_long_running_output(response) + header_dict = {} + client_raw_response = models.DatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + 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 update( - self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): - """Updates an existing database. + 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 @@ -765,28 +734,30 @@ def update( :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 updated. + :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 parameters: The required parameters for updating a database. - :type parameters: ~azure.mgmt.sql.models.DatabaseUpdate :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :return: An instance of AzureOperationPoller that returns Database or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.Database] - or ~msrest.pipeline.ClientRawResponse + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Database or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.Database or + ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' + 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'), + '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) @@ -805,56 +776,29 @@ def update( 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 - def long_running_send(): - - 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 + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - if response.status_code == 200: - deserialized = self._deserialize('Database', 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 delete( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Deletes a database. + 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 @@ -862,59 +806,77 @@ def delete( :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 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`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse + :return: An iterator like instance of Database + :rtype: + ~azure.mgmt.sql.models.DatabasePaged[~azure.mgmt.sql.models.Database] :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) + def internal_paging(next_link=None, raw=False): - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if not next_link: + # Construct URL + 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'), + 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_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 and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + else: + url = next_link + query_parameters = {} - if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + # 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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.DatabasePaged(internal_paging, self._deserialize.dependencies) if raw: - client_raw_response = ClientRawResponse(None, response) + header_dict = {} + client_raw_response = models.DatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) 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. + return deserialized + + 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 @@ -922,12 +884,11 @@ def get( :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 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 @@ -941,11 +902,12 @@ def get( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' + 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) @@ -953,8 +915,6 @@ def get( # 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 = {} @@ -968,7 +928,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -986,9 +946,9 @@ def get( 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. + 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 @@ -996,13 +956,9 @@ def list_by_server( :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 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 @@ -1019,21 +975,18 @@ 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' + 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') + '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') - 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 @@ -1052,28 +1005,205 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp - return response + 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 _import_method_initial( + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): + 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) + + # 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, 'ImportRequest') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ImportExportResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + 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. . + + :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 required parameters for importing a Bacpac into + a database. + :type parameters: ~azure.mgmt.sql.models.ImportRequest + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ImportExportResponse or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ImportExportResponse] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._import_method_initial( + resource_group_name=resource_group_name, + server_name=server_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **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 = self._deserialize('ImportExportResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_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_import_operation_initial( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + api_version = "2014-04-01" + + # Construct URL + 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'), + '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') + + # 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, 'ImportExtensionRequest') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + 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 - # Deserialize response - deserialized = models.DatabasePaged(internal_paging, self._deserialize.dependencies) + if response.status_code == 201: + deserialized = self._deserialize('ImportExportResponse', response) if raw: - header_dict = {} - client_raw_response = models.DatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = ClientRawResponse(deserialized, response) 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. + 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 @@ -1081,30 +1211,80 @@ def get_by_elastic_pool( :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. + :param database_name: The name of the database to import into :type database_name: str + :param parameters: The required parameters for importing a Bacpac into + a database. + :type parameters: ~azure.mgmt.sql.models.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`. - :return: Database or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.Database or - ~msrest.pipeline.ClientRawResponse + :return: An instance of AzureOperationPoller that returns + ImportExportResponse or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ImportExportResponse] + or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + raw_result = self._create_import_operation_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **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 = self._deserialize('ImportExportResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_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 _export_initial( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2014-04-01" # 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}/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'), - '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) @@ -1123,11 +1303,15 @@ def get_by_elastic_pool( 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) + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [200, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp @@ -1135,7 +1319,7 @@ def get_by_elastic_pool( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Database', response) + deserialized = self._deserialize('ImportExportResponse', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1143,9 +1327,9 @@ def get_by_elastic_pool( return deserialized - 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. + 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 @@ -1153,17 +1337,91 @@ def list_by_elastic_pool( :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 exported. + :type database_name: str + :param parameters: The required parameters for exporting a database. + :type parameters: ~azure.mgmt.sql.models.ExportRequest + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ImportExportResponse or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ImportExportResponse] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._export_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **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 = self._deserialize('ImportExportResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_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 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`. - :return: An iterator like instance of Database + :return: An iterator like instance of Metric :rtype: - ~azure.mgmt.sql.models.DatabasePaged[~azure.mgmt.sql.models.Database] + ~azure.mgmt.sql.models.MetricPaged[~azure.mgmt.sql.models.Metric] :raises: :class:`CloudError` """ api_version = "2014-04-01" @@ -1172,18 +1430,19 @@ 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}/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'), - '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['$filter'] = self._serialize.query("filter", filter, 'str') else: url = next_link @@ -1202,7 +1461,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -1212,18 +1471,18 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.DatabasePaged(internal_paging, self._deserialize.dependencies) + deserialized = models.MetricPaged(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.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized - 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. + 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 @@ -1231,89 +1490,16 @@ def get_by_recommended_elastic_pool( :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. + :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: Database or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.Database or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # 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("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('Database', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - 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 - 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`. - :return: An iterator like instance of Database + :return: An iterator like instance of MetricDefinition :rtype: - ~azure.mgmt.sql.models.DatabasePaged[~azure.mgmt.sql.models.Database] + ~azure.mgmt.sql.models.MetricDefinitionPaged[~azure.mgmt.sql.models.MetricDefinition] :raises: :class:`CloudError` """ api_version = "2014-04-01" @@ -1322,12 +1508,12 @@ 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' + 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'), - '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) @@ -1352,7 +1538,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -1362,11 +1548,11 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.DatabasePaged(internal_paging, self._deserialize.dependencies) + deserialized = models.MetricDefinitionPaged(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.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized @@ -1428,7 +1614,7 @@ def rename( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index ffaa12964b74..bc31e1e43f0c 100644 --- 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 @@ -94,7 +94,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index a42d8425b631..d5807e30537a 100644 --- 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 @@ -93,7 +93,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 caed9d6e6da6..9ade5cac6fdf 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 @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -38,88 +39,62 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def list_metrics( - self, resource_group_name, server_name, elastic_pool_name, filter, custom_headers=None, raw=False, **operation_config): - """Returns 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 - 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 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`. - :return: An iterator like instance of Metric - :rtype: - ~azure.mgmt.sql.models.MetricPaged[~azure.mgmt.sql.models.Metric] - :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}/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'), - 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) + def _create_or_update_initial( + self, resource_group_name, server_name, elastic_pool_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + 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') + } + 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') - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + # 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 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, 'ElasticPool') - # 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.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + if response.status_code not in [200, 201, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - return response + deserialized = None - # Deserialize response - deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies) + if response.status_code == 200: + deserialized = self._deserialize('ElasticPool', response) + if response.status_code == 201: + deserialized = self._deserialize('ElasticPool', response) if raw: - header_dict = {} - client_raw_response = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - def list_metric_definitions( - self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): - """Returns elastic pool metric definitions. + def create_or_update( + self, resource_group_name, server_name, elastic_pool_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates a new elastic pool or 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 @@ -127,97 +102,73 @@ def list_metric_definitions( :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. + :param elastic_pool_name: The name of the elastic pool to be operated + on (updated or created). :type elastic_pool_name: str + :param parameters: The required parameters for creating or updating an + elastic pool. + :type parameters: ~azure.mgmt.sql.models.ElasticPool :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 MetricDefinition + :return: An instance of AzureOperationPoller that returns ElasticPool + or ClientRawResponse if raw=true :rtype: - ~azure.mgmt.sql.models.MetricDefinitionPaged[~azure.mgmt.sql.models.MetricDefinition] + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ElasticPool] + or ~msrest.pipeline.ClientRawResponse :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}/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'), - 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + elastic_pool_name=elastic_pool_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + # Construct and send request + def long_running_send(): + return raw_result.response - else: - url = next_link - query_parameters = {} + def get_long_running_status(status_link, headers=None): - # Construct headers + request = self._client.get(status_link) + if headers: + request.headers.update(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') + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) - # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **operation_config) + def get_long_running_output(response): - if response.status_code not in [200]: + if response.status_code not in [200, 201, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp - return response + deserialized = self._deserialize('ElasticPool', response) - # Deserialize response - deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies) + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response - if raw: - header_dict = {} - client_raw_response = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response + return deserialized - 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( - self, resource_group_name, server_name, elastic_pool_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates a new elastic pool or 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 - 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 operated - on (updated or created). - :type elastic_pool_name: str - :param parameters: The required parameters for creating or updating an - elastic pool. - :type parameters: ~azure.mgmt.sql.models.ElasticPool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns ElasticPool - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ElasticPool] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, server_name, elastic_pool_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}' path_format_arguments = { @@ -243,53 +194,28 @@ def create_or_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, 'ElasticPool') + body_content = self._serialize.body(parameters, 'ElasticPoolUpdate') # 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) + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **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('ElasticPool', response) - if response.status_code == 201: - deserialized = self._deserialize('ElasticPool', 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(deserialized, response) - return client_raw_response + deserialized = None - return deserialized + if response.status_code == 200: + deserialized = self._deserialize('ElasticPool', 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 update( self, resource_group_name, server_name, elastic_pool_name, parameters, custom_headers=None, raw=False, **operation_config): @@ -316,47 +242,31 @@ def update( or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - # Construct URL - 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') - } - 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, 'ElasticPoolUpdate') + raw_result = self._update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + elastic_pool_name=elastic_pool_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result # Construct and send request def long_running_send(): - - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -365,10 +275,7 @@ 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('ElasticPool', response) + deserialized = self._deserialize('ElasticPool', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -376,10 +283,6 @@ def get_long_running_output(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) @@ -434,7 +337,7 @@ def delete( # Construct and send request request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200, 204]: exp = CloudError(response) @@ -494,7 +397,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -565,7 +468,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -583,3 +486,157 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + + def list_metrics( + self, resource_group_name, server_name, elastic_pool_name, filter, custom_headers=None, raw=False, **operation_config): + """Returns 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 + 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 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`. + :return: An iterator like instance of Metric + :rtype: + ~azure.mgmt.sql.models.MetricPaged[~azure.mgmt.sql.models.Metric] + :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}/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'), + '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') + 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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.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, elastic_pool_name, custom_headers=None, raw=False, **operation_config): + """Returns elastic pool 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 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 MetricDefinition + :rtype: + ~azure.mgmt.sql.models.MetricDefinitionPaged[~azure.mgmt.sql.models.MetricDefinition] + :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}/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'), + '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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.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 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 index 5b1c4a3ab083..3d3cf99ba0ed 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/encryption_protectors_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/encryption_protectors_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -93,7 +94,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -158,7 +159,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -176,28 +177,9 @@ def get( 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: ~azure.mgmt.sql.models.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: An instance of AzureOperationPoller that returns - EncryptionProtector or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.EncryptionProtector] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}' path_format_arguments = { @@ -226,19 +208,72 @@ def create_or_update( body_content = self._serialize.body(parameters, 'EncryptionProtector') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('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: ~azure.mgmt.sql.models.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: An instance of AzureOperationPoller that returns + EncryptionProtector or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.EncryptionProtector] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -247,10 +282,7 @@ 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('EncryptionProtector', response) + deserialized = self._deserialize('EncryptionProtector', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -258,10 +290,6 @@ def get_long_running_output(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) 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 966f83bb68b5..b2e5dba8c39b 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 @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -87,7 +88,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -105,31 +106,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, server_name, failover_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a failover group. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param server_name: The name of the server containing the failover - group. - :type server_name: str - :param failover_group_name: The name of the failover group. - :type failover_group_name: str - :param parameters: The failover group parameters. - :type parameters: ~azure.mgmt.sql.models.FailoverGroup - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FailoverGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.FailoverGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, server_name, failover_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}' path_format_arguments = { @@ -158,19 +137,78 @@ def create_or_update( body_content = self._serialize.body(parameters, 'FailoverGroup') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + 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('FailoverGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('FailoverGroup', 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, failover_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a failover group. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server containing the failover + group. + :type server_name: str + :param failover_group_name: The name of the failover group. + :type failover_group_name: str + :param parameters: The failover group parameters. + :type parameters: ~azure.mgmt.sql.models.FailoverGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FailoverGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.FailoverGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + failover_group_name=failover_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -179,12 +217,7 @@ 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('FailoverGroup', response) - if response.status_code == 201: - deserialized = self._deserialize('FailoverGroup', response) + deserialized = self._deserialize('FailoverGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -192,10 +225,6 @@ def get_long_running_output(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) @@ -203,28 +232,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, failover_group_name, custom_headers=None, raw=False, **operation_config): - """Deletes a failover group. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param server_name: The name of the server containing the failover - group. - :type server_name: str - :param failover_group_name: The name of the failover group. - :type failover_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}' path_format_arguments = { @@ -250,18 +260,64 @@ def delete( 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): + """Deletes a failover group. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server containing the failover + group. + :type server_name: str + :param failover_group_name: The name of the failover group. + :type failover_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + server_name=server_name, + failover_group_name=failover_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -274,10 +330,6 @@ def get_long_running_output(response): 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) @@ -285,31 +337,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, server_name, failover_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Updates a failover group. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param server_name: The name of the server containing the failover - group. - :type server_name: str - :param failover_group_name: The name of the failover group. - :type failover_group_name: str - :param parameters: The failover group parameters. - :type parameters: ~azure.mgmt.sql.models.FailoverGroupUpdate - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FailoverGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.FailoverGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, server_name, failover_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}' path_format_arguments = { @@ -338,19 +368,76 @@ def update( body_content = self._serialize.body(parameters, 'FailoverGroupUpdate') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('FailoverGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, server_name, failover_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Updates a failover group. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server containing the failover + group. + :type server_name: str + :param failover_group_name: The name of the failover group. + :type failover_group_name: str + :param parameters: The failover group parameters. + :type parameters: ~azure.mgmt.sql.models.FailoverGroupUpdate + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FailoverGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.FailoverGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + failover_group_name=failover_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -359,10 +446,7 @@ 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('FailoverGroup', response) + deserialized = self._deserialize('FailoverGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -370,10 +454,6 @@ def get_long_running_output(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) @@ -435,7 +515,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -454,29 +534,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def failover( - self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): - """Fails over from the current primary server to this 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 containing the failover - group. - :type server_name: str - :param failover_group_name: The name of the failover group. - :type failover_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FailoverGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.FailoverGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _failover_initial( + self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover' path_format_arguments = { @@ -502,18 +562,72 @@ def failover( 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) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('FailoverGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def failover( + self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): + """Fails over from the current primary server to this 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 containing the failover + group. + :type server_name: str + :param failover_group_name: The name of the failover group. + :type failover_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FailoverGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.FailoverGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._failover_initial( + resource_group_name=resource_group_name, + server_name=server_name, + failover_group_name=failover_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -522,10 +636,7 @@ 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('FailoverGroup', response) + deserialized = self._deserialize('FailoverGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -533,10 +644,6 @@ def get_long_running_output(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) @@ -544,30 +651,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def force_failover_allow_data_loss( - self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): - """Fails over from the current primary server to this server. 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 containing the failover - group. - :type server_name: str - :param failover_group_name: The name of the failover group. - :type failover_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - FailoverGroup or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.FailoverGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _force_failover_allow_data_loss_initial( + self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss' path_format_arguments = { @@ -593,18 +679,73 @@ def force_failover_allow_data_loss( 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) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('FailoverGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def force_failover_allow_data_loss( + self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): + """Fails over from the current primary server to this server. 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 containing the failover + group. + :type server_name: str + :param failover_group_name: The name of the failover group. + :type failover_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + FailoverGroup or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.FailoverGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._force_failover_allow_data_loss_initial( + resource_group_name=resource_group_name, + server_name=server_name, + failover_group_name=failover_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -613,10 +754,7 @@ 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('FailoverGroup', response) + deserialized = self._deserialize('FailoverGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -624,10 +762,6 @@ def get_long_running_output(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) 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 244ce10f1e76..9fb743feb379 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 @@ -99,7 +99,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -166,7 +166,7 @@ def delete( # Construct and send request request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200, 204]: exp = CloudError(response) @@ -225,7 +225,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -296,7 +296,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index 6ae1a0f10865..62dedc77c992 100644 --- 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 @@ -97,7 +97,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -166,7 +166,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -240,7 +240,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py index 33033408bf61..e841422f649d 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py @@ -78,7 +78,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 a87c927f50a8..42f2ad653ac5 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 @@ -86,7 +86,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -157,7 +157,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -233,7 +233,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 efbe6d1a0235..831eecf07511 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 @@ -86,7 +86,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -157,7 +157,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index 311ba77bcd2e..1dc5b0c7e3eb 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/replication_links_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/replication_links_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -89,7 +90,7 @@ def delete( # Construct and send request request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200, 204]: exp = CloudError(response) @@ -151,7 +152,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -169,31 +170,9 @@ def get( 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: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _failover_initial( + self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover' path_format_arguments = { @@ -220,18 +199,68 @@ def failover( 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) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + 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: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._failover_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + link_id=link_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -244,10 +273,6 @@ def get_long_running_output(response): 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) @@ -255,31 +280,9 @@ def get_long_running_output(response): 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: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _failover_allow_data_loss_initial( + self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss' path_format_arguments = { @@ -306,18 +309,68 @@ def failover_allow_data_loss( 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) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + 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: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._failover_allow_data_loss_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + link_id=link_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -330,10 +383,6 @@ def get_long_running_output(response): 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) @@ -397,7 +446,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 5a09b1185033..8383803776bf 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 @@ -86,7 +86,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -157,7 +157,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index 78027a869bc6..39053faa125c 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py @@ -94,7 +94,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 c925b627a74d..ef10d7f725da 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 @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -40,30 +41,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create_or_update( - self, resource_group_name, server_name, properties, custom_headers=None, raw=False, **operation_config): - """Creates a new Server Active Directory Administrator or updates an - existing server Active Directory Administrator. - :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 properties: The required parameters for creating or updating an - Active Directory Administrator. - :type properties: ~azure.mgmt.sql.models.ServerAzureADAdministrator - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - ServerAzureADAdministrator or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerAzureADAdministrator] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, server_name, properties, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}' path_format_arguments = { @@ -92,19 +72,78 @@ def create_or_update( body_content = self._serialize.body(properties, 'ServerAzureADAdministrator') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + 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('ServerAzureADAdministrator', response) + if response.status_code == 201: + deserialized = self._deserialize('ServerAzureADAdministrator', response) + if response.status_code == 202: + deserialized = self._deserialize('ServerAzureADAdministrator', 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, properties, custom_headers=None, raw=False, **operation_config): + """Creates a new Server Active Directory Administrator or updates an + existing server Active Directory Administrator. + + :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 properties: The required parameters for creating or updating an + Active Directory Administrator. + :type properties: ~azure.mgmt.sql.models.ServerAzureADAdministrator + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + ServerAzureADAdministrator or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerAzureADAdministrator] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + properties=properties, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -113,14 +152,7 @@ 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('ServerAzureADAdministrator', response) - if response.status_code == 201: - deserialized = self._deserialize('ServerAzureADAdministrator', response) - if response.status_code == 202: - deserialized = self._deserialize('ServerAzureADAdministrator', response) + deserialized = self._deserialize('ServerAzureADAdministrator', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -128,10 +160,6 @@ def get_long_running_output(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) @@ -139,26 +167,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, custom_headers=None, raw=False, **operation_config): - """Deletes an existing server Active Directory Administrator. - :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 - :return: An instance of AzureOperationPoller that returns - ServerAzureADAdministrator or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerAzureADAdministrator] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}' path_format_arguments = { @@ -184,18 +195,72 @@ def delete( 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ServerAzureADAdministrator', response) + if response.status_code == 202: + deserialized = self._deserialize('ServerAzureADAdministrator', response) + if response.status_code == 204: + deserialized = self._deserialize('ServerAzureADAdministrator', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def delete( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Deletes an existing server Active Directory Administrator. + + :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 + :return: An instance of AzureOperationPoller that returns + ServerAzureADAdministrator or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerAzureADAdministrator] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + server_name=server_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -204,14 +269,7 @@ 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('ServerAzureADAdministrator', response) - if response.status_code == 202: - deserialized = self._deserialize('ServerAzureADAdministrator', response) - if response.status_code == 204: - deserialized = self._deserialize('ServerAzureADAdministrator', response) + deserialized = self._deserialize('ServerAzureADAdministrator', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -219,10 +277,6 @@ def get_long_running_output(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) @@ -276,7 +330,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -347,7 +401,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 2a3fd1c79213..6260d8de01b5 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 @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -86,7 +87,7 @@ def delete( # Construct and send request request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -146,7 +147,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -164,31 +165,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, server_name, communication_link_name, partner_server, custom_headers=None, raw=False, **operation_config): - """Creates a server communication 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 communication_link_name: The name of the server communication - link. - :type communication_link_name: str - :param partner_server: The name of the partner server. - :type partner_server: 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: An instance of AzureOperationPoller that returns - ServerCommunicationLink or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerCommunicationLink] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, server_name, communication_link_name, partner_server, custom_headers=None, raw=False, **operation_config): parameters = models.ServerCommunicationLink(partner_server=partner_server) # Construct URL @@ -219,19 +198,76 @@ def create_or_update( body_content = self._serialize.body(parameters, 'ServerCommunicationLink') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + 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('ServerCommunicationLink', 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, communication_link_name, partner_server, custom_headers=None, raw=False, **operation_config): + """Creates a server communication 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 communication_link_name: The name of the server communication + link. + :type communication_link_name: str + :param partner_server: The name of the partner server. + :type partner_server: 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: An instance of AzureOperationPoller that returns + ServerCommunicationLink or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerCommunicationLink] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + communication_link_name=communication_link_name, + partner_server=partner_server, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -240,10 +276,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('ServerCommunicationLink', response) + deserialized = self._deserialize('ServerCommunicationLink', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -251,10 +284,6 @@ def get_long_running_output(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) @@ -315,7 +344,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index 2e417e4e540c..9e173ca15ec0 100644 --- 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 @@ -95,7 +95,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -161,7 +161,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_dns_aliases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_dns_aliases_operations.py index 770d4104dcaf..f90e0259360a 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_dns_aliases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_dns_aliases_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -87,7 +88,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -105,29 +106,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, server_name, dns_alias_name, custom_headers=None, raw=False, **operation_config): - """Creates a server dns alias. - :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 that the alias is pointing - to. - :type server_name: str - :param dns_alias_name: The name of the server DNS alias. - :type dns_alias_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: An instance of AzureOperationPoller that returns - ServerDnsAlias or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerDnsAlias] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, server_name, dns_alias_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}' path_format_arguments = { @@ -153,18 +134,74 @@ def create_or_update( 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.put(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 201, 202]: + 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, **operation_config) + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ServerDnsAlias', response) + if response.status_code == 201: + deserialized = self._deserialize('ServerDnsAlias', 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, dns_alias_name, custom_headers=None, raw=False, **operation_config): + """Creates a server dns alias. + + :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 that the alias is pointing + to. + :type server_name: str + :param dns_alias_name: The name of the server DNS alias. + :type dns_alias_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: An instance of AzureOperationPoller that returns + ServerDnsAlias or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerDnsAlias] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + dns_alias_name=dns_alias_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -173,12 +210,7 @@ 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('ServerDnsAlias', response) - if response.status_code == 201: - deserialized = self._deserialize('ServerDnsAlias', response) + deserialized = self._deserialize('ServerDnsAlias', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -186,10 +218,6 @@ def get_long_running_output(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) @@ -197,28 +225,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, dns_alias_name, custom_headers=None, raw=False, **operation_config): - """Deletes the server DNS alias with the given name. - :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 that the alias is pointing - to. - :type server_name: str - :param dns_alias_name: The name of the server DNS alias. - :type dns_alias_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: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, server_name, dns_alias_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}' path_format_arguments = { @@ -244,18 +253,64 @@ def delete( 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, server_name, dns_alias_name, custom_headers=None, raw=False, **operation_config): + """Deletes the server DNS alias with the given name. + + :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 that the alias is pointing + to. + :type server_name: str + :param dns_alias_name: The name of the server DNS alias. + :type dns_alias_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: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + server_name=server_name, + dns_alias_name=dns_alias_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -268,10 +323,6 @@ def get_long_running_output(response): 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) @@ -333,7 +384,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -352,31 +403,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def acquire( - self, resource_group_name, server_name, dns_alias_name, old_server_dns_alias_id=None, custom_headers=None, raw=False, **operation_config): - """Acquires server DNS alias from another 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 that the alias is pointing - to. - :type server_name: str - :param dns_alias_name: The name of the server dns alias. - :type dns_alias_name: str - :param old_server_dns_alias_id: The id of the server alias that will - be acquired to point to this server instead. - :type old_server_dns_alias_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: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _acquire_initial( + self, resource_group_name, server_name, dns_alias_name, old_server_dns_alias_id=None, custom_headers=None, raw=False, **operation_config): parameters = models.ServerDnsAliasAcquisition(old_server_dns_alias_id=old_server_dns_alias_id) # Construct URL @@ -407,19 +436,69 @@ def acquire( body_content = self._serialize.body(parameters, 'ServerDnsAliasAcquisition') # Construct and send request - def long_running_send(): + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.post(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def acquire( + self, resource_group_name, server_name, dns_alias_name, old_server_dns_alias_id=None, custom_headers=None, raw=False, **operation_config): + """Acquires server DNS alias from another 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 that the alias is pointing + to. + :type server_name: str + :param dns_alias_name: The name of the server dns alias. + :type dns_alias_name: str + :param old_server_dns_alias_id: The id of the server alias that will + be acquired to point to this server instead. + :type old_server_dns_alias_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: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._acquire_initial( + resource_group_name=resource_group_name, + server_name=server_name, + dns_alias_name=dns_alias_name, + old_server_dns_alias_id=old_server_dns_alias_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -432,10 +511,6 @@ def get_long_running_output(response): 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) 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 817d8b3b572c..3b3ae05dce44 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 @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -91,7 +92,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -158,7 +159,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -176,6 +177,59 @@ def get( return deserialized + + def _create_or_update_initial( + self, resource_group_name, server_name, key_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'keyName': self._serialize.url("key_name", key_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, 'ServerKey') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + 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('ServerKey', response) + if response.status_code == 201: + deserialized = self._deserialize('ServerKey', 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, key_name, parameters, custom_headers=None, raw=False, **operation_config): """Creates or updates a server key. @@ -205,47 +259,31 @@ def create_or_update( or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}' - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'keyName': self._serialize.url("key_name", key_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, 'ServerKey') + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + key_name=key_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result # 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) + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -254,12 +292,7 @@ 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('ServerKey', response) - if response.status_code == 201: - deserialized = self._deserialize('ServerKey', response) + deserialized = self._deserialize('ServerKey', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -267,10 +300,6 @@ def get_long_running_output(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) @@ -278,27 +307,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, key_name, custom_headers=None, raw=False, **operation_config): - """Deletes the server key with the given name. - :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 key_name: The name of the server key to be deleted. - :type key_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: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, server_name, key_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}' path_format_arguments = { @@ -324,18 +335,63 @@ def delete( 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, server_name, key_name, custom_headers=None, raw=False, **operation_config): + """Deletes the server key with the given name. + + :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 key_name: The name of the server key to be deleted. + :type key_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: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + server_name=server_name, + key_name=key_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -348,10 +404,6 @@ def get_long_running_output(response): 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) 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 index eab99186047c..192035e76e23 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_usages_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_usages_operations.py @@ -90,7 +90,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 8f8a934ab2e1..c85b4c8a1f78 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/servers_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/servers_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -84,7 +85,7 @@ def check_name_availability( # Construct and send request request = self._client.post(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -149,7 +150,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -220,7 +221,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -286,7 +287,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -304,28 +305,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates 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 parameters: The requested server resource state. - :type parameters: ~azure.mgmt.sql.models.Server - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Server or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.Server] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2015-05-01-preview" # Construct URL @@ -355,19 +337,74 @@ def create_or_update( body_content = self._serialize.body(parameters, 'Server') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + 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('Server', response) + if response.status_code == 201: + deserialized = self._deserialize('Server', 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): + """Creates or updates 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 parameters: The requested server resource state. + :type parameters: ~azure.mgmt.sql.models.Server + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Server or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.Server] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -376,12 +413,7 @@ 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('Server', response) - if response.status_code == 201: - deserialized = self._deserialize('Server', response) + deserialized = self._deserialize('Server', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -389,10 +421,6 @@ def get_long_running_output(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) @@ -400,25 +428,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, custom_headers=None, raw=False, **operation_config): - """Deletes 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 - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): api_version = "2015-05-01-preview" # Construct URL @@ -445,18 +457,60 @@ def delete( 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + def delete( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Deletes 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 + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + server_name=server_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -469,10 +523,6 @@ def get_long_running_output(response): 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) @@ -480,28 +530,9 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def update( - self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): - """Updates 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 parameters: The requested server resource state. - :type parameters: ~azure.mgmt.sql.models.ServerUpdate - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns Server or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.Server] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): api_version = "2015-05-01-preview" # Construct URL @@ -531,19 +562,72 @@ def update( body_content = self._serialize.body(parameters, 'ServerUpdate') # Construct and send request - def long_running_send(): + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Server', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): + """Updates 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 parameters: The requested server resource state. + :type parameters: ~azure.mgmt.sql.models.ServerUpdate + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns Server or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.Server] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -552,10 +636,7 @@ 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('Server', response) + deserialized = self._deserialize('Server', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -563,10 +644,6 @@ def get_long_running_output(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) 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 index 9a14c85e3f28..64ade5034a12 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/service_objectives_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/service_objectives_operations.py @@ -86,7 +86,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -157,7 +157,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index b795d635f445..11c70d2e4955 100644 --- 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 @@ -88,7 +88,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -162,7 +162,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/subscription_usages_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/subscription_usages_operations.py index 7ee07416002f..47973720f6cf 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/subscription_usages_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/subscription_usages_operations.py @@ -86,7 +86,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -149,7 +149,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_agents_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_agents_operations.py index 1590d6907f22..c09c8b886922 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_agents_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_agents_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -87,7 +88,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -105,32 +106,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, server_name, sync_agent_name, sync_database_id=None, custom_headers=None, raw=False, **operation_config): - """Creates or updates a sync agent. - :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 on which the sync agent is - hosted. - :type server_name: str - :param sync_agent_name: The name of the sync agent. - :type sync_agent_name: str - :param sync_database_id: ARM resource id of the sync database in the - sync agent. - :type sync_database_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns SyncAgent or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.SyncAgent] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, server_name, sync_agent_name, sync_database_id=None, custom_headers=None, raw=False, **operation_config): parameters = models.SyncAgent(sync_database_id=sync_database_id) # Construct URL @@ -161,19 +139,79 @@ def create_or_update( body_content = self._serialize.body(parameters, 'SyncAgent') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + 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('SyncAgent', response) + if response.status_code == 201: + deserialized = self._deserialize('SyncAgent', 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, sync_agent_name, sync_database_id=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates a sync agent. + + :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 on which the sync agent is + hosted. + :type server_name: str + :param sync_agent_name: The name of the sync agent. + :type sync_agent_name: str + :param sync_database_id: ARM resource id of the sync database in the + sync agent. + :type sync_database_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns SyncAgent or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.SyncAgent] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + sync_agent_name=sync_agent_name, + sync_database_id=sync_database_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -182,12 +220,7 @@ 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('SyncAgent', response) - if response.status_code == 201: - deserialized = self._deserialize('SyncAgent', response) + deserialized = self._deserialize('SyncAgent', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -195,10 +228,6 @@ def get_long_running_output(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) @@ -206,28 +235,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, sync_agent_name, custom_headers=None, raw=False, **operation_config): - """Deletes a sync agent. - :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 on which the sync agent is - hosted. - :type server_name: str - :param sync_agent_name: The name of the sync agent. - :type sync_agent_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: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, server_name, sync_agent_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}' path_format_arguments = { @@ -253,18 +263,64 @@ def delete( 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, server_name, sync_agent_name, custom_headers=None, raw=False, **operation_config): + """Deletes a sync agent. + + :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 on which the sync agent is + hosted. + :type server_name: str + :param sync_agent_name: The name of the sync agent. + :type sync_agent_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: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + server_name=server_name, + sync_agent_name=sync_agent_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -277,10 +333,6 @@ def get_long_running_output(response): 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) @@ -342,7 +394,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -410,7 +462,7 @@ def generate_key( # Construct and send request request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -485,7 +537,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_groups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_groups_operations.py index c216cc3cc394..d4766e1ef797 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_groups_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_groups_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -87,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -106,30 +107,9 @@ def internal_paging(next_link=None, raw=False): return deserialized - def refresh_hub_schema( - self, resource_group_name, server_name, database_name, sync_group_name, custom_headers=None, raw=False, **operation_config): - """Refreshes a hub database schema. - :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 on which the sync group - is hosted. - :type database_name: str - :param sync_group_name: The name of the sync group. - :type sync_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _refresh_hub_schema_initial( + self, resource_group_name, server_name, database_name, sync_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema' path_format_arguments = { @@ -156,18 +136,67 @@ def refresh_hub_schema( 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) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def refresh_hub_schema( + self, resource_group_name, server_name, database_name, sync_group_name, custom_headers=None, raw=False, **operation_config): + """Refreshes a hub database schema. + + :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 on which the sync group + is hosted. + :type database_name: str + :param sync_group_name: The name of the sync group. + :type sync_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._refresh_hub_schema_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + sync_group_name=sync_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -180,10 +209,6 @@ def get_long_running_output(response): 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) @@ -251,7 +276,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -344,7 +369,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -414,7 +439,7 @@ def cancel_sync( # Construct and send request request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -476,7 +501,7 @@ def trigger_sync( # Construct and send request request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -539,7 +564,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -557,33 +582,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or updates a sync group. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param server_name: The name of the server. - :type server_name: str - :param database_name: The name of the database on which the sync group - is hosted. - :type database_name: str - :param sync_group_name: The name of the sync group. - :type sync_group_name: str - :param parameters: The requested sync group resource state. - :type parameters: ~azure.mgmt.sql.models.SyncGroup - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns SyncGroup or - ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.SyncGroup] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}' path_format_arguments = { @@ -613,19 +614,81 @@ def create_or_update( body_content = self._serialize.body(parameters, 'SyncGroup') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + 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('SyncGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('SyncGroup', 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, sync_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a sync group. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database on which the sync group + is hosted. + :type database_name: str + :param sync_group_name: The name of the sync group. + :type sync_group_name: str + :param parameters: The requested sync group resource state. + :type parameters: ~azure.mgmt.sql.models.SyncGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns SyncGroup or + ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.SyncGroup] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + sync_group_name=sync_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -634,12 +697,7 @@ 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('SyncGroup', response) - if response.status_code == 201: - deserialized = self._deserialize('SyncGroup', response) + deserialized = self._deserialize('SyncGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -647,10 +705,6 @@ def get_long_running_output(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) @@ -658,6 +712,47 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + + def _delete_initial( + self, resource_group_name, server_name, database_name, sync_group_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}' + 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'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + def delete( self, resource_group_name, server_name, database_name, sync_group_name, custom_headers=None, raw=False, **operation_config): """Deletes a sync group. @@ -682,6 +777,53 @@ def delete( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + sync_group_name=sync_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + 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 _update_initial( + self, resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}' path_format_arguments = { @@ -707,41 +849,29 @@ 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 and send request - def long_running_send(): - - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) - - def get_long_running_status(status_link, headers=None): + # Construct body + body_content = self._serialize.body(parameters, 'SyncGroup') - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **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 response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + deserialized = None - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + if response.status_code == 200: + deserialized = self._deserialize('SyncGroup', 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 update( self, resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers=None, raw=False, **operation_config): @@ -770,48 +900,32 @@ def update( or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}' - 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'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # 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, 'SyncGroup') + raw_result = self._update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + sync_group_name=sync_group_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result # Construct and send request def long_running_send(): - - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -820,10 +934,7 @@ 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('SyncGroup', response) + deserialized = self._deserialize('SyncGroup', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -831,10 +942,6 @@ def get_long_running_output(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) @@ -899,7 +1006,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_members_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_members_operations.py index 240fea187b00..9672266eae2b 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_members_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_members_operations.py @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -94,7 +95,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -112,6 +113,61 @@ def get( return deserialized + + def _create_or_update_initial( + self, resource_group_name, server_name, database_name, sync_group_name, sync_member_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}' + 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'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'syncMemberName': self._serialize.url("sync_member_name", sync_member_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, 'SyncMember') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + 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('SyncMember', response) + if response.status_code == 201: + deserialized = self._deserialize('SyncMember', 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, sync_group_name, sync_member_name, parameters, custom_headers=None, raw=False, **operation_config): """Creates or updates a sync member. @@ -142,49 +198,33 @@ def create_or_update( or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}' - 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'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'syncMemberName': self._serialize.url("sync_member_name", sync_member_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, 'SyncMember') + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + sync_group_name=sync_group_name, + sync_member_name=sync_member_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result # 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) + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -193,12 +233,7 @@ 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('SyncMember', response) - if response.status_code == 201: - deserialized = self._deserialize('SyncMember', response) + deserialized = self._deserialize('SyncMember', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -206,10 +241,6 @@ def get_long_running_output(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) @@ -217,6 +248,48 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + + def _delete_initial( + self, resource_group_name, server_name, database_name, sync_group_name, sync_member_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}' + 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'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'syncMemberName': self._serialize.url("sync_member_name", sync_member_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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + def delete( self, resource_group_name, server_name, database_name, sync_group_name, sync_member_name, custom_headers=None, raw=False, **operation_config): """Deletes a sync member. @@ -244,6 +317,54 @@ def delete( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + sync_group_name=sync_group_name, + sync_member_name=sync_member_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + 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 _update_initial( + self, resource_group_name, server_name, database_name, sync_group_name, sync_member_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}' path_format_arguments = { @@ -270,41 +391,29 @@ 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 and send request - def long_running_send(): - - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) - - def get_long_running_status(status_link, headers=None): + # Construct body + body_content = self._serialize.body(parameters, 'SyncMember') - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **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 response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + deserialized = None - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + if response.status_code == 200: + deserialized = self._deserialize('SyncMember', 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 update( self, resource_group_name, server_name, database_name, sync_group_name, sync_member_name, parameters, custom_headers=None, raw=False, **operation_config): @@ -336,49 +445,33 @@ def update( or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}' - 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'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'syncMemberName': self._serialize.url("sync_member_name", sync_member_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, 'SyncMember') + raw_result = self._update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + sync_group_name=sync_group_name, + sync_member_name=sync_member_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result # Construct and send request def long_running_send(): - - request = self._client.patch(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -387,10 +480,7 @@ 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('SyncMember', response) + deserialized = self._deserialize('SyncMember', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -398,10 +488,6 @@ def get_long_running_output(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) @@ -469,7 +555,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -552,7 +638,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -571,6 +657,48 @@ def internal_paging(next_link=None, raw=False): return deserialized + + def _refresh_member_schema_initial( + self, resource_group_name, server_name, database_name, sync_group_name, sync_member_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/refreshSchema' + 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'), + 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), + 'syncMemberName': self._serialize.url("sync_member_name", sync_member_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.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + def refresh_member_schema( self, resource_group_name, server_name, database_name, sync_group_name, sync_member_name, custom_headers=None, raw=False, **operation_config): """Refreshes a sync member database schema. @@ -598,45 +726,32 @@ def refresh_member_schema( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/refreshSchema' - 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'), - 'syncGroupName': self._serialize.url("sync_group_name", sync_group_name, 'str'), - 'syncMemberName': self._serialize.url("sync_member_name", sync_member_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') + raw_result = self._refresh_member_schema_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + sync_group_name=sync_group_name, + sync_member_name=sync_member_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result # Construct and send request def long_running_send(): - - request = self._client.post(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -649,10 +764,6 @@ def get_long_running_output(response): 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) 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 index 17aff326251e..5db7032d0821 100644 --- 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 @@ -98,7 +98,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 index 46d591ab0fe0..8c1e412de709 100644 --- 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 @@ -100,7 +100,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [200, 201]: exp = CloudError(response) @@ -170,7 +170,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 82a4785fcbe9..348a02f0c4c0 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 @@ -12,6 +12,7 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -87,7 +88,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -105,35 +106,9 @@ def get( return deserialized - def create_or_update( - self, resource_group_name, server_name, virtual_network_rule_name, virtual_network_subnet_id, ignore_missing_vnet_service_endpoint=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 - 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 virtual_network_rule_name: The name of the virtual network - rule. - :type virtual_network_rule_name: str - :param virtual_network_subnet_id: The ARM resource id of the virtual - network subnet. - :type virtual_network_subnet_id: str - :param ignore_missing_vnet_service_endpoint: Create firewall rule - before the virtual network has vnet service endpoint enabled. - :type ignore_missing_vnet_service_endpoint: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - VirtualNetworkRule or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.VirtualNetworkRule] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, server_name, virtual_network_rule_name, virtual_network_subnet_id, ignore_missing_vnet_service_endpoint=None, custom_headers=None, raw=False, **operation_config): parameters = models.VirtualNetworkRule(virtual_network_subnet_id=virtual_network_subnet_id, ignore_missing_vnet_service_endpoint=ignore_missing_vnet_service_endpoint) # Construct URL @@ -164,19 +139,83 @@ def create_or_update( body_content = self._serialize.body(parameters, 'VirtualNetworkRule') # Construct and send request - def long_running_send(): + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) + 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('VirtualNetworkRule', response) + if response.status_code == 201: + deserialized = self._deserialize('VirtualNetworkRule', 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, virtual_network_rule_name, virtual_network_subnet_id, ignore_missing_vnet_service_endpoint=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 + 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 virtual_network_rule_name: The name of the virtual network + rule. + :type virtual_network_rule_name: str + :param virtual_network_subnet_id: The ARM resource id of the virtual + network subnet. + :type virtual_network_subnet_id: str + :param ignore_missing_vnet_service_endpoint: Create firewall rule + before the virtual network has vnet service endpoint enabled. + :type ignore_missing_vnet_service_endpoint: bool + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :return: An instance of AzureOperationPoller that returns + VirtualNetworkRule or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.VirtualNetworkRule] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_network_rule_name=virtual_network_rule_name, + virtual_network_subnet_id=virtual_network_subnet_id, + ignore_missing_vnet_service_endpoint=ignore_missing_vnet_service_endpoint, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -185,12 +224,7 @@ 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('VirtualNetworkRule', response) - if response.status_code == 201: - deserialized = self._deserialize('VirtualNetworkRule', response) + deserialized = self._deserialize('VirtualNetworkRule', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -198,10 +232,6 @@ def get_long_running_output(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) @@ -209,28 +239,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, virtual_network_rule_name, custom_headers=None, raw=False, **operation_config): - """Deletes the virtual network rule with the given name. - :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 virtual_network_rule_name: The name of the virtual network - rule. - :type virtual_network_rule_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: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _delete_initial( + self, resource_group_name, server_name, virtual_network_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}' path_format_arguments = { @@ -256,18 +267,64 @@ def delete( 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) - request = self._client.delete(url, query_parameters) - return self._client.send(request, header_parameters, **operation_config) + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, server_name, virtual_network_rule_name, custom_headers=None, raw=False, **operation_config): + """Deletes the virtual network rule with the given name. + + :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 virtual_network_rule_name: The name of the virtual network + rule. + :type virtual_network_rule_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: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + server_name=server_name, + virtual_network_rule_name=virtual_network_rule_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) if headers: request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] return self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) def get_long_running_output(response): @@ -280,10 +337,6 @@ def get_long_running_output(response): 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) @@ -344,7 +397,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) 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 a54c814a166d..321930d51ad4 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -19,19 +19,19 @@ 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.databases_operations import DatabasesOperations 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.elastic_pools_operations import ElasticPoolsOperations 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.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 @@ -106,22 +106,24 @@ class SqlManagementClient(object): :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 databases: Databases operations + :vartype databases: azure.mgmt.sql.operations.DatabasesOperations :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 elastic_pools: ElasticPools operations + :vartype elastic_pools: azure.mgmt.sql.operations.ElasticPoolsOperations :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 replication_links: ReplicationLinks operations :vartype replication_links: azure.mgmt.sql.operations.ReplicationLinksOperations :ivar server_azure_ad_administrators: ServerAzureADAdministrators operations @@ -130,8 +132,6 @@ class SqlManagementClient(object): :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 @@ -204,22 +204,24 @@ 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._client, self.config, self._serialize, self._deserialize) self.server_connection_policies = ServerConnectionPoliciesOperations( self._client, self.config, self._serialize, self._deserialize) + self.databases = DatabasesOperations( + 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.elastic_pools = ElasticPoolsOperations( + 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.replication_links = ReplicationLinksOperations( self._client, self.config, self._serialize, self._deserialize) self.server_azure_ad_administrators = ServerAzureADAdministratorsOperations( @@ -228,8 +230,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.service_objectives = ServiceObjectivesOperations( self._client, self.config, self._serialize, self._deserialize) - 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( From 5862d36eab9b06edd7eda076b7332c0c8b27d66e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 9 Feb 2018 18:57:10 +0000 Subject: [PATCH 02/11] Rebuild by https://github.com/Azure/azure-sdk-for-python/pull/1950 --- .../azure/mgmt/sql/models/__init__.py | 34 ++- .../sql/models/automatic_tuning_options.py | 57 +++++ .../models/automatic_tuning_server_options.py | 56 +++++ ...reate_database_restore_point_definition.py | 33 +++ .../sql/models/database_automatic_tuning.py | 57 +++++ .../azure/mgmt/sql/models/restore_point.py | 32 ++- .../sql/models/server_automatic_tuning.py | 60 +++++ .../sql/models/sql_management_client_enums.py | 58 ++++- .../azure/mgmt/sql/operations/__init__.py | 8 +- .../database_automatic_tuning_operations.py | 182 +++++++++++++++ .../operations/restore_points_operations.py | 211 +++++++++++++++++- .../server_automatic_tuning_operations.py | 177 +++++++++++++++ .../azure/mgmt/sql/sql_management_client.py | 20 +- azure-mgmt-sql/azure/mgmt/sql/version.py | 2 +- 14 files changed, 949 insertions(+), 38 deletions(-) create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/automatic_tuning_options.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/automatic_tuning_server_options.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/create_database_restore_point_definition.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/database_automatic_tuning.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/server_automatic_tuning.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/database_automatic_tuning_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/server_automatic_tuning_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index fffd1dfc5d5f..f7da1a4021a9 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -14,7 +14,6 @@ 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 from .max_size_capability import MaxSizeCapability @@ -64,6 +63,8 @@ from .server_usage import ServerUsage from .database_usage import DatabaseUsage from .database_blob_auditing_policy import DatabaseBlobAuditingPolicy +from .automatic_tuning_options import AutomaticTuningOptions +from .database_automatic_tuning import DatabaseAutomaticTuning from .encryption_protector import EncryptionProtector from .failover_group_read_write_endpoint import FailoverGroupReadWriteEndpoint from .failover_group_read_only_endpoint import FailoverGroupReadOnlyEndpoint @@ -93,11 +94,14 @@ from .virtual_network_rule import VirtualNetworkRule from .database_operation import DatabaseOperation from .resource_move_definition import ResourceMoveDefinition +from .automatic_tuning_server_options import AutomaticTuningServerOptions +from .server_automatic_tuning import ServerAutomaticTuning from .server_dns_alias import ServerDnsAlias from .server_dns_alias_acquisition import ServerDnsAliasAcquisition +from .restore_point import RestorePoint +from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition from .backup_long_term_retention_policy_paged import BackupLongTermRetentionPolicyPaged from .backup_long_term_retention_vault_paged import BackupLongTermRetentionVaultPaged -from .restore_point_paged import RestorePointPaged from .recoverable_database_paged import RecoverableDatabasePaged from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .server_paged import ServerPaged @@ -135,9 +139,9 @@ from .virtual_network_rule_paged import VirtualNetworkRulePaged from .database_operation_paged import DatabaseOperationPaged from .server_dns_alias_paged import ServerDnsAliasPaged +from .restore_point_paged import RestorePointPaged from .sql_management_client_enums import ( BackupLongTermRetentionPolicyState, - RestorePointType, CapabilityStatus, MaxSizeUnits, PerformanceLevelUnit, @@ -170,6 +174,10 @@ ReplicationRole, ReplicationState, BlobAuditingPolicyState, + AutomaticTuningMode, + AutomaticTuningOptionModeDesired, + AutomaticTuningOptionModeActual, + AutomaticTuningDisabledReason, ServerKeyType, ReadWriteEndpointFailoverPolicy, ReadOnlyEndpointFailoverPolicy, @@ -185,6 +193,9 @@ SyncMemberState, VirtualNetworkRuleState, ManagementOperationState, + AutomaticTuningServerMode, + AutomaticTuningServerReason, + RestorePointType, ) __all__ = [ @@ -193,7 +204,6 @@ 'BackupLongTermRetentionPolicy', 'BackupLongTermRetentionVault', 'TrackedResource', - 'RestorePoint', 'RecoverableDatabase', 'RestorableDroppedDatabase', 'MaxSizeCapability', @@ -243,6 +253,8 @@ 'ServerUsage', 'DatabaseUsage', 'DatabaseBlobAuditingPolicy', + 'AutomaticTuningOptions', + 'DatabaseAutomaticTuning', 'EncryptionProtector', 'FailoverGroupReadWriteEndpoint', 'FailoverGroupReadOnlyEndpoint', @@ -272,11 +284,14 @@ 'VirtualNetworkRule', 'DatabaseOperation', 'ResourceMoveDefinition', + 'AutomaticTuningServerOptions', + 'ServerAutomaticTuning', 'ServerDnsAlias', 'ServerDnsAliasAcquisition', + 'RestorePoint', + 'CreateDatabaseRestorePointDefinition', 'BackupLongTermRetentionPolicyPaged', 'BackupLongTermRetentionVaultPaged', - 'RestorePointPaged', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', 'ServerPaged', @@ -314,8 +329,8 @@ 'VirtualNetworkRulePaged', 'DatabaseOperationPaged', 'ServerDnsAliasPaged', + 'RestorePointPaged', 'BackupLongTermRetentionPolicyState', - 'RestorePointType', 'CapabilityStatus', 'MaxSizeUnits', 'PerformanceLevelUnit', @@ -348,6 +363,10 @@ 'ReplicationRole', 'ReplicationState', 'BlobAuditingPolicyState', + 'AutomaticTuningMode', + 'AutomaticTuningOptionModeDesired', + 'AutomaticTuningOptionModeActual', + 'AutomaticTuningDisabledReason', 'ServerKeyType', 'ReadWriteEndpointFailoverPolicy', 'ReadOnlyEndpointFailoverPolicy', @@ -363,4 +382,7 @@ 'SyncMemberState', 'VirtualNetworkRuleState', 'ManagementOperationState', + 'AutomaticTuningServerMode', + 'AutomaticTuningServerReason', + 'RestorePointType', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/automatic_tuning_options.py b/azure-mgmt-sql/azure/mgmt/sql/models/automatic_tuning_options.py new file mode 100644 index 000000000000..d51528905ca8 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/automatic_tuning_options.py @@ -0,0 +1,57 @@ +# 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 AutomaticTuningOptions(Model): + """Automatic tuning properties for individual advisors. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param desired_state: Automatic tuning option desired state. Possible + values include: 'Off', 'On', 'Default' + :type desired_state: str or + ~azure.mgmt.sql.models.AutomaticTuningOptionModeDesired + :ivar actual_state: Automatic tuning option actual state. Possible values + include: 'Off', 'On' + :vartype actual_state: str or + ~azure.mgmt.sql.models.AutomaticTuningOptionModeActual + :ivar reason_code: Reason code if desired and actual state are different. + :vartype reason_code: int + :ivar reason_desc: Reason description if desired and actual state are + different. Possible values include: 'Default', 'Disabled', + 'AutoConfigured', 'InheritedFromServer', 'QueryStoreOff', + 'QueryStoreReadOnly', 'NotSupported' + :vartype reason_desc: str or + ~azure.mgmt.sql.models.AutomaticTuningDisabledReason + """ + + _validation = { + 'actual_state': {'readonly': True}, + 'reason_code': {'readonly': True}, + 'reason_desc': {'readonly': True}, + } + + _attribute_map = { + 'desired_state': {'key': 'desiredState', 'type': 'AutomaticTuningOptionModeDesired'}, + 'actual_state': {'key': 'actualState', 'type': 'AutomaticTuningOptionModeActual'}, + 'reason_code': {'key': 'reasonCode', 'type': 'int'}, + 'reason_desc': {'key': 'reasonDesc', 'type': 'AutomaticTuningDisabledReason'}, + } + + def __init__(self, desired_state=None): + super(AutomaticTuningOptions, self).__init__() + self.desired_state = desired_state + self.actual_state = None + self.reason_code = None + self.reason_desc = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/automatic_tuning_server_options.py b/azure-mgmt-sql/azure/mgmt/sql/models/automatic_tuning_server_options.py new file mode 100644 index 000000000000..163fa8125cf1 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/automatic_tuning_server_options.py @@ -0,0 +1,56 @@ +# 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 AutomaticTuningServerOptions(Model): + """Automatic tuning properties for individual advisors. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param desired_state: Automatic tuning option desired state. Possible + values include: 'Off', 'On', 'Default' + :type desired_state: str or + ~azure.mgmt.sql.models.AutomaticTuningOptionModeDesired + :ivar actual_state: Automatic tuning option actual state. Possible values + include: 'Off', 'On' + :vartype actual_state: str or + ~azure.mgmt.sql.models.AutomaticTuningOptionModeActual + :ivar reason_code: Reason code if desired and actual state are different. + :vartype reason_code: int + :ivar reason_desc: Reason description if desired and actual state are + different. Possible values include: 'Default', 'Disabled', + 'AutoConfigured' + :vartype reason_desc: str or + ~azure.mgmt.sql.models.AutomaticTuningServerReason + """ + + _validation = { + 'actual_state': {'readonly': True}, + 'reason_code': {'readonly': True}, + 'reason_desc': {'readonly': True}, + } + + _attribute_map = { + 'desired_state': {'key': 'desiredState', 'type': 'AutomaticTuningOptionModeDesired'}, + 'actual_state': {'key': 'actualState', 'type': 'AutomaticTuningOptionModeActual'}, + 'reason_code': {'key': 'reasonCode', 'type': 'int'}, + 'reason_desc': {'key': 'reasonDesc', 'type': 'AutomaticTuningServerReason'}, + } + + def __init__(self, desired_state=None): + super(AutomaticTuningServerOptions, self).__init__() + self.desired_state = desired_state + self.actual_state = None + self.reason_code = None + self.reason_desc = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/create_database_restore_point_definition.py b/azure-mgmt-sql/azure/mgmt/sql/models/create_database_restore_point_definition.py new file mode 100644 index 000000000000..14c582c5fd37 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/create_database_restore_point_definition.py @@ -0,0 +1,33 @@ +# 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 CreateDatabaseRestorePointDefinition(Model): + """Contains the information necessary to perform a create database restore + point operation. + + :param restore_point_label: The restore point label to apply + :type restore_point_label: str + """ + + _validation = { + 'restore_point_label': {'required': True}, + } + + _attribute_map = { + 'restore_point_label': {'key': 'restorePointLabel', 'type': 'str'}, + } + + def __init__(self, restore_point_label): + super(CreateDatabaseRestorePointDefinition, self).__init__() + self.restore_point_label = restore_point_label diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_automatic_tuning.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_automatic_tuning.py new file mode 100644 index 000000000000..2bee39c6b0e6 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_automatic_tuning.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class DatabaseAutomaticTuning(ProxyResource): + """Database-level Automatic Tuning. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param desired_state: Automatic tuning desired state. Possible values + include: 'Inherit', 'Custom', 'Auto', 'Unspecified' + :type desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningMode + :ivar actual_state: Automatic tuning actual state. Possible values + include: 'Inherit', 'Custom', 'Auto', 'Unspecified' + :vartype actual_state: str or ~azure.mgmt.sql.models.AutomaticTuningMode + :param options: Automatic tuning options definition. + :type options: dict[str, ~azure.mgmt.sql.models.AutomaticTuningOptions] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'actual_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'desired_state': {'key': 'properties.desiredState', 'type': 'AutomaticTuningMode'}, + 'actual_state': {'key': 'properties.actualState', 'type': 'AutomaticTuningMode'}, + 'options': {'key': 'properties.options', 'type': '{AutomaticTuningOptions}'}, + } + + def __init__(self, desired_state=None, options=None): + super(DatabaseAutomaticTuning, self).__init__() + self.desired_state = desired_state + self.actual_state = None + self.options = options diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py b/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py index 7a2f5640a500..5a86dcac2e00 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py @@ -13,7 +13,7 @@ class RestorePoint(ProxyResource): - """A database restore point. + """Database restore points. Variables are only populated by the server, and will be ignored when sending a request. @@ -24,38 +24,48 @@ class RestorePoint(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar restore_point_type: The restore point type of the database restore - point. Possible values include: 'DISCRETE', 'CONTINUOUS' + :ivar location: Resource location. + :vartype location: str + :ivar restore_point_type: The type of restore point. Possible values + include: 'CONTINUOUS', 'DISCRETE' :vartype restore_point_type: str or ~azure.mgmt.sql.models.RestorePointType - :ivar restore_point_creation_date: Restore point creation time (ISO8601 - format). Populated when restorePointType = CONTINUOUS. Null otherwise. - :vartype restore_point_creation_date: datetime - :ivar earliest_restore_date: Earliest restore time (ISO8601 format). - Populated when restorePointType = DISCRETE. Null otherwise. + :ivar earliest_restore_date: The earliest time to which this database can + be restored :vartype earliest_restore_date: datetime + :ivar restore_point_creation_date: The time the backup was taken + :vartype restore_point_creation_date: datetime + :ivar restore_point_label: The label of restore point for backup request + by user + :vartype restore_point_label: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'readonly': True}, 'restore_point_type': {'readonly': True}, - 'restore_point_creation_date': {'readonly': True}, 'earliest_restore_date': {'readonly': True}, + 'restore_point_creation_date': {'readonly': True}, + 'restore_point_label': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, 'restore_point_type': {'key': 'properties.restorePointType', 'type': 'RestorePointType'}, - 'restore_point_creation_date': {'key': 'properties.restorePointCreationDate', 'type': 'iso-8601'}, 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, + 'restore_point_creation_date': {'key': 'properties.restorePointCreationDate', 'type': 'iso-8601'}, + 'restore_point_label': {'key': 'properties.restorePointLabel', 'type': 'str'}, } def __init__(self): super(RestorePoint, self).__init__() + self.location = None self.restore_point_type = None - self.restore_point_creation_date = None self.earliest_restore_date = None + self.restore_point_creation_date = None + self.restore_point_label = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_automatic_tuning.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_automatic_tuning.py new file mode 100644 index 000000000000..fd9963f37eab --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_automatic_tuning.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class ServerAutomaticTuning(ProxyResource): + """Server-level Automatic Tuning. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param desired_state: Automatic tuning desired state. Possible values + include: 'Custom', 'Auto', 'Unspecified' + :type desired_state: str or + ~azure.mgmt.sql.models.AutomaticTuningServerMode + :ivar actual_state: Automatic tuning actual state. Possible values + include: 'Custom', 'Auto', 'Unspecified' + :vartype actual_state: str or + ~azure.mgmt.sql.models.AutomaticTuningServerMode + :param options: Automatic tuning options definition. + :type options: dict[str, + ~azure.mgmt.sql.models.AutomaticTuningServerOptions] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'actual_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'desired_state': {'key': 'properties.desiredState', 'type': 'AutomaticTuningServerMode'}, + 'actual_state': {'key': 'properties.actualState', 'type': 'AutomaticTuningServerMode'}, + 'options': {'key': 'properties.options', 'type': '{AutomaticTuningServerOptions}'}, + } + + def __init__(self, desired_state=None, options=None): + super(ServerAutomaticTuning, self).__init__() + self.desired_state = desired_state + self.actual_state = None + self.options = options 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 2a19493bc5e7..b80618b70daf 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 @@ -18,12 +18,6 @@ class BackupLongTermRetentionPolicyState(Enum): enabled = "Enabled" -class RestorePointType(Enum): - - discrete = "DISCRETE" - continuous = "CONTINUOUS" - - class CapabilityStatus(Enum): visible = "Visible" @@ -333,6 +327,38 @@ class BlobAuditingPolicyState(Enum): disabled = "Disabled" +class AutomaticTuningMode(Enum): + + inherit = "Inherit" + custom = "Custom" + auto = "Auto" + unspecified = "Unspecified" + + +class AutomaticTuningOptionModeDesired(Enum): + + off = "Off" + on = "On" + default = "Default" + + +class AutomaticTuningOptionModeActual(Enum): + + off = "Off" + on = "On" + + +class AutomaticTuningDisabledReason(Enum): + + default = "Default" + disabled = "Disabled" + auto_configured = "AutoConfigured" + inherited_from_server = "InheritedFromServer" + query_store_off = "QueryStoreOff" + query_store_read_only = "QueryStoreReadOnly" + not_supported = "NotSupported" + + class ServerKeyType(Enum): service_managed = "ServiceManaged" @@ -450,3 +476,23 @@ class ManagementOperationState(Enum): failed = "Failed" cancel_in_progress = "CancelInProgress" cancelled = "Cancelled" + + +class AutomaticTuningServerMode(Enum): + + custom = "Custom" + auto = "Auto" + unspecified = "Unspecified" + + +class AutomaticTuningServerReason(Enum): + + default = "Default" + disabled = "Disabled" + auto_configured = "AutoConfigured" + + +class RestorePointType(Enum): + + continuous = "CONTINUOUS" + discrete = "DISCRETE" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index f6cf50e2157e..59b10b1d495f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -11,7 +11,6 @@ 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 @@ -37,6 +36,7 @@ from .server_usages_operations import ServerUsagesOperations from .database_usages_operations import DatabaseUsagesOperations from .database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations +from .database_automatic_tuning_operations import DatabaseAutomaticTuningOperations from .encryption_protectors_operations import EncryptionProtectorsOperations from .failover_groups_operations import FailoverGroupsOperations from .operations import Operations @@ -47,12 +47,13 @@ from .subscription_usages_operations import SubscriptionUsagesOperations from .virtual_network_rules_operations import VirtualNetworkRulesOperations from .database_operations import DatabaseOperations +from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations +from .restore_points_operations import RestorePointsOperations __all__ = [ 'BackupLongTermRetentionPoliciesOperations', 'BackupLongTermRetentionVaultsOperations', - 'RestorePointsOperations', 'RecoverableDatabasesOperations', 'RestorableDroppedDatabasesOperations', 'CapabilitiesOperations', @@ -78,6 +79,7 @@ 'ServerUsagesOperations', 'DatabaseUsagesOperations', 'DatabaseBlobAuditingPoliciesOperations', + 'DatabaseAutomaticTuningOperations', 'EncryptionProtectorsOperations', 'FailoverGroupsOperations', 'Operations', @@ -88,5 +90,7 @@ 'SubscriptionUsagesOperations', 'VirtualNetworkRulesOperations', 'DatabaseOperations', + 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', + 'RestorePointsOperations', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_automatic_tuning_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_automatic_tuning_operations.py new file mode 100644 index 000000000000..006b4bbf630b --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_automatic_tuning_operations.py @@ -0,0 +1,182 @@ +# 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 DatabaseAutomaticTuningOperations(object): + """DatabaseAutomaticTuningOperations 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". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-05-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a database's automatic tuning. + + :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: DatabaseAutomaticTuning or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.DatabaseAutomaticTuning or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAutomaticTuning', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, server_name, database_name, desired_state=None, options=None, custom_headers=None, raw=False, **operation_config): + """Update automatic tuning properties for target database. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param desired_state: Automatic tuning desired state. Possible values + include: 'Inherit', 'Custom', 'Auto', 'Unspecified' + :type desired_state: str or ~azure.mgmt.sql.models.AutomaticTuningMode + :param options: Automatic tuning options definition. + :type options: dict[str, + ~azure.mgmt.sql.models.AutomaticTuningOptions] + :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: DatabaseAutomaticTuning or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.DatabaseAutomaticTuning or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.DatabaseAutomaticTuning(desired_state=desired_state, options=options) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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, 'DatabaseAutomaticTuning') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DatabaseAutomaticTuning', 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/restore_points_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py index 39053faa125c..069134a69cfe 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py @@ -12,6 +12,8 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError +from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -23,7 +25,7 @@ class RestorePointsOperations(object): :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 api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ models = models @@ -33,13 +35,13 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2014-04-01" + self.api_version = "2017-03-01-preview" 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. + """Gets a collection of restore points that belongs to the database. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -47,8 +49,7 @@ def list_by_database( :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. + :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 @@ -66,10 +67,10 @@ def internal_paging(next_link=None, raw=False): # 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') + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -112,3 +113,199 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + + + def _create_initial( + self, resource_group_name, server_name, database_name, restore_point_label, custom_headers=None, raw=False, **operation_config): + parameters = models.CreateDatabaseRestorePointDefinition(restore_point_label=restore_point_label) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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, 'CreateDatabaseRestorePointDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + 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('RestorePoint', response) + if response.status_code == 201: + deserialized = self._deserialize('RestorePoint', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, server_name, database_name, restore_point_label, custom_headers=None, raw=False, **operation_config): + """Creates a restore point for 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 database. + :type database_name: str + :param restore_point_label: The restore point label to apply + :type restore_point_label: 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: An instance of AzureOperationPoller that returns RestorePoint + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.RestorePoint] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + restore_point_label=restore_point_label, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **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 = self._deserialize('RestorePoint', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_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( + self, resource_group_name, server_name, database_name, restore_point_name, custom_headers=None, raw=False, **operation_config): + """Gets a restore point. + + :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 restore_point_name: The name of the restore point. + :type restore_point_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: RestorePoint or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.RestorePoint or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}' + 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'), + 'restorePointName': self._serialize.url("restore_point_name", restore_point_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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RestorePoint', 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_automatic_tuning_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_automatic_tuning_operations.py new file mode 100644 index 000000000000..532834124125 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_automatic_tuning_operations.py @@ -0,0 +1,177 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ServerAutomaticTuningOperations(object): + """ServerAutomaticTuningOperations 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: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Retrieves server automatic tuning options. + + :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: ServerAutomaticTuning or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.ServerAutomaticTuning or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current' + 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') + + # 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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ServerAutomaticTuning', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, server_name, desired_state=None, options=None, custom_headers=None, raw=False, **operation_config): + """Update automatic tuning options on 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 desired_state: Automatic tuning desired state. Possible values + include: 'Custom', 'Auto', 'Unspecified' + :type desired_state: str or + ~azure.mgmt.sql.models.AutomaticTuningServerMode + :param options: Automatic tuning options definition. + :type options: dict[str, + ~azure.mgmt.sql.models.AutomaticTuningServerOptions] + :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: ServerAutomaticTuning or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.ServerAutomaticTuning or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.ServerAutomaticTuning(desired_state=desired_state, options=options) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current' + 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') + + # 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, 'ServerAutomaticTuning') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ServerAutomaticTuning', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized 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 321930d51ad4..bbe594e8efec 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -15,7 +15,6 @@ from .version import VERSION 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 @@ -41,6 +40,7 @@ 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.database_automatic_tuning_operations import DatabaseAutomaticTuningOperations from .operations.encryption_protectors_operations import EncryptionProtectorsOperations from .operations.failover_groups_operations import FailoverGroupsOperations from .operations.operations import Operations @@ -51,7 +51,9 @@ from .operations.subscription_usages_operations import SubscriptionUsagesOperations from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations from .operations.database_operations import DatabaseOperations +from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations +from .operations.restore_points_operations import RestorePointsOperations from . import models @@ -98,8 +100,6 @@ class SqlManagementClient(object): :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 @@ -150,6 +150,8 @@ class SqlManagementClient(object): :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 database_automatic_tuning: DatabaseAutomaticTuning operations + :vartype database_automatic_tuning: azure.mgmt.sql.operations.DatabaseAutomaticTuningOperations :ivar encryption_protectors: EncryptionProtectors operations :vartype encryption_protectors: azure.mgmt.sql.operations.EncryptionProtectorsOperations :ivar failover_groups: FailoverGroups operations @@ -170,8 +172,12 @@ class SqlManagementClient(object): :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations :ivar database_operations: DatabaseOperations operations :vartype database_operations: azure.mgmt.sql.operations.DatabaseOperations + :ivar server_automatic_tuning: ServerAutomaticTuning operations + :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations + :ivar restore_points: RestorePoints operations + :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -196,8 +202,6 @@ def __init__( 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) self.restorable_dropped_databases = RestorableDroppedDatabasesOperations( @@ -248,6 +252,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.database_blob_auditing_policies = DatabaseBlobAuditingPoliciesOperations( self._client, self.config, self._serialize, self._deserialize) + self.database_automatic_tuning = DatabaseAutomaticTuningOperations( + self._client, self.config, self._serialize, self._deserialize) self.encryption_protectors = EncryptionProtectorsOperations( self._client, self.config, self._serialize, self._deserialize) self.failover_groups = FailoverGroupsOperations( @@ -268,5 +274,9 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.database_operations = DatabaseOperations( self._client, self.config, self._serialize, self._deserialize) + self.server_automatic_tuning = ServerAutomaticTuningOperations( + self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( self._client, self.config, self._serialize, self._deserialize) + self.restore_points = RestorePointsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-sql/azure/mgmt/sql/version.py b/azure-mgmt-sql/azure/mgmt/sql/version.py index c806fd2eb6c3..53a203f32aaf 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/version.py +++ b/azure-mgmt-sql/azure/mgmt/sql/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.8.5" +VERSION = "" From db84943e8e6845f15f3fb409cd20eef49f898396 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 9 Feb 2018 11:13:09 -0800 Subject: [PATCH 03/11] Generated from dbaf4f1b4a6a05888680e3b210813b8f2a1d98db (#1951) Py version for SQL build --- .../azure/mgmt/sql/models/__init__.py | 8 ++--- ...ore_point.py => database_restore_point.py} | 6 ++-- ...ged.py => database_restore_point_paged.py} | 8 ++--- .../azure/mgmt/sql/operations/__init__.py | 4 +-- ... => database_restore_points_operations.py} | 30 +++++++++---------- .../azure/mgmt/sql/sql_management_client.py | 8 ++--- azure-mgmt-sql/azure/mgmt/sql/version.py | 2 +- 7 files changed, 33 insertions(+), 33 deletions(-) rename azure-mgmt-sql/azure/mgmt/sql/models/{restore_point.py => database_restore_point.py} (95%) rename azure-mgmt-sql/azure/mgmt/sql/models/{restore_point_paged.py => database_restore_point_paged.py} (67%) rename azure-mgmt-sql/azure/mgmt/sql/operations/{restore_points_operations.py => database_restore_points_operations.py} (92%) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index f7da1a4021a9..c3734d72ba7b 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -98,7 +98,7 @@ from .server_automatic_tuning import ServerAutomaticTuning from .server_dns_alias import ServerDnsAlias from .server_dns_alias_acquisition import ServerDnsAliasAcquisition -from .restore_point import RestorePoint +from .database_restore_point import DatabaseRestorePoint from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition from .backup_long_term_retention_policy_paged import BackupLongTermRetentionPolicyPaged from .backup_long_term_retention_vault_paged import BackupLongTermRetentionVaultPaged @@ -139,7 +139,7 @@ from .virtual_network_rule_paged import VirtualNetworkRulePaged from .database_operation_paged import DatabaseOperationPaged from .server_dns_alias_paged import ServerDnsAliasPaged -from .restore_point_paged import RestorePointPaged +from .database_restore_point_paged import DatabaseRestorePointPaged from .sql_management_client_enums import ( BackupLongTermRetentionPolicyState, CapabilityStatus, @@ -288,7 +288,7 @@ 'ServerAutomaticTuning', 'ServerDnsAlias', 'ServerDnsAliasAcquisition', - 'RestorePoint', + 'DatabaseRestorePoint', 'CreateDatabaseRestorePointDefinition', 'BackupLongTermRetentionPolicyPaged', 'BackupLongTermRetentionVaultPaged', @@ -329,7 +329,7 @@ 'VirtualNetworkRulePaged', 'DatabaseOperationPaged', 'ServerDnsAliasPaged', - 'RestorePointPaged', + 'DatabaseRestorePointPaged', 'BackupLongTermRetentionPolicyState', 'CapabilityStatus', 'MaxSizeUnits', diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_restore_point.py similarity index 95% rename from azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py rename to azure-mgmt-sql/azure/mgmt/sql/models/database_restore_point.py index 5a86dcac2e00..051d36e94a95 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_restore_point.py @@ -12,7 +12,7 @@ from .proxy_resource import ProxyResource -class RestorePoint(ProxyResource): +class DatabaseRestorePoint(ProxyResource): """Database restore points. Variables are only populated by the server, and will be ignored when @@ -56,14 +56,14 @@ class RestorePoint(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'restore_point_type': {'key': 'properties.restorePointType', 'type': 'RestorePointType'}, + 'restore_point_type': {'key': 'properties.restorePointType', 'type': 'str'}, 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, 'restore_point_creation_date': {'key': 'properties.restorePointCreationDate', 'type': 'iso-8601'}, 'restore_point_label': {'key': 'properties.restorePointLabel', 'type': 'str'}, } def __init__(self): - super(RestorePoint, self).__init__() + super(DatabaseRestorePoint, self).__init__() self.location = None self.restore_point_type = None self.earliest_restore_date = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/restore_point_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_restore_point_paged.py similarity index 67% rename from azure-mgmt-sql/azure/mgmt/sql/models/restore_point_paged.py rename to azure-mgmt-sql/azure/mgmt/sql/models/database_restore_point_paged.py index b77cde666dd0..ee720d3dc886 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/restore_point_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_restore_point_paged.py @@ -12,16 +12,16 @@ from msrest.paging import Paged -class RestorePointPaged(Paged): +class DatabaseRestorePointPaged(Paged): """ - A paging container for iterating over a list of :class:`RestorePoint ` object + A paging container for iterating over a list of :class:`DatabaseRestorePoint ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[RestorePoint]'} + 'current_page': {'key': 'value', 'type': '[DatabaseRestorePoint]'} } def __init__(self, *args, **kwargs): - super(RestorePointPaged, self).__init__(*args, **kwargs) + super(DatabaseRestorePointPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 59b10b1d495f..3bf7b5072a92 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -49,7 +49,7 @@ from .database_operations import DatabaseOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations -from .restore_points_operations import RestorePointsOperations +from .database_restore_points_operations import DatabaseRestorePointsOperations __all__ = [ 'BackupLongTermRetentionPoliciesOperations', @@ -92,5 +92,5 @@ 'DatabaseOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', - 'RestorePointsOperations', + 'DatabaseRestorePointsOperations', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_restore_points_operations.py similarity index 92% rename from azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py rename to azure-mgmt-sql/azure/mgmt/sql/operations/database_restore_points_operations.py index 069134a69cfe..ce6c74c26155 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_restore_points_operations.py @@ -18,8 +18,8 @@ from .. import models -class RestorePointsOperations(object): - """RestorePointsOperations operations. +class DatabaseRestorePointsOperations(object): + """DatabaseRestorePointsOperations operations. :param client: Client for service requests. :param config: Configuration of service client. @@ -56,9 +56,9 @@ def list_by_database( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of RestorePoint + :return: An iterator like instance of DatabaseRestorePoint :rtype: - ~azure.mgmt.sql.models.RestorePointPaged[~azure.mgmt.sql.models.RestorePoint] + ~azure.mgmt.sql.models.DatabaseRestorePointPaged[~azure.mgmt.sql.models.DatabaseRestorePoint] :raises: :class:`CloudError` """ def internal_paging(next_link=None, raw=False): @@ -105,11 +105,11 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.RestorePointPaged(internal_paging, self._deserialize.dependencies) + deserialized = models.DatabaseRestorePointPaged(internal_paging, self._deserialize.dependencies) if raw: header_dict = {} - client_raw_response = models.RestorePointPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = models.DatabaseRestorePointPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized @@ -159,9 +159,9 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RestorePoint', response) + deserialized = self._deserialize('DatabaseRestorePoint', response) if response.status_code == 201: - deserialized = self._deserialize('RestorePoint', response) + deserialized = self._deserialize('DatabaseRestorePoint', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -186,10 +186,10 @@ def create( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :return: An instance of AzureOperationPoller that returns RestorePoint - or ClientRawResponse if raw=true + :return: An instance of AzureOperationPoller that returns + DatabaseRestorePoint or ClientRawResponse if raw=true :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.RestorePoint] + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.DatabaseRestorePoint] or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -226,7 +226,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = self._deserialize('RestorePoint', response) + deserialized = self._deserialize('DatabaseRestorePoint', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -260,8 +260,8 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: RestorePoint or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.RestorePoint or + :return: DatabaseRestorePoint or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.DatabaseRestorePoint or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -302,7 +302,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('RestorePoint', response) + deserialized = self._deserialize('DatabaseRestorePoint', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) 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 bbe594e8efec..fa44c571ddf4 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -53,7 +53,7 @@ from .operations.database_operations import DatabaseOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations -from .operations.restore_points_operations import RestorePointsOperations +from .operations.database_restore_points_operations import DatabaseRestorePointsOperations from . import models @@ -176,8 +176,8 @@ class SqlManagementClient(object): :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations - :ivar restore_points: RestorePoints operations - :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations + :ivar database_restore_points: DatabaseRestorePoints operations + :vartype database_restore_points: azure.mgmt.sql.operations.DatabaseRestorePointsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -278,5 +278,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( self._client, self.config, self._serialize, self._deserialize) - self.restore_points = RestorePointsOperations( + self.database_restore_points = DatabaseRestorePointsOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-sql/azure/mgmt/sql/version.py b/azure-mgmt-sql/azure/mgmt/sql/version.py index 53a203f32aaf..3697d9b71739 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/version.py +++ b/azure-mgmt-sql/azure/mgmt/sql/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "" +VERSION = "0.9.0" From 85d01f9d2414304e6966ce125667e9aedc042692 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 21 Feb 2018 23:03:39 +0000 Subject: [PATCH 04/11] Rebuild by https://github.com/Azure/azure-sdk-for-python/pull/1950 --- .../azure/mgmt/sql/models/__init__.py | 8 +-- ...base_restore_point.py => restore_point.py} | 6 +-- ..._point_paged.py => restore_point_paged.py} | 8 +-- .../azure/mgmt/sql/operations/__init__.py | 4 +- ...long_term_retention_policies_operations.py | 11 ++-- ...p_long_term_retention_vaults_operations.py | 11 ++-- .../sql/operations/capabilities_operations.py | 5 +- .../data_masking_policies_operations.py | 8 +-- .../data_masking_rules_operations.py | 8 +-- .../database_automatic_tuning_operations.py | 8 +-- ...abase_blob_auditing_policies_operations.py | 8 +-- .../sql/operations/database_operations.py | 8 +-- ...se_threat_detection_policies_operations.py | 8 +-- .../operations/database_usages_operations.py | 5 +- .../sql/operations/databases_operations.py | 53 ++++++++++++------- .../elastic_pool_activities_operations.py | 5 +- ...tic_pool_database_activities_operations.py | 5 +- .../operations/elastic_pools_operations.py | 23 +++++--- .../encryption_protectors_operations.py | 11 ++-- .../operations/failover_groups_operations.py | 23 +++++--- .../operations/firewall_rules_operations.py | 14 +++-- .../geo_backup_policies_operations.py | 11 ++-- .../azure/mgmt/sql/operations/operations.py | 5 +- .../recommended_elastic_pools_operations.py | 11 ++-- .../recoverable_databases_operations.py | 8 +-- .../replication_links_operations.py | 17 +++--- ...restorable_dropped_databases_operations.py | 8 +-- ...ations.py => restore_points_operations.py} | 43 ++++++++------- .../server_automatic_tuning_operations.py | 8 +-- ...rver_azure_ad_administrators_operations.py | 14 +++-- .../server_communication_links_operations.py | 14 +++-- .../server_connection_policies_operations.py | 8 +-- .../server_dns_aliases_operations.py | 17 +++--- .../sql/operations/server_keys_operations.py | 14 +++-- .../operations/server_usages_operations.py | 5 +- .../mgmt/sql/operations/servers_operations.py | 23 +++++--- .../service_objectives_operations.py | 8 +-- .../service_tier_advisors_operations.py | 8 +-- .../subscription_usages_operations.py | 8 +-- .../sql/operations/sync_agents_operations.py | 20 ++++--- .../sql/operations/sync_groups_operations.py | 35 +++++++----- .../sql/operations/sync_members_operations.py | 23 +++++--- ...t_data_encryption_activities_operations.py | 5 +- ...transparent_data_encryptions_operations.py | 8 +-- .../virtual_network_rules_operations.py | 14 +++-- .../azure/mgmt/sql/sql_management_client.py | 8 +-- 46 files changed, 364 insertions(+), 219 deletions(-) rename azure-mgmt-sql/azure/mgmt/sql/models/{database_restore_point.py => restore_point.py} (95%) rename azure-mgmt-sql/azure/mgmt/sql/models/{database_restore_point_paged.py => restore_point_paged.py} (67%) rename azure-mgmt-sql/azure/mgmt/sql/operations/{database_restore_points_operations.py => restore_points_operations.py} (87%) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index c3734d72ba7b..f7da1a4021a9 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -98,7 +98,7 @@ from .server_automatic_tuning import ServerAutomaticTuning from .server_dns_alias import ServerDnsAlias from .server_dns_alias_acquisition import ServerDnsAliasAcquisition -from .database_restore_point import DatabaseRestorePoint +from .restore_point import RestorePoint from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition from .backup_long_term_retention_policy_paged import BackupLongTermRetentionPolicyPaged from .backup_long_term_retention_vault_paged import BackupLongTermRetentionVaultPaged @@ -139,7 +139,7 @@ from .virtual_network_rule_paged import VirtualNetworkRulePaged from .database_operation_paged import DatabaseOperationPaged from .server_dns_alias_paged import ServerDnsAliasPaged -from .database_restore_point_paged import DatabaseRestorePointPaged +from .restore_point_paged import RestorePointPaged from .sql_management_client_enums import ( BackupLongTermRetentionPolicyState, CapabilityStatus, @@ -288,7 +288,7 @@ 'ServerAutomaticTuning', 'ServerDnsAlias', 'ServerDnsAliasAcquisition', - 'DatabaseRestorePoint', + 'RestorePoint', 'CreateDatabaseRestorePointDefinition', 'BackupLongTermRetentionPolicyPaged', 'BackupLongTermRetentionVaultPaged', @@ -329,7 +329,7 @@ 'VirtualNetworkRulePaged', 'DatabaseOperationPaged', 'ServerDnsAliasPaged', - 'DatabaseRestorePointPaged', + 'RestorePointPaged', 'BackupLongTermRetentionPolicyState', 'CapabilityStatus', 'MaxSizeUnits', diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_restore_point.py b/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py similarity index 95% rename from azure-mgmt-sql/azure/mgmt/sql/models/database_restore_point.py rename to azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py index 051d36e94a95..5a86dcac2e00 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_restore_point.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py @@ -12,7 +12,7 @@ from .proxy_resource import ProxyResource -class DatabaseRestorePoint(ProxyResource): +class RestorePoint(ProxyResource): """Database restore points. Variables are only populated by the server, and will be ignored when @@ -56,14 +56,14 @@ class DatabaseRestorePoint(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'restore_point_type': {'key': 'properties.restorePointType', 'type': 'str'}, + 'restore_point_type': {'key': 'properties.restorePointType', 'type': 'RestorePointType'}, 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, 'restore_point_creation_date': {'key': 'properties.restorePointCreationDate', 'type': 'iso-8601'}, 'restore_point_label': {'key': 'properties.restorePointLabel', 'type': 'str'}, } def __init__(self): - super(DatabaseRestorePoint, self).__init__() + super(RestorePoint, self).__init__() self.location = None self.restore_point_type = None self.earliest_restore_date = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_restore_point_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/restore_point_paged.py similarity index 67% rename from azure-mgmt-sql/azure/mgmt/sql/models/database_restore_point_paged.py rename to azure-mgmt-sql/azure/mgmt/sql/models/restore_point_paged.py index ee720d3dc886..b77cde666dd0 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_restore_point_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/restore_point_paged.py @@ -12,16 +12,16 @@ from msrest.paging import Paged -class DatabaseRestorePointPaged(Paged): +class RestorePointPaged(Paged): """ - A paging container for iterating over a list of :class:`DatabaseRestorePoint ` object + A paging container for iterating over a list of :class:`RestorePoint ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DatabaseRestorePoint]'} + 'current_page': {'key': 'value', 'type': '[RestorePoint]'} } def __init__(self, *args, **kwargs): - super(DatabaseRestorePointPaged, self).__init__(*args, **kwargs) + super(RestorePointPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 3bf7b5072a92..59b10b1d495f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -49,7 +49,7 @@ from .database_operations import DatabaseOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations -from .database_restore_points_operations import DatabaseRestorePointsOperations +from .restore_points_operations import RestorePointsOperations __all__ = [ 'BackupLongTermRetentionPoliciesOperations', @@ -92,5 +92,5 @@ 'DatabaseOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', - 'DatabaseRestorePointsOperations', + 'RestorePointsOperations', ] 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 index 88393489350a..ebb3c8ff07f0 100644 --- 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 @@ -24,7 +24,7 @@ class BackupLongTermRetentionPoliciesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object 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". """ @@ -65,7 +65,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}' + url = self.get.metadata['url'] 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'), @@ -108,6 +108,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}'} def _create_or_update_initial( @@ -115,7 +116,7 @@ def _create_or_update_initial( 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}' + url = self.create_or_update.metadata['url'] 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'), @@ -242,6 +243,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}'} def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -269,7 +271,7 @@ 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}/backupLongTermRetentionPolicies' + url = self.list_by_database.metadata['url'] 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'), @@ -317,3 +319,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies'} 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 index 643317a5201c..cf800d7202bd 100644 --- 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 @@ -24,7 +24,7 @@ class BackupLongTermRetentionVaultsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object 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". """ @@ -62,7 +62,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}' + url = self.get.metadata['url'] 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'), @@ -104,6 +104,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}'} def _create_or_update_initial( @@ -111,7 +112,7 @@ def _create_or_update_initial( 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}' + url = self.create_or_update.metadata['url'] 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'), @@ -229,6 +230,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -254,7 +256,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults' + url = self.list_by_server.metadata['url'] 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'), @@ -301,3 +303,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults'} 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 fd3384b788eb..8582337dde24 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py @@ -22,7 +22,7 @@ class CapabilitiesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -54,7 +54,7 @@ def list_by_location( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationId}/capabilities' + url = self.list_by_location.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'locationId': self._serialize.url("location_id", location_id, 'str') @@ -94,3 +94,4 @@ def list_by_location( return client_raw_response return deserialized + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationId}/capabilities'} 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 index ae84e8595721..384b2f6a6b4f 100644 --- 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 @@ -22,7 +22,7 @@ class DataMaskingPoliciesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object 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". """ @@ -73,7 +73,7 @@ def create_or_update( 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}' + url = self.create_or_update.metadata['url'] 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'), @@ -120,6 +120,7 @@ def create_or_update( return client_raw_response return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}'} def get( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -144,7 +145,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}' + url = self.get.metadata['url'] 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'), @@ -187,3 +188,4 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}'} 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 index d1acc61f6fba..4e3020d9656c 100644 --- 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 @@ -22,7 +22,7 @@ class DataMaskingRulesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object 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". """ @@ -67,7 +67,7 @@ def create_or_update( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}' + url = self.create_or_update.metadata['url'] 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'), @@ -117,6 +117,7 @@ def create_or_update( return client_raw_response return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}'} def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -144,7 +145,7 @@ 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 = self.list_by_database.metadata['url'] 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'), @@ -193,3 +194,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_automatic_tuning_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_automatic_tuning_operations.py index 006b4bbf630b..ba3eb4dede13 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_automatic_tuning_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_automatic_tuning_operations.py @@ -22,7 +22,7 @@ class DatabaseAutomaticTuningOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". """ @@ -60,7 +60,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -102,6 +102,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current'} def update( self, resource_group_name, server_name, database_name, desired_state=None, options=None, custom_headers=None, raw=False, **operation_config): @@ -134,7 +135,7 @@ def update( parameters = models.DatabaseAutomaticTuning(desired_state=desired_state, options=options) # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current' + url = self.update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -180,3 +181,4 @@ def update( return client_raw_response return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current'} 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 index 6e59884297e3..fa915bf7c00d 100644 --- 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 @@ -22,7 +22,7 @@ class DatabaseBlobAuditingPoliciesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object 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". """ @@ -63,7 +63,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -106,6 +106,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}'} def create_or_update( self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): @@ -133,7 +134,7 @@ def create_or_update( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}' + url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -182,3 +183,4 @@ def create_or_update( return client_raw_response return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py index 72d8b47a341d..bce677fff8ee 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py @@ -22,7 +22,7 @@ class DatabaseOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ @@ -61,7 +61,7 @@ def cancel( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel' + url = self.cancel.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -97,6 +97,7 @@ def cancel( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel'} def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -124,7 +125,7 @@ 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}/operations' + url = self.list_by_database.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -172,3 +173,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations'} 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 index 64a79fda1606..79d0ec20f134 100644 --- 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 @@ -22,7 +22,7 @@ class DatabaseThreatDetectionPoliciesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar security_alert_policy_name: The name of the security alert policy. Constant value: "default". :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -63,7 +63,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}' + url = self.get.metadata['url'] 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'), @@ -106,6 +106,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}'} def create_or_update( self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): @@ -133,7 +134,7 @@ def create_or_update( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}' + url = self.create_or_update.metadata['url'] 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'), @@ -182,3 +183,4 @@ def create_or_update( return client_raw_response return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}'} 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 index 312436098cb5..3291bc0d88c5 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_usages_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_usages_operations.py @@ -22,7 +22,7 @@ class DatabaseUsagesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -63,7 +63,7 @@ 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 = self.list_by_database.metadata['url'] 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'), @@ -111,3 +111,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages'} 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 7548052ffbb8..35e9625e0d31 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py @@ -24,7 +24,7 @@ class DatabasesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar extension_name: The name of the operation to perform. Constant value: "import". """ @@ -45,7 +45,7 @@ def _pause_initial( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause' + url = self.pause.metadata['url'] 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'), @@ -144,6 +144,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + pause.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause'} def _resume_initial( @@ -151,7 +152,7 @@ def _resume_initial( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume' + url = self.resume.metadata['url'] 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'), @@ -250,6 +251,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume'} def _create_or_update_initial( @@ -257,7 +259,7 @@ def _create_or_update_initial( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' + url = self.create_or_update.metadata['url'] 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'), @@ -379,6 +381,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'} def _update_initial( @@ -386,7 +389,7 @@ def _update_initial( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' + url = self.update.metadata['url'] 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'), @@ -504,6 +507,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'} def delete( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -529,7 +533,7 @@ def delete( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' + url = self.delete.metadata['url'] 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'), @@ -564,6 +568,7 @@ def delete( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'} def get( self, resource_group_name, server_name, database_name, expand=None, custom_headers=None, raw=False, **operation_config): @@ -594,7 +599,7 @@ def get( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' + url = self.get.metadata['url'] 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'), @@ -638,6 +643,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'} def list_by_server( self, resource_group_name, server_name, expand=None, filter=None, custom_headers=None, raw=False, **operation_config): @@ -672,7 +678,7 @@ 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' + url = self.list_by_server.metadata['url'] 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'), @@ -723,6 +729,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases'} def get_by_elastic_pool( self, resource_group_name, server_name, elastic_pool_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -752,7 +759,7 @@ def get_by_elastic_pool( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}' + url = self.get_by_elastic_pool.metadata['url'] 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'), @@ -795,6 +802,7 @@ def get_by_elastic_pool( return client_raw_response return deserialized + get_by_elastic_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}'} def list_by_elastic_pool( self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): @@ -825,7 +833,7 @@ 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 = self.list_by_elastic_pool.metadata['url'] 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'), @@ -873,6 +881,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_elastic_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases'} 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): @@ -902,7 +911,7 @@ def get_by_recommended_elastic_pool( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}' + url = self.get_by_recommended_elastic_pool.metadata['url'] 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'), @@ -945,6 +954,7 @@ def get_by_recommended_elastic_pool( return client_raw_response return deserialized + get_by_recommended_elastic_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}'} def list_by_recommended_elastic_pool( self, resource_group_name, server_name, recommended_elastic_pool_name, custom_headers=None, raw=False, **operation_config): @@ -975,7 +985,7 @@ 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' + url = self.list_by_recommended_elastic_pool.metadata['url'] 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'), @@ -1023,6 +1033,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_recommended_elastic_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases'} def _import_method_initial( @@ -1030,7 +1041,7 @@ def _import_method_initial( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import' + url = self.import_method.metadata['url'] 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'), @@ -1145,6 +1156,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + import_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import'} def _create_import_operation_initial( @@ -1152,7 +1164,7 @@ def _create_import_operation_initial( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}' + url = self.create_import_operation.metadata['url'] 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'), @@ -1273,6 +1285,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_import_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}'} def _export_initial( @@ -1280,7 +1293,7 @@ def _export_initial( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export' + url = self.export.metadata['url'] 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'), @@ -1398,6 +1411,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + export.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export'} def list_metrics( self, resource_group_name, server_name, database_name, filter, custom_headers=None, raw=False, **operation_config): @@ -1430,7 +1444,7 @@ 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' + url = self.list_metrics.metadata['url'] 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'), @@ -1479,6 +1493,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metrics'} def list_metric_definitions( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -1508,7 +1523,7 @@ 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' + url = self.list_metric_definitions.metadata['url'] 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'), @@ -1556,6 +1571,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metricDefinitions'} def rename( self, resource_group_name, server_name, database_name, id, custom_headers=None, raw=False, **operation_config): @@ -1585,7 +1601,7 @@ def rename( api_version = "2017-03-01-preview" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move' + url = self.rename.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -1624,3 +1640,4 @@ def rename( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + rename.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move'} 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 index bc31e1e43f0c..b2e826ad1551 100644 --- 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 @@ -22,7 +22,7 @@ class ElasticPoolActivitiesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -64,7 +64,7 @@ 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' + url = self.list_by_elastic_pool.metadata['url'] 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'), @@ -112,3 +112,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_elastic_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity'} 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 index d5807e30537a..244394a4223f 100644 --- 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 @@ -22,7 +22,7 @@ class ElasticPoolDatabaseActivitiesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -63,7 +63,7 @@ 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' + url = self.list_by_elastic_pool.metadata['url'] 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'), @@ -111,3 +111,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_elastic_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity'} 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 9ade5cac6fdf..18908db589dc 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 @@ -24,7 +24,7 @@ class ElasticPoolsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, resource_group_name, server_name, elastic_pool_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}' + url = self.create_or_update.metadata['url'] 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'), @@ -165,12 +165,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'} def _update_initial( self, resource_group_name, server_name, elastic_pool_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}' + url = self.update.metadata['url'] 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'), @@ -289,6 +290,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'} def delete( self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): @@ -312,7 +314,7 @@ def delete( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}' + url = self.delete.metadata['url'] 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'), @@ -347,6 +349,7 @@ def delete( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'} def get( self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): @@ -372,7 +375,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}' + url = self.get.metadata['url'] 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'), @@ -414,6 +417,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -439,7 +443,7 @@ 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' + url = self.list_by_server.metadata['url'] 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'), @@ -486,6 +490,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools'} def list_metrics( self, resource_group_name, server_name, elastic_pool_name, filter, custom_headers=None, raw=False, **operation_config): @@ -516,7 +521,7 @@ 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}/metrics' + url = self.list_metrics.metadata['url'] 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'), @@ -565,6 +570,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metrics'} def list_metric_definitions( self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): @@ -592,7 +598,7 @@ 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}/metricDefinitions' + url = self.list_metric_definitions.metadata['url'] 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'), @@ -640,3 +646,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_metric_definitions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metricDefinitions'} 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 index 3d3cf99ba0ed..f8c1774609aa 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/encryption_protectors_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/encryption_protectors_operations.py @@ -24,7 +24,7 @@ class EncryptionProtectorsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object 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". """ @@ -65,7 +65,7 @@ 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' + url = self.list_by_server.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -112,6 +112,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector'} def get( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -134,7 +135,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -176,12 +177,13 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}'} def _create_or_update_initial( self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}' + url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -296,3 +298,4 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}'} 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 b2e5dba8c39b..5c8c8d18bad3 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 @@ -24,7 +24,7 @@ class FailoverGroupsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". """ @@ -63,7 +63,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -105,12 +105,13 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}'} def _create_or_update_initial( self, resource_group_name, server_name, failover_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}' + url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -231,12 +232,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}'} def _delete_initial( self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}' + url = self.delete.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -336,12 +338,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}'} def _update_initial( self, resource_group_name, server_name, failover_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}' + url = self.update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -460,6 +463,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -486,7 +490,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups' + url = self.list_by_server.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -533,12 +537,13 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups'} def _failover_initial( self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover' + url = self.failover.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -650,12 +655,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover'} def _force_failover_allow_data_loss_initial( self, resource_group_name, server_name, failover_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss' + url = self.force_failover_allow_data_loss.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -768,3 +774,4 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + force_failover_allow_data_loss.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss'} 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 9fb743feb379..5827a0c4fa76 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 @@ -22,7 +22,7 @@ class FirewallRulesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -70,7 +70,7 @@ def create_or_update( parameters = models.FirewallRule(start_ip_address=start_ip_address, end_ip_address=end_ip_address) # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}' + url = self.create_or_update.metadata['url'] 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'), @@ -118,6 +118,7 @@ def create_or_update( return client_raw_response return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}'} def delete( self, resource_group_name, server_name, firewall_rule_name, custom_headers=None, raw=False, **operation_config): @@ -141,7 +142,7 @@ def delete( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}' + url = self.delete.metadata['url'] 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'), @@ -176,6 +177,7 @@ def delete( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}'} def get( self, resource_group_name, server_name, firewall_rule_name, custom_headers=None, raw=False, **operation_config): @@ -200,7 +202,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}' + url = self.get.metadata['url'] 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'), @@ -242,6 +244,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -267,7 +270,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules' + url = self.list_by_server.metadata['url'] 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'), @@ -314,3 +317,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules'} 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 index 62dedc77c992..d73dbf426b17 100644 --- 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 @@ -22,7 +22,7 @@ class GeoBackupPoliciesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object 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". """ @@ -67,7 +67,7 @@ def create_or_update( parameters = models.GeoBackupPolicy(state=state) # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}' + url = self.create_or_update.metadata['url'] 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'), @@ -116,6 +116,7 @@ def create_or_update( return client_raw_response return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}'} def get( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -140,7 +141,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}' + url = self.get.metadata['url'] 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'), @@ -183,6 +184,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}'} def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -210,7 +212,7 @@ 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 = self.list_by_database.metadata['url'] 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'), @@ -258,3 +260,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py index e841422f649d..869264933111 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py @@ -22,7 +22,7 @@ class Operations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". """ @@ -55,7 +55,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/providers/Microsoft.Sql/operations' + url = self.list.metadata['url'] # Construct parameters query_parameters = {} @@ -96,3 +96,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/providers/Microsoft.Sql/operations'} 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 42f2ad653ac5..4a776d820a8f 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 @@ -22,7 +22,7 @@ class RecommendedElasticPoolsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -61,7 +61,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}' + url = self.get.metadata['url'] 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'), @@ -103,6 +103,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -128,7 +129,7 @@ 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' + url = self.list_by_server.metadata['url'] 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'), @@ -175,6 +176,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools'} def list_metrics( self, resource_group_name, server_name, recommended_elastic_pool_name, custom_headers=None, raw=False, **operation_config): @@ -203,7 +205,7 @@ 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}/metrics' + url = self.list_metrics.metadata['url'] 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'), @@ -251,3 +253,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics'} 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 831eecf07511..299ee095bd0e 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 @@ -22,7 +22,7 @@ class RecoverableDatabasesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -61,7 +61,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}' + url = self.get.metadata['url'] 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'), @@ -103,6 +103,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -128,7 +129,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases' + url = self.list_by_server.metadata['url'] 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'), @@ -175,3 +176,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases'} 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 index 1dc5b0c7e3eb..97b22a63406e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/replication_links_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/replication_links_operations.py @@ -24,7 +24,7 @@ class ReplicationLinksOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -64,7 +64,7 @@ def delete( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}' + url = self.delete.metadata['url'] 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'), @@ -100,6 +100,7 @@ def delete( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}'} def get( self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): @@ -126,7 +127,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}' + url = self.get.metadata['url'] 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'), @@ -169,12 +170,13 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}'} def _failover_initial( self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover' + url = self.failover.metadata['url'] 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'), @@ -279,12 +281,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover'} def _failover_allow_data_loss_initial( self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss' + url = self.failover_allow_data_loss.metadata['url'] 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'), @@ -389,6 +392,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + failover_allow_data_loss.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss'} def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -416,7 +420,7 @@ 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' + url = self.list_by_database.metadata['url'] 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'), @@ -464,3 +468,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks'} 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 8383803776bf..ec5a1ed9c7fa 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 @@ -22,7 +22,7 @@ class RestorableDroppedDatabasesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -61,7 +61,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppededDatabaseId}' + url = self.get.metadata['url'] 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'), @@ -103,6 +103,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppededDatabaseId}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -128,7 +129,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases' + url = self.list_by_server.metadata['url'] 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'), @@ -175,3 +176,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_restore_points_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py similarity index 87% rename from azure-mgmt-sql/azure/mgmt/sql/operations/database_restore_points_operations.py rename to azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py index ce6c74c26155..50bd0711d98a 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_restore_points_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py @@ -18,13 +18,13 @@ from .. import models -class DatabaseRestorePointsOperations(object): - """DatabaseRestorePointsOperations operations. +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. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ @@ -41,7 +41,7 @@ def __init__(self, client, config, serializer, deserializer): def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets a collection of restore points that belongs to the database. + """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 @@ -56,16 +56,16 @@ def list_by_database( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of DatabaseRestorePoint + :return: An iterator like instance of RestorePoint :rtype: - ~azure.mgmt.sql.models.DatabaseRestorePointPaged[~azure.mgmt.sql.models.DatabaseRestorePoint] + ~azure.mgmt.sql.models.RestorePointPaged[~azure.mgmt.sql.models.RestorePoint] :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' + url = self.list_by_database.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -105,14 +105,15 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.DatabaseRestorePointPaged(internal_paging, self._deserialize.dependencies) + deserialized = models.RestorePointPaged(internal_paging, self._deserialize.dependencies) if raw: header_dict = {} - client_raw_response = models.DatabaseRestorePointPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = models.RestorePointPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints'} def _create_initial( @@ -120,7 +121,7 @@ def _create_initial( parameters = models.CreateDatabaseRestorePointDefinition(restore_point_label=restore_point_label) # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints' + url = self.create.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -159,9 +160,9 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('DatabaseRestorePoint', response) + deserialized = self._deserialize('RestorePoint', response) if response.status_code == 201: - deserialized = self._deserialize('DatabaseRestorePoint', response) + deserialized = self._deserialize('RestorePoint', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -186,10 +187,10 @@ def create( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :return: An instance of AzureOperationPoller that returns - DatabaseRestorePoint or ClientRawResponse if raw=true + :return: An instance of AzureOperationPoller that returns RestorePoint + or ClientRawResponse if raw=true :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.DatabaseRestorePoint] + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.RestorePoint] or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -226,7 +227,7 @@ def get_long_running_output(response): exp.request_id = response.headers.get('x-ms-request-id') raise exp - deserialized = self._deserialize('DatabaseRestorePoint', response) + deserialized = self._deserialize('RestorePoint', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -240,6 +241,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints'} def get( self, resource_group_name, server_name, database_name, restore_point_name, custom_headers=None, raw=False, **operation_config): @@ -260,13 +262,13 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: DatabaseRestorePoint or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.DatabaseRestorePoint or + :return: RestorePoint or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.RestorePoint or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -302,10 +304,11 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('DatabaseRestorePoint', response) + deserialized = self._deserialize('RestorePoint', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_automatic_tuning_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_automatic_tuning_operations.py index 532834124125..2ce94e0e4058 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_automatic_tuning_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_automatic_tuning_operations.py @@ -22,7 +22,7 @@ class ServerAutomaticTuningOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ @@ -58,7 +58,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -99,6 +99,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current'} def update( self, resource_group_name, server_name, desired_state=None, options=None, custom_headers=None, raw=False, **operation_config): @@ -130,7 +131,7 @@ def update( parameters = models.ServerAutomaticTuning(desired_state=desired_state, options=options) # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current' + url = self.update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -175,3 +176,4 @@ def update( return client_raw_response return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current'} 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 ef10d7f725da..7aa49566fd0c 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 @@ -24,7 +24,7 @@ class ServerAzureADAdministratorsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". :ivar administrator_name: Name of the server administrator resource. Constant value: "activeDirectory". """ @@ -45,7 +45,7 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, resource_group_name, server_name, properties, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}' + url = self.create_or_update.metadata['url'] 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'), @@ -166,12 +166,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}'} def _delete_initial( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}' + url = self.delete.metadata['url'] 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'), @@ -283,6 +284,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}'} def get( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -305,7 +307,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}' + url = self.get.metadata['url'] 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'), @@ -347,6 +349,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -372,7 +375,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators' + url = self.list_by_server.metadata['url'] 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'), @@ -419,3 +422,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators'} 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 6260d8de01b5..fb064c155f6b 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 @@ -24,7 +24,7 @@ class ServerCommunicationLinksOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -62,7 +62,7 @@ def delete( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}' + url = self.delete.metadata['url'] 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'), @@ -97,6 +97,7 @@ def delete( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}'} def get( self, resource_group_name, server_name, communication_link_name, custom_headers=None, raw=False, **operation_config): @@ -122,7 +123,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}' + url = self.get.metadata['url'] 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'), @@ -164,6 +165,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}'} def _create_or_update_initial( @@ -171,7 +173,7 @@ def _create_or_update_initial( parameters = models.ServerCommunicationLink(partner_server=partner_server) # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}' + url = self.create_or_update.metadata['url'] 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'), @@ -290,6 +292,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -315,7 +318,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks' + url = self.list_by_server.metadata['url'] 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'), @@ -362,3 +365,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks'} 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 index 9e173ca15ec0..e352e147a10b 100644 --- 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 @@ -22,7 +22,7 @@ class ServerConnectionPoliciesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object 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". """ @@ -66,7 +66,7 @@ def create_or_update( parameters = models.ServerConnectionPolicy(connection_type=connection_type) # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}' + url = self.create_or_update.metadata['url'] 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'), @@ -114,6 +114,7 @@ def create_or_update( return client_raw_response return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}'} def get( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -136,7 +137,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}' + url = self.get.metadata['url'] 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'), @@ -178,3 +179,4 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/server_dns_aliases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/server_dns_aliases_operations.py index f90e0259360a..d4537d795491 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_dns_aliases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_dns_aliases_operations.py @@ -24,7 +24,7 @@ class ServerDnsAliasesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ @@ -63,7 +63,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -105,12 +105,13 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}'} def _create_or_update_initial( self, resource_group_name, server_name, dns_alias_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}' + url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -224,12 +225,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}'} def _delete_initial( self, resource_group_name, server_name, dns_alias_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}' + url = self.delete.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -329,6 +331,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -355,7 +358,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases' + url = self.list_by_server.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -402,6 +405,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases'} def _acquire_initial( @@ -409,7 +413,7 @@ def _acquire_initial( parameters = models.ServerDnsAliasAcquisition(old_server_dns_alias_id=old_server_dns_alias_id) # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}/acquire' + url = self.acquire.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -517,3 +521,4 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + acquire.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}/acquire'} 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 3b3ae05dce44..d2a7f960e3a8 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 @@ -24,7 +24,7 @@ class ServerKeysOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". """ @@ -63,7 +63,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys' + url = self.list_by_server.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -110,6 +110,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys'} def get( self, resource_group_name, server_name, key_name, custom_headers=None, raw=False, **operation_config): @@ -134,7 +135,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -176,12 +177,13 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}'} def _create_or_update_initial( self, resource_group_name, server_name, key_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}' + url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -306,12 +308,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}'} def _delete_initial( self, resource_group_name, server_name, key_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}' + url = self.delete.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -410,3 +413,4 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}'} 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 index 192035e76e23..4160b69c1f1d 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/server_usages_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/server_usages_operations.py @@ -22,7 +22,7 @@ class ServerUsagesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -61,7 +61,7 @@ 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' + url = self.list_by_server.metadata['url'] 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'), @@ -108,3 +108,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages'} 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 c85b4c8a1f78..b6a01aa11780 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/servers_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/servers_operations.py @@ -24,7 +24,7 @@ class ServersOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. """ models = models @@ -59,7 +59,7 @@ def check_name_availability( api_version = "2014-04-01" # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability' + url = self.check_name_availability.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -102,6 +102,7 @@ def check_name_availability( return client_raw_response return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability'} def list( self, custom_headers=None, raw=False, **operation_config): @@ -123,7 +124,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers' + url = self.list.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -168,6 +169,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers'} def list_by_resource_group( self, resource_group_name, custom_headers=None, raw=False, **operation_config): @@ -193,7 +195,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers' + url = self.list_by_resource_group.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') @@ -239,6 +241,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers'} def get( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -263,7 +266,7 @@ def get( api_version = "2015-05-01-preview" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -304,6 +307,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'} def _create_or_update_initial( @@ -311,7 +315,7 @@ def _create_or_update_initial( api_version = "2015-05-01-preview" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}' + url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -427,6 +431,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'} def _delete_initial( @@ -434,7 +439,7 @@ def _delete_initial( api_version = "2015-05-01-preview" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}' + url = self.delete.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -529,6 +534,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'} def _update_initial( @@ -536,7 +542,7 @@ def _update_initial( api_version = "2015-05-01-preview" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}' + url = self.update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -650,3 +656,4 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'} 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 index 64ade5034a12..2ff770f2daec 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/service_objectives_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/service_objectives_operations.py @@ -22,7 +22,7 @@ class ServiceObjectivesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -61,7 +61,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}' + url = self.get.metadata['url'] 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'), @@ -103,6 +103,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -128,7 +129,7 @@ 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' + url = self.list_by_server.metadata['url'] 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'), @@ -175,3 +176,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives'} 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 index 11c70d2e4955..d3075cfd97e9 100644 --- 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 @@ -22,7 +22,7 @@ class ServiceTierAdvisorsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ @@ -62,7 +62,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}' + url = self.get.metadata['url'] 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'), @@ -105,6 +105,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}'} def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -132,7 +133,7 @@ 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' + url = self.list_by_database.metadata['url'] 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'), @@ -180,3 +181,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/subscription_usages_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/subscription_usages_operations.py index 47973720f6cf..e4b33959c152 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/subscription_usages_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/subscription_usages_operations.py @@ -22,7 +22,7 @@ class SubscriptionUsagesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". """ @@ -58,7 +58,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages' + url = self.list_by_location.metadata['url'] path_format_arguments = { 'locationName': self._serialize.url("location_name", location_name, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') @@ -104,6 +104,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages'} def get( self, location_name, usage_name, custom_headers=None, raw=False, **operation_config): @@ -125,7 +126,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName}' + url = self.get.metadata['url'] path_format_arguments = { 'locationName': self._serialize.url("location_name", location_name, 'str'), 'usageName': self._serialize.url("usage_name", usage_name, 'str'), @@ -166,3 +167,4 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_agents_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_agents_operations.py index c09c8b886922..8fa4b7762a85 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_agents_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_agents_operations.py @@ -24,7 +24,7 @@ class SyncAgentsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". """ @@ -63,7 +63,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -105,6 +105,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}'} def _create_or_update_initial( @@ -112,7 +113,7 @@ def _create_or_update_initial( parameters = models.SyncAgent(sync_database_id=sync_database_id) # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}' + url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -234,12 +235,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}'} def _delete_initial( self, resource_group_name, server_name, sync_agent_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}' + url = self.delete.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -339,6 +341,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -365,7 +368,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents' + url = self.list_by_server.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -412,6 +415,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents'} def generate_key( self, resource_group_name, server_name, sync_agent_name, custom_headers=None, raw=False, **operation_config): @@ -437,7 +441,7 @@ def generate_key( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}/generateKey' + url = self.generate_key.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -479,6 +483,7 @@ def generate_key( return client_raw_response return deserialized + generate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}/generateKey'} def list_linked_databases( self, resource_group_name, server_name, sync_agent_name, custom_headers=None, raw=False, **operation_config): @@ -507,7 +512,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}/linkedDatabases' + url = self.list_linked_databases.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -555,3 +560,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_linked_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}/linkedDatabases'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_groups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_groups_operations.py index d4766e1ef797..391f1d42b9ad 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_groups_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_groups_operations.py @@ -24,7 +24,7 @@ class SyncGroupsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". """ @@ -60,7 +60,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds' + url = self.list_sync_database_ids.metadata['url'] path_format_arguments = { 'locationName': self._serialize.url("location_name", location_name, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') @@ -106,12 +106,13 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_sync_database_ids.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds'} def _refresh_hub_schema_initial( self, resource_group_name, server_name, database_name, sync_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema' + url = self.refresh_hub_schema.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -215,6 +216,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + refresh_hub_schema.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema'} def list_hub_schemas( self, resource_group_name, server_name, database_name, sync_group_name, custom_headers=None, raw=False, **operation_config): @@ -245,7 +247,7 @@ 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}/syncGroups/{syncGroupName}/hubSchemas' + url = self.list_hub_schemas.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -294,6 +296,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_hub_schemas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/hubSchemas'} def list_logs( self, resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token=None, custom_headers=None, raw=False, **operation_config): @@ -333,7 +336,7 @@ 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}/syncGroups/{syncGroupName}/logs' + url = self.list_logs.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -387,6 +390,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_logs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/logs'} def cancel_sync( self, resource_group_name, server_name, database_name, sync_group_name, custom_headers=None, raw=False, **operation_config): @@ -413,7 +417,7 @@ def cancel_sync( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/cancelSync' + url = self.cancel_sync.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -449,6 +453,7 @@ def cancel_sync( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + cancel_sync.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/cancelSync'} def trigger_sync( self, resource_group_name, server_name, database_name, sync_group_name, custom_headers=None, raw=False, **operation_config): @@ -475,7 +480,7 @@ def trigger_sync( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/triggerSync' + url = self.trigger_sync.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -511,6 +516,7 @@ def trigger_sync( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + trigger_sync.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/triggerSync'} def get( self, resource_group_name, server_name, database_name, sync_group_name, custom_headers=None, raw=False, **operation_config): @@ -538,7 +544,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -581,12 +587,13 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}'} def _create_or_update_initial( self, resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}' + url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -711,12 +718,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}'} def _delete_initial( self, resource_group_name, server_name, database_name, sync_group_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}' + url = self.delete.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -820,12 +828,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}'} def _update_initial( self, resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}' + url = self.update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -948,6 +957,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}'} def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -976,7 +986,7 @@ 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}/syncGroups' + url = self.list_by_database.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -1024,3 +1034,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_members_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_members_operations.py index 9672266eae2b..ed914395809e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/sync_members_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/sync_members_operations.py @@ -24,7 +24,7 @@ class SyncMembersOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". """ @@ -68,7 +68,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -112,12 +112,13 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}'} def _create_or_update_initial( self, resource_group_name, server_name, database_name, sync_group_name, sync_member_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}' + url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -247,12 +248,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}'} def _delete_initial( self, resource_group_name, server_name, database_name, sync_group_name, sync_member_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}' + url = self.delete.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -361,12 +363,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}'} def _update_initial( self, resource_group_name, server_name, database_name, sync_group_name, sync_member_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}' + url = self.update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -494,6 +497,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}'} def list_by_sync_group( self, resource_group_name, server_name, database_name, sync_group_name, custom_headers=None, raw=False, **operation_config): @@ -524,7 +528,7 @@ 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}/syncGroups/{syncGroupName}/syncMembers' + url = self.list_by_sync_group.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -573,6 +577,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_sync_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers'} def list_member_schemas( self, resource_group_name, server_name, database_name, sync_group_name, sync_member_name, custom_headers=None, raw=False, **operation_config): @@ -606,7 +611,7 @@ 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}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/schemas' + url = self.list_member_schemas.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -656,12 +661,13 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_member_schemas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/schemas'} def _refresh_member_schema_initial( self, resource_group_name, server_name, database_name, sync_group_name, sync_member_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/refreshSchema' + url = self.refresh_member_schema.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -770,3 +776,4 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + refresh_member_schema.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}/refreshSchema'} 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 index 5db7032d0821..d27623ba644f 100644 --- 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 @@ -22,7 +22,7 @@ class TransparentDataEncryptionActivitiesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object 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". """ @@ -67,7 +67,7 @@ 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' + url = self.list_by_configuration.metadata['url'] 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'), @@ -116,3 +116,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}/operationResults'} 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 index 8c1e412de709..a672a32bf38e 100644 --- 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 @@ -22,7 +22,7 @@ class TransparentDataEncryptionsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object 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". """ @@ -70,7 +70,7 @@ def create_or_update( parameters = models.TransparentDataEncryption(status=status) # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}' + url = self.create_or_update.metadata['url'] 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'), @@ -119,6 +119,7 @@ def create_or_update( return client_raw_response return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}'} def get( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): @@ -144,7 +145,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}' + url = self.get.metadata['url'] 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'), @@ -187,3 +188,4 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}'} 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 348a02f0c4c0..37671105d16f 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 @@ -24,7 +24,7 @@ class VirtualNetworkRulesOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". """ @@ -63,7 +63,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -105,6 +105,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}'} def _create_or_update_initial( @@ -112,7 +113,7 @@ def _create_or_update_initial( parameters = models.VirtualNetworkRule(virtual_network_subnet_id=virtual_network_subnet_id, ignore_missing_vnet_service_endpoint=ignore_missing_vnet_service_endpoint) # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}' + url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -238,12 +239,13 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}'} def _delete_initial( self, resource_group_name, server_name, virtual_network_rule_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}' + url = self.delete.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -343,6 +345,7 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}'} def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): @@ -368,7 +371,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules' + url = self.list_by_server.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -415,3 +418,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules'} 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 fa44c571ddf4..bbe594e8efec 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -53,7 +53,7 @@ from .operations.database_operations import DatabaseOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations -from .operations.database_restore_points_operations import DatabaseRestorePointsOperations +from .operations.restore_points_operations import RestorePointsOperations from . import models @@ -176,8 +176,8 @@ class SqlManagementClient(object): :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations - :ivar database_restore_points: DatabaseRestorePoints operations - :vartype database_restore_points: azure.mgmt.sql.operations.DatabaseRestorePointsOperations + :ivar restore_points: RestorePoints operations + :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -278,5 +278,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( self._client, self.config, self._serialize, self._deserialize) - self.database_restore_points = DatabaseRestorePointsOperations( + self.restore_points = RestorePointsOperations( self._client, self.config, self._serialize, self._deserialize) From 5e9d38b7329d555bdd2f806a6cd228439db679c6 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 28 Feb 2018 11:07:34 -0800 Subject: [PATCH 05/11] [AutoPR sql/resource-manager] [DO NOT MERGE]update swaggers for azure elastic pool operation (#2052) * Extract databases, elastic pools, and check name availability from sql.core.json (#1829) * Generated from 5a6fe19cfbfc33daf461404f3e77978e398bec49 Extract checkNameAvailability.json from sql.core.json * Generated from b1f5dd6f842a458a6c117a2a5da68a7f5d895d77 Fixed cross-file references * Update version.py * Rebuild by https://github.com/Azure/azure-sdk-for-python/pull/1950 * Generated from dbaf4f1b4a6a05888680e3b210813b8f2a1d98db (#1951) Py version for SQL build * Rebuild by https://github.com/Azure/azure-sdk-for-python/pull/1950 * Generated from d2120e21ed90c81cfc47b30f813b1f3c0356e3ec Update the cancel operations swagger on database and pool, and corresponding examples --- .../azure/mgmt/sql/models/database_operation.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_operation.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_operation.py index bb748f8757b9..e33ba1c29bcc 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_operation.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_operation.py @@ -48,6 +48,13 @@ class DatabaseOperation(ProxyResource): :vartype error_severity: int :ivar is_user_error: Whether or not the error is a user error. :vartype is_user_error: bool + :ivar estimated_completion_time: The estimated completion time of the + operation. + :vartype estimated_completion_time: datetime + :ivar description: The operation description. + :vartype description: str + :ivar is_cancellable: Whether the operation can be cancelled. + :vartype is_cancellable: bool """ _validation = { @@ -65,6 +72,9 @@ class DatabaseOperation(ProxyResource): 'error_description': {'readonly': True}, 'error_severity': {'readonly': True}, 'is_user_error': {'readonly': True}, + 'estimated_completion_time': {'readonly': True}, + 'description': {'readonly': True}, + 'is_cancellable': {'readonly': True}, } _attribute_map = { @@ -82,6 +92,9 @@ class DatabaseOperation(ProxyResource): 'error_description': {'key': 'properties.errorDescription', 'type': 'str'}, 'error_severity': {'key': 'properties.errorSeverity', 'type': 'int'}, 'is_user_error': {'key': 'properties.isUserError', 'type': 'bool'}, + 'estimated_completion_time': {'key': 'properties.estimatedCompletionTime', 'type': 'iso-8601'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'is_cancellable': {'key': 'properties.isCancellable', 'type': 'bool'}, } def __init__(self): @@ -97,3 +110,6 @@ def __init__(self): self.error_description = None self.error_severity = None self.is_user_error = None + self.estimated_completion_time = None + self.description = None + self.is_cancellable = None From ff441dd8999faa9140f65af48635a4de644753f7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 5 Mar 2018 14:25:57 -0800 Subject: [PATCH 06/11] Generated from 8d8cc61cbddd7729d0e2691cca657ffdd5df37a9 (#2103) add delete restore points API and change to async for create API --- .../operations/restore_points_operations.py | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) 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 index 50bd0711d98a..6586a45c20cb 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py @@ -312,3 +312,65 @@ def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}'} + + def delete( + self, resource_group_name, server_name, database_name, restore_point_name, custom_headers=None, raw=False, **operation_config): + """Deletes a restore point. + + :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 restore_point_name: The name of the restore point. + :type restore_point_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'restorePointName': self._serialize.url("restore_point_name", restore_point_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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}'} From 15357ffa0a7baa8789bcfd0c6b7ca8c5f7e515b0 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 9 Mar 2018 10:01:14 -0800 Subject: [PATCH 07/11] [AutoPR sql/resource-manager] Add swagger for dataWarehouseUserActivities API (#2086) * Generated from c39c7d121543da651a1ffd746e93fb300a240c17 add dataWarehouseUserActivityName add dataWarehouseUserActivityName * Generated from 01b7ccaf7a59aaa579126db1ed34a380eca6fc97 add missing "body" --- .../azure/mgmt/sql/models/__init__.py | 16 +- ...reate_database_restore_point_definition.py | 33 --- .../models/data_warehouse_user_activities.py | 47 +++ .../mgmt/sql/models/database_operation.py | 16 - .../azure/mgmt/sql/models/restore_point.py | 32 +- .../sql/models/sql_management_client_enums.py | 12 +- .../azure/mgmt/sql/operations/__init__.py | 6 +- ...ta_warehouse_user_activities_operations.py | 109 +++++++ .../operations/restore_points_operations.py | 273 +----------------- .../azure/mgmt/sql/sql_management_client.py | 15 +- azure-mgmt-sql/azure/mgmt/sql/version.py | 2 +- 11 files changed, 202 insertions(+), 359 deletions(-) delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/create_database_restore_point_definition.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/data_warehouse_user_activities.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/data_warehouse_user_activities_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index f7da1a4021a9..41df6e199697 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -14,6 +14,7 @@ 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 from .max_size_capability import MaxSizeCapability @@ -93,15 +94,15 @@ from .subscription_usage import SubscriptionUsage from .virtual_network_rule import VirtualNetworkRule from .database_operation import DatabaseOperation +from .data_warehouse_user_activities import DataWarehouseUserActivities from .resource_move_definition import ResourceMoveDefinition from .automatic_tuning_server_options import AutomaticTuningServerOptions from .server_automatic_tuning import ServerAutomaticTuning from .server_dns_alias import ServerDnsAlias from .server_dns_alias_acquisition import ServerDnsAliasAcquisition -from .restore_point import RestorePoint -from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition from .backup_long_term_retention_policy_paged import BackupLongTermRetentionPolicyPaged from .backup_long_term_retention_vault_paged import BackupLongTermRetentionVaultPaged +from .restore_point_paged import RestorePointPaged from .recoverable_database_paged import RecoverableDatabasePaged from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .server_paged import ServerPaged @@ -139,9 +140,9 @@ from .virtual_network_rule_paged import VirtualNetworkRulePaged from .database_operation_paged import DatabaseOperationPaged from .server_dns_alias_paged import ServerDnsAliasPaged -from .restore_point_paged import RestorePointPaged from .sql_management_client_enums import ( BackupLongTermRetentionPolicyState, + RestorePointType, CapabilityStatus, MaxSizeUnits, PerformanceLevelUnit, @@ -195,7 +196,6 @@ ManagementOperationState, AutomaticTuningServerMode, AutomaticTuningServerReason, - RestorePointType, ) __all__ = [ @@ -204,6 +204,7 @@ 'BackupLongTermRetentionPolicy', 'BackupLongTermRetentionVault', 'TrackedResource', + 'RestorePoint', 'RecoverableDatabase', 'RestorableDroppedDatabase', 'MaxSizeCapability', @@ -283,15 +284,15 @@ 'SubscriptionUsage', 'VirtualNetworkRule', 'DatabaseOperation', + 'DataWarehouseUserActivities', 'ResourceMoveDefinition', 'AutomaticTuningServerOptions', 'ServerAutomaticTuning', 'ServerDnsAlias', 'ServerDnsAliasAcquisition', - 'RestorePoint', - 'CreateDatabaseRestorePointDefinition', 'BackupLongTermRetentionPolicyPaged', 'BackupLongTermRetentionVaultPaged', + 'RestorePointPaged', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', 'ServerPaged', @@ -329,8 +330,8 @@ 'VirtualNetworkRulePaged', 'DatabaseOperationPaged', 'ServerDnsAliasPaged', - 'RestorePointPaged', 'BackupLongTermRetentionPolicyState', + 'RestorePointType', 'CapabilityStatus', 'MaxSizeUnits', 'PerformanceLevelUnit', @@ -384,5 +385,4 @@ 'ManagementOperationState', 'AutomaticTuningServerMode', 'AutomaticTuningServerReason', - 'RestorePointType', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/create_database_restore_point_definition.py b/azure-mgmt-sql/azure/mgmt/sql/models/create_database_restore_point_definition.py deleted file mode 100644 index 14c582c5fd37..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/create_database_restore_point_definition.py +++ /dev/null @@ -1,33 +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 CreateDatabaseRestorePointDefinition(Model): - """Contains the information necessary to perform a create database restore - point operation. - - :param restore_point_label: The restore point label to apply - :type restore_point_label: str - """ - - _validation = { - 'restore_point_label': {'required': True}, - } - - _attribute_map = { - 'restore_point_label': {'key': 'restorePointLabel', 'type': 'str'}, - } - - def __init__(self, restore_point_label): - super(CreateDatabaseRestorePointDefinition, self).__init__() - self.restore_point_label = restore_point_label diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/data_warehouse_user_activities.py b/azure-mgmt-sql/azure/mgmt/sql/models/data_warehouse_user_activities.py new file mode 100644 index 000000000000..f541bc5bebee --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/data_warehouse_user_activities.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class DataWarehouseUserActivities(ProxyResource): + """User activities of a data warehouse. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar active_queries_count: Count of running and suspended queries. + :vartype active_queries_count: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'active_queries_count': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'active_queries_count': {'key': 'properties.activeQueriesCount', 'type': 'int'}, + } + + def __init__(self): + super(DataWarehouseUserActivities, self).__init__() + self.active_queries_count = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_operation.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_operation.py index e33ba1c29bcc..bb748f8757b9 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_operation.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_operation.py @@ -48,13 +48,6 @@ class DatabaseOperation(ProxyResource): :vartype error_severity: int :ivar is_user_error: Whether or not the error is a user error. :vartype is_user_error: bool - :ivar estimated_completion_time: The estimated completion time of the - operation. - :vartype estimated_completion_time: datetime - :ivar description: The operation description. - :vartype description: str - :ivar is_cancellable: Whether the operation can be cancelled. - :vartype is_cancellable: bool """ _validation = { @@ -72,9 +65,6 @@ class DatabaseOperation(ProxyResource): 'error_description': {'readonly': True}, 'error_severity': {'readonly': True}, 'is_user_error': {'readonly': True}, - 'estimated_completion_time': {'readonly': True}, - 'description': {'readonly': True}, - 'is_cancellable': {'readonly': True}, } _attribute_map = { @@ -92,9 +82,6 @@ class DatabaseOperation(ProxyResource): 'error_description': {'key': 'properties.errorDescription', 'type': 'str'}, 'error_severity': {'key': 'properties.errorSeverity', 'type': 'int'}, 'is_user_error': {'key': 'properties.isUserError', 'type': 'bool'}, - 'estimated_completion_time': {'key': 'properties.estimatedCompletionTime', 'type': 'iso-8601'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'is_cancellable': {'key': 'properties.isCancellable', 'type': 'bool'}, } def __init__(self): @@ -110,6 +97,3 @@ def __init__(self): self.error_description = None self.error_severity = None self.is_user_error = None - self.estimated_completion_time = None - self.description = None - self.is_cancellable = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py b/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py index 5a86dcac2e00..7a2f5640a500 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py @@ -13,7 +13,7 @@ class RestorePoint(ProxyResource): - """Database restore points. + """A database restore point. Variables are only populated by the server, and will be ignored when sending a request. @@ -24,48 +24,38 @@ class RestorePoint(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Resource location. - :vartype location: str - :ivar restore_point_type: The type of restore point. Possible values - include: 'CONTINUOUS', 'DISCRETE' + :ivar restore_point_type: The restore point type of the database restore + point. Possible values include: 'DISCRETE', 'CONTINUOUS' :vartype restore_point_type: str or ~azure.mgmt.sql.models.RestorePointType - :ivar earliest_restore_date: The earliest time to which this database can - be restored - :vartype earliest_restore_date: datetime - :ivar restore_point_creation_date: The time the backup was taken + :ivar restore_point_creation_date: Restore point creation time (ISO8601 + format). Populated when restorePointType = CONTINUOUS. Null otherwise. :vartype restore_point_creation_date: datetime - :ivar restore_point_label: The label of restore point for backup request - by user - :vartype restore_point_label: str + :ivar earliest_restore_date: Earliest restore time (ISO8601 format). + Populated when restorePointType = DISCRETE. Null otherwise. + :vartype earliest_restore_date: datetime """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'readonly': True}, 'restore_point_type': {'readonly': True}, - 'earliest_restore_date': {'readonly': True}, 'restore_point_creation_date': {'readonly': True}, - 'restore_point_label': {'readonly': True}, + 'earliest_restore_date': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, 'restore_point_type': {'key': 'properties.restorePointType', 'type': 'RestorePointType'}, - 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, 'restore_point_creation_date': {'key': 'properties.restorePointCreationDate', 'type': 'iso-8601'}, - 'restore_point_label': {'key': 'properties.restorePointLabel', 'type': 'str'}, + 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, } def __init__(self): super(RestorePoint, self).__init__() - self.location = None self.restore_point_type = None - self.earliest_restore_date = None self.restore_point_creation_date = None - self.restore_point_label = None + self.earliest_restore_date = None 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 b80618b70daf..f6aba93bdcc6 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 @@ -18,6 +18,12 @@ class BackupLongTermRetentionPolicyState(Enum): enabled = "Enabled" +class RestorePointType(Enum): + + discrete = "DISCRETE" + continuous = "CONTINUOUS" + + class CapabilityStatus(Enum): visible = "Visible" @@ -490,9 +496,3 @@ class AutomaticTuningServerReason(Enum): default = "Default" disabled = "Disabled" auto_configured = "AutoConfigured" - - -class RestorePointType(Enum): - - continuous = "CONTINUOUS" - discrete = "DISCRETE" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 59b10b1d495f..34b0744b54c7 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -11,6 +11,7 @@ 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 @@ -47,13 +48,14 @@ from .subscription_usages_operations import SubscriptionUsagesOperations from .virtual_network_rules_operations import VirtualNetworkRulesOperations from .database_operations import DatabaseOperations +from .data_warehouse_user_activities_operations import DataWarehouseUserActivitiesOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations -from .restore_points_operations import RestorePointsOperations __all__ = [ 'BackupLongTermRetentionPoliciesOperations', 'BackupLongTermRetentionVaultsOperations', + 'RestorePointsOperations', 'RecoverableDatabasesOperations', 'RestorableDroppedDatabasesOperations', 'CapabilitiesOperations', @@ -90,7 +92,7 @@ 'SubscriptionUsagesOperations', 'VirtualNetworkRulesOperations', 'DatabaseOperations', + 'DataWarehouseUserActivitiesOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', - 'RestorePointsOperations', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/data_warehouse_user_activities_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/data_warehouse_user_activities_operations.py new file mode 100644 index 000000000000..4fb32c15c6d3 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/data_warehouse_user_activities_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 DataWarehouseUserActivitiesOperations(object): + """DataWarehouseUserActivitiesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar data_warehouse_user_activity_name: The activity name of the data warehouse. . Constant value: "current". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.data_warehouse_user_activity_name = "current" + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets the user activities of a data warehouse which includes running and + suspended queries. + + :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: DataWarehouseUserActivities or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.DataWarehouseUserActivities or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataWarehouseUserActivityName': self._serialize.url("self.data_warehouse_user_activity_name", self.data_warehouse_user_activity_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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DataWarehouseUserActivities', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}'} 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 index 6586a45c20cb..3c37b5a26804 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py @@ -12,8 +12,6 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -from msrest.exceptions import DeserializationError -from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -25,7 +23,7 @@ class RestorePointsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". """ models = models @@ -35,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-03-01-preview" + self.api_version = "2014-04-01" self.config = config @@ -49,7 +47,8 @@ def list_by_database( :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 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 @@ -67,10 +66,10 @@ def internal_paging(next_link=None, raw=False): # Construct URL url = self.list_by_database.metadata['url'] 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'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'databaseName': self._serialize.url("database_name", database_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -114,263 +113,3 @@ def internal_paging(next_link=None, raw=False): return deserialized list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints'} - - - def _create_initial( - self, resource_group_name, server_name, database_name, restore_point_label, custom_headers=None, raw=False, **operation_config): - parameters = models.CreateDatabaseRestorePointDefinition(restore_point_label=restore_point_label) - - # Construct URL - url = self.create.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - 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, 'CreateDatabaseRestorePointDefinition') - - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - 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('RestorePoint', response) - if response.status_code == 201: - deserialized = self._deserialize('RestorePoint', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create( - self, resource_group_name, server_name, database_name, restore_point_label, custom_headers=None, raw=False, **operation_config): - """Creates a restore point for 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 database. - :type database_name: str - :param restore_point_label: The restore point label to apply - :type restore_point_label: 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: An instance of AzureOperationPoller that returns RestorePoint - or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.RestorePoint] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - raw_result = self._create_initial( - resource_group_name=resource_group_name, - server_name=server_name, - database_name=database_name, - restore_point_label=restore_point_label, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **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 = self._deserialize('RestorePoint', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_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) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints'} - - def get( - self, resource_group_name, server_name, database_name, restore_point_name, custom_headers=None, raw=False, **operation_config): - """Gets a restore point. - - :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 restore_point_name: The name of the restore point. - :type restore_point_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: RestorePoint or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.RestorePoint or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_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, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('RestorePoint', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}'} - - def delete( - self, resource_group_name, server_name, database_name, restore_point_name, custom_headers=None, raw=False, **operation_config): - """Deletes a restore point. - - :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 restore_point_name: The name of the restore point. - :type restore_point_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_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.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}'} 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 bbe594e8efec..d296357fc458 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -15,6 +15,7 @@ from .version import VERSION 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 @@ -51,9 +52,9 @@ from .operations.subscription_usages_operations import SubscriptionUsagesOperations from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations from .operations.database_operations import DatabaseOperations +from .operations.data_warehouse_user_activities_operations import DataWarehouseUserActivitiesOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations -from .operations.restore_points_operations import RestorePointsOperations from . import models @@ -100,6 +101,8 @@ class SqlManagementClient(object): :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 @@ -172,12 +175,12 @@ class SqlManagementClient(object): :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations :ivar database_operations: DatabaseOperations operations :vartype database_operations: azure.mgmt.sql.operations.DatabaseOperations + :ivar data_warehouse_user_activities: DataWarehouseUserActivities operations + :vartype data_warehouse_user_activities: azure.mgmt.sql.operations.DataWarehouseUserActivitiesOperations :ivar server_automatic_tuning: ServerAutomaticTuning operations :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations - :ivar restore_points: RestorePoints operations - :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -202,6 +205,8 @@ def __init__( 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) self.restorable_dropped_databases = RestorableDroppedDatabasesOperations( @@ -274,9 +279,9 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.database_operations = DatabaseOperations( self._client, self.config, self._serialize, self._deserialize) + self.data_warehouse_user_activities = DataWarehouseUserActivitiesOperations( + self._client, self.config, self._serialize, self._deserialize) self.server_automatic_tuning = ServerAutomaticTuningOperations( self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( self._client, self.config, self._serialize, self._deserialize) - self.restore_points = RestorePointsOperations( - self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-sql/azure/mgmt/sql/version.py b/azure-mgmt-sql/azure/mgmt/sql/version.py index 3697d9b71739..53a203f32aaf 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/version.py +++ b/azure-mgmt-sql/azure/mgmt/sql/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.9.0" +VERSION = "" From 11acc67f2489b6b8d70a65b51c45f738298ef523 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 14 Mar 2018 15:38:11 -0700 Subject: [PATCH 08/11] Generated from 9c705de5f5ec7b686cf5624a8340dfc544343d33 (#2154) Refactor sql readme.md - Rename schema-* to package-pure-* in order to follow convention for python multi-version - Rename package-2017-10-preview to package-composite-v1. The reasons for this are explained in package-2017-03-01-preview tag. The next tag that I add in the near future will be package-composite-v2, which will represent a breaking change & major version bump for clients. - Improved description of various sections - Whitespace/header consistency --- .../azure/mgmt/sql/models/__init__.py | 32 +- ...reate_database_restore_point_definition.py | 33 +++ .../models/data_warehouse_user_activities.py | 47 --- .../mgmt/sql/models/database_operation.py | 16 + .../mgmt/sql/models/elastic_pool_operation.py | 114 ++++++++ .../models/elastic_pool_operation_paged.py | 27 ++ .../azure/mgmt/sql/models/restore_point.py | 32 +- .../sql/models/sql_management_client_enums.py | 32 +- .../azure/mgmt/sql/operations/__init__.py | 12 +- ...ta_warehouse_user_activities_operations.py | 109 ------- .../sql/operations/database_operations.py | 4 +- .../sql/operations/elastic_pool_operations.py | 176 +++++++++++ .../operations/restore_points_operations.py | 273 +++++++++++++++++- .../azure/mgmt/sql/sql_management_client.py | 30 +- azure-mgmt-sql/azure/mgmt/sql/version.py | 2 +- 15 files changed, 712 insertions(+), 227 deletions(-) create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/create_database_restore_point_definition.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/data_warehouse_user_activities.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation_paged.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/data_warehouse_user_activities_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 41df6e199697..44a5e54b9f8a 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -14,7 +14,6 @@ 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 from .max_size_capability import MaxSizeCapability @@ -93,16 +92,17 @@ from .sync_member import SyncMember from .subscription_usage import SubscriptionUsage from .virtual_network_rule import VirtualNetworkRule -from .database_operation import DatabaseOperation -from .data_warehouse_user_activities import DataWarehouseUserActivities from .resource_move_definition import ResourceMoveDefinition from .automatic_tuning_server_options import AutomaticTuningServerOptions from .server_automatic_tuning import ServerAutomaticTuning from .server_dns_alias import ServerDnsAlias from .server_dns_alias_acquisition import ServerDnsAliasAcquisition +from .restore_point import RestorePoint +from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition +from .database_operation import DatabaseOperation +from .elastic_pool_operation import ElasticPoolOperation from .backup_long_term_retention_policy_paged import BackupLongTermRetentionPolicyPaged from .backup_long_term_retention_vault_paged import BackupLongTermRetentionVaultPaged -from .restore_point_paged import RestorePointPaged from .recoverable_database_paged import RecoverableDatabasePaged from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .server_paged import ServerPaged @@ -138,11 +138,12 @@ from .sync_member_paged import SyncMemberPaged from .subscription_usage_paged import SubscriptionUsagePaged from .virtual_network_rule_paged import VirtualNetworkRulePaged -from .database_operation_paged import DatabaseOperationPaged from .server_dns_alias_paged import ServerDnsAliasPaged +from .restore_point_paged import RestorePointPaged +from .database_operation_paged import DatabaseOperationPaged +from .elastic_pool_operation_paged import ElasticPoolOperationPaged from .sql_management_client_enums import ( BackupLongTermRetentionPolicyState, - RestorePointType, CapabilityStatus, MaxSizeUnits, PerformanceLevelUnit, @@ -193,9 +194,10 @@ SyncDirection, SyncMemberState, VirtualNetworkRuleState, - ManagementOperationState, AutomaticTuningServerMode, AutomaticTuningServerReason, + RestorePointType, + ManagementOperationState, ) __all__ = [ @@ -204,7 +206,6 @@ 'BackupLongTermRetentionPolicy', 'BackupLongTermRetentionVault', 'TrackedResource', - 'RestorePoint', 'RecoverableDatabase', 'RestorableDroppedDatabase', 'MaxSizeCapability', @@ -283,16 +284,17 @@ 'SyncMember', 'SubscriptionUsage', 'VirtualNetworkRule', - 'DatabaseOperation', - 'DataWarehouseUserActivities', 'ResourceMoveDefinition', 'AutomaticTuningServerOptions', 'ServerAutomaticTuning', 'ServerDnsAlias', 'ServerDnsAliasAcquisition', + 'RestorePoint', + 'CreateDatabaseRestorePointDefinition', + 'DatabaseOperation', + 'ElasticPoolOperation', 'BackupLongTermRetentionPolicyPaged', 'BackupLongTermRetentionVaultPaged', - 'RestorePointPaged', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', 'ServerPaged', @@ -328,10 +330,11 @@ 'SyncMemberPaged', 'SubscriptionUsagePaged', 'VirtualNetworkRulePaged', - 'DatabaseOperationPaged', 'ServerDnsAliasPaged', + 'RestorePointPaged', + 'DatabaseOperationPaged', + 'ElasticPoolOperationPaged', 'BackupLongTermRetentionPolicyState', - 'RestorePointType', 'CapabilityStatus', 'MaxSizeUnits', 'PerformanceLevelUnit', @@ -382,7 +385,8 @@ 'SyncDirection', 'SyncMemberState', 'VirtualNetworkRuleState', - 'ManagementOperationState', 'AutomaticTuningServerMode', 'AutomaticTuningServerReason', + 'RestorePointType', + 'ManagementOperationState', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/create_database_restore_point_definition.py b/azure-mgmt-sql/azure/mgmt/sql/models/create_database_restore_point_definition.py new file mode 100644 index 000000000000..14c582c5fd37 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/create_database_restore_point_definition.py @@ -0,0 +1,33 @@ +# 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 CreateDatabaseRestorePointDefinition(Model): + """Contains the information necessary to perform a create database restore + point operation. + + :param restore_point_label: The restore point label to apply + :type restore_point_label: str + """ + + _validation = { + 'restore_point_label': {'required': True}, + } + + _attribute_map = { + 'restore_point_label': {'key': 'restorePointLabel', 'type': 'str'}, + } + + def __init__(self, restore_point_label): + super(CreateDatabaseRestorePointDefinition, self).__init__() + self.restore_point_label = restore_point_label diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/data_warehouse_user_activities.py b/azure-mgmt-sql/azure/mgmt/sql/models/data_warehouse_user_activities.py deleted file mode 100644 index f541bc5bebee..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/data_warehouse_user_activities.py +++ /dev/null @@ -1,47 +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 .proxy_resource import ProxyResource - - -class DataWarehouseUserActivities(ProxyResource): - """User activities of a data warehouse. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar active_queries_count: Count of running and suspended queries. - :vartype active_queries_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'active_queries_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'active_queries_count': {'key': 'properties.activeQueriesCount', 'type': 'int'}, - } - - def __init__(self): - super(DataWarehouseUserActivities, self).__init__() - self.active_queries_count = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database_operation.py b/azure-mgmt-sql/azure/mgmt/sql/models/database_operation.py index bb748f8757b9..e33ba1c29bcc 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database_operation.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database_operation.py @@ -48,6 +48,13 @@ class DatabaseOperation(ProxyResource): :vartype error_severity: int :ivar is_user_error: Whether or not the error is a user error. :vartype is_user_error: bool + :ivar estimated_completion_time: The estimated completion time of the + operation. + :vartype estimated_completion_time: datetime + :ivar description: The operation description. + :vartype description: str + :ivar is_cancellable: Whether the operation can be cancelled. + :vartype is_cancellable: bool """ _validation = { @@ -65,6 +72,9 @@ class DatabaseOperation(ProxyResource): 'error_description': {'readonly': True}, 'error_severity': {'readonly': True}, 'is_user_error': {'readonly': True}, + 'estimated_completion_time': {'readonly': True}, + 'description': {'readonly': True}, + 'is_cancellable': {'readonly': True}, } _attribute_map = { @@ -82,6 +92,9 @@ class DatabaseOperation(ProxyResource): 'error_description': {'key': 'properties.errorDescription', 'type': 'str'}, 'error_severity': {'key': 'properties.errorSeverity', 'type': 'int'}, 'is_user_error': {'key': 'properties.isUserError', 'type': 'bool'}, + 'estimated_completion_time': {'key': 'properties.estimatedCompletionTime', 'type': 'iso-8601'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'is_cancellable': {'key': 'properties.isCancellable', 'type': 'bool'}, } def __init__(self): @@ -97,3 +110,6 @@ def __init__(self): self.error_description = None self.error_severity = None self.is_user_error = None + self.estimated_completion_time = None + self.description = None + self.is_cancellable = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation.py new file mode 100644 index 000000000000..85bcf3262bee --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation.py @@ -0,0 +1,114 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class ElasticPoolOperation(ProxyResource): + """A elastic pool operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar elastic_pool_name: The name of the elastic pool the operation is + being performed on. + :vartype elastic_pool_name: str + :ivar operation: The name of operation. + :vartype operation: str + :ivar operation_friendly_name: The friendly name of operation. + :vartype operation_friendly_name: str + :ivar percent_complete: The percentage of the operation completed. + :vartype percent_complete: int + :ivar server_name: The name of the server. + :vartype server_name: str + :ivar start_time: The operation start time. + :vartype start_time: datetime + :ivar state: The operation state. + :vartype state: str + :ivar error_code: The operation error code. + :vartype error_code: int + :ivar error_description: The operation error description. + :vartype error_description: str + :ivar error_severity: The operation error severity. + :vartype error_severity: int + :ivar is_user_error: Whether or not the error is a user error. + :vartype is_user_error: bool + :ivar estimated_completion_time: The estimated completion time of the + operation. + :vartype estimated_completion_time: datetime + :ivar description: The operation description. + :vartype description: str + :ivar is_cancellable: Whether the operation can be cancelled. + :vartype is_cancellable: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'elastic_pool_name': {'readonly': True}, + 'operation': {'readonly': True}, + 'operation_friendly_name': {'readonly': True}, + 'percent_complete': {'readonly': True}, + 'server_name': {'readonly': True}, + 'start_time': {'readonly': True}, + 'state': {'readonly': True}, + 'error_code': {'readonly': True}, + 'error_description': {'readonly': True}, + 'error_severity': {'readonly': True}, + 'is_user_error': {'readonly': True}, + 'estimated_completion_time': {'readonly': True}, + 'description': {'readonly': True}, + 'is_cancellable': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'elastic_pool_name': {'key': 'properties.elasticPoolName', 'type': 'str'}, + 'operation': {'key': 'properties.operation', 'type': 'str'}, + 'operation_friendly_name': {'key': 'properties.operationFriendlyName', 'type': 'str'}, + 'percent_complete': {'key': 'properties.percentComplete', 'type': 'int'}, + 'server_name': {'key': 'properties.serverName', 'type': 'str'}, + 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'error_code': {'key': 'properties.errorCode', 'type': 'int'}, + 'error_description': {'key': 'properties.errorDescription', 'type': 'str'}, + 'error_severity': {'key': 'properties.errorSeverity', 'type': 'int'}, + 'is_user_error': {'key': 'properties.isUserError', 'type': 'bool'}, + 'estimated_completion_time': {'key': 'properties.estimatedCompletionTime', 'type': 'iso-8601'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'is_cancellable': {'key': 'properties.isCancellable', 'type': 'bool'}, + } + + def __init__(self): + super(ElasticPoolOperation, self).__init__() + self.elastic_pool_name = None + self.operation = None + self.operation_friendly_name = None + self.percent_complete = None + self.server_name = None + self.start_time = None + self.state = None + self.error_code = None + self.error_description = None + self.error_severity = None + self.is_user_error = None + self.estimated_completion_time = None + self.description = None + self.is_cancellable = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation_paged.py new file mode 100644 index 000000000000..530637e1479c --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation_paged.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ElasticPoolOperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`ElasticPoolOperation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ElasticPoolOperation]'} + } + + def __init__(self, *args, **kwargs): + + super(ElasticPoolOperationPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py b/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py index 7a2f5640a500..5a86dcac2e00 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/restore_point.py @@ -13,7 +13,7 @@ class RestorePoint(ProxyResource): - """A database restore point. + """Database restore points. Variables are only populated by the server, and will be ignored when sending a request. @@ -24,38 +24,48 @@ class RestorePoint(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar restore_point_type: The restore point type of the database restore - point. Possible values include: 'DISCRETE', 'CONTINUOUS' + :ivar location: Resource location. + :vartype location: str + :ivar restore_point_type: The type of restore point. Possible values + include: 'CONTINUOUS', 'DISCRETE' :vartype restore_point_type: str or ~azure.mgmt.sql.models.RestorePointType - :ivar restore_point_creation_date: Restore point creation time (ISO8601 - format). Populated when restorePointType = CONTINUOUS. Null otherwise. - :vartype restore_point_creation_date: datetime - :ivar earliest_restore_date: Earliest restore time (ISO8601 format). - Populated when restorePointType = DISCRETE. Null otherwise. + :ivar earliest_restore_date: The earliest time to which this database can + be restored :vartype earliest_restore_date: datetime + :ivar restore_point_creation_date: The time the backup was taken + :vartype restore_point_creation_date: datetime + :ivar restore_point_label: The label of restore point for backup request + by user + :vartype restore_point_label: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'readonly': True}, 'restore_point_type': {'readonly': True}, - 'restore_point_creation_date': {'readonly': True}, 'earliest_restore_date': {'readonly': True}, + 'restore_point_creation_date': {'readonly': True}, + 'restore_point_label': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, 'restore_point_type': {'key': 'properties.restorePointType', 'type': 'RestorePointType'}, - 'restore_point_creation_date': {'key': 'properties.restorePointCreationDate', 'type': 'iso-8601'}, 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, + 'restore_point_creation_date': {'key': 'properties.restorePointCreationDate', 'type': 'iso-8601'}, + 'restore_point_label': {'key': 'properties.restorePointLabel', 'type': 'str'}, } def __init__(self): super(RestorePoint, self).__init__() + self.location = None self.restore_point_type = None - self.restore_point_creation_date = None self.earliest_restore_date = None + self.restore_point_creation_date = None + self.restore_point_label = None 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 f6aba93bdcc6..1c81cadf4a97 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 @@ -18,12 +18,6 @@ class BackupLongTermRetentionPolicyState(Enum): enabled = "Enabled" -class RestorePointType(Enum): - - discrete = "DISCRETE" - continuous = "CONTINUOUS" - - class CapabilityStatus(Enum): visible = "Visible" @@ -474,16 +468,6 @@ class VirtualNetworkRuleState(Enum): unknown = "Unknown" -class ManagementOperationState(Enum): - - pending = "Pending" - in_progress = "InProgress" - succeeded = "Succeeded" - failed = "Failed" - cancel_in_progress = "CancelInProgress" - cancelled = "Cancelled" - - class AutomaticTuningServerMode(Enum): custom = "Custom" @@ -496,3 +480,19 @@ class AutomaticTuningServerReason(Enum): default = "Default" disabled = "Disabled" auto_configured = "AutoConfigured" + + +class RestorePointType(Enum): + + continuous = "CONTINUOUS" + discrete = "DISCRETE" + + +class ManagementOperationState(Enum): + + pending = "Pending" + in_progress = "InProgress" + succeeded = "Succeeded" + failed = "Failed" + cancel_in_progress = "CancelInProgress" + cancelled = "Cancelled" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 34b0744b54c7..e5d44f9453e2 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -11,7 +11,6 @@ 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 @@ -47,15 +46,15 @@ from .sync_members_operations import SyncMembersOperations from .subscription_usages_operations import SubscriptionUsagesOperations from .virtual_network_rules_operations import VirtualNetworkRulesOperations -from .database_operations import DatabaseOperations -from .data_warehouse_user_activities_operations import DataWarehouseUserActivitiesOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations +from .restore_points_operations import RestorePointsOperations +from .database_operations import DatabaseOperations +from .elastic_pool_operations import ElasticPoolOperations __all__ = [ 'BackupLongTermRetentionPoliciesOperations', 'BackupLongTermRetentionVaultsOperations', - 'RestorePointsOperations', 'RecoverableDatabasesOperations', 'RestorableDroppedDatabasesOperations', 'CapabilitiesOperations', @@ -91,8 +90,9 @@ 'SyncMembersOperations', 'SubscriptionUsagesOperations', 'VirtualNetworkRulesOperations', - 'DatabaseOperations', - 'DataWarehouseUserActivitiesOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', + 'RestorePointsOperations', + 'DatabaseOperations', + 'ElasticPoolOperations', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/data_warehouse_user_activities_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/data_warehouse_user_activities_operations.py deleted file mode 100644 index 4fb32c15c6d3..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/data_warehouse_user_activities_operations.py +++ /dev/null @@ -1,109 +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. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError - -from .. import models - - -class DataWarehouseUserActivitiesOperations(object): - """DataWarehouseUserActivitiesOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar data_warehouse_user_activity_name: The activity name of the data warehouse. . Constant value: "current". - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.data_warehouse_user_activity_name = "current" - self.api_version = "2017-03-01-preview" - - self.config = config - - def get( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets the user activities of a data warehouse which includes running and - suspended queries. - - :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: DataWarehouseUserActivities or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.DataWarehouseUserActivities or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataWarehouseUserActivityName': self._serialize.url("self.data_warehouse_user_activity_name", self.data_warehouse_user_activity_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, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('DataWarehouseUserActivities', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py index bce677fff8ee..c46a648198b9 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py @@ -23,7 +23,7 @@ class DatabaseOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + :ivar api_version: The API version to use for the request. Constant value: "2017-10-01-preview". """ models = models @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-03-01-preview" + self.api_version = "2017-10-01-preview" self.config = config diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py new file mode 100644 index 000000000000..38c35a868650 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py @@ -0,0 +1,176 @@ +# 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 ElasticPoolOperations(object): + """ElasticPoolOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2017-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-10-01-preview" + + self.config = config + + def cancel( + self, resource_group_name, server_name, elastic_pool_name, operation_id, custom_headers=None, raw=False, **operation_config): + """Cancels the asynchronous operation on 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 + 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: + :type elastic_pool_name: str + :param operation_id: The operation identifier. + :type operation_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 ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.cancel.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations/{operationId}/cancel'} + + def list_by_elastic_pool( + self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of operations performed on 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 + 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: + :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 ElasticPoolOperation + :rtype: + ~azure.mgmt.sql.models.ElasticPoolOperationPaged[~azure.mgmt.sql.models.ElasticPoolOperation] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_elastic_pool.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ElasticPoolOperationPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ElasticPoolOperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_elastic_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations'} 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 index 3c37b5a26804..6586a45c20cb 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/restore_points_operations.py @@ -12,6 +12,8 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError +from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -23,7 +25,7 @@ class RestorePointsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ models = models @@ -33,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2014-04-01" + self.api_version = "2017-03-01-preview" self.config = config @@ -47,8 +49,7 @@ def list_by_database( :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. + :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 @@ -66,10 +67,10 @@ def internal_paging(next_link=None, raw=False): # Construct URL url = self.list_by_database.metadata['url'] 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') + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -113,3 +114,263 @@ def internal_paging(next_link=None, raw=False): return deserialized list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints'} + + + def _create_initial( + self, resource_group_name, server_name, database_name, restore_point_label, custom_headers=None, raw=False, **operation_config): + parameters = models.CreateDatabaseRestorePointDefinition(restore_point_label=restore_point_label) + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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, 'CreateDatabaseRestorePointDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + 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('RestorePoint', response) + if response.status_code == 201: + deserialized = self._deserialize('RestorePoint', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, resource_group_name, server_name, database_name, restore_point_label, custom_headers=None, raw=False, **operation_config): + """Creates a restore point for 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 database. + :type database_name: str + :param restore_point_label: The restore point label to apply + :type restore_point_label: 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: An instance of AzureOperationPoller that returns RestorePoint + or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.RestorePoint] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + restore_point_label=restore_point_label, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **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 = self._deserialize('RestorePoint', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_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) + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints'} + + def get( + self, resource_group_name, server_name, database_name, restore_point_name, custom_headers=None, raw=False, **operation_config): + """Gets a restore point. + + :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 restore_point_name: The name of the restore point. + :type restore_point_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: RestorePoint or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.RestorePoint or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'restorePointName': self._serialize.url("restore_point_name", restore_point_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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RestorePoint', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}'} + + def delete( + self, resource_group_name, server_name, database_name, restore_point_name, custom_headers=None, raw=False, **operation_config): + """Deletes a restore point. + + :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 restore_point_name: The name of the restore point. + :type restore_point_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'restorePointName': self._serialize.url("restore_point_name", restore_point_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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}'} 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 d296357fc458..06ca7b1630a2 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -15,7 +15,6 @@ from .version import VERSION 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 @@ -51,10 +50,11 @@ from .operations.sync_members_operations import SyncMembersOperations from .operations.subscription_usages_operations import SubscriptionUsagesOperations from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations -from .operations.database_operations import DatabaseOperations -from .operations.data_warehouse_user_activities_operations import DataWarehouseUserActivitiesOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations +from .operations.restore_points_operations import RestorePointsOperations +from .operations.database_operations import DatabaseOperations +from .operations.elastic_pool_operations import ElasticPoolOperations from . import models @@ -101,8 +101,6 @@ class SqlManagementClient(object): :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 @@ -173,14 +171,16 @@ class SqlManagementClient(object): :vartype subscription_usages: azure.mgmt.sql.operations.SubscriptionUsagesOperations :ivar virtual_network_rules: VirtualNetworkRules operations :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations - :ivar database_operations: DatabaseOperations operations - :vartype database_operations: azure.mgmt.sql.operations.DatabaseOperations - :ivar data_warehouse_user_activities: DataWarehouseUserActivities operations - :vartype data_warehouse_user_activities: azure.mgmt.sql.operations.DataWarehouseUserActivitiesOperations :ivar server_automatic_tuning: ServerAutomaticTuning operations :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations + :ivar restore_points: RestorePoints operations + :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations + :ivar database_operations: DatabaseOperations operations + :vartype database_operations: azure.mgmt.sql.operations.DatabaseOperations + :ivar elastic_pool_operations: ElasticPoolOperations operations + :vartype elastic_pool_operations: azure.mgmt.sql.operations.ElasticPoolOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -205,8 +205,6 @@ def __init__( 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) self.restorable_dropped_databases = RestorableDroppedDatabasesOperations( @@ -277,11 +275,13 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.virtual_network_rules = VirtualNetworkRulesOperations( self._client, self.config, self._serialize, self._deserialize) - self.database_operations = DatabaseOperations( - self._client, self.config, self._serialize, self._deserialize) - self.data_warehouse_user_activities = DataWarehouseUserActivitiesOperations( - self._client, self.config, self._serialize, self._deserialize) self.server_automatic_tuning = ServerAutomaticTuningOperations( self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( self._client, self.config, self._serialize, self._deserialize) + self.restore_points = RestorePointsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.database_operations = DatabaseOperations( + self._client, self.config, self._serialize, self._deserialize) + self.elastic_pool_operations = ElasticPoolOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-sql/azure/mgmt/sql/version.py b/azure-mgmt-sql/azure/mgmt/sql/version.py index 53a203f32aaf..3697d9b71739 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/version.py +++ b/azure-mgmt-sql/azure/mgmt/sql/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "" +VERSION = "0.9.0" From 7acbb705f254b06f7f0c2307619a424e69a15424 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 19 Mar 2018 11:50:06 -0700 Subject: [PATCH 09/11] [AutoPR sql/resource-manager] Change databaseState in longTermRetention.json to longTermRetentionDatabaseState (#2215) * Generated from 922cc7baf78eff3e45a6e935e3f1513983c2e3c6 updating databaseState to longTermRetentionDatabaseState * Generated from 58d3850cc7c258e8ea4136406edd06b723924767 Making longTermRetentionDatabaseState a common parameter * Generated from de2f644e708d9e1b13c719a7a11dd3200e703695 adding parameter location as method to LongTermRetentionDatabaseStateParameter --- .../azure/mgmt/sql/models/__init__.py | 22 +- .../backup_long_term_retention_policy.py | 42 +- ...backup_long_term_retention_policy_paged.py | 27 - .../backup_long_term_retention_vault.py | 53 -- .../sql/models/long_term_retention_backup.py | 73 +++ ...py => long_term_retention_backup_paged.py} | 8 +- .../sql/models/sql_management_client_enums.py | 13 +- .../azure/mgmt/sql/operations/__init__.py | 8 +- ...long_term_retention_policies_operations.py | 138 +++--- ...p_long_term_retention_vaults_operations.py | 306 ------------ .../long_term_retention_backups_operations.py | 464 ++++++++++++++++++ .../azure/mgmt/sql/sql_management_client.py | 20 +- 12 files changed, 654 insertions(+), 520 deletions(-) delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy_paged.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup.py rename azure-mgmt-sql/azure/mgmt/sql/models/{backup_long_term_retention_vault_paged.py => long_term_retention_backup_paged.py} (64%) delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_vaults_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 44a5e54b9f8a..23b6a2424c59 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -10,10 +10,8 @@ # -------------------------------------------------------------------------- from .resource import Resource -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 .proxy_resource import ProxyResource from .recoverable_database import RecoverableDatabase from .restorable_dropped_database import RestorableDroppedDatabase from .max_size_capability import MaxSizeCapability @@ -92,6 +90,8 @@ from .sync_member import SyncMember from .subscription_usage import SubscriptionUsage from .virtual_network_rule import VirtualNetworkRule +from .long_term_retention_backup import LongTermRetentionBackup +from .backup_long_term_retention_policy import BackupLongTermRetentionPolicy from .resource_move_definition import ResourceMoveDefinition from .automatic_tuning_server_options import AutomaticTuningServerOptions from .server_automatic_tuning import ServerAutomaticTuning @@ -101,8 +101,6 @@ from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition from .database_operation import DatabaseOperation from .elastic_pool_operation import ElasticPoolOperation -from .backup_long_term_retention_policy_paged import BackupLongTermRetentionPolicyPaged -from .backup_long_term_retention_vault_paged import BackupLongTermRetentionVaultPaged from .recoverable_database_paged import RecoverableDatabasePaged from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .server_paged import ServerPaged @@ -138,12 +136,12 @@ from .sync_member_paged import SyncMemberPaged from .subscription_usage_paged import SubscriptionUsagePaged from .virtual_network_rule_paged import VirtualNetworkRulePaged +from .long_term_retention_backup_paged import LongTermRetentionBackupPaged from .server_dns_alias_paged import ServerDnsAliasPaged from .restore_point_paged import RestorePointPaged from .database_operation_paged import DatabaseOperationPaged from .elastic_pool_operation_paged import ElasticPoolOperationPaged from .sql_management_client_enums import ( - BackupLongTermRetentionPolicyState, CapabilityStatus, MaxSizeUnits, PerformanceLevelUnit, @@ -198,14 +196,13 @@ AutomaticTuningServerReason, RestorePointType, ManagementOperationState, + LongTermRetentionDatabaseState, ) __all__ = [ 'Resource', - 'ProxyResource', - 'BackupLongTermRetentionPolicy', - 'BackupLongTermRetentionVault', 'TrackedResource', + 'ProxyResource', 'RecoverableDatabase', 'RestorableDroppedDatabase', 'MaxSizeCapability', @@ -284,6 +281,8 @@ 'SyncMember', 'SubscriptionUsage', 'VirtualNetworkRule', + 'LongTermRetentionBackup', + 'BackupLongTermRetentionPolicy', 'ResourceMoveDefinition', 'AutomaticTuningServerOptions', 'ServerAutomaticTuning', @@ -293,8 +292,6 @@ 'CreateDatabaseRestorePointDefinition', 'DatabaseOperation', 'ElasticPoolOperation', - 'BackupLongTermRetentionPolicyPaged', - 'BackupLongTermRetentionVaultPaged', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', 'ServerPaged', @@ -330,11 +327,11 @@ 'SyncMemberPaged', 'SubscriptionUsagePaged', 'VirtualNetworkRulePaged', + 'LongTermRetentionBackupPaged', 'ServerDnsAliasPaged', 'RestorePointPaged', 'DatabaseOperationPaged', 'ElasticPoolOperationPaged', - 'BackupLongTermRetentionPolicyState', 'CapabilityStatus', 'MaxSizeUnits', 'PerformanceLevelUnit', @@ -389,4 +386,5 @@ 'AutomaticTuningServerReason', 'RestorePointType', 'ManagementOperationState', + 'LongTermRetentionDatabaseState', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy.py index 482093d96833..cac3d4046f73 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy.py @@ -13,7 +13,7 @@ class BackupLongTermRetentionPolicy(ProxyResource): - """A backup long term retention policy. + """A long term retention policy. Variables are only populated by the server, and will be ignored when sending a request. @@ -24,37 +24,39 @@ class BackupLongTermRetentionPolicy(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: The geo-location where the resource lives - :vartype location: str - :param state: The status of the backup long term retention policy. - Possible values include: 'Disabled', 'Enabled' - :type state: str or - ~azure.mgmt.sql.models.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 weekly_retention: The weekly retention policy for an LTR backup in + an ISO 8601 format. + :type weekly_retention: str + :param monthly_retention: The montly retention policy for an LTR backup in + an ISO 8601 format. + :type monthly_retention: str + :param yearly_retention: The yearly retention policy for an LTR backup in + an ISO 8601 format. + :type yearly_retention: str + :param week_of_year: The week of year to take the yearly backup in an ISO + 8601 format. + :type week_of_year: int """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'state': {'required': True}, - 'recovery_services_backup_policy_resource_id': {'required': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'BackupLongTermRetentionPolicyState'}, - 'recovery_services_backup_policy_resource_id': {'key': 'properties.recoveryServicesBackupPolicyResourceId', 'type': 'str'}, + 'weekly_retention': {'key': 'properties.weeklyRetention', 'type': 'str'}, + 'monthly_retention': {'key': 'properties.monthlyRetention', 'type': 'str'}, + 'yearly_retention': {'key': 'properties.yearlyRetention', 'type': 'str'}, + 'week_of_year': {'key': 'properties.weekOfYear', 'type': 'int'}, } - def __init__(self, state, recovery_services_backup_policy_resource_id): + def __init__(self, weekly_retention=None, monthly_retention=None, yearly_retention=None, week_of_year=None): super(BackupLongTermRetentionPolicy, self).__init__() - self.location = None - self.state = state - self.recovery_services_backup_policy_resource_id = recovery_services_backup_policy_resource_id + self.weekly_retention = weekly_retention + self.monthly_retention = monthly_retention + self.yearly_retention = yearly_retention + self.week_of_year = week_of_year diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy_paged.py deleted file mode 100644 index 609528d85e94..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy_paged.py +++ /dev/null @@ -1,27 +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.paging import Paged - - -class BackupLongTermRetentionPolicyPaged(Paged): - """ - A paging container for iterating over a list of :class:`BackupLongTermRetentionPolicy ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BackupLongTermRetentionPolicy]'} - } - - def __init__(self, *args, **kwargs): - - super(BackupLongTermRetentionPolicyPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault.py b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault.py deleted file mode 100644 index c8d4cca98273..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault.py +++ /dev/null @@ -1,53 +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 .proxy_resource import ProxyResource - - -class BackupLongTermRetentionVault(ProxyResource): - """A backup long term retention vault. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar location: The geo-location where the resource lives - :vartype location: str - :param recovery_services_vault_resource_id: The azure recovery services - vault resource id - :type recovery_services_vault_resource_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'recovery_services_vault_resource_id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'recovery_services_vault_resource_id': {'key': 'properties.recoveryServicesVaultResourceId', 'type': 'str'}, - } - - def __init__(self, recovery_services_vault_resource_id): - super(BackupLongTermRetentionVault, self).__init__() - self.location = None - self.recovery_services_vault_resource_id = recovery_services_vault_resource_id diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup.py b/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup.py new file mode 100644 index 000000000000..d0f4b2405507 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class LongTermRetentionBackup(ProxyResource): + """A long term retention backup. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar server_name: The server name that the backup database belong to. + :vartype server_name: str + :ivar server_create_time: The create time of the server. + :vartype server_create_time: datetime + :ivar database_name: The name of the database the backup belong to + :vartype database_name: str + :ivar database_deletion_time: The delete time of the database + :vartype database_deletion_time: datetime + :ivar backup_time: The time the backup was taken + :vartype backup_time: datetime + :ivar backup_expiration_time: The time the long term retention backup will + expire. + :vartype backup_expiration_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'server_name': {'readonly': True}, + 'server_create_time': {'readonly': True}, + 'database_name': {'readonly': True}, + 'database_deletion_time': {'readonly': True}, + 'backup_time': {'readonly': True}, + 'backup_expiration_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'server_name': {'key': 'properties.serverName', 'type': 'str'}, + 'server_create_time': {'key': 'properties.serverCreateTime', 'type': 'iso-8601'}, + 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, + 'database_deletion_time': {'key': 'properties.databaseDeletionTime', 'type': 'iso-8601'}, + 'backup_time': {'key': 'properties.backupTime', 'type': 'iso-8601'}, + 'backup_expiration_time': {'key': 'properties.backupExpirationTime', 'type': 'iso-8601'}, + } + + def __init__(self): + super(LongTermRetentionBackup, self).__init__() + self.server_name = None + self.server_create_time = None + self.database_name = None + self.database_deletion_time = None + self.backup_time = None + self.backup_expiration_time = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup_paged.py similarity index 64% rename from azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault_paged.py rename to azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup_paged.py index 79b7b79ab289..15e32283bbd7 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup_paged.py @@ -12,16 +12,16 @@ from msrest.paging import Paged -class BackupLongTermRetentionVaultPaged(Paged): +class LongTermRetentionBackupPaged(Paged): """ - A paging container for iterating over a list of :class:`BackupLongTermRetentionVault ` object + A paging container for iterating over a list of :class:`LongTermRetentionBackup ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BackupLongTermRetentionVault]'} + 'current_page': {'key': 'value', 'type': '[LongTermRetentionBackup]'} } def __init__(self, *args, **kwargs): - super(BackupLongTermRetentionVaultPaged, self).__init__(*args, **kwargs) + super(LongTermRetentionBackupPaged, self).__init__(*args, **kwargs) 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 1c81cadf4a97..b9db1792fcef 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,12 +12,6 @@ from enum import Enum -class BackupLongTermRetentionPolicyState(Enum): - - disabled = "Disabled" - enabled = "Enabled" - - class CapabilityStatus(Enum): visible = "Visible" @@ -496,3 +490,10 @@ class ManagementOperationState(Enum): failed = "Failed" cancel_in_progress = "CancelInProgress" cancelled = "Cancelled" + + +class LongTermRetentionDatabaseState(Enum): + + all = "All" + live = "Live" + deleted = "Deleted" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index e5d44f9453e2..e73ee1288114 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -9,8 +9,6 @@ # regenerated. # -------------------------------------------------------------------------- -from .backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations -from .backup_long_term_retention_vaults_operations import BackupLongTermRetentionVaultsOperations from .recoverable_databases_operations import RecoverableDatabasesOperations from .restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations from .capabilities_operations import CapabilitiesOperations @@ -46,6 +44,8 @@ from .sync_members_operations import SyncMembersOperations from .subscription_usages_operations import SubscriptionUsagesOperations from .virtual_network_rules_operations import VirtualNetworkRulesOperations +from .long_term_retention_backups_operations import LongTermRetentionBackupsOperations +from .backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations from .restore_points_operations import RestorePointsOperations @@ -53,8 +53,6 @@ from .elastic_pool_operations import ElasticPoolOperations __all__ = [ - 'BackupLongTermRetentionPoliciesOperations', - 'BackupLongTermRetentionVaultsOperations', 'RecoverableDatabasesOperations', 'RestorableDroppedDatabasesOperations', 'CapabilitiesOperations', @@ -90,6 +88,8 @@ 'SyncMembersOperations', 'SubscriptionUsagesOperations', 'VirtualNetworkRulesOperations', + 'LongTermRetentionBackupsOperations', + 'BackupLongTermRetentionPoliciesOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', 'RestorePointsOperations', 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 index ebb3c8ff07f0..d9dd54e012d5 100644 --- 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 @@ -25,8 +25,8 @@ class BackupLongTermRetentionPoliciesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". - :ivar backup_long_term_retention_policy_name: The name of the backup long term retention policy. Constant value: "Default". + :ivar policy_name: The policy name. Should always be Default. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ models = models @@ -36,14 +36,14 @@ 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.policy_name = "default" + self.api_version = "2017-03-01-preview" 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. + """Gets a database's long term retention policy. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -67,11 +67,11 @@ def get( # Construct URL url = self.get.metadata['url'] 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') + 'policyName': self._serialize.url("self.policy_name", self.policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -108,21 +108,19 @@ def get( return client_raw_response return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}'} def _create_or_update_initial( - self, resource_group_name, server_name, database_name, state, recovery_services_backup_policy_resource_id, custom_headers=None, raw=False, **operation_config): - parameters = models.BackupLongTermRetentionPolicy(state=state, recovery_services_backup_policy_resource_id=recovery_services_backup_policy_resource_id) - + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create_or_update.metadata['url'] 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') + 'policyName': self._serialize.url("self.policy_name", self.policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -148,7 +146,7 @@ def _create_or_update_initial( response = self._client.send( request, header_parameters, body_content, stream=False, **operation_config) - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp @@ -157,8 +155,6 @@ def _create_or_update_initial( 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) @@ -167,8 +163,8 @@ def _create_or_update_initial( 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. + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + """Sets a database's long term retention policy. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -176,15 +172,10 @@ def create_or_update( :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. :type database_name: str - :param state: The status of the backup long term retention policy. - Possible values include: 'Disabled', 'Enabled' - :type state: str or - ~azure.mgmt.sql.models.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 parameters: The long term retention policy info. + :type parameters: ~azure.mgmt.sql.models.BackupLongTermRetentionPolicy :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -199,8 +190,7 @@ def create_or_update( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, - state=state, - recovery_services_backup_policy_resource_id=recovery_services_backup_policy_resource_id, + parameters=parameters, custom_headers=custom_headers, raw=True, **operation_config @@ -224,7 +214,7 @@ def get_long_running_status(status_link, headers=None): def get_long_running_output(response): - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp @@ -243,11 +233,11 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}'} def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Returns a database backup long term retention policy. + """Gets a database's long term retention policy. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -262,60 +252,52 @@ def list_by_database( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of BackupLongTermRetentionPolicy - :rtype: - ~azure.mgmt.sql.models.BackupLongTermRetentionPolicyPaged[~azure.mgmt.sql.models.BackupLongTermRetentionPolicy] + :return: BackupLongTermRetentionPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.BackupLongTermRetentionPolicy or + ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_database.metadata['url'] - path_format_arguments = { - '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, stream=False, **operation_config) + # Construct URL + url = self.list_by_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) - if response.status_code not in [200]: - 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("self.api_version", self.api_version, 'str') - return response + # 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') - # Deserialize response - deserialized = models.BackupLongTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies) + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BackupLongTermRetentionPolicy', response) if raw: - header_dict = {} - client_raw_response = models.BackupLongTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized 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 deleted file mode 100644 index cf800d7202bd..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_vaults_operations.py +++ /dev/null @@ -1,306 +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. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.exceptions import DeserializationError -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 object 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". - """ - - models = models - - 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: BackupLongTermRetentionVault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.BackupLongTermRetentionVault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - 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, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BackupLongTermRetentionVault', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}'} - - - def _create_or_update_initial( - self, resource_group_name, server_name, recovery_services_vault_resource_id, custom_headers=None, raw=False, **operation_config): - parameters = models.BackupLongTermRetentionVault(recovery_services_vault_resource_id=recovery_services_vault_resource_id) - - # Construct URL - url = self.create_or_update.metadata['url'] - 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 - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - 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 - - 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: An instance of AzureOperationPoller that returns - BackupLongTermRetentionVault or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.BackupLongTermRetentionVault] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - server_name=server_name, - recovery_services_vault_resource_id=recovery_services_vault_resource_id, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **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 = self._deserialize('BackupLongTermRetentionVault', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_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) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}'} - - def list_by_server( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Gets server backup long term retention vaults 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`. - :return: An iterator like instance of BackupLongTermRetentionVault - :rtype: - ~azure.mgmt.sql.models.BackupLongTermRetentionVaultPaged[~azure.mgmt.sql.models.BackupLongTermRetentionVault] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_server.metadata['url'] - path_format_arguments = { - '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, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.BackupLongTermRetentionVaultPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.BackupLongTermRetentionVaultPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py new file mode 100644 index 000000000000..d974038867ab --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py @@ -0,0 +1,464 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError +from msrestazure.azure_operation import AzureOperationPoller + +from .. import models + + +class LongTermRetentionBackupsOperations(object): + """LongTermRetentionBackupsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, **operation_config): + """Gets a long term retention backup. + + :param location_name: The location of the database. + :type location_name: str + :param long_term_retention_server_name: + :type long_term_retention_server_name: str + :param long_term_retention_database_name: + :type long_term_retention_database_name: str + :param backup_name: The backup name. + :type backup_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: LongTermRetentionBackup or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.LongTermRetentionBackup or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), + 'longTermRetentionDatabaseName': self._serialize.url("long_term_retention_database_name", long_term_retention_database_name, 'str'), + 'backupName': self._serialize.url("backup_name", backup_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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LongTermRetentionBackup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'} + + + def _delete_initial( + self, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), + 'longTermRetentionDatabaseName': self._serialize.url("long_term_retention_database_name", long_term_retention_database_name, 'str'), + 'backupName': self._serialize.url("backup_name", backup_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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, **operation_config): + """Deletes a long term retention backup. + + :param location_name: The location of the database + :type location_name: str + :param long_term_retention_server_name: + :type long_term_retention_server_name: str + :param long_term_retention_database_name: + :type long_term_retention_database_name: str + :param backup_name: The backup name. + :type backup_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: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + location_name=location_name, + long_term_retention_server_name=long_term_retention_server_name, + long_term_retention_database_name=long_term_retention_database_name, + backup_name=backup_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **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 + + 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) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'} + + def list_by_database( + self, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists all long term retention backups for a database. + + :param location_name: The location of the database + :type location_name: str + :param long_term_retention_server_name: + :type long_term_retention_server_name: str + :param long_term_retention_database_name: + :type long_term_retention_database_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or + ~azure.mgmt.sql.models.LongTermRetentionDatabaseState + :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 LongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.LongTermRetentionBackupPaged[~azure.mgmt.sql.models.LongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_database.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), + 'longTermRetentionDatabaseName': self._serialize.url("long_term_retention_database_name", long_term_retention_database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups'} + + def list_by_location( + self, location_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists the long term retention backups for a given location. + + :param location_name: The location of the database + :type location_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or + ~azure.mgmt.sql.models.LongTermRetentionDatabaseState + :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 LongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.LongTermRetentionBackupPaged[~azure.mgmt.sql.models.LongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_location.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups'} + + def list_by_server( + self, location_name, long_term_retention_server_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists the long term retention backups for a given server. + + :param location_name: The location of the database + :type location_name: str + :param long_term_retention_server_name: + :type long_term_retention_server_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or + ~azure.mgmt.sql.models.LongTermRetentionDatabaseState + :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 LongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.LongTermRetentionBackupPaged[~azure.mgmt.sql.models.LongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_server.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_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 = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups'} 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 06ca7b1630a2..f028e14bc51e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -13,8 +13,6 @@ from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION -from .operations.backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations -from .operations.backup_long_term_retention_vaults_operations import BackupLongTermRetentionVaultsOperations from .operations.recoverable_databases_operations import RecoverableDatabasesOperations from .operations.restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations from .operations.capabilities_operations import CapabilitiesOperations @@ -50,6 +48,8 @@ from .operations.sync_members_operations import SyncMembersOperations from .operations.subscription_usages_operations import SubscriptionUsagesOperations from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations +from .operations.long_term_retention_backups_operations import LongTermRetentionBackupsOperations +from .operations.backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations from .operations.restore_points_operations import RestorePointsOperations @@ -97,10 +97,6 @@ class SqlManagementClient(object): :ivar config: Configuration for client. :vartype config: SqlManagementClientConfiguration - :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 recoverable_databases: RecoverableDatabases operations :vartype recoverable_databases: azure.mgmt.sql.operations.RecoverableDatabasesOperations :ivar restorable_dropped_databases: RestorableDroppedDatabases operations @@ -171,6 +167,10 @@ class SqlManagementClient(object): :vartype subscription_usages: azure.mgmt.sql.operations.SubscriptionUsagesOperations :ivar virtual_network_rules: VirtualNetworkRules operations :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations + :ivar long_term_retention_backups: LongTermRetentionBackups operations + :vartype long_term_retention_backups: azure.mgmt.sql.operations.LongTermRetentionBackupsOperations + :ivar backup_long_term_retention_policies: BackupLongTermRetentionPolicies operations + :vartype backup_long_term_retention_policies: azure.mgmt.sql.operations.BackupLongTermRetentionPoliciesOperations :ivar server_automatic_tuning: ServerAutomaticTuning operations :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations @@ -201,10 +201,6 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - 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.recoverable_databases = RecoverableDatabasesOperations( self._client, self.config, self._serialize, self._deserialize) self.restorable_dropped_databases = RestorableDroppedDatabasesOperations( @@ -275,6 +271,10 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.virtual_network_rules = VirtualNetworkRulesOperations( self._client, self.config, self._serialize, self._deserialize) + self.long_term_retention_backups = LongTermRetentionBackupsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.backup_long_term_retention_policies = BackupLongTermRetentionPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.server_automatic_tuning = ServerAutomaticTuningOperations( self._client, self.config, self._serialize, self._deserialize) self.server_dns_aliases = ServerDnsAliasesOperations( From 20384f2e31858f3375f9471a59a7064a643424c4 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 20 Mar 2018 13:20:16 -0700 Subject: [PATCH 10/11] Generated from a6e24f1e4205f46b865a197f080aaea9ec0994b0 (#2239) Error descriptions changed in instanceFailoverGroup swagger --- .../azure/mgmt/sql/models/__init__.py | 38 +- .../backup_long_term_retention_policy.py | 42 +- ...ackup_long_term_retention_policy_paged.py} | 8 +- .../backup_long_term_retention_vault.py | 53 ++ ...backup_long_term_retention_vault_paged.py} | 8 +- .../mgmt/sql/models/elastic_pool_operation.py | 114 ----- .../sql/models/long_term_retention_backup.py | 73 --- .../sql/models/sql_management_client_enums.py | 33 +- .../azure/mgmt/sql/operations/__init__.py | 14 +- ...long_term_retention_policies_operations.py | 138 +++--- ...p_long_term_retention_vaults_operations.py | 306 ++++++++++++ .../sql/operations/database_operations.py | 4 +- .../sql/operations/elastic_pool_operations.py | 176 ------- .../long_term_retention_backups_operations.py | 464 ------------------ .../azure/mgmt/sql/sql_management_client.py | 33 +- 15 files changed, 521 insertions(+), 983 deletions(-) rename azure-mgmt-sql/azure/mgmt/sql/models/{long_term_retention_backup_paged.py => backup_long_term_retention_policy_paged.py} (64%) create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault.py rename azure-mgmt-sql/azure/mgmt/sql/models/{elastic_pool_operation_paged.py => backup_long_term_retention_vault_paged.py} (64%) delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_vaults_operations.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 23b6a2424c59..f7da1a4021a9 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 .recoverable_database import RecoverableDatabase from .restorable_dropped_database import RestorableDroppedDatabase from .max_size_capability import MaxSizeCapability @@ -90,8 +92,7 @@ from .sync_member import SyncMember from .subscription_usage import SubscriptionUsage from .virtual_network_rule import VirtualNetworkRule -from .long_term_retention_backup import LongTermRetentionBackup -from .backup_long_term_retention_policy import BackupLongTermRetentionPolicy +from .database_operation import DatabaseOperation from .resource_move_definition import ResourceMoveDefinition from .automatic_tuning_server_options import AutomaticTuningServerOptions from .server_automatic_tuning import ServerAutomaticTuning @@ -99,8 +100,8 @@ from .server_dns_alias_acquisition import ServerDnsAliasAcquisition from .restore_point import RestorePoint from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition -from .database_operation import DatabaseOperation -from .elastic_pool_operation import ElasticPoolOperation +from .backup_long_term_retention_policy_paged import BackupLongTermRetentionPolicyPaged +from .backup_long_term_retention_vault_paged import BackupLongTermRetentionVaultPaged from .recoverable_database_paged import RecoverableDatabasePaged from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .server_paged import ServerPaged @@ -136,12 +137,11 @@ from .sync_member_paged import SyncMemberPaged from .subscription_usage_paged import SubscriptionUsagePaged from .virtual_network_rule_paged import VirtualNetworkRulePaged -from .long_term_retention_backup_paged import LongTermRetentionBackupPaged +from .database_operation_paged import DatabaseOperationPaged from .server_dns_alias_paged import ServerDnsAliasPaged from .restore_point_paged import RestorePointPaged -from .database_operation_paged import DatabaseOperationPaged -from .elastic_pool_operation_paged import ElasticPoolOperationPaged from .sql_management_client_enums import ( + BackupLongTermRetentionPolicyState, CapabilityStatus, MaxSizeUnits, PerformanceLevelUnit, @@ -192,17 +192,18 @@ SyncDirection, SyncMemberState, VirtualNetworkRuleState, + ManagementOperationState, AutomaticTuningServerMode, AutomaticTuningServerReason, RestorePointType, - ManagementOperationState, - LongTermRetentionDatabaseState, ) __all__ = [ 'Resource', - 'TrackedResource', 'ProxyResource', + 'BackupLongTermRetentionPolicy', + 'BackupLongTermRetentionVault', + 'TrackedResource', 'RecoverableDatabase', 'RestorableDroppedDatabase', 'MaxSizeCapability', @@ -281,8 +282,7 @@ 'SyncMember', 'SubscriptionUsage', 'VirtualNetworkRule', - 'LongTermRetentionBackup', - 'BackupLongTermRetentionPolicy', + 'DatabaseOperation', 'ResourceMoveDefinition', 'AutomaticTuningServerOptions', 'ServerAutomaticTuning', @@ -290,8 +290,8 @@ 'ServerDnsAliasAcquisition', 'RestorePoint', 'CreateDatabaseRestorePointDefinition', - 'DatabaseOperation', - 'ElasticPoolOperation', + 'BackupLongTermRetentionPolicyPaged', + 'BackupLongTermRetentionVaultPaged', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', 'ServerPaged', @@ -327,11 +327,10 @@ 'SyncMemberPaged', 'SubscriptionUsagePaged', 'VirtualNetworkRulePaged', - 'LongTermRetentionBackupPaged', + 'DatabaseOperationPaged', 'ServerDnsAliasPaged', 'RestorePointPaged', - 'DatabaseOperationPaged', - 'ElasticPoolOperationPaged', + 'BackupLongTermRetentionPolicyState', 'CapabilityStatus', 'MaxSizeUnits', 'PerformanceLevelUnit', @@ -382,9 +381,8 @@ 'SyncDirection', 'SyncMemberState', 'VirtualNetworkRuleState', + 'ManagementOperationState', 'AutomaticTuningServerMode', 'AutomaticTuningServerReason', 'RestorePointType', - 'ManagementOperationState', - 'LongTermRetentionDatabaseState', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy.py index cac3d4046f73..482093d96833 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy.py @@ -13,7 +13,7 @@ class BackupLongTermRetentionPolicy(ProxyResource): - """A long term retention policy. + """A backup long term retention policy. Variables are only populated by the server, and will be ignored when sending a request. @@ -24,39 +24,37 @@ class BackupLongTermRetentionPolicy(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param weekly_retention: The weekly retention policy for an LTR backup in - an ISO 8601 format. - :type weekly_retention: str - :param monthly_retention: The montly retention policy for an LTR backup in - an ISO 8601 format. - :type monthly_retention: str - :param yearly_retention: The yearly retention policy for an LTR backup in - an ISO 8601 format. - :type yearly_retention: str - :param week_of_year: The week of year to take the yearly backup in an ISO - 8601 format. - :type week_of_year: int + :ivar location: The geo-location where the resource lives + :vartype location: str + :param state: The status of the backup long term retention policy. + Possible values include: 'Disabled', 'Enabled' + :type state: str or + ~azure.mgmt.sql.models.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 """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'state': {'required': True}, + 'recovery_services_backup_policy_resource_id': {'required': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'weekly_retention': {'key': 'properties.weeklyRetention', 'type': 'str'}, - 'monthly_retention': {'key': 'properties.monthlyRetention', 'type': 'str'}, - 'yearly_retention': {'key': 'properties.yearlyRetention', 'type': 'str'}, - 'week_of_year': {'key': 'properties.weekOfYear', 'type': 'int'}, + 'location': {'key': 'location', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'BackupLongTermRetentionPolicyState'}, + 'recovery_services_backup_policy_resource_id': {'key': 'properties.recoveryServicesBackupPolicyResourceId', 'type': 'str'}, } - def __init__(self, weekly_retention=None, monthly_retention=None, yearly_retention=None, week_of_year=None): + def __init__(self, state, recovery_services_backup_policy_resource_id): super(BackupLongTermRetentionPolicy, self).__init__() - self.weekly_retention = weekly_retention - self.monthly_retention = monthly_retention - self.yearly_retention = yearly_retention - self.week_of_year = week_of_year + self.location = None + self.state = state + self.recovery_services_backup_policy_resource_id = recovery_services_backup_policy_resource_id diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy_paged.py similarity index 64% rename from azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup_paged.py rename to azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy_paged.py index 15e32283bbd7..609528d85e94 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy_paged.py @@ -12,16 +12,16 @@ from msrest.paging import Paged -class LongTermRetentionBackupPaged(Paged): +class BackupLongTermRetentionPolicyPaged(Paged): """ - A paging container for iterating over a list of :class:`LongTermRetentionBackup ` object + A paging container for iterating over a list of :class:`BackupLongTermRetentionPolicy ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[LongTermRetentionBackup]'} + 'current_page': {'key': 'value', 'type': '[BackupLongTermRetentionPolicy]'} } def __init__(self, *args, **kwargs): - super(LongTermRetentionBackupPaged, self).__init__(*args, **kwargs) + super(BackupLongTermRetentionPolicyPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault.py b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault.py new file mode 100644 index 000000000000..c8d4cca98273 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class BackupLongTermRetentionVault(ProxyResource): + """A backup long term retention vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: The geo-location where the resource lives + :vartype location: str + :param recovery_services_vault_resource_id: The azure recovery services + vault resource id + :type recovery_services_vault_resource_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'recovery_services_vault_resource_id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'recovery_services_vault_resource_id': {'key': 'properties.recoveryServicesVaultResourceId', 'type': 'str'}, + } + + def __init__(self, recovery_services_vault_resource_id): + super(BackupLongTermRetentionVault, self).__init__() + self.location = None + self.recovery_services_vault_resource_id = recovery_services_vault_resource_id diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault_paged.py similarity index 64% rename from azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation_paged.py rename to azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault_paged.py index 530637e1479c..79b7b79ab289 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault_paged.py @@ -12,16 +12,16 @@ from msrest.paging import Paged -class ElasticPoolOperationPaged(Paged): +class BackupLongTermRetentionVaultPaged(Paged): """ - A paging container for iterating over a list of :class:`ElasticPoolOperation ` object + A paging container for iterating over a list of :class:`BackupLongTermRetentionVault ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ElasticPoolOperation]'} + 'current_page': {'key': 'value', 'type': '[BackupLongTermRetentionVault]'} } def __init__(self, *args, **kwargs): - super(ElasticPoolOperationPaged, self).__init__(*args, **kwargs) + super(BackupLongTermRetentionVaultPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation.py deleted file mode 100644 index 85bcf3262bee..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation.py +++ /dev/null @@ -1,114 +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 .proxy_resource import ProxyResource - - -class ElasticPoolOperation(ProxyResource): - """A elastic pool operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar elastic_pool_name: The name of the elastic pool the operation is - being performed on. - :vartype elastic_pool_name: str - :ivar operation: The name of operation. - :vartype operation: str - :ivar operation_friendly_name: The friendly name of operation. - :vartype operation_friendly_name: str - :ivar percent_complete: The percentage of the operation completed. - :vartype percent_complete: int - :ivar server_name: The name of the server. - :vartype server_name: str - :ivar start_time: The operation start time. - :vartype start_time: datetime - :ivar state: The operation state. - :vartype state: str - :ivar error_code: The operation error code. - :vartype error_code: int - :ivar error_description: The operation error description. - :vartype error_description: str - :ivar error_severity: The operation error severity. - :vartype error_severity: int - :ivar is_user_error: Whether or not the error is a user error. - :vartype is_user_error: bool - :ivar estimated_completion_time: The estimated completion time of the - operation. - :vartype estimated_completion_time: datetime - :ivar description: The operation description. - :vartype description: str - :ivar is_cancellable: Whether the operation can be cancelled. - :vartype is_cancellable: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'elastic_pool_name': {'readonly': True}, - 'operation': {'readonly': True}, - 'operation_friendly_name': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'server_name': {'readonly': True}, - 'start_time': {'readonly': True}, - 'state': {'readonly': True}, - 'error_code': {'readonly': True}, - 'error_description': {'readonly': True}, - 'error_severity': {'readonly': True}, - 'is_user_error': {'readonly': True}, - 'estimated_completion_time': {'readonly': True}, - 'description': {'readonly': True}, - 'is_cancellable': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'elastic_pool_name': {'key': 'properties.elasticPoolName', 'type': 'str'}, - 'operation': {'key': 'properties.operation', 'type': 'str'}, - 'operation_friendly_name': {'key': 'properties.operationFriendlyName', 'type': 'str'}, - 'percent_complete': {'key': 'properties.percentComplete', 'type': 'int'}, - 'server_name': {'key': 'properties.serverName', 'type': 'str'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'error_code': {'key': 'properties.errorCode', 'type': 'int'}, - 'error_description': {'key': 'properties.errorDescription', 'type': 'str'}, - 'error_severity': {'key': 'properties.errorSeverity', 'type': 'int'}, - 'is_user_error': {'key': 'properties.isUserError', 'type': 'bool'}, - 'estimated_completion_time': {'key': 'properties.estimatedCompletionTime', 'type': 'iso-8601'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'is_cancellable': {'key': 'properties.isCancellable', 'type': 'bool'}, - } - - def __init__(self): - super(ElasticPoolOperation, self).__init__() - self.elastic_pool_name = None - self.operation = None - self.operation_friendly_name = None - self.percent_complete = None - self.server_name = None - self.start_time = None - self.state = None - self.error_code = None - self.error_description = None - self.error_severity = None - self.is_user_error = None - self.estimated_completion_time = None - self.description = None - self.is_cancellable = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup.py b/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup.py deleted file mode 100644 index d0f4b2405507..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup.py +++ /dev/null @@ -1,73 +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 .proxy_resource import ProxyResource - - -class LongTermRetentionBackup(ProxyResource): - """A long term retention backup. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar server_name: The server name that the backup database belong to. - :vartype server_name: str - :ivar server_create_time: The create time of the server. - :vartype server_create_time: datetime - :ivar database_name: The name of the database the backup belong to - :vartype database_name: str - :ivar database_deletion_time: The delete time of the database - :vartype database_deletion_time: datetime - :ivar backup_time: The time the backup was taken - :vartype backup_time: datetime - :ivar backup_expiration_time: The time the long term retention backup will - expire. - :vartype backup_expiration_time: datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'server_name': {'readonly': True}, - 'server_create_time': {'readonly': True}, - 'database_name': {'readonly': True}, - 'database_deletion_time': {'readonly': True}, - 'backup_time': {'readonly': True}, - 'backup_expiration_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'server_name': {'key': 'properties.serverName', 'type': 'str'}, - 'server_create_time': {'key': 'properties.serverCreateTime', 'type': 'iso-8601'}, - 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, - 'database_deletion_time': {'key': 'properties.databaseDeletionTime', 'type': 'iso-8601'}, - 'backup_time': {'key': 'properties.backupTime', 'type': 'iso-8601'}, - 'backup_expiration_time': {'key': 'properties.backupExpirationTime', 'type': 'iso-8601'}, - } - - def __init__(self): - super(LongTermRetentionBackup, self).__init__() - self.server_name = None - self.server_create_time = None - self.database_name = None - self.database_deletion_time = None - self.backup_time = None - self.backup_expiration_time = None 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 b9db1792fcef..b80618b70daf 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 CapabilityStatus(Enum): visible = "Visible" @@ -462,6 +468,16 @@ class VirtualNetworkRuleState(Enum): unknown = "Unknown" +class ManagementOperationState(Enum): + + pending = "Pending" + in_progress = "InProgress" + succeeded = "Succeeded" + failed = "Failed" + cancel_in_progress = "CancelInProgress" + cancelled = "Cancelled" + + class AutomaticTuningServerMode(Enum): custom = "Custom" @@ -480,20 +496,3 @@ class RestorePointType(Enum): continuous = "CONTINUOUS" discrete = "DISCRETE" - - -class ManagementOperationState(Enum): - - pending = "Pending" - in_progress = "InProgress" - succeeded = "Succeeded" - failed = "Failed" - cancel_in_progress = "CancelInProgress" - cancelled = "Cancelled" - - -class LongTermRetentionDatabaseState(Enum): - - all = "All" - live = "Live" - deleted = "Deleted" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index e73ee1288114..59b10b1d495f 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -9,6 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- +from .backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations +from .backup_long_term_retention_vaults_operations import BackupLongTermRetentionVaultsOperations from .recoverable_databases_operations import RecoverableDatabasesOperations from .restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations from .capabilities_operations import CapabilitiesOperations @@ -44,15 +46,14 @@ from .sync_members_operations import SyncMembersOperations from .subscription_usages_operations import SubscriptionUsagesOperations from .virtual_network_rules_operations import VirtualNetworkRulesOperations -from .long_term_retention_backups_operations import LongTermRetentionBackupsOperations -from .backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations +from .database_operations import DatabaseOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations from .restore_points_operations import RestorePointsOperations -from .database_operations import DatabaseOperations -from .elastic_pool_operations import ElasticPoolOperations __all__ = [ + 'BackupLongTermRetentionPoliciesOperations', + 'BackupLongTermRetentionVaultsOperations', 'RecoverableDatabasesOperations', 'RestorableDroppedDatabasesOperations', 'CapabilitiesOperations', @@ -88,11 +89,8 @@ 'SyncMembersOperations', 'SubscriptionUsagesOperations', 'VirtualNetworkRulesOperations', - 'LongTermRetentionBackupsOperations', - 'BackupLongTermRetentionPoliciesOperations', + 'DatabaseOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', 'RestorePointsOperations', - 'DatabaseOperations', - 'ElasticPoolOperations', ] 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 index d9dd54e012d5..ebb3c8ff07f0 100644 --- 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 @@ -25,8 +25,8 @@ class BackupLongTermRetentionPoliciesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar policy_name: The policy name. Should always be Default. Constant value: "default". - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + :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". """ models = models @@ -36,14 +36,14 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.policy_name = "default" - self.api_version = "2017-03-01-preview" + self.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): - """Gets a database's long term retention policy. + """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 @@ -67,11 +67,11 @@ def get( # Construct URL url = self.get.metadata['url'] 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'), - 'policyName': self._serialize.url("self.policy_name", self.policy_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, '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) @@ -108,19 +108,21 @@ def get( return client_raw_response return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}'} def _create_or_update_initial( - self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, state, recovery_services_backup_policy_resource_id, custom_headers=None, raw=False, **operation_config): + parameters = models.BackupLongTermRetentionPolicy(state=state, recovery_services_backup_policy_resource_id=recovery_services_backup_policy_resource_id) + # Construct URL url = self.create_or_update.metadata['url'] 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'), - 'policyName': self._serialize.url("self.policy_name", self.policy_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, '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) @@ -146,7 +148,7 @@ def _create_or_update_initial( response = self._client.send( request, header_parameters, body_content, stream=False, **operation_config) - 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 @@ -155,6 +157,8 @@ def _create_or_update_initial( 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) @@ -163,8 +167,8 @@ def _create_or_update_initial( return deserialized def create_or_update( - self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): - """Sets a database's 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. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -172,10 +176,15 @@ def create_or_update( :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 :type database_name: str - :param parameters: The long term retention policy info. - :type parameters: ~azure.mgmt.sql.models.BackupLongTermRetentionPolicy + :param state: The status of the backup long term retention policy. + Possible values include: 'Disabled', 'Enabled' + :type state: str or + ~azure.mgmt.sql.models.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 @@ -190,7 +199,8 @@ def create_or_update( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, - parameters=parameters, + state=state, + recovery_services_backup_policy_resource_id=recovery_services_backup_policy_resource_id, custom_headers=custom_headers, raw=True, **operation_config @@ -214,7 +224,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 @@ -233,11 +243,11 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}'} def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Gets a database's long term retention policy. + """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 @@ -252,52 +262,60 @@ def list_by_database( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: BackupLongTermRetentionPolicy or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.sql.models.BackupLongTermRetentionPolicy or - ~msrest.pipeline.ClientRawResponse + :return: An iterator like instance of BackupLongTermRetentionPolicy + :rtype: + ~azure.mgmt.sql.models.BackupLongTermRetentionPolicyPaged[~azure.mgmt.sql.models.BackupLongTermRetentionPolicy] :raises: :class:`CloudError` """ - # Construct URL - url = self.list_by_database.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - 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, stream=False, **operation_config) + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_database.metadata['url'] + 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, stream=False, **operation_config) - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + if 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('BackupLongTermRetentionPolicy', response) + # Deserialize response + deserialized = models.BackupLongTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies) if raw: - client_raw_response = ClientRawResponse(deserialized, response) + header_dict = {} + client_raw_response = models.BackupLongTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized 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..cf800d7202bd --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_vaults_operations.py @@ -0,0 +1,306 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError +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 object 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". + """ + + models = models + + 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: BackupLongTermRetentionVault or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.BackupLongTermRetentionVault or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + 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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BackupLongTermRetentionVault', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}'} + + + def _create_or_update_initial( + self, resource_group_name, server_name, recovery_services_vault_resource_id, custom_headers=None, raw=False, **operation_config): + parameters = models.BackupLongTermRetentionVault(recovery_services_vault_resource_id=recovery_services_vault_resource_id) + + # Construct URL + url = self.create_or_update.metadata['url'] + 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 + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + 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 + + 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: An instance of AzureOperationPoller that returns + BackupLongTermRetentionVault or ClientRawResponse if raw=true + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.BackupLongTermRetentionVault] + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + recovery_services_vault_resource_id=recovery_services_vault_resource_id, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **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 = self._deserialize('BackupLongTermRetentionVault', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_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) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}'} + + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Gets server backup long term retention vaults 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`. + :return: An iterator like instance of BackupLongTermRetentionVault + :rtype: + ~azure.mgmt.sql.models.BackupLongTermRetentionVaultPaged[~azure.mgmt.sql.models.BackupLongTermRetentionVault] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_server.metadata['url'] + path_format_arguments = { + '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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.BackupLongTermRetentionVaultPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.BackupLongTermRetentionVaultPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py index c46a648198b9..bce677fff8ee 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py @@ -23,7 +23,7 @@ class DatabaseOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for the request. Constant value: "2017-10-01-preview". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ models = models @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-10-01-preview" + self.api_version = "2017-03-01-preview" self.config = config diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py deleted file mode 100644 index 38c35a868650..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py +++ /dev/null @@ -1,176 +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. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError - -from .. import models - - -class ElasticPoolOperations(object): - """ElasticPoolOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for the request. Constant value: "2017-10-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2017-10-01-preview" - - self.config = config - - def cancel( - self, resource_group_name, server_name, elastic_pool_name, operation_id, custom_headers=None, raw=False, **operation_config): - """Cancels the asynchronous operation on 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 - 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: - :type elastic_pool_name: str - :param operation_id: The operation identifier. - :type operation_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 ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.cancel.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['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.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations/{operationId}/cancel'} - - def list_by_elastic_pool( - self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): - """Gets a list of operations performed on 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 - 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: - :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 ElasticPoolOperation - :rtype: - ~azure.mgmt.sql.models.ElasticPoolOperationPaged[~azure.mgmt.sql.models.ElasticPoolOperation] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_elastic_pool.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serverName': self._serialize.url("server_name", server_name, 'str'), - 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_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, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.ElasticPoolOperationPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ElasticPoolOperationPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_elastic_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py deleted file mode 100644 index d974038867ab..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py +++ /dev/null @@ -1,464 +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. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.exceptions import DeserializationError -from msrestazure.azure_operation import AzureOperationPoller - -from .. import models - - -class LongTermRetentionBackupsOperations(object): - """LongTermRetentionBackupsOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2017-03-01-preview" - - self.config = config - - def get( - self, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, **operation_config): - """Gets a long term retention backup. - - :param location_name: The location of the database. - :type location_name: str - :param long_term_retention_server_name: - :type long_term_retention_server_name: str - :param long_term_retention_database_name: - :type long_term_retention_database_name: str - :param backup_name: The backup name. - :type backup_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: LongTermRetentionBackup or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.LongTermRetentionBackup or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), - 'longTermRetentionDatabaseName': self._serialize.url("long_term_retention_database_name", long_term_retention_database_name, 'str'), - 'backupName': self._serialize.url("backup_name", backup_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, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('LongTermRetentionBackup', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'} - - - def _delete_initial( - self, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), - 'longTermRetentionDatabaseName': self._serialize.url("long_term_retention_database_name", long_term_retention_database_name, 'str'), - 'backupName': self._serialize.url("backup_name", backup_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.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, **operation_config): - """Deletes a long term retention backup. - - :param location_name: The location of the database - :type location_name: str - :param long_term_retention_server_name: - :type long_term_retention_server_name: str - :param long_term_retention_database_name: - :type long_term_retention_database_name: str - :param backup_name: The backup name. - :type backup_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: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - raw_result = self._delete_initial( - location_name=location_name, - long_term_retention_server_name=long_term_retention_server_name, - long_term_retention_database_name=long_term_retention_database_name, - backup_name=backup_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **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 - - 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) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'} - - def list_by_database( - self, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): - """Lists all long term retention backups for a database. - - :param location_name: The location of the database - :type location_name: str - :param long_term_retention_server_name: - :type long_term_retention_server_name: str - :param long_term_retention_database_name: - :type long_term_retention_database_name: str - :param only_latest_per_database: Whether or not to only get the latest - backup for each database. - :type only_latest_per_database: bool - :param database_state: Whether to query against just live databases, - just deleted databases, or all databases. Possible values include: - 'All', 'Live', 'Deleted' - :type database_state: str or - ~azure.mgmt.sql.models.LongTermRetentionDatabaseState - :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 LongTermRetentionBackup - :rtype: - ~azure.mgmt.sql.models.LongTermRetentionBackupPaged[~azure.mgmt.sql.models.LongTermRetentionBackup] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_database.metadata['url'] - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), - 'longTermRetentionDatabaseName': self._serialize.url("long_term_retention_database_name", long_term_retention_database_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if only_latest_per_database is not None: - query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') - if database_state is not None: - query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['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, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups'} - - def list_by_location( - self, location_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): - """Lists the long term retention backups for a given location. - - :param location_name: The location of the database - :type location_name: str - :param only_latest_per_database: Whether or not to only get the latest - backup for each database. - :type only_latest_per_database: bool - :param database_state: Whether to query against just live databases, - just deleted databases, or all databases. Possible values include: - 'All', 'Live', 'Deleted' - :type database_state: str or - ~azure.mgmt.sql.models.LongTermRetentionDatabaseState - :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 LongTermRetentionBackup - :rtype: - ~azure.mgmt.sql.models.LongTermRetentionBackupPaged[~azure.mgmt.sql.models.LongTermRetentionBackup] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_location.metadata['url'] - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if only_latest_per_database is not None: - query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') - if database_state is not None: - query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['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, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups'} - - def list_by_server( - self, location_name, long_term_retention_server_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): - """Lists the long term retention backups for a given server. - - :param location_name: The location of the database - :type location_name: str - :param long_term_retention_server_name: - :type long_term_retention_server_name: str - :param only_latest_per_database: Whether or not to only get the latest - backup for each database. - :type only_latest_per_database: bool - :param database_state: Whether to query against just live databases, - just deleted databases, or all databases. Possible values include: - 'All', 'Live', 'Deleted' - :type database_state: str or - ~azure.mgmt.sql.models.LongTermRetentionDatabaseState - :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 LongTermRetentionBackup - :rtype: - ~azure.mgmt.sql.models.LongTermRetentionBackupPaged[~azure.mgmt.sql.models.LongTermRetentionBackup] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_server.metadata['url'] - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_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 = {} - if only_latest_per_database is not None: - query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') - if database_state is not None: - query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['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, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups'} 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 f028e14bc51e..bbe594e8efec 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -13,6 +13,8 @@ from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION +from .operations.backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations +from .operations.backup_long_term_retention_vaults_operations import BackupLongTermRetentionVaultsOperations from .operations.recoverable_databases_operations import RecoverableDatabasesOperations from .operations.restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations from .operations.capabilities_operations import CapabilitiesOperations @@ -48,13 +50,10 @@ from .operations.sync_members_operations import SyncMembersOperations from .operations.subscription_usages_operations import SubscriptionUsagesOperations from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations -from .operations.long_term_retention_backups_operations import LongTermRetentionBackupsOperations -from .operations.backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations +from .operations.database_operations import DatabaseOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations from .operations.restore_points_operations import RestorePointsOperations -from .operations.database_operations import DatabaseOperations -from .operations.elastic_pool_operations import ElasticPoolOperations from . import models @@ -97,6 +96,10 @@ class SqlManagementClient(object): :ivar config: Configuration for client. :vartype config: SqlManagementClientConfiguration + :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 recoverable_databases: RecoverableDatabases operations :vartype recoverable_databases: azure.mgmt.sql.operations.RecoverableDatabasesOperations :ivar restorable_dropped_databases: RestorableDroppedDatabases operations @@ -167,20 +170,14 @@ class SqlManagementClient(object): :vartype subscription_usages: azure.mgmt.sql.operations.SubscriptionUsagesOperations :ivar virtual_network_rules: VirtualNetworkRules operations :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations - :ivar long_term_retention_backups: LongTermRetentionBackups operations - :vartype long_term_retention_backups: azure.mgmt.sql.operations.LongTermRetentionBackupsOperations - :ivar backup_long_term_retention_policies: BackupLongTermRetentionPolicies operations - :vartype backup_long_term_retention_policies: azure.mgmt.sql.operations.BackupLongTermRetentionPoliciesOperations + :ivar database_operations: DatabaseOperations operations + :vartype database_operations: azure.mgmt.sql.operations.DatabaseOperations :ivar server_automatic_tuning: ServerAutomaticTuning operations :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations :ivar restore_points: RestorePoints operations :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations - :ivar database_operations: DatabaseOperations operations - :vartype database_operations: azure.mgmt.sql.operations.DatabaseOperations - :ivar elastic_pool_operations: ElasticPoolOperations operations - :vartype elastic_pool_operations: azure.mgmt.sql.operations.ElasticPoolOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -201,6 +198,10 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + 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.recoverable_databases = RecoverableDatabasesOperations( self._client, self.config, self._serialize, self._deserialize) self.restorable_dropped_databases = RestorableDroppedDatabasesOperations( @@ -271,9 +272,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.virtual_network_rules = VirtualNetworkRulesOperations( self._client, self.config, self._serialize, self._deserialize) - self.long_term_retention_backups = LongTermRetentionBackupsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.backup_long_term_retention_policies = BackupLongTermRetentionPoliciesOperations( + self.database_operations = DatabaseOperations( self._client, self.config, self._serialize, self._deserialize) self.server_automatic_tuning = ServerAutomaticTuningOperations( self._client, self.config, self._serialize, self._deserialize) @@ -281,7 +280,3 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.restore_points = RestorePointsOperations( self._client, self.config, self._serialize, self._deserialize) - self.database_operations = DatabaseOperations( - self._client, self.config, self._serialize, self._deserialize) - self.elastic_pool_operations = ElasticPoolOperations( - self._client, self.config, self._serialize, self._deserialize) From afeab520f19b8d80063dc6ba24368c628d6cc769 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 21 Mar 2018 13:06:11 -0700 Subject: [PATCH 11/11] [AutoPR sql/resource-manager] [DO NOT MERGE] Sql job agent (#2138) * Generated from 00c10e2add6a8d8d5c0cd8c28f8f6f09a3dde3b8 Merge remote-tracking branch 'azure/master' into sqljobs3 * Generated from a1a2a6257910df295f818dea4002b4c465c11197 Merge remote-tracking branch 'azure/master' into sqljobs3 --- .../azure/mgmt/sql/models/__init__.py | 38 +- .../backup_long_term_retention_policy.py | 42 +- .../backup_long_term_retention_vault.py | 53 -- .../mgmt/sql/models/elastic_pool_operation.py | 114 +++++ ...ged.py => elastic_pool_operation_paged.py} | 8 +- .../sql/models/long_term_retention_backup.py | 73 +++ ...py => long_term_retention_backup_paged.py} | 8 +- .../sql/models/sql_management_client_enums.py | 33 +- .../azure/mgmt/sql/operations/__init__.py | 14 +- ...long_term_retention_policies_operations.py | 138 +++--- ...p_long_term_retention_vaults_operations.py | 306 ------------ .../sql/operations/database_operations.py | 4 +- .../sql/operations/elastic_pool_operations.py | 176 +++++++ .../long_term_retention_backups_operations.py | 461 ++++++++++++++++++ .../azure/mgmt/sql/sql_management_client.py | 33 +- 15 files changed, 980 insertions(+), 521 deletions(-) delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation.py rename azure-mgmt-sql/azure/mgmt/sql/models/{backup_long_term_retention_vault_paged.py => elastic_pool_operation_paged.py} (64%) create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup.py rename azure-mgmt-sql/azure/mgmt/sql/models/{backup_long_term_retention_policy_paged.py => long_term_retention_backup_paged.py} (64%) delete mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_vaults_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index f7da1a4021a9..f23f08c6348d 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -10,10 +10,8 @@ # -------------------------------------------------------------------------- from .resource import Resource -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 .proxy_resource import ProxyResource from .recoverable_database import RecoverableDatabase from .restorable_dropped_database import RestorableDroppedDatabase from .max_size_capability import MaxSizeCapability @@ -92,7 +90,8 @@ from .sync_member import SyncMember from .subscription_usage import SubscriptionUsage from .virtual_network_rule import VirtualNetworkRule -from .database_operation import DatabaseOperation +from .long_term_retention_backup import LongTermRetentionBackup +from .backup_long_term_retention_policy import BackupLongTermRetentionPolicy from .resource_move_definition import ResourceMoveDefinition from .automatic_tuning_server_options import AutomaticTuningServerOptions from .server_automatic_tuning import ServerAutomaticTuning @@ -100,8 +99,8 @@ from .server_dns_alias_acquisition import ServerDnsAliasAcquisition from .restore_point import RestorePoint from .create_database_restore_point_definition import CreateDatabaseRestorePointDefinition -from .backup_long_term_retention_policy_paged import BackupLongTermRetentionPolicyPaged -from .backup_long_term_retention_vault_paged import BackupLongTermRetentionVaultPaged +from .database_operation import DatabaseOperation +from .elastic_pool_operation import ElasticPoolOperation from .recoverable_database_paged import RecoverableDatabasePaged from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .server_paged import ServerPaged @@ -137,11 +136,12 @@ from .sync_member_paged import SyncMemberPaged from .subscription_usage_paged import SubscriptionUsagePaged from .virtual_network_rule_paged import VirtualNetworkRulePaged -from .database_operation_paged import DatabaseOperationPaged +from .long_term_retention_backup_paged import LongTermRetentionBackupPaged from .server_dns_alias_paged import ServerDnsAliasPaged from .restore_point_paged import RestorePointPaged +from .database_operation_paged import DatabaseOperationPaged +from .elastic_pool_operation_paged import ElasticPoolOperationPaged from .sql_management_client_enums import ( - BackupLongTermRetentionPolicyState, CapabilityStatus, MaxSizeUnits, PerformanceLevelUnit, @@ -192,18 +192,17 @@ SyncDirection, SyncMemberState, VirtualNetworkRuleState, - ManagementOperationState, AutomaticTuningServerMode, AutomaticTuningServerReason, RestorePointType, + ManagementOperationState, + DatabaseState, ) __all__ = [ 'Resource', - 'ProxyResource', - 'BackupLongTermRetentionPolicy', - 'BackupLongTermRetentionVault', 'TrackedResource', + 'ProxyResource', 'RecoverableDatabase', 'RestorableDroppedDatabase', 'MaxSizeCapability', @@ -282,7 +281,8 @@ 'SyncMember', 'SubscriptionUsage', 'VirtualNetworkRule', - 'DatabaseOperation', + 'LongTermRetentionBackup', + 'BackupLongTermRetentionPolicy', 'ResourceMoveDefinition', 'AutomaticTuningServerOptions', 'ServerAutomaticTuning', @@ -290,8 +290,8 @@ 'ServerDnsAliasAcquisition', 'RestorePoint', 'CreateDatabaseRestorePointDefinition', - 'BackupLongTermRetentionPolicyPaged', - 'BackupLongTermRetentionVaultPaged', + 'DatabaseOperation', + 'ElasticPoolOperation', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', 'ServerPaged', @@ -327,10 +327,11 @@ 'SyncMemberPaged', 'SubscriptionUsagePaged', 'VirtualNetworkRulePaged', - 'DatabaseOperationPaged', + 'LongTermRetentionBackupPaged', 'ServerDnsAliasPaged', 'RestorePointPaged', - 'BackupLongTermRetentionPolicyState', + 'DatabaseOperationPaged', + 'ElasticPoolOperationPaged', 'CapabilityStatus', 'MaxSizeUnits', 'PerformanceLevelUnit', @@ -381,8 +382,9 @@ 'SyncDirection', 'SyncMemberState', 'VirtualNetworkRuleState', - 'ManagementOperationState', 'AutomaticTuningServerMode', 'AutomaticTuningServerReason', 'RestorePointType', + 'ManagementOperationState', + 'DatabaseState', ] diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy.py b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy.py index 482093d96833..cac3d4046f73 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy.py @@ -13,7 +13,7 @@ class BackupLongTermRetentionPolicy(ProxyResource): - """A backup long term retention policy. + """A long term retention policy. Variables are only populated by the server, and will be ignored when sending a request. @@ -24,37 +24,39 @@ class BackupLongTermRetentionPolicy(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: The geo-location where the resource lives - :vartype location: str - :param state: The status of the backup long term retention policy. - Possible values include: 'Disabled', 'Enabled' - :type state: str or - ~azure.mgmt.sql.models.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 weekly_retention: The weekly retention policy for an LTR backup in + an ISO 8601 format. + :type weekly_retention: str + :param monthly_retention: The montly retention policy for an LTR backup in + an ISO 8601 format. + :type monthly_retention: str + :param yearly_retention: The yearly retention policy for an LTR backup in + an ISO 8601 format. + :type yearly_retention: str + :param week_of_year: The week of year to take the yearly backup in an ISO + 8601 format. + :type week_of_year: int """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'state': {'required': True}, - 'recovery_services_backup_policy_resource_id': {'required': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'BackupLongTermRetentionPolicyState'}, - 'recovery_services_backup_policy_resource_id': {'key': 'properties.recoveryServicesBackupPolicyResourceId', 'type': 'str'}, + 'weekly_retention': {'key': 'properties.weeklyRetention', 'type': 'str'}, + 'monthly_retention': {'key': 'properties.monthlyRetention', 'type': 'str'}, + 'yearly_retention': {'key': 'properties.yearlyRetention', 'type': 'str'}, + 'week_of_year': {'key': 'properties.weekOfYear', 'type': 'int'}, } - def __init__(self, state, recovery_services_backup_policy_resource_id): + def __init__(self, weekly_retention=None, monthly_retention=None, yearly_retention=None, week_of_year=None): super(BackupLongTermRetentionPolicy, self).__init__() - self.location = None - self.state = state - self.recovery_services_backup_policy_resource_id = recovery_services_backup_policy_resource_id + self.weekly_retention = weekly_retention + self.monthly_retention = monthly_retention + self.yearly_retention = yearly_retention + self.week_of_year = week_of_year diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault.py b/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault.py deleted file mode 100644 index c8d4cca98273..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault.py +++ /dev/null @@ -1,53 +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 .proxy_resource import ProxyResource - - -class BackupLongTermRetentionVault(ProxyResource): - """A backup long term retention vault. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar location: The geo-location where the resource lives - :vartype location: str - :param recovery_services_vault_resource_id: The azure recovery services - vault resource id - :type recovery_services_vault_resource_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'recovery_services_vault_resource_id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'recovery_services_vault_resource_id': {'key': 'properties.recoveryServicesVaultResourceId', 'type': 'str'}, - } - - def __init__(self, recovery_services_vault_resource_id): - super(BackupLongTermRetentionVault, self).__init__() - self.location = None - self.recovery_services_vault_resource_id = recovery_services_vault_resource_id diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation.py new file mode 100644 index 000000000000..85bcf3262bee --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation.py @@ -0,0 +1,114 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class ElasticPoolOperation(ProxyResource): + """A elastic pool operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar elastic_pool_name: The name of the elastic pool the operation is + being performed on. + :vartype elastic_pool_name: str + :ivar operation: The name of operation. + :vartype operation: str + :ivar operation_friendly_name: The friendly name of operation. + :vartype operation_friendly_name: str + :ivar percent_complete: The percentage of the operation completed. + :vartype percent_complete: int + :ivar server_name: The name of the server. + :vartype server_name: str + :ivar start_time: The operation start time. + :vartype start_time: datetime + :ivar state: The operation state. + :vartype state: str + :ivar error_code: The operation error code. + :vartype error_code: int + :ivar error_description: The operation error description. + :vartype error_description: str + :ivar error_severity: The operation error severity. + :vartype error_severity: int + :ivar is_user_error: Whether or not the error is a user error. + :vartype is_user_error: bool + :ivar estimated_completion_time: The estimated completion time of the + operation. + :vartype estimated_completion_time: datetime + :ivar description: The operation description. + :vartype description: str + :ivar is_cancellable: Whether the operation can be cancelled. + :vartype is_cancellable: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'elastic_pool_name': {'readonly': True}, + 'operation': {'readonly': True}, + 'operation_friendly_name': {'readonly': True}, + 'percent_complete': {'readonly': True}, + 'server_name': {'readonly': True}, + 'start_time': {'readonly': True}, + 'state': {'readonly': True}, + 'error_code': {'readonly': True}, + 'error_description': {'readonly': True}, + 'error_severity': {'readonly': True}, + 'is_user_error': {'readonly': True}, + 'estimated_completion_time': {'readonly': True}, + 'description': {'readonly': True}, + 'is_cancellable': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'elastic_pool_name': {'key': 'properties.elasticPoolName', 'type': 'str'}, + 'operation': {'key': 'properties.operation', 'type': 'str'}, + 'operation_friendly_name': {'key': 'properties.operationFriendlyName', 'type': 'str'}, + 'percent_complete': {'key': 'properties.percentComplete', 'type': 'int'}, + 'server_name': {'key': 'properties.serverName', 'type': 'str'}, + 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'error_code': {'key': 'properties.errorCode', 'type': 'int'}, + 'error_description': {'key': 'properties.errorDescription', 'type': 'str'}, + 'error_severity': {'key': 'properties.errorSeverity', 'type': 'int'}, + 'is_user_error': {'key': 'properties.isUserError', 'type': 'bool'}, + 'estimated_completion_time': {'key': 'properties.estimatedCompletionTime', 'type': 'iso-8601'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'is_cancellable': {'key': 'properties.isCancellable', 'type': 'bool'}, + } + + def __init__(self): + super(ElasticPoolOperation, self).__init__() + self.elastic_pool_name = None + self.operation = None + self.operation_friendly_name = None + self.percent_complete = None + self.server_name = None + self.start_time = None + self.state = None + self.error_code = None + self.error_description = None + self.error_severity = None + self.is_user_error = None + self.estimated_completion_time = None + self.description = None + self.is_cancellable = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation_paged.py similarity index 64% rename from azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault_paged.py rename to azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation_paged.py index 79b7b79ab289..530637e1479c 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_vault_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_operation_paged.py @@ -12,16 +12,16 @@ from msrest.paging import Paged -class BackupLongTermRetentionVaultPaged(Paged): +class ElasticPoolOperationPaged(Paged): """ - A paging container for iterating over a list of :class:`BackupLongTermRetentionVault ` object + A paging container for iterating over a list of :class:`ElasticPoolOperation ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BackupLongTermRetentionVault]'} + 'current_page': {'key': 'value', 'type': '[ElasticPoolOperation]'} } def __init__(self, *args, **kwargs): - super(BackupLongTermRetentionVaultPaged, self).__init__(*args, **kwargs) + super(ElasticPoolOperationPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup.py b/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup.py new file mode 100644 index 000000000000..d0f4b2405507 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .proxy_resource import ProxyResource + + +class LongTermRetentionBackup(ProxyResource): + """A long term retention backup. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar server_name: The server name that the backup database belong to. + :vartype server_name: str + :ivar server_create_time: The create time of the server. + :vartype server_create_time: datetime + :ivar database_name: The name of the database the backup belong to + :vartype database_name: str + :ivar database_deletion_time: The delete time of the database + :vartype database_deletion_time: datetime + :ivar backup_time: The time the backup was taken + :vartype backup_time: datetime + :ivar backup_expiration_time: The time the long term retention backup will + expire. + :vartype backup_expiration_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'server_name': {'readonly': True}, + 'server_create_time': {'readonly': True}, + 'database_name': {'readonly': True}, + 'database_deletion_time': {'readonly': True}, + 'backup_time': {'readonly': True}, + 'backup_expiration_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'server_name': {'key': 'properties.serverName', 'type': 'str'}, + 'server_create_time': {'key': 'properties.serverCreateTime', 'type': 'iso-8601'}, + 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, + 'database_deletion_time': {'key': 'properties.databaseDeletionTime', 'type': 'iso-8601'}, + 'backup_time': {'key': 'properties.backupTime', 'type': 'iso-8601'}, + 'backup_expiration_time': {'key': 'properties.backupExpirationTime', 'type': 'iso-8601'}, + } + + def __init__(self): + super(LongTermRetentionBackup, self).__init__() + self.server_name = None + self.server_create_time = None + self.database_name = None + self.database_deletion_time = None + self.backup_time = None + self.backup_expiration_time = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup_paged.py similarity index 64% rename from azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy_paged.py rename to azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup_paged.py index 609528d85e94..15e32283bbd7 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/backup_long_term_retention_policy_paged.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/long_term_retention_backup_paged.py @@ -12,16 +12,16 @@ from msrest.paging import Paged -class BackupLongTermRetentionPolicyPaged(Paged): +class LongTermRetentionBackupPaged(Paged): """ - A paging container for iterating over a list of :class:`BackupLongTermRetentionPolicy ` object + A paging container for iterating over a list of :class:`LongTermRetentionBackup ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BackupLongTermRetentionPolicy]'} + 'current_page': {'key': 'value', 'type': '[LongTermRetentionBackup]'} } def __init__(self, *args, **kwargs): - super(BackupLongTermRetentionPolicyPaged, self).__init__(*args, **kwargs) + super(LongTermRetentionBackupPaged, self).__init__(*args, **kwargs) 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 b80618b70daf..70d648eb69d9 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,12 +12,6 @@ from enum import Enum -class BackupLongTermRetentionPolicyState(Enum): - - disabled = "Disabled" - enabled = "Enabled" - - class CapabilityStatus(Enum): visible = "Visible" @@ -468,16 +462,6 @@ class VirtualNetworkRuleState(Enum): unknown = "Unknown" -class ManagementOperationState(Enum): - - pending = "Pending" - in_progress = "InProgress" - succeeded = "Succeeded" - failed = "Failed" - cancel_in_progress = "CancelInProgress" - cancelled = "Cancelled" - - class AutomaticTuningServerMode(Enum): custom = "Custom" @@ -496,3 +480,20 @@ class RestorePointType(Enum): continuous = "CONTINUOUS" discrete = "DISCRETE" + + +class ManagementOperationState(Enum): + + pending = "Pending" + in_progress = "InProgress" + succeeded = "Succeeded" + failed = "Failed" + cancel_in_progress = "CancelInProgress" + cancelled = "Cancelled" + + +class DatabaseState(Enum): + + all = "All" + live = "Live" + deleted = "Deleted" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 59b10b1d495f..e73ee1288114 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -9,8 +9,6 @@ # regenerated. # -------------------------------------------------------------------------- -from .backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations -from .backup_long_term_retention_vaults_operations import BackupLongTermRetentionVaultsOperations from .recoverable_databases_operations import RecoverableDatabasesOperations from .restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations from .capabilities_operations import CapabilitiesOperations @@ -46,14 +44,15 @@ from .sync_members_operations import SyncMembersOperations from .subscription_usages_operations import SubscriptionUsagesOperations from .virtual_network_rules_operations import VirtualNetworkRulesOperations -from .database_operations import DatabaseOperations +from .long_term_retention_backups_operations import LongTermRetentionBackupsOperations +from .backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations from .server_automatic_tuning_operations import ServerAutomaticTuningOperations from .server_dns_aliases_operations import ServerDnsAliasesOperations from .restore_points_operations import RestorePointsOperations +from .database_operations import DatabaseOperations +from .elastic_pool_operations import ElasticPoolOperations __all__ = [ - 'BackupLongTermRetentionPoliciesOperations', - 'BackupLongTermRetentionVaultsOperations', 'RecoverableDatabasesOperations', 'RestorableDroppedDatabasesOperations', 'CapabilitiesOperations', @@ -89,8 +88,11 @@ 'SyncMembersOperations', 'SubscriptionUsagesOperations', 'VirtualNetworkRulesOperations', - 'DatabaseOperations', + 'LongTermRetentionBackupsOperations', + 'BackupLongTermRetentionPoliciesOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', 'RestorePointsOperations', + 'DatabaseOperations', + 'ElasticPoolOperations', ] 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 index ebb3c8ff07f0..d9dd54e012d5 100644 --- 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 @@ -25,8 +25,8 @@ class BackupLongTermRetentionPoliciesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". - :ivar backup_long_term_retention_policy_name: The name of the backup long term retention policy. Constant value: "Default". + :ivar policy_name: The policy name. Should always be Default. Constant value: "default". + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". """ models = models @@ -36,14 +36,14 @@ 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.policy_name = "default" + self.api_version = "2017-03-01-preview" 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. + """Gets a database's long term retention policy. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -67,11 +67,11 @@ def get( # Construct URL url = self.get.metadata['url'] 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') + 'policyName': self._serialize.url("self.policy_name", self.policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -108,21 +108,19 @@ def get( return client_raw_response return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}'} def _create_or_update_initial( - self, resource_group_name, server_name, database_name, state, recovery_services_backup_policy_resource_id, custom_headers=None, raw=False, **operation_config): - parameters = models.BackupLongTermRetentionPolicy(state=state, recovery_services_backup_policy_resource_id=recovery_services_backup_policy_resource_id) - + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create_or_update.metadata['url'] 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') + 'policyName': self._serialize.url("self.policy_name", self.policy_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -148,7 +146,7 @@ def _create_or_update_initial( response = self._client.send( request, header_parameters, body_content, stream=False, **operation_config) - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp @@ -157,8 +155,6 @@ def _create_or_update_initial( 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) @@ -167,8 +163,8 @@ def _create_or_update_initial( 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. + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + """Sets a database's long term retention policy. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -176,15 +172,10 @@ def create_or_update( :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. :type database_name: str - :param state: The status of the backup long term retention policy. - Possible values include: 'Disabled', 'Enabled' - :type state: str or - ~azure.mgmt.sql.models.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 parameters: The long term retention policy info. + :type parameters: ~azure.mgmt.sql.models.BackupLongTermRetentionPolicy :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -199,8 +190,7 @@ def create_or_update( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, - state=state, - recovery_services_backup_policy_resource_id=recovery_services_backup_policy_resource_id, + parameters=parameters, custom_headers=custom_headers, raw=True, **operation_config @@ -224,7 +214,7 @@ def get_long_running_status(status_link, headers=None): def get_long_running_output(response): - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp @@ -243,11 +233,11 @@ def get_long_running_output(response): return AzureOperationPoller( long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}'} def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Returns a database backup long term retention policy. + """Gets a database's long term retention policy. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -262,60 +252,52 @@ def list_by_database( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of BackupLongTermRetentionPolicy - :rtype: - ~azure.mgmt.sql.models.BackupLongTermRetentionPolicyPaged[~azure.mgmt.sql.models.BackupLongTermRetentionPolicy] + :return: BackupLongTermRetentionPolicy or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.BackupLongTermRetentionPolicy or + ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_database.metadata['url'] - path_format_arguments = { - '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, stream=False, **operation_config) + # Construct URL + url = self.list_by_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) - if response.status_code not in [200]: - 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("self.api_version", self.api_version, 'str') - return response + # 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') - # Deserialize response - deserialized = models.BackupLongTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies) + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BackupLongTermRetentionPolicy', response) if raw: - header_dict = {} - client_raw_response = models.BackupLongTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized 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 deleted file mode 100644 index cf800d7202bd..000000000000 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/backup_long_term_retention_vaults_operations.py +++ /dev/null @@ -1,306 +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. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.exceptions import DeserializationError -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 object 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". - """ - - models = models - - 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: BackupLongTermRetentionVault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.sql.models.BackupLongTermRetentionVault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - 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, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('BackupLongTermRetentionVault', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}'} - - - def _create_or_update_initial( - self, resource_group_name, server_name, recovery_services_vault_resource_id, custom_headers=None, raw=False, **operation_config): - parameters = models.BackupLongTermRetentionVault(recovery_services_vault_resource_id=recovery_services_vault_resource_id) - - # Construct URL - url = self.create_or_update.metadata['url'] - 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 - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) - - 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 - - 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: An instance of AzureOperationPoller that returns - BackupLongTermRetentionVault or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.BackupLongTermRetentionVault] - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - server_name=server_name, - recovery_services_vault_resource_id=recovery_services_vault_resource_id, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **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 = self._deserialize('BackupLongTermRetentionVault', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_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) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}'} - - def list_by_server( - self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Gets server backup long term retention vaults 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`. - :return: An iterator like instance of BackupLongTermRetentionVault - :rtype: - ~azure.mgmt.sql.models.BackupLongTermRetentionVaultPaged[~azure.mgmt.sql.models.BackupLongTermRetentionVault] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_server.metadata['url'] - path_format_arguments = { - '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, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.BackupLongTermRetentionVaultPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.BackupLongTermRetentionVaultPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py index bce677fff8ee..c46a648198b9 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/database_operations.py @@ -23,7 +23,7 @@ class DatabaseOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + :ivar api_version: The API version to use for the request. Constant value: "2017-10-01-preview". """ models = models @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-03-01-preview" + self.api_version = "2017-10-01-preview" self.config = config diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py new file mode 100644 index 000000000000..38c35a868650 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pool_operations.py @@ -0,0 +1,176 @@ +# 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 ElasticPoolOperations(object): + """ElasticPoolOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2017-10-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-10-01-preview" + + self.config = config + + def cancel( + self, resource_group_name, server_name, elastic_pool_name, operation_id, custom_headers=None, raw=False, **operation_config): + """Cancels the asynchronous operation on 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 + 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: + :type elastic_pool_name: str + :param operation_id: The operation identifier. + :type operation_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 ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.cancel.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations/{operationId}/cancel'} + + def list_by_elastic_pool( + self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of operations performed on 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 + 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: + :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 ElasticPoolOperation + :rtype: + ~azure.mgmt.sql.models.ElasticPoolOperationPaged[~azure.mgmt.sql.models.ElasticPoolOperation] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_elastic_pool.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ElasticPoolOperationPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ElasticPoolOperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_elastic_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations'} diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py new file mode 100644 index 000000000000..93d77dbad5d2 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py @@ -0,0 +1,461 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError +from msrestazure.azure_operation import AzureOperationPoller + +from .. import models + + +class LongTermRetentionBackupsOperations(object): + """LongTermRetentionBackupsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-03-01-preview" + + self.config = config + + def get( + self, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, **operation_config): + """Gets a long term retention backup. + + :param location_name: The location of the database. + :type location_name: str + :param long_term_retention_server_name: + :type long_term_retention_server_name: str + :param long_term_retention_database_name: + :type long_term_retention_database_name: str + :param backup_name: The backup name. + :type backup_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: LongTermRetentionBackup or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.LongTermRetentionBackup or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), + 'longTermRetentionDatabaseName': self._serialize.url("long_term_retention_database_name", long_term_retention_database_name, 'str'), + 'backupName': self._serialize.url("backup_name", backup_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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LongTermRetentionBackup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'} + + + def _delete_initial( + self, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), + 'longTermRetentionDatabaseName': self._serialize.url("long_term_retention_database_name", long_term_retention_database_name, 'str'), + 'backupName': self._serialize.url("backup_name", backup_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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, **operation_config): + """Deletes a long term retention backup. + + :param location_name: The location of the database + :type location_name: str + :param long_term_retention_server_name: + :type long_term_retention_server_name: str + :param long_term_retention_database_name: + :type long_term_retention_database_name: str + :param backup_name: The backup name. + :type backup_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: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + location_name=location_name, + long_term_retention_server_name=long_term_retention_server_name, + long_term_retention_database_name=long_term_retention_database_name, + backup_name=backup_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **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 + + 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) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'} + + def list_by_database( + self, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists all long term retention backups for a database. + + :param location_name: The location of the database + :type location_name: str + :param long_term_retention_server_name: + :type long_term_retention_server_name: str + :param long_term_retention_database_name: + :type long_term_retention_database_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or ~azure.mgmt.sql.models.DatabaseState + :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 LongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.LongTermRetentionBackupPaged[~azure.mgmt.sql.models.LongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_database.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), + 'longTermRetentionDatabaseName': self._serialize.url("long_term_retention_database_name", long_term_retention_database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups'} + + def list_by_location( + self, location_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists the long term retention backups for a given location. + + :param location_name: The location of the database + :type location_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or ~azure.mgmt.sql.models.DatabaseState + :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 LongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.LongTermRetentionBackupPaged[~azure.mgmt.sql.models.LongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_location.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups'} + + def list_by_server( + self, location_name, long_term_retention_server_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists the long term retention backups for a given server. + + :param location_name: The location of the database + :type location_name: str + :param long_term_retention_server_name: + :type long_term_retention_server_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or ~azure.mgmt.sql.models.DatabaseState + :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 LongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.LongTermRetentionBackupPaged[~azure.mgmt.sql.models.LongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_server.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_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 = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups'} 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 bbe594e8efec..f028e14bc51e 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -13,8 +13,6 @@ from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION -from .operations.backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations -from .operations.backup_long_term_retention_vaults_operations import BackupLongTermRetentionVaultsOperations from .operations.recoverable_databases_operations import RecoverableDatabasesOperations from .operations.restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations from .operations.capabilities_operations import CapabilitiesOperations @@ -50,10 +48,13 @@ from .operations.sync_members_operations import SyncMembersOperations from .operations.subscription_usages_operations import SubscriptionUsagesOperations from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations -from .operations.database_operations import DatabaseOperations +from .operations.long_term_retention_backups_operations import LongTermRetentionBackupsOperations +from .operations.backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations from .operations.server_automatic_tuning_operations import ServerAutomaticTuningOperations from .operations.server_dns_aliases_operations import ServerDnsAliasesOperations from .operations.restore_points_operations import RestorePointsOperations +from .operations.database_operations import DatabaseOperations +from .operations.elastic_pool_operations import ElasticPoolOperations from . import models @@ -96,10 +97,6 @@ class SqlManagementClient(object): :ivar config: Configuration for client. :vartype config: SqlManagementClientConfiguration - :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 recoverable_databases: RecoverableDatabases operations :vartype recoverable_databases: azure.mgmt.sql.operations.RecoverableDatabasesOperations :ivar restorable_dropped_databases: RestorableDroppedDatabases operations @@ -170,14 +167,20 @@ class SqlManagementClient(object): :vartype subscription_usages: azure.mgmt.sql.operations.SubscriptionUsagesOperations :ivar virtual_network_rules: VirtualNetworkRules operations :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations - :ivar database_operations: DatabaseOperations operations - :vartype database_operations: azure.mgmt.sql.operations.DatabaseOperations + :ivar long_term_retention_backups: LongTermRetentionBackups operations + :vartype long_term_retention_backups: azure.mgmt.sql.operations.LongTermRetentionBackupsOperations + :ivar backup_long_term_retention_policies: BackupLongTermRetentionPolicies operations + :vartype backup_long_term_retention_policies: azure.mgmt.sql.operations.BackupLongTermRetentionPoliciesOperations :ivar server_automatic_tuning: ServerAutomaticTuning operations :vartype server_automatic_tuning: azure.mgmt.sql.operations.ServerAutomaticTuningOperations :ivar server_dns_aliases: ServerDnsAliases operations :vartype server_dns_aliases: azure.mgmt.sql.operations.ServerDnsAliasesOperations :ivar restore_points: RestorePoints operations :vartype restore_points: azure.mgmt.sql.operations.RestorePointsOperations + :ivar database_operations: DatabaseOperations operations + :vartype database_operations: azure.mgmt.sql.operations.DatabaseOperations + :ivar elastic_pool_operations: ElasticPoolOperations operations + :vartype elastic_pool_operations: azure.mgmt.sql.operations.ElasticPoolOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -198,10 +201,6 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - 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.recoverable_databases = RecoverableDatabasesOperations( self._client, self.config, self._serialize, self._deserialize) self.restorable_dropped_databases = RestorableDroppedDatabasesOperations( @@ -272,7 +271,9 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.virtual_network_rules = VirtualNetworkRulesOperations( self._client, self.config, self._serialize, self._deserialize) - self.database_operations = DatabaseOperations( + self.long_term_retention_backups = LongTermRetentionBackupsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.backup_long_term_retention_policies = BackupLongTermRetentionPoliciesOperations( self._client, self.config, self._serialize, self._deserialize) self.server_automatic_tuning = ServerAutomaticTuningOperations( self._client, self.config, self._serialize, self._deserialize) @@ -280,3 +281,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.restore_points = RestorePointsOperations( self._client, self.config, self._serialize, self._deserialize) + self.database_operations = DatabaseOperations( + self._client, self.config, self._serialize, self._deserialize) + self.elastic_pool_operations = ElasticPoolOperations( + self._client, self.config, self._serialize, self._deserialize)