Skip to content

Commit

Permalink
[KeyVault] Add Status Methods to Query Backup and Restore Operations (#…
Browse files Browse the repository at this point in the history
…14158)

* Add backup/restore status methods to KeyVaultBackupClient
  • Loading branch information
mccoyp authored Oct 2, 2020
1 parent a77fbd6 commit 51049f5
Show file tree
Hide file tree
Showing 8 changed files with 1,077 additions and 287 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,35 @@ def begin_selective_restore(self, blob_storage_uri, sas_token, folder_name, key_
polling=LROBasePolling(lro_algorithms=[KeyVaultBackupClientPolling()], timeout=polling_interval, **kwargs),
**kwargs
)

def get_backup_status(self, job_id, **kwargs):
# type: (str, **Any) -> BackupOperation
"""Returns the status of a full backup operation.
:param job_id: The job ID returned as part of the backup request
:type job_id: str
:return: The full backup operation status as a :class:`BackupOperation`
:rtype: BackupOperation
"""
return self._client.full_backup_status(
vault_base_url=self._vault_url,
job_id=job_id,
cls=BackupOperation._wrap_generated,
**kwargs
)

def get_restore_status(self, job_id, **kwargs):
# type: (str, **Any) -> RestoreOperation
"""Returns the status of a restore operation.
:param job_id: The job ID returned as part of the restore request
:type job_id: str
:return: The restore operation status as a :class:`RestoreOperation`
:rtype: RestoreOperation
"""
return self._client.restore_status(
vault_base_url=self.vault_url,
job_id=job_id,
cls=RestoreOperation._wrap_generated,
**kwargs
)
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,35 @@ async def begin_selective_restore(
),
**kwargs
)

async def get_backup_status(
self, job_id: str, **kwargs: "Any"
) -> "BackupOperation":
"""Returns the status of a full backup operation.
:param str job_id: The job ID returned as part of the backup request
:returns: The full backup operation status as a :class:`BackupOperation`
:rtype: BackupOperation
"""
return await self._client.full_backup_status(
vault_base_url=self._vault_url,
job_id=job_id,
cls=BackupOperation._wrap_generated,
**kwargs
)

async def get_restore_status(
self, job_id: str, **kwargs: "Any"
) -> "RestoreOperation":
"""Returns the status of a restore operation.
:param str job_id: The ID returned as part of the restore request
:returns: The restore operation status as a :class:`RestoreOperation`
:rtype: RestoreOperation
"""
return await self._client.restore_status(
vault_base_url=self._vault_url,
job_id=job_id,
cls=RestoreOperation._wrap_generated,
**kwargs
)
Loading

0 comments on commit 51049f5

Please sign in to comment.