How to use the cartography.intel.gcp.compute.load_gcp_subnets 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_subnet_data(neo4j_session):
    cartography.intel.gcp.compute.load_gcp_subnets(
        neo4j_session,
        tests.data.gcp.compute.TRANSFORMED_GCP_SUBNETS,
        TEST_UPDATE_TAG,
    )
github lyft / cartography / tests / integration / cartography / intel / gcp / test_compute.py View on Github external
def test_transform_and_load_subnets(neo4j_session):
    """
    Ensure we can transform and load subnets.
    """
    subnet_res = tests.data.gcp.compute.VPC_SUBNET_RESPONSE
    subnet_list = cartography.intel.gcp.compute.transform_gcp_subnets(subnet_res)
    cartography.intel.gcp.compute.load_gcp_subnets(neo4j_session, subnet_list, TEST_UPDATE_TAG)

    query = """
    MATCH(subnet:GCPSubnet)
    RETURN subnet.id, subnet.region, subnet.gateway_address, subnet.ip_cidr_range, subnet.private_ip_google_access,
    subnet.vpc_partial_uri
    """
    nodes = neo4j_session.run(query)
    actual_nodes = {
        (
            n['subnet.id'],
            n['subnet.region'],
            n['subnet.gateway_address'],
            n['subnet.ip_cidr_range'],
            n['subnet.private_ip_google_access'],
            n['subnet.vpc_partial_uri'],
        ) for n in nodes