def get_billing_info(self, project_id):
"""Gets the biling information for a project.
Args:
project_id (int): The project id for a GCP project.
Returns:
dict: A ProjectBillingInfo resource.
https://cloud.google.com/billing/reference/rest/v1/ProjectBillingInfo
{
"name": string,
"projectId": string,
"billingAccountName": string,
"billingEnabled": boolean,
}
Raises:
ApiExecutionError: ApiExecutionError is raised if the call to the
GCP ClodSQL API fails
"""
try:
name = self.repository.projects.get_name(project_id)
return self.repository.projects.get_billing_info(name)
except (errors.HttpError, HttpLib2Error) as e:
LOGGER.warn(api_errors.ApiExecutionError(project_id, e))
raise api_errors.ApiExecutionError('billing_info', e)
cloudbilling.py 文件源码
python
阅读 17
收藏 0
点赞 0
评论 0
评论列表
文章目录