diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/_recovery_services_backup_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/_recovery_services_backup_client.py index d8f1cb73fd71..ab66ea4b2f1a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/_recovery_services_backup_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/_recovery_services_backup_client.py @@ -13,14 +13,14 @@ from msrest import Serializer, Deserializer from ._configuration import RecoveryServicesBackupClientConfiguration +from .operations import BackupPoliciesOperations +from .operations import ProtectionPoliciesOperations +from .operations import ProtectionPolicyOperationResultsOperations from .operations import BackupResourceVaultConfigsOperations from .operations import ProtectedItemsOperations from .operations import ProtectedItemOperationResultsOperations from .operations import RecoveryPointsOperations from .operations import RestoresOperations -from .operations import BackupPoliciesOperations -from .operations import ProtectionPoliciesOperations -from .operations import ProtectionPolicyOperationResultsOperations from .operations import BackupJobsOperations from .operations import JobDetailsOperations from .operations import JobCancellationsOperations @@ -60,6 +60,12 @@ class RecoveryServicesBackupClient(SDKClient): :ivar config: Configuration for client. :vartype config: RecoveryServicesBackupClientConfiguration + :ivar backup_policies: BackupPolicies operations + :vartype backup_policies: azure.mgmt.recoveryservicesbackup.operations.BackupPoliciesOperations + :ivar protection_policies: ProtectionPolicies operations + :vartype protection_policies: azure.mgmt.recoveryservicesbackup.operations.ProtectionPoliciesOperations + :ivar protection_policy_operation_results: ProtectionPolicyOperationResults operations + :vartype protection_policy_operation_results: azure.mgmt.recoveryservicesbackup.operations.ProtectionPolicyOperationResultsOperations :ivar backup_resource_vault_configs: BackupResourceVaultConfigs operations :vartype backup_resource_vault_configs: azure.mgmt.recoveryservicesbackup.operations.BackupResourceVaultConfigsOperations :ivar protected_items: ProtectedItems operations @@ -70,12 +76,6 @@ class RecoveryServicesBackupClient(SDKClient): :vartype recovery_points: azure.mgmt.recoveryservicesbackup.operations.RecoveryPointsOperations :ivar restores: Restores operations :vartype restores: azure.mgmt.recoveryservicesbackup.operations.RestoresOperations - :ivar backup_policies: BackupPolicies operations - :vartype backup_policies: azure.mgmt.recoveryservicesbackup.operations.BackupPoliciesOperations - :ivar protection_policies: ProtectionPolicies operations - :vartype protection_policies: azure.mgmt.recoveryservicesbackup.operations.ProtectionPoliciesOperations - :ivar protection_policy_operation_results: ProtectionPolicyOperationResults operations - :vartype protection_policy_operation_results: azure.mgmt.recoveryservicesbackup.operations.ProtectionPolicyOperationResultsOperations :ivar backup_jobs: BackupJobs operations :vartype backup_jobs: azure.mgmt.recoveryservicesbackup.operations.BackupJobsOperations :ivar job_details: JobDetails operations @@ -155,6 +155,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.backup_policies = BackupPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.protection_policies = ProtectionPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.protection_policy_operation_results = ProtectionPolicyOperationResultsOperations( + self._client, self.config, self._serialize, self._deserialize) self.backup_resource_vault_configs = BackupResourceVaultConfigsOperations( self._client, self.config, self._serialize, self._deserialize) self.protected_items = ProtectedItemsOperations( @@ -165,12 +171,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.restores = RestoresOperations( self._client, self.config, self._serialize, self._deserialize) - self.backup_policies = BackupPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) - self.protection_policies = ProtectionPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) - self.protection_policy_operation_results = ProtectionPolicyOperationResultsOperations( - self._client, self.config, self._serialize, self._deserialize) self.backup_jobs = BackupJobsOperations( self._client, self.config, self._serialize, self._deserialize) self.job_details = JobDetailsOperations( diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/__init__.py index 3ae64ab0a5be..af6388d6fdf2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/__init__.py @@ -488,13 +488,20 @@ from ._paged_models import WorkloadItemResourcePaged from ._paged_models import WorkloadProtectableItemResourcePaged from ._recovery_services_backup_client_enums import ( + WorkloadType, + PolicyType, + RetentionDurationType, + DayOfWeek, + RetentionScheduleFormat, + WeekOfMonth, + MonthOfYear, + BackupManagementType, + ScheduleRunType, ProtectionState, HealthStatus, RecoveryType, CopyOptions, RestoreRequestType, - WorkloadType, - PolicyType, JobSupportedAction, ProtectedItemState, LastBackupStatus, @@ -508,22 +515,15 @@ EnhancedSecurityState, SoftDeleteFeatureState, RestorePointQueryType, - RetentionDurationType, RecoveryPointTierType, RecoveryPointTierStatus, - BackupManagementType, JobStatus, JobOperationType, - DayOfWeek, - RetentionScheduleFormat, - WeekOfMonth, - MonthOfYear, MabServerType, HttpStatusCode, DataSourceType, CreateMode, HealthState, - ScheduleRunType, SupportStatus, WorkloadItemType, UsagesUnit, @@ -774,8 +774,8 @@ 'WorkloadProtectableItem', 'WorkloadProtectableItemResource', 'YearlyRetentionSchedule', - 'RecoveryPointResourcePaged', 'ProtectionPolicyResourcePaged', + 'RecoveryPointResourcePaged', 'JobResourcePaged', 'ProtectedItemResourcePaged', 'ProtectionIntentResourcePaged', @@ -786,13 +786,20 @@ 'WorkloadProtectableItemResourcePaged', 'ProtectionContainerResourcePaged', 'ClientDiscoveryValueForSingleApiPaged', + 'WorkloadType', + 'PolicyType', + 'RetentionDurationType', + 'DayOfWeek', + 'RetentionScheduleFormat', + 'WeekOfMonth', + 'MonthOfYear', + 'BackupManagementType', + 'ScheduleRunType', 'ProtectionState', 'HealthStatus', 'RecoveryType', 'CopyOptions', 'RestoreRequestType', - 'WorkloadType', - 'PolicyType', 'JobSupportedAction', 'ProtectedItemState', 'LastBackupStatus', @@ -806,22 +813,15 @@ 'EnhancedSecurityState', 'SoftDeleteFeatureState', 'RestorePointQueryType', - 'RetentionDurationType', 'RecoveryPointTierType', 'RecoveryPointTierStatus', - 'BackupManagementType', 'JobStatus', 'JobOperationType', - 'DayOfWeek', - 'RetentionScheduleFormat', - 'WeekOfMonth', - 'MonthOfYear', 'MabServerType', 'HttpStatusCode', 'DataSourceType', 'CreateMode', 'HealthState', - 'ScheduleRunType', 'SupportStatus', 'WorkloadItemType', 'UsagesUnit', diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_models.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_models.py index 8f6faff98638..5d70b9a2f4da 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_models.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_models.py @@ -847,9 +847,10 @@ class ProtectionPolicy(Model): from this class. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureVmWorkloadProtectionPolicy, - AzureFileShareProtectionPolicy, AzureIaaSVMProtectionPolicy, - AzureSqlProtectionPolicy, GenericProtectionPolicy, MabProtectionPolicy + sub-classes are: AzureFileShareProtectionPolicy, + AzureIaaSVMProtectionPolicy, AzureSqlProtectionPolicy, + AzureVmWorkloadProtectionPolicy, GenericProtectionPolicy, + MabProtectionPolicy All required parameters must be populated in order to send to Azure. @@ -869,7 +870,7 @@ class ProtectionPolicy(Model): } _subtype_map = { - 'backup_management_type': {'AzureWorkload': 'AzureVmWorkloadProtectionPolicy', 'AzureStorage': 'AzureFileShareProtectionPolicy', 'AzureIaasVM': 'AzureIaaSVMProtectionPolicy', 'AzureSql': 'AzureSqlProtectionPolicy', 'GenericProtectionPolicy': 'GenericProtectionPolicy', 'MAB': 'MabProtectionPolicy'} + 'backup_management_type': {'AzureStorage': 'AzureFileShareProtectionPolicy', 'AzureIaasVM': 'AzureIaaSVMProtectionPolicy', 'AzureSql': 'AzureSqlProtectionPolicy', 'AzureWorkload': 'AzureVmWorkloadProtectionPolicy', 'GenericProtectionPolicy': 'GenericProtectionPolicy', 'MAB': 'MabProtectionPolicy'} } def __init__(self, **kwargs): @@ -2176,6 +2177,9 @@ class AzureIaaSVMProtectionPolicy(ProtectionPolicy): :type protected_items_count: int :param backup_management_type: Required. Constant filled by server. :type backup_management_type: str + :param instant_rp_details: + :type instant_rp_details: + ~azure.mgmt.recoveryservicesbackup.models.InstantRPAdditionalDetails :param schedule_policy: Backup schedule specified as part of backup policy. :type schedule_policy: @@ -2199,6 +2203,7 @@ class AzureIaaSVMProtectionPolicy(ProtectionPolicy): _attribute_map = { 'protected_items_count': {'key': 'protectedItemsCount', 'type': 'int'}, 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, + 'instant_rp_details': {'key': 'instantRPDetails', 'type': 'InstantRPAdditionalDetails'}, 'schedule_policy': {'key': 'schedulePolicy', 'type': 'SchedulePolicy'}, 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, 'instant_rp_retention_range_in_days': {'key': 'instantRpRetentionRangeInDays', 'type': 'int'}, @@ -2207,6 +2212,7 @@ class AzureIaaSVMProtectionPolicy(ProtectionPolicy): def __init__(self, **kwargs): super(AzureIaaSVMProtectionPolicy, self).__init__(**kwargs) + self.instant_rp_details = kwargs.get('instant_rp_details', None) self.schedule_policy = kwargs.get('schedule_policy', None) self.retention_policy = kwargs.get('retention_policy', None) self.instant_rp_retention_range_in_days = kwargs.get('instant_rp_retention_range_in_days', None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_models_py3.py index 3d88aadfd7da..0cecb38ef35d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_models_py3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_models_py3.py @@ -847,9 +847,10 @@ class ProtectionPolicy(Model): from this class. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureVmWorkloadProtectionPolicy, - AzureFileShareProtectionPolicy, AzureIaaSVMProtectionPolicy, - AzureSqlProtectionPolicy, GenericProtectionPolicy, MabProtectionPolicy + sub-classes are: AzureFileShareProtectionPolicy, + AzureIaaSVMProtectionPolicy, AzureSqlProtectionPolicy, + AzureVmWorkloadProtectionPolicy, GenericProtectionPolicy, + MabProtectionPolicy All required parameters must be populated in order to send to Azure. @@ -869,7 +870,7 @@ class ProtectionPolicy(Model): } _subtype_map = { - 'backup_management_type': {'AzureWorkload': 'AzureVmWorkloadProtectionPolicy', 'AzureStorage': 'AzureFileShareProtectionPolicy', 'AzureIaasVM': 'AzureIaaSVMProtectionPolicy', 'AzureSql': 'AzureSqlProtectionPolicy', 'GenericProtectionPolicy': 'GenericProtectionPolicy', 'MAB': 'MabProtectionPolicy'} + 'backup_management_type': {'AzureStorage': 'AzureFileShareProtectionPolicy', 'AzureIaasVM': 'AzureIaaSVMProtectionPolicy', 'AzureSql': 'AzureSqlProtectionPolicy', 'AzureWorkload': 'AzureVmWorkloadProtectionPolicy', 'GenericProtectionPolicy': 'GenericProtectionPolicy', 'MAB': 'MabProtectionPolicy'} } def __init__(self, *, protected_items_count: int=None, **kwargs) -> None: @@ -2176,6 +2177,9 @@ class AzureIaaSVMProtectionPolicy(ProtectionPolicy): :type protected_items_count: int :param backup_management_type: Required. Constant filled by server. :type backup_management_type: str + :param instant_rp_details: + :type instant_rp_details: + ~azure.mgmt.recoveryservicesbackup.models.InstantRPAdditionalDetails :param schedule_policy: Backup schedule specified as part of backup policy. :type schedule_policy: @@ -2199,14 +2203,16 @@ class AzureIaaSVMProtectionPolicy(ProtectionPolicy): _attribute_map = { 'protected_items_count': {'key': 'protectedItemsCount', 'type': 'int'}, 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, + 'instant_rp_details': {'key': 'instantRPDetails', 'type': 'InstantRPAdditionalDetails'}, 'schedule_policy': {'key': 'schedulePolicy', 'type': 'SchedulePolicy'}, 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, 'instant_rp_retention_range_in_days': {'key': 'instantRpRetentionRangeInDays', 'type': 'int'}, 'time_zone': {'key': 'timeZone', 'type': 'str'}, } - def __init__(self, *, protected_items_count: int=None, schedule_policy=None, retention_policy=None, instant_rp_retention_range_in_days: int=None, time_zone: str=None, **kwargs) -> None: + def __init__(self, *, protected_items_count: int=None, instant_rp_details=None, schedule_policy=None, retention_policy=None, instant_rp_retention_range_in_days: int=None, time_zone: str=None, **kwargs) -> None: super(AzureIaaSVMProtectionPolicy, self).__init__(protected_items_count=protected_items_count, **kwargs) + self.instant_rp_details = instant_rp_details self.schedule_policy = schedule_policy self.retention_policy = retention_policy self.instant_rp_retention_range_in_days = instant_rp_retention_range_in_days diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_paged_models.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_paged_models.py index 7d41f9f8ebb5..e8fc597f3cb4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_paged_models.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_paged_models.py @@ -12,32 +12,32 @@ from msrest.paging import Paged -class RecoveryPointResourcePaged(Paged): +class ProtectionPolicyResourcePaged(Paged): """ - A paging container for iterating over a list of :class:`RecoveryPointResource ` object + A paging container for iterating over a list of :class:`ProtectionPolicyResource ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[RecoveryPointResource]'} + 'current_page': {'key': 'value', 'type': '[ProtectionPolicyResource]'} } def __init__(self, *args, **kwargs): - super(RecoveryPointResourcePaged, self).__init__(*args, **kwargs) -class ProtectionPolicyResourcePaged(Paged): + super(ProtectionPolicyResourcePaged, self).__init__(*args, **kwargs) +class RecoveryPointResourcePaged(Paged): """ - A paging container for iterating over a list of :class:`ProtectionPolicyResource ` object + A paging container for iterating over a list of :class:`RecoveryPointResource ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ProtectionPolicyResource]'} + 'current_page': {'key': 'value', 'type': '[RecoveryPointResource]'} } def __init__(self, *args, **kwargs): - super(ProtectionPolicyResourcePaged, self).__init__(*args, **kwargs) + super(RecoveryPointResourcePaged, self).__init__(*args, **kwargs) class JobResourcePaged(Paged): """ A paging container for iterating over a list of :class:`JobResource ` object diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_recovery_services_backup_client_enums.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_recovery_services_backup_client_enums.py index ae5858f72a38..0eb8a67c4ae2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_recovery_services_backup_client_enums.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/_recovery_services_backup_client_enums.py @@ -12,6 +12,108 @@ from enum import Enum +class WorkloadType(str, Enum): + + invalid = "Invalid" + vm = "VM" + file_folder = "FileFolder" + azure_sql_db = "AzureSqlDb" + sqldb = "SQLDB" + exchange = "Exchange" + sharepoint = "Sharepoint" + vmware_vm = "VMwareVM" + system_state = "SystemState" + client = "Client" + generic_data_source = "GenericDataSource" + sql_data_base = "SQLDataBase" + azure_file_share = "AzureFileShare" + sap_hana_database = "SAPHanaDatabase" + sap_ase_database = "SAPAseDatabase" + + +class PolicyType(str, Enum): + + invalid = "Invalid" + full = "Full" + differential = "Differential" + log = "Log" + copy_only_full = "CopyOnlyFull" + + +class RetentionDurationType(str, Enum): + + invalid = "Invalid" + days = "Days" + weeks = "Weeks" + months = "Months" + years = "Years" + + +class DayOfWeek(str, Enum): + + sunday = "Sunday" + monday = "Monday" + tuesday = "Tuesday" + wednesday = "Wednesday" + thursday = "Thursday" + friday = "Friday" + saturday = "Saturday" + + +class RetentionScheduleFormat(str, Enum): + + invalid = "Invalid" + daily = "Daily" + weekly = "Weekly" + + +class WeekOfMonth(str, Enum): + + first = "First" + second = "Second" + third = "Third" + fourth = "Fourth" + last = "Last" + invalid = "Invalid" + + +class MonthOfYear(str, Enum): + + invalid = "Invalid" + january = "January" + february = "February" + march = "March" + april = "April" + may = "May" + june = "June" + july = "July" + august = "August" + september = "September" + october = "October" + november = "November" + december = "December" + + +class BackupManagementType(str, Enum): + + invalid = "Invalid" + azure_iaas_vm = "AzureIaasVM" + mab = "MAB" + dpm = "DPM" + azure_backup_server = "AzureBackupServer" + azure_sql = "AzureSql" + azure_storage = "AzureStorage" + azure_workload = "AzureWorkload" + default_backup = "DefaultBackup" + + +class ScheduleRunType(str, Enum): + + invalid = "Invalid" + daily = "Daily" + weekly = "Weekly" + + class ProtectionState(str, Enum): invalid = "Invalid" @@ -55,34 +157,6 @@ class RestoreRequestType(str, Enum): item_level_restore = "ItemLevelRestore" -class WorkloadType(str, Enum): - - invalid = "Invalid" - vm = "VM" - file_folder = "FileFolder" - azure_sql_db = "AzureSqlDb" - sqldb = "SQLDB" - exchange = "Exchange" - sharepoint = "Sharepoint" - vmware_vm = "VMwareVM" - system_state = "SystemState" - client = "Client" - generic_data_source = "GenericDataSource" - sql_data_base = "SQLDataBase" - azure_file_share = "AzureFileShare" - sap_hana_database = "SAPHanaDatabase" - sap_ase_database = "SAPAseDatabase" - - -class PolicyType(str, Enum): - - invalid = "Invalid" - full = "Full" - differential = "Differential" - log = "Log" - copy_only_full = "CopyOnlyFull" - - class JobSupportedAction(str, Enum): invalid = "Invalid" @@ -184,15 +258,6 @@ class RestorePointQueryType(str, Enum): all = "All" -class RetentionDurationType(str, Enum): - - invalid = "Invalid" - days = "Days" - weeks = "Weeks" - months = "Months" - years = "Years" - - class RecoveryPointTierType(str, Enum): invalid = "Invalid" @@ -208,19 +273,6 @@ class RecoveryPointTierStatus(str, Enum): deleted = "Deleted" -class BackupManagementType(str, Enum): - - invalid = "Invalid" - azure_iaas_vm = "AzureIaasVM" - mab = "MAB" - dpm = "DPM" - azure_backup_server = "AzureBackupServer" - azure_sql = "AzureSql" - azure_storage = "AzureStorage" - azure_workload = "AzureWorkload" - default_backup = "DefaultBackup" - - class JobStatus(str, Enum): invalid = "Invalid" @@ -246,51 +298,6 @@ class JobOperationType(str, Enum): undelete = "Undelete" -class DayOfWeek(str, Enum): - - sunday = "Sunday" - monday = "Monday" - tuesday = "Tuesday" - wednesday = "Wednesday" - thursday = "Thursday" - friday = "Friday" - saturday = "Saturday" - - -class RetentionScheduleFormat(str, Enum): - - invalid = "Invalid" - daily = "Daily" - weekly = "Weekly" - - -class WeekOfMonth(str, Enum): - - first = "First" - second = "Second" - third = "Third" - fourth = "Fourth" - last = "Last" - invalid = "Invalid" - - -class MonthOfYear(str, Enum): - - invalid = "Invalid" - january = "January" - february = "February" - march = "March" - april = "April" - may = "May" - june = "June" - july = "July" - august = "August" - september = "September" - october = "October" - november = "November" - december = "December" - - class MabServerType(str, Enum): invalid = "Invalid" @@ -395,13 +402,6 @@ class HealthState(str, Enum): invalid = "Invalid" -class ScheduleRunType(str, Enum): - - invalid = "Invalid" - daily = "Daily" - weekly = "Weekly" - - class SupportStatus(str, Enum): invalid = "Invalid" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/__init__.py index 111256c5d919..52970257bdc4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/__init__.py @@ -9,14 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- +from ._backup_policies_operations import BackupPoliciesOperations +from ._protection_policies_operations import ProtectionPoliciesOperations +from ._protection_policy_operation_results_operations import ProtectionPolicyOperationResultsOperations from ._backup_resource_vault_configs_operations import BackupResourceVaultConfigsOperations from ._protected_items_operations import ProtectedItemsOperations from ._protected_item_operation_results_operations import ProtectedItemOperationResultsOperations from ._recovery_points_operations import RecoveryPointsOperations from ._restores_operations import RestoresOperations -from ._backup_policies_operations import BackupPoliciesOperations -from ._protection_policies_operations import ProtectionPoliciesOperations -from ._protection_policy_operation_results_operations import ProtectionPolicyOperationResultsOperations from ._backup_jobs_operations import BackupJobsOperations from ._job_details_operations import JobDetailsOperations from ._job_cancellations_operations import JobCancellationsOperations @@ -49,14 +49,14 @@ from ._operations import Operations __all__ = [ + 'BackupPoliciesOperations', + 'ProtectionPoliciesOperations', + 'ProtectionPolicyOperationResultsOperations', 'BackupResourceVaultConfigsOperations', 'ProtectedItemsOperations', 'ProtectedItemOperationResultsOperations', 'RecoveryPointsOperations', 'RestoresOperations', - 'BackupPoliciesOperations', - 'ProtectionPoliciesOperations', - 'ProtectionPolicyOperationResultsOperations', 'BackupJobsOperations', 'JobDetailsOperations', 'JobCancellationsOperations', diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/_backup_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/_backup_policies_operations.py index b85b14f06bd1..07fe639855e3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/_backup_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/_backup_policies_operations.py @@ -25,7 +25,7 @@ class BackupPoliciesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-05-13". + :ivar api_version: Client Api Version. Constant value: "2019-06-15". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-05-13" + self.api_version = "2019-06-15" self.config = config diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/_protection_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/_protection_policies_operations.py index 4bab40f40828..7a6b4ba5172b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/_protection_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/_protection_policies_operations.py @@ -12,6 +12,8 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling from .. import models @@ -25,6 +27,7 @@ class ProtectionPoliciesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-06-15". """ models = models @@ -34,6 +37,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer + self.api_version = "2019-06-15" self.config = config @@ -62,8 +66,6 @@ def get( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - api_version = "2019-05-13" - # Construct URL url = self.get.metadata['url'] path_format_arguments = { @@ -76,7 +78,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -108,35 +110,9 @@ def get( return deserialized get.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}'} - def create_or_update( - self, vault_name, resource_group_name, policy_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates or modifies a backup policy. This is an asynchronous operation. - Status of the operation can be fetched - using GetPolicyOperationResult API. - - :param vault_name: The name of the recovery services vault. - :type vault_name: str - :param resource_group_name: The name of the resource group where the - recovery services vault is present. - :type resource_group_name: str - :param policy_name: Backup policy to be created. - :type policy_name: str - :param parameters: resource backup policy - :type parameters: - ~azure.mgmt.recoveryservicesbackup.models.ProtectionPolicyResource - :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: ProtectionPolicyResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.recoveryservicesbackup.models.ProtectionPolicyResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - api_version = "2019-05-13" + def _create_or_update_initial( + self, vault_name, resource_group_name, policy_name, parameters, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { @@ -149,7 +125,7 @@ def create_or_update( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -175,6 +151,7 @@ def create_or_update( raise exp deserialized = None + if response.status_code == 200: deserialized = self._deserialize('ProtectionPolicyResource', response) @@ -183,6 +160,63 @@ def create_or_update( return client_raw_response return deserialized + + def create_or_update( + self, vault_name, resource_group_name, policy_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or modifies a backup policy. This is an asynchronous operation. + Status of the operation can be fetched + using GetPolicyOperationResult API. + + :param vault_name: The name of the recovery services vault. + :type vault_name: str + :param resource_group_name: The name of the resource group where the + recovery services vault is present. + :type resource_group_name: str + :param policy_name: Backup policy to be created. + :type policy_name: str + :param parameters: resource backup policy + :type parameters: + ~azure.mgmt.recoveryservicesbackup.models.ProtectionPolicyResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ProtectionPolicyResource or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.recoveryservicesbackup.models.ProtectionPolicyResource] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.recoveryservicesbackup.models.ProtectionPolicyResource]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + vault_name=vault_name, + resource_group_name=resource_group_name, + policy_name=policy_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ProtectionPolicyResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) create_or_update.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}'} def delete( @@ -207,8 +241,6 @@ def delete( :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - api_version = "2016-12-01" - # Construct URL url = self.delete.metadata['url'] path_format_arguments = { @@ -221,7 +253,7 @@ def delete( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/_protection_policy_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/_protection_policy_operation_results_operations.py index d20d9cfaf569..a1ea10b68c6f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/_protection_policy_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/_protection_policy_operation_results_operations.py @@ -25,7 +25,7 @@ class ProtectionPolicyOperationResultsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-05-13". + :ivar api_version: Client Api Version. Constant value: "2019-06-15". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-05-13" + self.api_version = "2019-06-15" self.config = config