Ejemplo n.º 1
0
def _sync_single_project(
    neo4j_session: neo4j.Session,
    resources: Resource,
    project_id: str,
    gcp_update_tag: int,
    common_job_parameters: Dict,
) -> None:
    """
    Handles graph sync for a single GCP project.
    :param neo4j_session: The Neo4j session
    :param resources: namedtuple of the GCP resource objects
    :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: Other parameters sent to Neo4j
    :return: Nothing
    """
    # Determine the resources available on the project.
    enabled_services = _services_enabled_on_project(resources.serviceusage,
                                                    project_id)
    if service_names.compute in enabled_services:
        compute.sync(neo4j_session, resources.compute, project_id,
                     gcp_update_tag, common_job_parameters)
    if service_names.storage in enabled_services:
        storage.sync_gcp_buckets(neo4j_session, resources.storage, project_id,
                                 gcp_update_tag, common_job_parameters)
    if service_names.gke in enabled_services:
        gke.sync_gke_clusters(neo4j_session, resources.container, project_id,
                              gcp_update_tag, common_job_parameters)
    if service_names.dns in enabled_services:
        dns.sync(neo4j_session, resources.dns, project_id, gcp_update_tag,
                 common_job_parameters)
Ejemplo n.º 2
0
def _sync_single_project(session, resources, project_id, gcp_update_tag, common_job_parameters):
    """
    Handles graph sync for a single GCP project.
    :param session: The Neo4j session
    :param resources: namedtuple of the GCP resource objects
    :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: Other parameters sent to Neo4j
    :return: Nothing
    """
    compute.sync(session, resources.compute, project_id, gcp_update_tag, common_job_parameters)