google.cloud.forseti.common.util.relationship module

Util for finding resource entity relationships.

find_ancestors(starting_resource, full_name)[source]

Find the ancestors for a given resource.

Take advantage of the full name from the data model which has the entire hierarchy.

Keeping this outside of the class, because the class is mocked out during testing.

Parameters:
  • starting_resource (Resource) – The GCP resource associated with the policy binding. This is where we move up the resource hierarchy.
  • full_name (str) – Full name of the resource in hierarchical format. Example of a full_name: organization/88888/project/myproject/firewall/99999/
Returns:

A list of GCP resources in ascending order in the resource hierarchy.

Return type:

list