vertex

package
v0.0.3 Latest Latest
Warning

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

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

Documentation

Overview

Package vertex implements the inference.Provider interface for Google Cloud Vertex AI. It supports three modes of credential provisioning:

  1. GCP project ID only → create service account + key
  2. GCP project ID + SA name → verify SA exists, create key
  3. GCP project ID + credential JSON → use key directly

Index

Constants

View Source
const (
	// SecretCredentials is the repo secret name for the GCP service account key JSON.
	// Uses the FULLSEND_ prefix to avoid confusion with the GCP SDK env var
	// GOOGLE_APPLICATION_CREDENTIALS, which expects a file path, not JSON content.
	SecretCredentials = "FULLSEND_GCP_SA_KEY_JSON"

	// SecretProjectID is the repo secret name for the GCP project ID.
	// Uses the FULLSEND_ prefix for consistency with other secrets.
	SecretProjectID = "FULLSEND_GCP_PROJECT_ID"

	// VariableRegion is the repo variable name for the GCP region.
	VariableRegion = "FULLSEND_GCP_REGION"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ProjectID          string // required
	Region             string // required: GCP region (e.g. us-east5)
	ServiceAccountName string // optional: existing SA name (mode 2)
	CredentialJSON     []byte // optional: pre-made key JSON (mode 3)
}

Config holds the inputs for Vertex credential provisioning.

type GCPClient

type GCPClient interface {
	// GetServiceAccount checks that a service account exists.
	GetServiceAccount(ctx context.Context, projectID, saName string) error

	// CreateServiceAccount creates a new service account.
	CreateServiceAccount(ctx context.Context, projectID, saName, displayName string) error

	// CreateServiceAccountKey generates a new JSON key for a service account.
	CreateServiceAccountKey(ctx context.Context, projectID, saEmail string) ([]byte, error)
}

GCPClient abstracts GCP IAM operations for testability.

type LiveGCPClient

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

LiveGCPClient implements GCPClient using the GCP IAM REST API. It obtains access tokens via Application Default Credentials.

func NewLiveGCPClient

func NewLiveGCPClient() *LiveGCPClient

NewLiveGCPClient creates a new LiveGCPClient.

func (*LiveGCPClient) CreateServiceAccount

func (c *LiveGCPClient) CreateServiceAccount(ctx context.Context, projectID, saName, displayName string) error

CreateServiceAccount creates a new service account in the project.

func (*LiveGCPClient) CreateServiceAccountKey

func (c *LiveGCPClient) CreateServiceAccountKey(ctx context.Context, projectID, saEmail string) ([]byte, error)

CreateServiceAccountKey generates a new JSON key for the service account.

func (*LiveGCPClient) GetServiceAccount

func (c *LiveGCPClient) GetServiceAccount(ctx context.Context, projectID, saName string) error

GetServiceAccount checks that a service account exists in the project.

type Provider

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

Provider implements inference.Provider for Vertex AI.

func New

func New(cfg Config, gcpAPI GCPClient) *Provider

New creates a Vertex Provider with the given config and GCP client.

func NewAnalyzeOnly

func NewAnalyzeOnly() *Provider

NewAnalyzeOnly creates a Provider that only supports SecretNames() and Name(). Calling Provision() on this provider returns an error.

func (*Provider) Name

func (p *Provider) Name() string

Name returns "vertex".

func (*Provider) Provision

func (p *Provider) Provision(ctx context.Context) (map[string]string, error)

Provision acquires GCP credentials and returns them as secrets.

func (*Provider) SecretNames

func (p *Provider) SecretNames() []string

SecretNames returns the secret names this provider manages.

func (*Provider) Variables

func (p *Provider) Variables() map[string]string

Variables returns non-secret name/value pairs to store as repo variables.

Jump to

Keyboard shortcuts

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