def list_snapshots(compute, project):
""" Lists all snapshots created for this project """
backup_logger.debug("Finding all snapshots for specified project")
all_snapshots = []
try:
result = compute.snapshots().list(project=project).execute()
all_snapshots.extend(result['items'])
while 'nextPageToken' in result:
result = compute.snapshots().list(project=project, \
pageToken=result['nextPageToken']).execute()
all_snapshots.extend(result['items'])
except HttpError:
backup_logger.error("Error with HTTP request made to list_snapshots")
sys.exit(1)
return all_snapshots
评论列表
文章目录