cloudasset

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package cloudasset serves the GCP Cloud Asset Inventory v1 REST API against a *resourcediscovery.Engine.

Filter syntax (documented subset of the real Cloud Asset filter expression):

service:storage.googleapis.com      service:compute.googleapis.com
assetType:storage.googleapis.com/Bucket
location:us-east1                    location:us-central1
labels.env:prod                      tags.env:prod

Multiple terms are whitespace-separated and AND-composed. Unknown keys are tolerated and ignored (matches Cloud Asset's permissive behavior for unknown fields). Contradictory terms (two distinct services in the same query, or two values for the same label) flip ForceEmpty so the handler short-circuits to an empty result — a single resource cannot belong to two services or hold two values for one label, so the real API would also return zero rows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler serves Cloud Asset Inventory v1 REST requests.

func New

func New(engine *resourcediscovery.Engine, projectID string) *Handler

New returns a Cloud Asset handler backed by engine. projectID is used for feed-name validation and asset scoping; if empty, the engine's own AccountID (which holds the GCP project ID for GCP engines) is used so callers don't have to repeat it.

func (*Handler) Matches

func (*Handler) Matches(r *http.Request) bool

Matches accepts paths that are unambiguously Cloud Asset. We match narrowly to avoid shadowing other GCP REST handlers (firestore claims /v1/projects/ broadly), so registration order is forgiving.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL