Skip to content

Commit 8eab0f2

Browse files
committed
Use location instead of region in the resources
This is consistent with our other GCP resources Signed-off-by: Tim Smith <tsmith84@gmail.com>
1 parent 134b805 commit 8eab0f2

File tree

6 files changed

+40
-40
lines changed

6 files changed

+40
-40
lines changed

providers/gcp/resources/cloud_functions.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (g *mqlGcpProject) cloudFunctions() ([]any, error) {
145145

146146
mqlCloudFuncs, err := CreateResource(g.MqlRuntime, "gcp.project.cloudFunction", map[string]*llx.RawData{
147147
"projectId": llx.StringData(projectId),
148-
"region": llx.StringData(parseLocationFromPath(f.Name)),
148+
"location": llx.StringData(parseLocationFromPath(f.Name)),
149149
"name": llx.StringData(parseResourceName(f.Name)),
150150
"description": llx.StringData(f.Description),
151151
"sourceArchiveUrl": llx.StringData(sourceArchiveUrl),
@@ -210,7 +210,7 @@ func initGcpProjectCloudFunction(runtime *plugin.Runtime, args map[string]*llx.R
210210
}
211211
if ids := getAssetIdentifier(runtime); ids != nil {
212212
args["name"] = llx.StringData(ids.name)
213-
args["region"] = llx.StringData(ids.region)
213+
args["location"] = llx.StringData(ids.region)
214214
args["projectId"] = llx.StringData(ids.project)
215215
} else {
216216
return nil, nil, errors.New("no asset identifier found")
@@ -230,13 +230,13 @@ func initGcpProjectCloudFunction(runtime *plugin.Runtime, args map[string]*llx.R
230230
}
231231

232232
nameVal := args["name"].Value.(string)
233-
regionVal := ""
234-
if args["region"] != nil {
235-
regionVal = args["region"].Value.(string)
233+
locationVal := ""
234+
if args["location"] != nil {
235+
locationVal = args["location"].Value.(string)
236236
}
237237
for _, f := range funcs.Data {
238238
fn := f.(*mqlGcpProjectCloudFunction)
239-
if fn.Name.Data == nameVal && (regionVal == "" || fn.Region.Data == regionVal) {
239+
if fn.Name.Data == nameVal && (locationVal == "" || fn.Location.Data == locationVal) {
240240
return args, fn, nil
241241
}
242242
}

providers/gcp/resources/dataproc.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ func (g *mqlGcpProjectDataprocService) clusters() ([]any, error) {
584584

585585
mqlCluster, err := CreateResource(g.MqlRuntime, "gcp.project.dataprocService.cluster", map[string]*llx.RawData{
586586
"projectId": llx.StringData(projectId),
587-
"region": llx.StringData(regionName),
587+
"location": llx.StringData(regionName),
588588
"name": llx.StringData(c.ClusterName),
589589
"uuid": llx.StringData(c.ClusterUuid),
590590
"config": llx.ResourceData(mqlConfig, "gcp.project.dataprocService.cluster.config"),
@@ -652,7 +652,7 @@ func initGcpProjectDataprocServiceCluster(runtime *plugin.Runtime, args map[stri
652652
}
653653
if ids := getAssetIdentifier(runtime); ids != nil {
654654
args["name"] = llx.StringData(ids.name)
655-
args["region"] = llx.StringData(ids.region)
655+
args["location"] = llx.StringData(ids.region)
656656
args["projectId"] = llx.StringData(ids.project)
657657
} else {
658658
return nil, nil, errors.New("no asset identifier found")
@@ -673,13 +673,13 @@ func initGcpProjectDataprocServiceCluster(runtime *plugin.Runtime, args map[stri
673673
}
674674

675675
nameVal := args["name"].Value.(string)
676-
regionVal := ""
677-
if args["region"] != nil {
678-
regionVal = args["region"].Value.(string)
676+
locationVal := ""
677+
if args["location"] != nil {
678+
locationVal = args["location"].Value.(string)
679679
}
680680
for _, c := range clusters.Data {
681681
cluster := c.(*mqlGcpProjectDataprocServiceCluster)
682-
if cluster.Name.Data == nameVal && (regionVal == "" || cluster.Region.Data == regionVal) {
682+
if cluster.Name.Data == nameVal && (locationVal == "" || cluster.Location.Data == locationVal) {
683683
return args, cluster, nil
684684
}
685685
}

providers/gcp/resources/discovery.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,10 +1032,10 @@ func discoverProject(conn *connection.GcpConnection, gcpProject *mqlGcpProject,
10321032
}
10331033
for i := range funcs.Data {
10341034
fn := funcs.Data[i].(*mqlGcpProjectCloudFunction)
1035-
region := fn.Region.Data
1035+
location := fn.Location.Data
10361036
assetList = append(assetList, &inventory.Asset{
10371037
PlatformIds: []string{
1038-
connection.NewResourcePlatformID("cloud-functions", gcpProject.Id.Data, region, "function", fn.Name.Data),
1038+
connection.NewResourcePlatformID("cloud-functions", gcpProject.Id.Data, location, "function", fn.Name.Data),
10391039
},
10401040
Name: fn.Name.Data,
10411041
Platform: &inventory.Platform{
@@ -1044,7 +1044,7 @@ func discoverProject(conn *connection.GcpConnection, gcpProject *mqlGcpProject,
10441044
Runtime: "gcp",
10451045
Kind: "gcp-object",
10461046
Family: []string{"google"},
1047-
TechnologyUrlSegments: connection.ResourceTechnologyUrl("cloud-functions", gcpProject.Id.Data, region, "function", fn.Name.Data),
1047+
TechnologyUrlSegments: connection.ResourceTechnologyUrl("cloud-functions", gcpProject.Id.Data, location, "function", fn.Name.Data),
10481048
},
10491049
Labels: mapStrInterfaceToMapStrStr(fn.GetLabels().Data),
10501050
Connections: []*inventory.Config{conn.Conf.Clone(inventory.WithoutDiscovery(), inventory.WithParentConnectionId(conn.Conf.Id))},
@@ -1063,10 +1063,10 @@ func discoverProject(conn *connection.GcpConnection, gcpProject *mqlGcpProject,
10631063
}
10641064
for i := range clusters.Data {
10651065
cluster := clusters.Data[i].(*mqlGcpProjectDataprocServiceCluster)
1066-
region := cluster.Region.Data
1066+
location := cluster.Location.Data
10671067
assetList = append(assetList, &inventory.Asset{
10681068
PlatformIds: []string{
1069-
connection.NewResourcePlatformID("dataproc", gcpProject.Id.Data, region, "cluster", cluster.Name.Data),
1069+
connection.NewResourcePlatformID("dataproc", gcpProject.Id.Data, location, "cluster", cluster.Name.Data),
10701070
},
10711071
Name: cluster.Name.Data,
10721072
Platform: &inventory.Platform{
@@ -1075,7 +1075,7 @@ func discoverProject(conn *connection.GcpConnection, gcpProject *mqlGcpProject,
10751075
Runtime: "gcp",
10761076
Kind: "gcp-object",
10771077
Family: []string{"google"},
1078-
TechnologyUrlSegments: connection.ResourceTechnologyUrl("dataproc", gcpProject.Id.Data, region, "cluster", cluster.Name.Data),
1078+
TechnologyUrlSegments: connection.ResourceTechnologyUrl("dataproc", gcpProject.Id.Data, location, "cluster", cluster.Name.Data),
10791079
},
10801080
Labels: mapStrInterfaceToMapStrStr(cluster.GetLabels().Data),
10811081
Connections: []*inventory.Config{conn.Conf.Clone(inventory.WithoutDiscovery(), inventory.WithParentConnectionId(conn.Conf.Id))},

providers/gcp/resources/gcp.lr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,8 +2608,8 @@ private gcp.project.iamService.serviceAccount.key @defaults("name") {
26082608
private gcp.project.cloudFunction @defaults("name") {
26092609
// Project ID
26102610
projectId string
2611-
// Region where the function is deployed
2612-
region string
2611+
// Location where the function is deployed
2612+
location string
26132613
// Cloud function name
26142614
name string
26152615
// Cloud function description
@@ -2691,8 +2691,8 @@ private gcp.project.dataprocService {
26912691
private gcp.project.dataprocService.cluster @defaults("name") {
26922692
// Project ID
26932693
projectId string
2694-
// Region where the cluster is deployed
2695-
region string
2694+
// Location where the cluster is deployed
2695+
location string
26962696
// Cluster name
26972697
name string
26982698
// Cluster UUID

providers/gcp/resources/gcp.lr.go

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

providers/gcp/resources/gcp.lr.manifest.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,13 @@ resources:
342342
ingressSettings: {}
343343
kmsKeyName: {}
344344
labels: {}
345+
location:
346+
min_mondoo_version: 11.0.146
345347
maxInstances: {}
346348
minInstances: {}
347349
name: {}
348350
network: {}
349351
projectId: {}
350-
region:
351-
min_mondoo_version: 11.0.146
352352
runtime: {}
353353
secretEnvVars: {}
354354
secretVolumes: {}
@@ -1108,11 +1108,11 @@ resources:
11081108
fields:
11091109
config: {}
11101110
labels: {}
1111+
location:
1112+
min_mondoo_version: 11.0.146
11111113
metrics: {}
11121114
name: {}
11131115
projectId: {}
1114-
region:
1115-
min_mondoo_version: 11.0.146
11161116
status: {}
11171117
statusHistory: {}
11181118
uuid: {}

0 commit comments

Comments
 (0)