Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR azure-mgmt-sql] Add V2020-02-02-Preview ShortTermRetention API Specification of SQL DB #1031

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_sql_management_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
from .operations import ManagedDatabaseVulnerabilityAssessmentScansOperations
from .operations import ManagedDatabaseVulnerabilityAssessmentsOperations
from .operations import InstanceFailoverGroupsOperations
from .operations import BackupShortTermRetentionPoliciesOperations
from .operations import TdeCertificatesOperations
from .operations import ManagedInstanceTdeCertificatesOperations
from .operations import ManagedInstanceKeysOperations
Expand All @@ -102,6 +101,7 @@
from .operations import SyncGroupsOperations
from .operations import SyncMembersOperations
from .operations import ManagedInstancesOperations
from .operations import BackupShortTermRetentionPoliciesOperations
from .operations import ManagedDatabaseRestoreDetailsOperations
from .operations import ManagedDatabasesOperations
from .operations import ServerAzureADOnlyAuthenticationsOperations
Expand Down Expand Up @@ -244,8 +244,6 @@ class SqlManagementClient(SDKClient):
:vartype managed_database_vulnerability_assessments: azure.mgmt.sql.operations.ManagedDatabaseVulnerabilityAssessmentsOperations
:ivar instance_failover_groups: InstanceFailoverGroups operations
:vartype instance_failover_groups: azure.mgmt.sql.operations.InstanceFailoverGroupsOperations
:ivar backup_short_term_retention_policies: BackupShortTermRetentionPolicies operations
:vartype backup_short_term_retention_policies: azure.mgmt.sql.operations.BackupShortTermRetentionPoliciesOperations
:ivar tde_certificates: TdeCertificates operations
:vartype tde_certificates: azure.mgmt.sql.operations.TdeCertificatesOperations
:ivar managed_instance_tde_certificates: ManagedInstanceTdeCertificates operations
Expand Down Expand Up @@ -292,6 +290,8 @@ class SqlManagementClient(SDKClient):
:vartype sync_members: azure.mgmt.sql.operations.SyncMembersOperations
:ivar managed_instances: ManagedInstances operations
:vartype managed_instances: azure.mgmt.sql.operations.ManagedInstancesOperations
:ivar backup_short_term_retention_policies: BackupShortTermRetentionPolicies operations
:vartype backup_short_term_retention_policies: azure.mgmt.sql.operations.BackupShortTermRetentionPoliciesOperations
:ivar managed_database_restore_details: ManagedDatabaseRestoreDetails operations
:vartype managed_database_restore_details: azure.mgmt.sql.operations.ManagedDatabaseRestoreDetailsOperations
:ivar managed_databases: ManagedDatabases operations
Expand Down Expand Up @@ -448,8 +448,6 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.instance_failover_groups = InstanceFailoverGroupsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.backup_short_term_retention_policies = BackupShortTermRetentionPoliciesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.tde_certificates = TdeCertificatesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.managed_instance_tde_certificates = ManagedInstanceTdeCertificatesOperations(
Expand Down Expand Up @@ -496,6 +494,8 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.managed_instances = ManagedInstancesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.backup_short_term_retention_policies = BackupShortTermRetentionPoliciesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.managed_database_restore_details = ManagedDatabaseRestoreDetailsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.managed_databases = ManagedDatabasesOperations(
Expand Down
2 changes: 1 addition & 1 deletion sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,6 @@
'ElasticPoolOperationPaged',
'VulnerabilityAssessmentScanRecordPaged',
'InstanceFailoverGroupPaged',
'BackupShortTermRetentionPolicyPaged',
'ManagedInstanceKeyPaged',
'ManagedInstanceEncryptionProtectorPaged',
'RecoverableManagedDatabasePaged',
Expand All @@ -816,6 +815,7 @@
'SyncGroupPaged',
'SyncMemberPaged',
'ManagedInstancePaged',
'BackupShortTermRetentionPolicyPaged',
'ManagedDatabasePaged',
'ServerAzureADOnlyAuthenticationPaged',
'ServerConnectionType',
Expand Down
7 changes: 7 additions & 0 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ class BackupShortTermRetentionPolicy(ProxyResource):
:param retention_days: The backup retention period in days. This is how
many days Point-in-Time Restore will be supported.
:type retention_days: int
:param diff_backup_interval_in_hours: The differential backup interval in
hours. This is how many interval hours between each differential backup
will be supported. This is only applicable to live databases but not
dropped databases.
:type diff_backup_interval_in_hours: int
"""

_validation = {
Expand All @@ -293,11 +298,13 @@ class BackupShortTermRetentionPolicy(ProxyResource):
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'retention_days': {'key': 'properties.retentionDays', 'type': 'int'},
'diff_backup_interval_in_hours': {'key': 'properties.diffBackupIntervalInHours', 'type': 'int'},
}

def __init__(self, **kwargs):
super(BackupShortTermRetentionPolicy, self).__init__(**kwargs)
self.retention_days = kwargs.get('retention_days', None)
self.diff_backup_interval_in_hours = kwargs.get('diff_backup_interval_in_hours', None)


class CheckNameAvailabilityRequest(Model):
Expand Down
9 changes: 8 additions & 1 deletion sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ class BackupShortTermRetentionPolicy(ProxyResource):
:param retention_days: The backup retention period in days. This is how
many days Point-in-Time Restore will be supported.
:type retention_days: int
:param diff_backup_interval_in_hours: The differential backup interval in
hours. This is how many interval hours between each differential backup
will be supported. This is only applicable to live databases but not
dropped databases.
:type diff_backup_interval_in_hours: int
"""

_validation = {
Expand All @@ -293,11 +298,13 @@ class BackupShortTermRetentionPolicy(ProxyResource):
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'retention_days': {'key': 'properties.retentionDays', 'type': 'int'},
'diff_backup_interval_in_hours': {'key': 'properties.diffBackupIntervalInHours', 'type': 'int'},
}

def __init__(self, *, retention_days: int=None, **kwargs) -> None:
def __init__(self, *, retention_days: int=None, diff_backup_interval_in_hours: int=None, **kwargs) -> None:
super(BackupShortTermRetentionPolicy, self).__init__(**kwargs)
self.retention_days = retention_days
self.diff_backup_interval_in_hours = diff_backup_interval_in_hours


class CheckNameAvailabilityRequest(Model):
Expand Down
26 changes: 13 additions & 13 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,19 +727,6 @@ class InstanceFailoverGroupPaged(Paged):
def __init__(self, *args, **kwargs):

super(InstanceFailoverGroupPaged, self).__init__(*args, **kwargs)
class BackupShortTermRetentionPolicyPaged(Paged):
"""
A paging container for iterating over a list of :class:`BackupShortTermRetentionPolicy <azure.mgmt.sql.models.BackupShortTermRetentionPolicy>` object
"""

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

def __init__(self, *args, **kwargs):

super(BackupShortTermRetentionPolicyPaged, self).__init__(*args, **kwargs)
class ManagedInstanceKeyPaged(Paged):
"""
A paging container for iterating over a list of :class:`ManagedInstanceKey <azure.mgmt.sql.models.ManagedInstanceKey>` object
Expand Down Expand Up @@ -1026,6 +1013,19 @@ class ManagedInstancePaged(Paged):
def __init__(self, *args, **kwargs):

super(ManagedInstancePaged, self).__init__(*args, **kwargs)
class BackupShortTermRetentionPolicyPaged(Paged):
"""
A paging container for iterating over a list of :class:`BackupShortTermRetentionPolicy <azure.mgmt.sql.models.BackupShortTermRetentionPolicy>` object
"""

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

def __init__(self, *args, **kwargs):

super(BackupShortTermRetentionPolicyPaged, self).__init__(*args, **kwargs)
class ManagedDatabasePaged(Paged):
"""
A paging container for iterating over a list of :class:`ManagedDatabase <azure.mgmt.sql.models.ManagedDatabase>` object
Expand Down
4 changes: 2 additions & 2 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
from ._managed_database_vulnerability_assessment_scans_operations import ManagedDatabaseVulnerabilityAssessmentScansOperations
from ._managed_database_vulnerability_assessments_operations import ManagedDatabaseVulnerabilityAssessmentsOperations
from ._instance_failover_groups_operations import InstanceFailoverGroupsOperations
from ._backup_short_term_retention_policies_operations import BackupShortTermRetentionPoliciesOperations
from ._tde_certificates_operations import TdeCertificatesOperations
from ._managed_instance_tde_certificates_operations import ManagedInstanceTdeCertificatesOperations
from ._managed_instance_keys_operations import ManagedInstanceKeysOperations
Expand All @@ -98,6 +97,7 @@
from ._sync_groups_operations import SyncGroupsOperations
from ._sync_members_operations import SyncMembersOperations
from ._managed_instances_operations import ManagedInstancesOperations
from ._backup_short_term_retention_policies_operations import BackupShortTermRetentionPoliciesOperations
from ._managed_database_restore_details_operations import ManagedDatabaseRestoreDetailsOperations
from ._managed_databases_operations import ManagedDatabasesOperations
from ._server_azure_ad_only_authentications_operations import ServerAzureADOnlyAuthenticationsOperations
Expand Down Expand Up @@ -168,7 +168,6 @@
'ManagedDatabaseVulnerabilityAssessmentScansOperations',
'ManagedDatabaseVulnerabilityAssessmentsOperations',
'InstanceFailoverGroupsOperations',
'BackupShortTermRetentionPoliciesOperations',
'TdeCertificatesOperations',
'ManagedInstanceTdeCertificatesOperations',
'ManagedInstanceKeysOperations',
Expand All @@ -192,6 +191,7 @@
'SyncGroupsOperations',
'SyncMembersOperations',
'ManagedInstancesOperations',
'BackupShortTermRetentionPoliciesOperations',
'ManagedDatabaseRestoreDetailsOperations',
'ManagedDatabasesOperations',
'ServerAzureADOnlyAuthenticationsOperations',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class BackupShortTermRetentionPoliciesOperations(object):
: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-10-01-preview".
:ivar api_version: The API version to use for the request. Constant value: "2020-02-02-preview".
"""

models = models
Expand All @@ -39,7 +39,7 @@ def __init__(self, client, config, serializer, deserializer):
self._serialize = serializer
self._deserialize = deserializer
self.policy_name = "default"
self.api_version = "2017-10-01-preview"
self.api_version = "2020-02-02-preview"

self.config = config

Expand Down Expand Up @@ -113,8 +113,8 @@ def get(


def _create_or_update_initial(
self, resource_group_name, server_name, database_name, retention_days=None, custom_headers=None, raw=False, **operation_config):
parameters = models.BackupShortTermRetentionPolicy(retention_days=retention_days)
self, resource_group_name, server_name, database_name, retention_days=None, diff_backup_interval_in_hours=None, custom_headers=None, raw=False, **operation_config):
parameters = models.BackupShortTermRetentionPolicy(retention_days=retention_days, diff_backup_interval_in_hours=diff_backup_interval_in_hours)

# Construct URL
url = self.create_or_update.metadata['url']
Expand Down Expand Up @@ -166,7 +166,7 @@ def _create_or_update_initial(
return deserialized

def create_or_update(
self, resource_group_name, server_name, database_name, retention_days=None, custom_headers=None, raw=False, polling=True, **operation_config):
self, resource_group_name, server_name, database_name, retention_days=None, diff_backup_interval_in_hours=None, custom_headers=None, raw=False, polling=True, **operation_config):
"""Updates a database's short term retention policy.

:param resource_group_name: The name of the resource group that
Expand All @@ -180,6 +180,11 @@ def create_or_update(
:param retention_days: The backup retention period in days. This is
how many days Point-in-Time Restore will be supported.
:type retention_days: int
:param diff_backup_interval_in_hours: The differential backup interval
in hours. This is how many interval hours between each differential
backup will be supported. This is only applicable to live databases
but not dropped databases.
:type diff_backup_interval_in_hours: int
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
Expand All @@ -199,6 +204,7 @@ def create_or_update(
server_name=server_name,
database_name=database_name,
retention_days=retention_days,
diff_backup_interval_in_hours=diff_backup_interval_in_hours,
custom_headers=custom_headers,
raw=True,
**operation_config
Expand All @@ -224,8 +230,8 @@ def get_long_running_output(response):


def _update_initial(
self, resource_group_name, server_name, database_name, retention_days=None, custom_headers=None, raw=False, **operation_config):
parameters = models.BackupShortTermRetentionPolicy(retention_days=retention_days)
self, resource_group_name, server_name, database_name, retention_days=None, diff_backup_interval_in_hours=None, custom_headers=None, raw=False, **operation_config):
parameters = models.BackupShortTermRetentionPolicy(retention_days=retention_days, diff_backup_interval_in_hours=diff_backup_interval_in_hours)

# Construct URL
url = self.update.metadata['url']
Expand Down Expand Up @@ -277,7 +283,7 @@ def _update_initial(
return deserialized

def update(
self, resource_group_name, server_name, database_name, retention_days=None, custom_headers=None, raw=False, polling=True, **operation_config):
self, resource_group_name, server_name, database_name, retention_days=None, diff_backup_interval_in_hours=None, custom_headers=None, raw=False, polling=True, **operation_config):
"""Updates a database's short term retention policy.

:param resource_group_name: The name of the resource group that
Expand All @@ -291,6 +297,11 @@ def update(
:param retention_days: The backup retention period in days. This is
how many days Point-in-Time Restore will be supported.
:type retention_days: int
:param diff_backup_interval_in_hours: The differential backup interval
in hours. This is how many interval hours between each differential
backup will be supported. This is only applicable to live databases
but not dropped databases.
:type diff_backup_interval_in_hours: int
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
Expand All @@ -310,6 +321,7 @@ def update(
server_name=server_name,
database_name=database_name,
retention_days=retention_days,
diff_backup_interval_in_hours=diff_backup_interval_in_hours,
custom_headers=custom_headers,
raw=True,
**operation_config
Expand Down