Skip to content

Commit 846f985

Browse files
tas50claude
andcommitted
Address review comments: simplify sccParent, document org-level service check
Use g.Id.Data directly in sccParent() instead of redundantly calling conn.OrganizationID(). Add comment explaining why org-level SCC methods skip isServiceEnabled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fbbcf95 commit 846f985

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

providers/gcp/resources/securitycenter.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,17 +282,17 @@ func listSCCBigQueryExports(runtime *plugin.Runtime, conn *connection.GcpConnect
282282
}
283283

284284
// Organization-level methods
285+
// Note: org-level SCC methods do not check isServiceEnabled because the Security
286+
// Command Center API is enabled at the project level, not the organization level.
287+
// Organization-scoped queries work as long as the caller has the appropriate IAM
288+
// permissions on the org.
285289

286290
func (g *mqlGcpOrganization) sccParent() (string, *connection.GcpConnection, error) {
287291
if g.Id.Error != nil {
288292
return "", nil, g.Id.Error
289293
}
290294
conn := g.MqlRuntime.Connection.(*connection.GcpConnection)
291-
orgId, err := conn.OrganizationID()
292-
if err != nil {
293-
return "", nil, err
294-
}
295-
return "organizations/" + orgId, conn, nil
295+
return "organizations/" + g.Id.Data, conn, nil
296296
}
297297

298298
func (g *mqlGcpOrganization) sccSources() ([]any, error) {

0 commit comments

Comments
 (0)