Skip to content

Commit 51049f5

Browse files
authored
[KeyVault] Add Status Methods to Query Backup and Restore Operations (#14158)
* Add backup/restore status methods to KeyVaultBackupClient
1 parent a77fbd6 commit 51049f5

8 files changed

+1077
-287
lines changed

sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_backup_client.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,35 @@ def begin_selective_restore(self, blob_storage_uri, sas_token, folder_name, key_
9393
polling=LROBasePolling(lro_algorithms=[KeyVaultBackupClientPolling()], timeout=polling_interval, **kwargs),
9494
**kwargs
9595
)
96+
97+
def get_backup_status(self, job_id, **kwargs):
98+
# type: (str, **Any) -> BackupOperation
99+
"""Returns the status of a full backup operation.
100+
101+
:param job_id: The job ID returned as part of the backup request
102+
:type job_id: str
103+
:return: The full backup operation status as a :class:`BackupOperation`
104+
:rtype: BackupOperation
105+
"""
106+
return self._client.full_backup_status(
107+
vault_base_url=self._vault_url,
108+
job_id=job_id,
109+
cls=BackupOperation._wrap_generated,
110+
**kwargs
111+
)
112+
113+
def get_restore_status(self, job_id, **kwargs):
114+
# type: (str, **Any) -> RestoreOperation
115+
"""Returns the status of a restore operation.
116+
117+
:param job_id: The job ID returned as part of the restore request
118+
:type job_id: str
119+
:return: The restore operation status as a :class:`RestoreOperation`
120+
:rtype: RestoreOperation
121+
"""
122+
return self._client.restore_status(
123+
vault_base_url=self.vault_url,
124+
job_id=job_id,
125+
cls=RestoreOperation._wrap_generated,
126+
**kwargs
127+
)

sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/aio/_backup_client.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,35 @@ async def begin_selective_restore(
102102
),
103103
**kwargs
104104
)
105+
106+
async def get_backup_status(
107+
self, job_id: str, **kwargs: "Any"
108+
) -> "BackupOperation":
109+
"""Returns the status of a full backup operation.
110+
111+
:param str job_id: The job ID returned as part of the backup request
112+
:returns: The full backup operation status as a :class:`BackupOperation`
113+
:rtype: BackupOperation
114+
"""
115+
return await self._client.full_backup_status(
116+
vault_base_url=self._vault_url,
117+
job_id=job_id,
118+
cls=BackupOperation._wrap_generated,
119+
**kwargs
120+
)
121+
122+
async def get_restore_status(
123+
self, job_id: str, **kwargs: "Any"
124+
) -> "RestoreOperation":
125+
"""Returns the status of a restore operation.
126+
127+
:param str job_id: The ID returned as part of the restore request
128+
:returns: The restore operation status as a :class:`RestoreOperation`
129+
:rtype: RestoreOperation
130+
"""
131+
return await self._client.restore_status(
132+
vault_base_url=self._vault_url,
133+
job_id=job_id,
134+
cls=RestoreOperation._wrap_generated,
135+
**kwargs
136+
)

0 commit comments

Comments
 (0)