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

[KeyVault] Add Status Methods to Query Backup and Restore Operations #14158

Merged
merged 5 commits into from
Oct 2, 2020
Merged
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
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a general comment with no action for this PR: interestingly, we can't learn whether the operation is selective from the job ID or the service's status response. We therefore can't know whether to choose RestoreOperation or SelectiveKeyRestoreOperation here. Further reason to merge those classes, I suppose.

**kwargs
)
Loading