Help us shape the future of Go! Take the 2026 Go Developer Survey

objectstore

package
v2.13.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package objectstore provides the object storage integration definition: customer installations read and write objects in their own Google Cloud Storage, Amazon S3 or Cloudflare R2 bucket and import JSON records under a prefix, while the runtime integration imports platform-owned records as system-owned rows

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPrefixRequired indicates no bucket prefix was configured for the record import
	ErrPrefixRequired = errors.New("objectstore: import prefix required")
	// ErrBucketRequired indicates no bucket was configured for the installation
	ErrBucketRequired = errors.New("objectstore: bucket required")
	// ErrProjectNumberRequired indicates no workload identity pool project number was provided
	ErrProjectNumberRequired = errors.New("objectstore: workload identity project number required")
	// ErrServiceAccountKeyInvalid indicates the service account key JSON is invalid
	ErrServiceAccountKeyInvalid = errors.New("objectstore: service account key invalid")
	// ErrClientCreate indicates the storage client could not be created
	ErrClientCreate = errors.New("objectstore: storage client creation failed")
	// ErrRuntimeConfigDecode indicates the runtime config could not be decoded
	ErrRuntimeConfigDecode = errors.New("objectstore: runtime config decode failed")
	// ErrRuntimeConfigInvalid indicates the runtime config has no enabled provider, bucket or import prefix
	ErrRuntimeConfigInvalid = errors.New("objectstore: runtime config invalid")
	// ErrRuntimeProviderAmbiguous indicates the runtime config enables more than one provider
	ErrRuntimeProviderAmbiguous = errors.New("objectstore: runtime config enables more than one provider")
	// ErrVerifyFailed indicates the bucket could not be listed with the configured credentials
	ErrVerifyFailed = errors.New("objectstore: connection verification failed")
	// ErrListObjectsFailed indicates the objects under the import prefix could not be listed
	ErrListObjectsFailed = errors.New("objectstore: list objects failed")
	// ErrObjectDownloadFailed indicates an object's bytes could not be read from the bucket
	ErrObjectDownloadFailed = errors.New("objectstore: object download failed")
	// ErrObjectContentInvalid indicates an object is neither a JSON array of records nor a single JSON record
	ErrObjectContentInvalid = errors.New("objectstore: object content is not json records")
	// ErrContentEncode indicates the document to write could not be JSON encoded
	ErrContentEncode = errors.New("objectstore: content encode failed")
	// ErrObjectUploadFailed indicates the document could not be written to the bucket
	ErrObjectUploadFailed = errors.New("objectstore: object upload failed")
	// ErrResultEncode indicates an operation result could not be serialized
	ErrResultEncode = errors.New("objectstore: result encode failed")
	// ErrEntityTypeSeed indicates the entity type the mapping links to could not be found or created
	ErrEntityTypeSeed = errors.New("objectstore: entity type seed failed")
	// ErrObjectMoveFailed indicates a processed object could not be moved into the processed directory
	ErrObjectMoveFailed = errors.New("objectstore: object move failed")
	// ErrProviderCannotCopy indicates the storage provider does not copy objects server side
	ErrProviderCannotCopy = errors.New("objectstore: storage provider cannot copy objects")
)
View Source
var (
	// DefinitionID is the stable identifier for the object storage integration definition
	DefinitionID = types.NewDefinitionRef("def_01K0OBJECTSTORE00000000001")

	// ImportRecordsOp is the operation ref for the record import shared by installations and the runtime
	ImportRecordsOp = types.OperationRefOf[ImportRecords]() //nolint:revive
)

Functions

func Builder

func Builder(runtime *RuntimeConfig, federationIssuer string, cfg Config) registry.Builder

Builder returns the object storage definition builder advertising the supplied federation issuer and using cfg as the operator config carrying the AWS source identity; the definition registers hidden so organizations cannot install it, and when runtime.Provisioned() is true a RuntimeIntegration is included so the scheduled record import cycle reads the platform-owned bucket

Types

type AWSAccessKeyCredentialSchema

type AWSAccessKeyCredentialSchema struct {
	// AccessKeyID is the IAM access key ID
	AccessKeyID string `json:"accessKeyId" jsonschema:"required,title=Access Key ID"`
	// SecretAccessKey is the IAM secret access key
	SecretAccessKey string `json:"secretAccessKey" jsonschema:"required,title=Secret Access Key,secret=true"`
	// Region is the AWS region of the bucket
	Region string `json:"region" jsonschema:"required,title=Region,description=AWS region of the bucket (e.g. us-east-1)"`
	// BucketScope names the bucket the installation reads and writes
	BucketScope
}

AWSAccessKeyCredentialSchema holds static IAM keys for an S3 bucket

type AWSAssumeRoleCredentialSchema

type AWSAssumeRoleCredentialSchema struct {
	// RoleARN is the cross-account IAM role Openlane assumes in the customer account
	RoleARN string `` /* 131-byte string literal not displayed */
	// ExternalID is the external ID required in the role trust policy
	ExternalID string `` /* 149-byte string literal not displayed */
	// Region is the AWS region of the bucket
	Region string `json:"region" jsonschema:"required,title=Region,description=AWS region of the bucket (e.g. us-east-1)"`
	// SessionName is an optional STS session name override
	SessionName string `json:"sessionName,omitempty" jsonschema:"title=Session Name,description=Optional STS session name override"`
	// BucketScope names the bucket the installation reads and writes
	BucketScope
}

AWSAssumeRoleCredentialSchema holds the cross-account role Openlane assumes to reach an S3 bucket

type BucketScope

type BucketScope struct {
	// Bucket is the bucket the installation reads from and writes to
	Bucket string `json:"bucket" jsonschema:"required,title=Bucket,description=Bucket the integration reads from and writes to"`
}

BucketScope names the bucket an installation reads and writes

type Client

type Client struct {
	// Provider is the storage provider scoped to the bucket
	Provider storage.Provider
	// Import is the prefix and kind the runtime import reads when the operation config leaves them empty, zero for installations
	Import ImportSpec
}

Client is the storage provider for one bucket with the import spec the runtime path reads

type Config

type Config struct {
	// AccessKeyID is the AWS access key ID for Openlane's source identity used when assuming customer roles
	AccessKeyID string `json:"accessKeyId" koanf:"accesskeyid" sensitive:"true"`
	// SecretAccessKey is the AWS secret access key for Openlane's source identity
	SecretAccessKey string `json:"secretAccessKey" koanf:"secretaccesskey" sensitive:"true"`
	// ARN is the Openlane principal customers allow in the trust policy of the role Openlane assumes
	ARN string `json:"arn" koanf:"arn"`
}

Config holds operator-level credentials for the object storage definition

type ImportRecords

type ImportRecords struct {
	types.OperationSettings
	// ImportSpec selects the prefix to import
	ImportSpec
}

ImportRecords is the stored input of the record import

type ImportRecordsResult

type ImportRecordsResult struct {
	operations.IngestResult
	// Objects is the number of JSON objects read under the prefix
	Objects int
	// Moved is the number of objects moved into the processed directory
	Moved int
}

ImportRecordsResult reports the record import across every object under the prefix

type ImportSpec

type ImportSpec struct {
	// Prefix is the object key prefix whose JSON files hold arrays of records
	Prefix string `` /* 145-byte string literal not displayed */
	// MoveProcessed moves each object under the processed directory of the prefix once its records import without failure
	MoveProcessed bool `` /* 201-byte string literal not displayed */
}

ImportSpec selects the objects under a bucket prefix

type InstallationMetadata

type InstallationMetadata struct {
	// Provider is the storage provider holding the bucket
	Provider storage.ProviderType `json:"provider,omitempty" jsonschema:"title=Provider"`
	// Bucket is the bucket the installation is scoped to
	Bucket string `json:"bucket,omitempty" jsonschema:"title=Bucket"`
	// Region is the AWS region of the bucket when the provider is s3
	Region string `json:"region,omitempty" jsonschema:"title=Region"`
	// ProjectID is the Google Cloud project that owns the bucket when the provider is gcs
	ProjectID string `json:"projectId,omitempty" jsonschema:"title=Project ID"`
	// ServiceAccountEmail is the service account the installation acts as when available
	ServiceAccountEmail string `json:"serviceAccountEmail,omitempty" jsonschema:"title=Service Account Email"`
}

InstallationMetadata holds the stable provider, bucket and identity attributes for one installation

func (InstallationMetadata) InstallationIdentity

InstallationIdentity implements types.InstallationIdentifiable

type R2CredentialSchema

type R2CredentialSchema struct {
	// AccountID is the Cloudflare account that owns the bucket
	AccountID string `json:"accountId" jsonschema:"required,title=Account ID,description=Cloudflare account ID that owns the bucket"`
	// AccessKeyID is the R2 API token access key ID
	AccessKeyID string `json:"accessKeyId" jsonschema:"required,title=Access Key ID"`
	// SecretAccessKey is the R2 API token secret access key
	SecretAccessKey string `json:"secretAccessKey" jsonschema:"required,title=Secret Access Key,secret=true"`
	// BucketScope names the bucket the installation reads and writes
	BucketScope
}

R2CredentialSchema holds Cloudflare R2 S3-compatible keys for a bucket

type RuntimeConfig

type RuntimeConfig struct {
	// Providers holds the storage providers, exactly one enabled, holding the platform-owned bucket
	Providers storage.Providers `` /* 133-byte string literal not displayed */
	// Import selects the prefix and record kind the runtime import reads when the operation config leaves them empty
	Import ImportSpec `` /* 152-byte string literal not displayed */
}

RuntimeConfig is the operator-provisioned configuration for the platform-owned bucket

func (RuntimeConfig) Provisioned

func (c RuntimeConfig) Provisioned() bool

Provisioned reports whether the runtime config enables exactly one provider with a bucket, an import prefix and a record kind

type ServiceAccountCredentialSchema

type ServiceAccountCredentialSchema struct {
	// ServiceAccountKey is the service account key JSON used for direct credentials
	ServiceAccountKey string `` /* 182-byte string literal not displayed */
	// ProjectID is the Google Cloud project that owns the bucket
	ProjectID string `` /* 144-byte string literal not displayed */
	// BucketScope names the bucket the installation reads and writes
	BucketScope
}

ServiceAccountCredentialSchema holds the service account key credentials for one installation

type WorkloadIdentityCredentialSchema

type WorkloadIdentityCredentialSchema struct {
	// ProjectNumber is the numeric project number of the GCP project hosting the openlane workload identity pool and provider
	ProjectNumber string `` /* 195-byte string literal not displayed */
	// ServiceAccountEmail optionally impersonates a service account with access to the bucket
	ServiceAccountEmail string `` /* 155-byte string literal not displayed */
	// ProjectID is the Google Cloud project that owns the bucket
	ProjectID string `` /* 144-byte string literal not displayed */
	// BucketScope names the bucket the installation reads and writes
	BucketScope
}

WorkloadIdentityCredentialSchema holds the workload identity federation inputs for one installation; Openlane signs a short-lived assertion with its own keys and exchanges it at Google STS so nothing here is secret

type WriteObject

type WriteObject struct {
	// Key is the object key to write the document under
	Key string `json:"key" jsonschema:"required,title=Key,description=Object key to write the document under"`
	// ContentType is the MIME type recorded for the object
	ContentType string `` /* 129-byte string literal not displayed */
	// Content is the document to write; a string is written verbatim and any other value is JSON encoded
	Content any `` /* 144-byte string literal not displayed */
}

WriteObject writes a document to the bucket under a key

func (WriteObject) Run

Run encodes the document and uploads it to the bucket under the configured key

type WriteObjectResult

type WriteObjectResult struct {
	// Bucket is the bucket the object was written to
	Bucket string `json:"bucket"`
	// Key is the object key the document was written under
	Key string `json:"key"`
	// ContentType is the MIME type recorded for the object
	ContentType string `json:"contentType"`
	// Size is the number of bytes written
	Size int64 `json:"size"`
	// URI is the provider URI of the written object
	URI string `json:"uri"`
}

WriteObjectResult describes the object written by the write operation

Jump to

Keyboard shortcuts

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