google.cloud.forseti.common.gcp_api.appengine module

Wrapper for AppEngine API client.

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

Bases: object

AppEngine Client.

https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps

get_app(project_id)[source]

Gets information about an application.

Parameters:project_id (str) – The id of the project.
Returns:The response of retrieving the AppEngine app.
Return type:dict
get_instance(project_id, service_id, version_id, instances_id)[source]

Gets information about a specific instance of a service.

Parameters:
  • project_id (str) – The id of the project.
  • service_id (str) – The id of the service to query.
  • version_id (str) – The id of the version to query.
  • instances_id (str) – The id of the instance to query.
Returns:

An Instance resource dict for a given project_id, service_id and version_id.

Return type:

dict

get_service(project_id, service_id)[source]

Gets information about a specific service.

Parameters:
  • project_id (str) – The id of the project.
  • service_id (str) – The id of the service to query.
Returns:

A Service resource dict for a given project_id and service_id.

Return type:

dict

get_version(project_id, service_id, version_id)[source]

Gets information about a specific version of a service.

Parameters:
  • project_id (str) – The id of the project.
  • service_id (str) – The id of the service to query.
  • version_id (str) – The id of the version to query.
Returns:

A Version resource dict for a given project_id and service_id.

Return type:

dict

list_instances(project_id, service_id, version_id)[source]

Lists instances of a given service and version.

Parameters:
  • project_id (str) – The id of the project.
  • service_id (str) – The id of the service to query.
  • version_id (str) – The id of the version to query.
Returns:

A list of Instance resource dicts for a given Version.

Return type:

list

list_services(project_id)[source]

Lists services of a project.

Parameters:project_id (str) – The id of the project.
Returns:A list of Service resource dicts for a project_id.
Return type:list
list_versions(project_id, service_id)[source]

Lists versions of a given service.

Parameters:
  • project_id (str) – The id of the project.
  • service_id (str) – The id of the service to query.
Returns:

A list of Version resource dicts for a given Service.

Return type:

list

class AppEngineRepositoryClient(quota_max_calls=None, quota_period=1.0, use_rate_limiter=True)[source]

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

AppEngine API Respository.

app_services

Returns an _AppEngineAppsServicesRepository instance.

apps

Returns an _AppEngineAppsRepository instance.

service_versions

Returns an _AppEngineAppsServicesVersionsRepository instance.

version_instances

Returns an _AppEngineAppsServicesVersionsInstancesRepository.

class _AppEngineAppsRepository(**kwargs)[source]

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

Implementation of AppEngine Apps repository.

class _AppEngineAppsServicesRepository(**kwargs)[source]

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

Implementation of AppEngine Apps Services repository.

class _AppEngineAppsServicesVersionsInstancesRepository(**kwargs)[source]

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

Implementation of AppEngine Apps Services Versions Instances repo.

get(resource, target, services_id, versions_id, **kwargs)[source]

Get specific entity of a given resource.

Parameters:
  • resource (str) – The id of the resource to query.
  • target (str) – Name of the entity to fetch.
  • services_id (str) – The id of the service to query.
  • versions_id (str) – The id of the version to query.
  • **kwargs (dict) – Optional additional arguments to pass to the query.
Returns:

An API response containing the entity resource.

Return type:

dict

list(resource, services_id, versions_id, **kwargs)[source]

List subresources of a given resource.

Parameters:
  • resource (str) – The id of the resource to query.
  • services_id (str) – The id of the service to query.
  • versions_id (str) – The id of the version to query.
  • **kwargs (dict) – Optional additional arguments to pass to the query.
Returns:

An iterator over each page of results from the API.

Return type:

iterator

class _AppEngineAppsServicesVersionsRepository(**kwargs)[source]

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

Implementation of AppEngine Apps Services Versions repository.

get(resource, target, services_id, **kwargs)[source]

Get specific entity of a given resource.

Parameters:
  • resource (str) – The id of the resource to query.
  • target (str) – Name of the entity to fetch.
  • services_id (str) – The id of the service to query.
  • **kwargs (dict) – Optional additional arguments to pass to the query.
Returns:

An API response containing the entity resource.

Return type:

dict

list(resource, services_id, **kwargs)[source]

List subresources of a given resource.

Parameters:
  • resource (str) – The id of the resource to query.
  • services_id (str) – The id of the service to query.
  • **kwargs (dict) – Optional additional arguments to pass to the query.
Returns:

An iterator over each page of results from the API.

Return type:

iterator

_is_status_not_found(error)[source]

Decodes the error from the API to check if status is NOT_FOUND.

Parameters:error (errors.HttpError) – The error response from the API.
Returns:True if the error is application not found, else False.
Return type:bool