google.cloud.forseti.common.gcp_api.serviceusage module

Wrapper for Service Management API client.

class ServiceUsageClient(global_configs, **kwargs)[source]

Bases: object

Service Usage Client.

DEFAULT_MAX_RESULTS = 100
get_enabled_apis(project_id)[source]

Gets the enabled APIs for a project.

Parameters:project_id (str) – The project id for a GCP project.
Returns:A list of Services resource dicts. https://cloud.google.com/service-usage/docs/reference/rest/v1/services#Service
{
“name”: string, “parent”: string, “config”: {
object (ServiceConfig)

}, “state”: enum (State)

}

Return type:list
Raises:ApiExecutionError – ApiExecutionError is raised if the call to the GCP API fails.
class ServiceUsageRepositoryClient(quota_max_calls=None, quota_period=100.0, use_rate_limiter=True)[source]

Bases: google.cloud.forseti.common.gcp_api._base_repository.BaseRepositoryClient

Service Usage API Repository.

services

Returns a _ServiceUsageRepository instance.

class _ServiceUsageServicesRepository(**kwargs)[source]

Bases: google.cloud.forseti.common.gcp_api.repository_mixins.GetIamPolicyQueryMixin, google.cloud.forseti.common.gcp_api.repository_mixins.ListQueryMixin, google.cloud.forseti.common.gcp_api._base_repository.GCPRepository

Implementation of Service Usage Services repository.

static get_formatted_project_name(project_id)[source]

Returns a formatted project name string field to pass in to the API.

Parameters:project_id (str) – The id of the project to query.
Returns:A formatted project name.
Return type:str