in cartography/intel/gcp/compute.py [0:0]
def sync(session, compute, project_id, gcp_update_tag, common_job_parameters):
"""
Sync all objects that we need the GCP Compute resource object for.
:param session: The Neo4j session object
:param compute: The GCP Compute resource object
:param project_id: The project ID number to sync.
:param project_id: The project ID number to sync. See the `projectId` field in
https://cloud.google.com/resource-manager/reference/rest/v1/projects
:param gcp_update_tag: The timestamp value to set our new Neo4j nodes with
:param common_job_parameters: dict of other job parameters to pass to Neo4j
:return: Nothing
"""
logger.info("Syncing Compute objects for project %s.", project_id)
zones = get_zones_in_project(project_id, compute)
# Only pull additional assets for this project if the Compute API is enabled
if zones is None:
return
else:
regions = _zones_to_regions(zones)
sync_gcp_vpcs(session, compute, project_id, gcp_update_tag, common_job_parameters)
sync_gcp_firewall_rules(session, compute, project_id, gcp_update_tag, common_job_parameters)
sync_gcp_subnets(session, compute, project_id, regions, gcp_update_tag, common_job_parameters)
sync_gcp_instances(session, compute, project_id, zones, gcp_update_tag, common_job_parameters)