Skip to main content

Mapping Extra Resources

As you've probably looked at the Examples page, you've noticed that the GCP Integration supports some GCP resources, but most of them are documented in the Examples page.

This page will help you understand what kind of GCP resources are supported by the GCP integration and how to map them into Port.

Is the resource supported by the GCP Integration?

The GCP Integration is relying on GCP's Asset Inventory API. That means:

Mapping the resource to Port

After you've found the resource in the Cloud Asset Supported Resources, you can map it to Port by following these steps:

Blueprint

Create a Port blueprint definition for the resource. The blueprint definition is based on the resource API specified per asset type. A few examples:

Compute

Subnetwork Blueprint
{
"identifier": "gcpSubnetwork",
"description": "This blueprint represents a GCP subnetwork in our software catalog",
"title": "Subnetwork",
"icon": "GoogleCloud",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"privateIpGoogleAccess": {
"title": "Private IP Google Access",
"type": "boolean"
},
"internalIpv6Prefix": {
"title": "Internal Ipv6 Prefix",
"type": "string"
},
"externalIpv6Prefix": {
"title": "External Ipv6 Prefix",
"type": "string"
},
"ipCidrRange": {
"title": "IP CIDR Range",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"project": {
"target": "gcpProject",
"title": "Project",
"required": false,
"many": false
}
}
}
Firewall Blueprint
{
"identifier": "gcpFirewall",
"description": "This blueprint represents a GCP Firewall in our software catalog",
"title": "Firewall",
"icon": "GoogelCloud",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"network": {
"title": "Network",
"type": "string"
},
"destinationRanges": {
"title": "Destination Ranges",
"type": "array"
},
"sourceRanges": {
"title": "Source Ranges",
"type": "array"
},
"priority": {
"title": "Priority",
"type": "integer"
},
"allowed": {
"title": "Allowed",
"type": "array"
},
"denied": {
"title": "Denied",
"type": "array"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"project": {
"target": "gcpProject",
"title": "Project",
"required": false,
"many": false
}
}
}
Subnetwork Blueprint
{
"identifier": "gcpSubnetwork",
"description": "This blueprint represents a GCP subnetwork in our software catalog",
"title": "Subnetwork",
"icon": "GoogleCloud",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"privateIpGoogleAccess": {
"title": "Private IP Google Access",
"type": "boolean"
},
"internalIpv6Prefix": {
"title": "Internal Ipv6 Prefix",
"type": "string"
},
"externalIpv6Prefix": {
"title": "External Ipv6 Prefix",
"type": "string"
},
"ipCidrRange": {
"title": "IP CIDR Range",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"project": {
"target": "gcpProject",
"title": "Project",
"required": false,
"many": false
}
}
}
Compute Instance Blueprint
{
"identifier": "gcpComputeInstance",
"description": "This blueprint represents a GCP Compute Instance in our software catalog",
"title": "ComputeInstance",
"icon": "GoogelCloud",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"machineType": {
"title": "Provisioning State",
"type": "string"
},
"subnetworks": {
"title": "Subnetwork",
"type": "array"
},
"cpuPlatform": {
"title": "CPU Platform",
"type": "string"
},
"selfLink": {
"title": "Self Link",
"type": "string"
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {
"project": {
"target": "gcpProject",
"title": "Project",
"required": false,
"many": false
}
}
}
}

Data Management

BigQuery Dataset Blueprint
{
"identifier": "gcpBigQueryDataset",
"description": "This blueprint represents a GCP BigQuery dataset in our software catalog",
"title": "BigQuery Dataset",
"icon": "GoogleCloud",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"lastModified": {
"type": "string",
"title": "Last Modified",
"format": "date-time"
},
"createdTime": {
"type": "string",
"title": "Create Time",
"format": "date-time"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"project": {
"title": "Project",
"target": "gcpProject",
"required": false,
"many": false
}
}
}
BigQuery Table Blueprint
{
"identifier": "gcpBigQueryTable",
"description": "This blueprint represents a GCP BigQuery table in our software catalog",
"title": "BigQuery Table",
"icon": "GoogleCloud",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"createdTime": {
"type": "string",
"title": "Created Time",
"format": "date-time"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"project": {
"title": "Project",
"target": "gcpProject",
"required": false,
"many": false
},
"dataset": {
"title": "Dataset",
"target": "gcpBigQueryDataset",
"required": false,
"many": false
}
}
}
BigQuery Model Blueprint
{
"identifier": "gcpBigQueryModel",
"description": "This blueprint represents a GCP BigQuery model in our software catalog",
"title": "BigQuery Model",
"icon": "GoogleCloud",
"schema": {
"properties": {
"location": {
"title": "Location",
"type": "string"
},
"createdTime": {
"type": "string",
"title": "Created Time",
"format": "date-time"
},
"modelType": {
"type": "string",
"title": "Model Type"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"dataset": {
"title": "Dataset",
"target": "gcpBigQueryDataset",
"required": false,
"many": false
},
"project": {
"title": "Project",
"target": "gcpProject",
"required": false,
"many": false
}
}
}

Integration configuration

Create an integration configuration for the resource. The integration configuration is a YAML file that describes the ETL process to load data into the developer portal.

Mapping Configuration for Autoscaler, Firewall, Subnetwork, Compute Instance

resources:
- kind: compute.googleapis.com/Autoscaler
selector:
query: "true"
port:
entity:
mappings:
identifier: ".id"
title: ".name"
blueprint: '"gcpAutoScaler"'
properties:
location: .location
description: ".description"
minNumReplicas: ".autoscalingPolicy.minNumReplicas"
maxNumReplicas: ".autoscalingPolicy.maxNumReplicas"
recommendedSize: ".recommendedSize"
target: ".target"
relations:
project: ".__project.name"
- kind: compute.googleapis.com/Firewall
selector:
query: "true"
port:
entity:
mappings:
identifier: ".id"
title: ".name"
blueprint: '"gcpFirewall"'
properties:
location: .location
network: ".network"
destinationRanges: ".destinationRanges"
sourceRanges: ".sourceRanges"
priority: ".priority"
allowed: ".allowed"
denied: ".denied"
relations:
project: ".__project.name"
- kind: compute.googleapis.com/Subnetwork
selector:
query: "true"
port:
entity:
mappings:
identifier: ".id"
title: ".name"
blueprint: '"gcpSubnetwork"'
properties:
location: .location
privateIpGoogleAccess: ".privateIpGoogleAccess"
internalIpv6Prefix: ".internalIpv6Prefix"
externalIpv6Prefix: ".externalIpv6Prefix"
ipCidrRange: ".ipCidrRange"
description: ".description"
relations:
project: ".__project.name"
- kind: compute.googleapis.com/Instance
selector:
query: "true"
port:
entity:
mappings:
identifier: ".id"
title: ".name"
blueprint: '"gcpComputeInstance"'
properties:
location: .location
machineType: ".machineType"
subnetworks: ".networkInterfaces[].subnetwork"
cpuPlatform: ".cpuPlatform"
selfLink: ".selfLink"
relations:
project: ".__project.name"

Mapping Configuration for BigQuery Dataset, Table and Model

resources:
- kind: bigquery.googleapis.com/Dataset
selector:
query: 'true'
port:
entity:
mappings:
identifier: .datasetReference.datasetId
title: .datasetReference.datasetId
blueprint: '"gcpBigQueryDataset"'
properties:
location: .location
last_modified: >-
if .lastModifiedTime != null then (.lastModifiedTime | tonumber /
1000 | todate) else null end
createdTime: >-
if .creationTime != null then (.creationTime | tonumber / 1000 |
todate) else null end
relations:
project: .__project.name
- kind: bigquery.googleapis.com/Table
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
title: .tableReference.tableId
blueprint: '"gcpBigQueryTable"'
properties:
location: .location
createdTime: >-
if .creationTime != null then (.creationTime | tonumber / 1000 |
todate) else null end
relations:
project: .__project.name
dataset: .tableReference.datasetId
- kind: bigquery.googleapis.com/Model
selector:
query: 'true'
port:
entity:
mappings:
identifier: .modelReference.modelId
title: .modelReference.modelId
blueprint: '"gcpBigQueryModel"'
properties:
location: .location
createdTime: >-
if .creationTime != null then (.creationTime | tonumber / 1000 |
todate) else null end
modelType: .modelType
relations:
project: .__project.name
dataset: .modelReference.datasetId

The integration configuration structure

  • The kind field describes the GCP resource type to be ingested into Port. The kind field should be set to the GCP resource type as it appears in the supported resources guide. e.g. The resource type for the Compute Instance is compute.googleapis.com/Instance

    resources:
    - kind: compute.googleapis.com/Instance
    selector:
    ...
  • The selector field describes the GCP resource selection criteria.

    	resources:
    - kind: compute.googleapis.com/Instance
    selector:
    query: "true" # JQ boolean expression. If evaluated to false - this object will be skipped.
    port:
    • The query field is a JQ boolean query, if evaluated to false - the resource will be skipped. Example use case - skip syncing resources that are not in a specific region.
      query: .location == "global"
  • The port field describes the Port entity to be created from the GCP resource.

    resources:
    - kind: compute.googleapis.com/Instance
    selector:
    query: "true" # JQ boolean query. If evaluated to false - skip syncing the object.
    port:
    entity:
    mappings: # Mappings between one GCP object to a Port entity. Each value is a JQ query.
    identifier: ".id"
    title: ".name"
    blueprint: '"gcpComputeInstance"'
    properties:
    location: .location
    machineType: ".machineType"
    subnetworks: ".networkInterfaces[].subnetwork"
    cpuPlatform: ".cpuPlatform"
    selfLink: ".selfLink"
    relations:
    project: ".__project.name"
    • The entity field describes the Port entity to be created from the GCP resource.

      • The mappings field describes the mapping between the GCP resource and the Port entity.

        • The identifier field describes the GCP resource identifier. This field is required for all resources.

          mappings:
          identifier: ".id"
        • The title field describes the GCP resource title. This field is required for all resources.

          mappings:
          title: ".name"
        • The blueprint field describes the Port blueprint to be used to create the Port entity. This field is required for all resources.

          mappings:
          blueprint: '"gcpComputeInstance"'
        • The properties field describes the GCP resource properties to be mapped to the Port

          	mappings:
          identifier: ".id"
          title: ".name"
          blueprint: '"gcpComputeInstance"'
          properties:
          location: .location
          machineType: ".machineType"