Examples
This page contains the base examples for mapping GCP resources to Port.
This base example thrives to provide a simpler and more abstract way to map GCP resources to Port.
The simplification is achieved by using the generic cloudResource
blueprint, which can be used to map any GCP resource to Port.
Mapping GCP Projectsโ
In the following example you will ingest your GCP Projects to Port, you may use the following Port blueprint definitions and integration configuration:
Project Blueprint
{
"identifier": "gcpProject",
"title": "GCP Project",
"icon": "GoogleCloud",
"schema": {
"properties": {}
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {}
}
Mapping configuration for Google Cloud Projects
resources:
- kind: cloudresourcemanager.googleapis.com/Project
selector:
query: "true"
port:
entity:
mappings:
identifier: ".name"
blueprint: '"gcpProject"'
title: ".display_name"
Here are the API references we used to create those blueprints and app config:
Mapping Cloud Resourcesโ
In the following example you will ingest your GCP Resources to Port, you may use the following Port blueprint definitions and integration configuration:
The Resources below have a relation to the Project, so the creation of the Project is required.
Cloud Resource Blueprint
{
"identifier": "gcpCloudResource",
"title": "Cloud Resource",
"icon": "GoogleCloud",
"schema": {
"properties": {
"type": {
"icon": "Service",
"title": "Type",
"type": "string"
},
"location": {
"icon": "Home",
"title": "Location",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"project": {
"target": "gcpProject",
"title": "Project",
"required": false,
"many": false
}
}
}
Mapping configuration for cloud resources
resources:
- kind: container.googleapis.com/Cluster
selector:
query: "true"
port:
entity:
mappings:
identifier: ".name"
title: '.name | split("/") | last'
blueprint: '"gcpCloudResource"'
properties:
type: '.name | split("/") | .[-2]'
location: ".location"
relations:
project: ".__project.name"
- kind: cloudfunctions.googleapis.com/Function
selector:
query: "true"
port:
entity:
mappings:
identifier: ".name"
title: '.name | split("/") | last'
blueprint: '"gcpCloudResource"'
properties:
type: '.name | split("/") | .[-2]'
location: ".location"
relations:
project: ".__project.name"
- kind: pubsub.googleapis.com/Topic
selector:
query: "true"
port:
entity:
mappings:
identifier: ".name"
title: ".name | split("/") | last"
blueprint: '"gcpCloudResource"'
properties:
type: '.name | split("/") | .[-2]'
location: ".location"
relations:
project: ".__project.name"
Mapping Extra Resourcesโ
The resources in this page are only a few of the resources that the GCP Integration supports.
If the resources you want to ingest into Port do not appear in these examples, you can head to the Mapping Extra Resources page to learn about all of the kinds of GCP resources that are supported by the GCP integration and how to map them into Port.