def insert_test_resource(self):
"""Call GCE API to create the test resource.
Returns:
GCE operation.
Raises:
errors.HttpError: On a failed API call.
"""
body = self.create_test_resource_body()
try:
request = api.CLIENTS.compute.instances().insert(
project=config.get_project_id(),
zone=AuditLogLoop.ZONE,
body=body)
operation = request.execute()
except errors.HttpError as e:
if e.resp.status == 409:
logging.warning('test resource already exists')
return None
else:
raise
self.record_call('insert', operation)
return operation
audit_log.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录