Documentation
¶
Overview ¶
Package vertex implements the inference.Provider interface for Google Cloud Vertex AI. It supports two auth modes:
- SA key (default): long-lived service account key JSON, with sub-modes for creating, verifying, or using a pre-made key.
- WIF: Workload Identity Federation with GitHub OIDC — no stored keys.
Index ¶
- Constants
- type AuthMode
- type Config
- type GCPClient
- type LiveGCPClient
- func (c *LiveGCPClient) CreateServiceAccount(ctx context.Context, projectID, saName, displayName string) error
- func (c *LiveGCPClient) CreateServiceAccountKey(ctx context.Context, projectID, saEmail string) ([]byte, error)
- func (c *LiveGCPClient) GetServiceAccount(ctx context.Context, projectID, saName string) error
- type Provider
Constants ¶
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" // VariableAuthMode tells workflows which GCP auth method to use. // Must be a variable (not a secret) because GitHub's dispatch-time // validator does not recognise the secrets context. VariableAuthMode = "FULLSEND_GCP_AUTH_MODE" // SecretWIFProvider is the repo secret for the full WIF provider resource name. // Stored as a secret so the value is masked in GitHub Actions logs. SecretWIFProvider = "FULLSEND_GCP_WIF_PROVIDER" // SecretWIFServiceAccount is the repo secret for the SA email used with WIF. // Stored as a secret so the value is masked in GitHub Actions logs. SecretWIFServiceAccount = "FULLSEND_GCP_WIF_SA_EMAIL" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthMode ¶ added in v0.2.0
type AuthMode string
AuthMode selects between service-account key and Workload Identity Federation.
type Config ¶
type Config struct {
ProjectID string // required
Region string // required: GCP region (e.g. global)
Mode AuthMode // "sa_key" (default) or "wif"
ServiceAccountName string // optional: existing SA name (sa_key mode 2)
CredentialJSON []byte // optional: pre-made key JSON (sa_key mode 3)
WIFProvider string // WIF mode: full provider resource name
WIFServiceAccount string // WIF mode: service account email
}
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 NewAnalyzeOnly ¶
NewAnalyzeOnly creates a Provider that only supports SecretNames() and Name(). Calling Provision() on this provider returns an error.
func (*Provider) SecretNames ¶
SecretNames returns the secret names this provider manages.