How to use the cartography.intel.gcp.compute.load_gcp_vpcs function in cartography

To help you get started, we’ve selected a few cartography examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lyft / cartography / tests / integration / cartography / intel / gcp / test_compute.py View on Github external
def _ensure_local_neo4j_has_test_vpc_data(neo4j_session):
    cartography.intel.gcp.compute.load_gcp_vpcs(
        neo4j_session,
        tests.data.gcp.compute.TRANSFORMED_GCP_VPCS,
        TEST_UPDATE_TAG,
    )
github lyft / cartography / tests / integration / cartography / intel / gcp / test_compute.py View on Github external
def test_transform_and_load_vpcs(neo4j_session):
    """
    Test that we can correctly transform and load VPC nodes to Neo4j.
    """
    vpc_res = tests.data.gcp.compute.VPC_RESPONSE
    vpc_list = cartography.intel.gcp.compute.transform_gcp_vpcs(vpc_res)
    cartography.intel.gcp.compute.load_gcp_vpcs(neo4j_session, vpc_list, TEST_UPDATE_TAG)

    query = """
    MATCH(vpc:GCPVpc{id:{VpcId}})
    RETURN vpc.id, vpc.partial_uri, vpc.auto_create_subnetworks
    """
    expected_vpc_id = 'projects/project-abc/global/networks/default'
    nodes = neo4j_session.run(
        query,
        VpcId=expected_vpc_id,
    )
    actual_nodes = {(n['vpc.id'], n['vpc.partial_uri'], n['vpc.auto_create_subnetworks']) for n in nodes}
    expected_nodes = {
        (expected_vpc_id, expected_vpc_id, True),
    }
    assert actual_nodes == expected_nodes