Documentation
¶
Overview ¶
Package vertex implements the inference.Provider interface for Google Cloud Vertex AI. It supports three modes of credential provisioning:
- GCP project ID only → create service account + key
- GCP project ID + SA name → verify SA exists, create key
- GCP project ID + credential JSON → use key directly
Index ¶
- Constants
- 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" )
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. global)
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 NewAnalyzeOnly ¶
func NewAnalyzeOnly() *Provider
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.