compute.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:forseti-security 作者: GoogleCloudPlatform 项目源码 文件源码
def is_api_enabled(self, project_id):
        """Checks if the Compute API is enabled for the specified project.

        Args:
            project_id (str): The project id.

        Returns:
            bool: True if the API is enabled, else False.
        """
        try:
            result = self.repository.projects.get(project_id, fields='name')
            return bool('name' in result)  # True if name, otherwise False.
        except (errors.HttpError, HttpLib2Error) as e:
            api_not_enabled, _ = _api_not_enabled(e)
            if api_not_enabled:
                return False
            raise api_errors.ApiExecutionError(project_id, e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号