common

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecretNameServiceAccountKey      = "serviceAccountKey"
	SecretNameAccessToken            = "accessToken"
	ScopeCloudPlatform               = "https://www.googleapis.com/auth/cloud-platform"
	ActionNameEnsureCloudBuild       = "ensureCloudBuild"
	ActionNameEnsureArtifactRegistry = "ensureArtifactRegistry"
	ActionNameEnsurePubSubOnMessage  = "ensurePubSubOnMessage"
)
View Source
const (
	AuthMethodServiceAccountKey = "serviceAccountKey"
	AuthMethodWIF               = "workloadIdentityFederation"
)

Variables

View Source
var RequiredJSONKeys = []string{"type", "project_id", "private_key_id", "private_key", "client_email", "client_id"}

Functions

func AuthMethodFromMetadata

func AuthMethodFromMetadata(meta any) string

func CredentialsFromIntegration

func CredentialsFromIntegration(ctx core.IntegrationContext, scopes ...string) (*google.Credentials, error)

func FindSecretValue

func FindSecretValue(secrets []core.IntegrationSecret, name string) []byte

func IsAlreadyExistsError

func IsAlreadyExistsError(err error) bool

func IsNotFoundError

func IsNotFoundError(err error) bool

func ParseGCPError

func ParseGCPError(statusCode int, body []byte) error

func TokenSourceFromIntegration

func TokenSourceFromIntegration(ctx core.IntegrationContext, scopes ...string) (oauth2.TokenSource, error)

Types

type Client

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

func NewClient

func NewClient(httpClient core.HTTPContext, integration core.IntegrationContext) (*Client, error)

func (*Client) BaseURL

func (c *Client) BaseURL() string

func (*Client) ExecRequest

func (c *Client) ExecRequest(ctx context.Context, method, url string, body io.Reader) ([]byte, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string) ([]byte, error)

func (*Client) GetURL

func (c *Client) GetURL(ctx context.Context, fullURL string) ([]byte, error)

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body any) ([]byte, error)

func (*Client) PostURL added in v0.11.0

func (c *Client) PostURL(ctx context.Context, fullURL string, body any) ([]byte, error)

func (*Client) ProjectID

func (c *Client) ProjectID() string

type GCPAPIError

type GCPAPIError struct {
	StatusCode int
	Message    string
}

func (*GCPAPIError) Error

func (e *GCPAPIError) Error() string

type Metadata

type Metadata struct {
	ProjectID                     string `json:"projectId"`
	ClientEmail                   string `json:"clientEmail"`
	AuthMethod                    string `json:"authMethod"`
	AccessTokenExpiresAt          string `json:"accessTokenExpiresAt"`
	PubSubTopic                   string `json:"pubsubTopic,omitempty"`
	PubSubSubscription            string `json:"pubsubSubscription,omitempty"`
	CloudBuildSubscription        string `json:"cloudBuildSubscription,omitempty"`
	ArtifactPushSubscription      string `json:"artifactPushSubscription,omitempty"`
	ContainerAnalysisSubscription string `json:"containerAnalysisSubscription,omitempty"`
}

Jump to

Keyboard shortcuts

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