Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
update-testcase
  • Loading branch information
ChenxiJiang333 committed Nov 4, 2024
commit 61c900c79b0d5e0a60f657f15e2eae24609a3249
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from azure.identity import DefaultAzureCredential

from azure.mgmt.sql import SqlManagementClient

"""
# PREREQUISITES
pip install azure-identity
Expand All @@ -21,21 +22,24 @@
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""


def main():
client = SqlManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-1111-2222-3333-444444444444",
)

response = client.managed_backup_short_term_retention_policies.begin_update(
resource_group_name='resourceGroup',
managed_instance_name='testsvr',
database_name='testdb',
policy_name='default',
parameters={'properties': {'retentionDays': 14}},
resource_group_name="resourceGroup",
managed_instance_name="testsvr",
database_name="testdb",
policy_name="default",
parameters={"properties": {"retentionDays": 14}},
).result()
print(response)


# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicy.json
if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from azure.identity import DefaultAzureCredential

from azure.mgmt.sql import SqlManagementClient

"""
# PREREQUISITES
pip install azure-identity
Expand All @@ -21,21 +22,24 @@
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""


def main():
client = SqlManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-1111-2222-3333-444444444444",
)

response = client.managed_restorable_dropped_database_backup_short_term_retention_policies.begin_update(
resource_group_name='resourceGroup',
managed_instance_name='testsvr',
restorable_dropped_database_id='testdb,131403269876900000',
policy_name='default',
parameters={'properties': {'retentionDays': 14}},
resource_group_name="resourceGroup",
managed_instance_name="testsvr",
restorable_dropped_database_id="testdb,131403269876900000",
policy_name="default",
parameters={"properties": {"retentionDays": 14}},
).result()
print(response)


# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicyRestorableDropped.json
if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from azure.identity import DefaultAzureCredential

from azure.mgmt.sql import SqlManagementClient

"""
# PREREQUISITES
pip install azure-identity
Expand All @@ -21,21 +22,24 @@
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""


def main():
client = SqlManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-1111-2222-3333-444444444444",
)

response = client.backup_short_term_retention_policies.begin_update(
resource_group_name='resourceGroup',
server_name='testsvr',
database_name='testdb',
policy_name='default',
parameters={'properties': {'diffBackupIntervalInHours': 24, 'retentionDays': 7}},
resource_group_name="resourceGroup",
server_name="testsvr",
database_name="testdb",
policy_name="default",
parameters={"properties": {"diffBackupIntervalInHours": 24, "retentionDays": 7}},
).result()
print(response)


# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/UpdateShortTermRetentionPolicy.json
if __name__ == "__main__":
main()