provisionworker

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: AGPL-3.0 Imports: 49 Imported by: 0

Documentation

Overview

Package provisionworker processes managed instance provisioning jobs from SQS.

Index

Constants

View Source
const ServiceName = "provision-worker"

ServiceName is the canonical service identifier for the provisioning worker.

Variables

View Source
var ErrConsentEncryptionKeyRequired = errors.New("consent encryption key is required")

ErrConsentEncryptionKeyRequired is returned when the consent encryption key is empty or missing.

Functions

func ConsentEncryptionKeyHex added in v0.4.5

func ConsentEncryptionKeyHex(keyHex string) ([]byte, error)

ConsentEncryptionKeyHex decodes a hex-encoded consent encryption key string into a 32-byte key suitable for EncryptConsent / DecryptConsent. Returns an error if the key is not exactly 64 hex characters (32 bytes).

func DecryptConsent added in v0.4.5

func DecryptConsent(encoded string, key []byte) (string, error)

DecryptConsent decrypts a consent value that was encrypted with EncryptConsent. If the value does not have the "enc:v1:" prefix, it is returned as-is for backward compatibility with legacy plaintext consent. Returns the exact decrypted bytes on success (no trimming).

func EncryptConsent added in v0.4.5

func EncryptConsent(plaintext string, key []byte) (string, error)

EncryptConsent encrypts a plaintext consent payload using AES-256-GCM with the supplied 32-byte key. Returns a base64-encoded ciphertext prefixed with "enc:v1:" so the decryption path can distinguish encrypted values from legacy plaintext consent stored in older job records.

The plaintext is encrypted as-is (no trimming) so that signed consent bytes round-trip exactly.

func New

func New(opts ...apptheory.Option) *apptheory.App

New constructs the provisioning worker app.

func PackConsent added in v0.4.5

func PackConsent(message, signature string) ([]byte, error)

PackConsent serializes a consent message and signature into a JSON byte slice suitable for encryption. The message and signature bytes are preserved exactly — no trimming is applied by this function.

func Register

func Register(app *apptheory.App, srv *Server) *apptheory.App

Register registers SQS handlers with the provided app.

func UnpackConsent added in v0.4.5

func UnpackConsent(raw []byte) (message string, signature string)

UnpackConsent deserializes an encrypted-then-decrypted consent payload JSON back into message and signature. If the payload cannot be parsed as a consentCryptoPacket, it is treated as a plain message with no signature for backward compatibility with legacy non-structured payloads.

func ValidateManagedLesserBodyReleaseCompatibility added in v0.2.3

func ValidateManagedLesserBodyReleaseCompatibility(ctx context.Context, client *http.Client, owner string, repo string, version string, stage string) error

func ValidateManagedLesserBodyReleaseTemplatePreflight added in v0.2.3

func ValidateManagedLesserBodyReleaseTemplatePreflight(
	ctx context.Context,
	client *http.Client,
	owner string,
	repo string,
	version string,
	stage string,
) (string, error)

func ValidateManagedLesserBodyReleaseVersionSupported added in v0.2.3

func ValidateManagedLesserBodyReleaseVersionSupported(version string) error

func ValidateManagedLesserReleaseCompatibility added in v0.2.3

func ValidateManagedLesserReleaseCompatibility(ctx context.Context, client *http.Client, owner string, repo string, version string) error

func ValidateManagedLesserReleaseVersionSupported added in v0.2.3

func ValidateManagedLesserReleaseVersionSupported(version string) error

Types

type ManagedLesserBodyAuxiliaryAssetsContract added in v0.3.2

type ManagedLesserBodyAuxiliaryAssetsContract struct {
	RequiredCapability string   `json:"required_capability"`
	S3KeySemantics     string   `json:"s3_key_semantics"`
	TemplateParameter  string   `json:"template_parameter"`
	RequiredFields     []string `json:"required_fields"`
}

type ManagedLesserBodyCompatibilityContract added in v0.2.3

type ManagedLesserBodyCompatibilityContract struct {
	SchemaVersion                   int                                      `json:"schema_version"`
	ReleaseName                     string                                   `json:"release_name"`
	MinimumReleaseVersion           string                                   `json:"minimum_release_version"`
	ReleaseManifestAsset            string                                   `json:"release_manifest_asset"`
	ReleaseManifestSchema           int                                      `json:"release_manifest_schema"`
	SupportedReleaseManifestSchemas []int                                    `json:"supported_release_manifest_schemas"`
	Checksums                       ManagedReleaseChecksumsContract          `json:"checksums"`
	DeployManifest                  ManagedLesserBodyDeployManifestContract  `json:"deploy_manifest"`
	Deploy                          ManagedLesserBodyDeployContract          `json:"deploy"`
	LambdaZip                       ManagedLesserBodyPathContract            `json:"lambda_zip"`
	DeployScript                    ManagedLesserBodyPathContract            `json:"deploy_script"`
	SupportedStages                 []string                                 `json:"supported_stages"`
	DeployTemplates                 ManagedLesserBodyDeployTemplatesContract `json:"deploy_templates"`
	AuxiliaryAssets                 ManagedLesserBodyAuxiliaryAssetsContract `json:"auxiliary_assets"`
}

func CurrentManagedLesserBodyCompatibilityContract added in v0.2.3

func CurrentManagedLesserBodyCompatibilityContract() ManagedLesserBodyCompatibilityContract

type ManagedLesserBodyDeployContract added in v0.2.3

type ManagedLesserBodyDeployContract struct {
	SchemaVersion                 int      `json:"schema_version"`
	SupportedSchemaVersions       []int    `json:"supported_schema_versions"`
	ManifestPath                  string   `json:"manifest_path"`
	TemplateSelection             string   `json:"template_selection"`
	SourceCheckoutRequired        bool     `json:"source_checkout_required"`
	NPMInstallRequired            bool     `json:"npm_install_required"`
	SupportedRequiredCapabilities []string `json:"supported_required_capabilities"`
}

type ManagedLesserBodyDeployManifestContract added in v0.2.3

type ManagedLesserBodyDeployManifestContract struct {
	Path                    string `json:"path"`
	SchemaVersion           int    `json:"schema_version"`
	SupportedSchemaVersions []int  `json:"supported_schema_versions"`
}

type ManagedLesserBodyDeployTemplatesContract added in v0.2.3

type ManagedLesserBodyDeployTemplatesContract struct {
	Format string `json:"format"`
}

type ManagedLesserBodyPathContract added in v0.2.3

type ManagedLesserBodyPathContract struct {
	Path string `json:"path"`
}

type ManagedLesserCompatibilityContract added in v0.2.3

type ManagedLesserCompatibilityContract struct {
	SchemaVersion         int                               `json:"schema_version"`
	ReleaseName           string                            `json:"release_name"`
	MinimumReleaseVersion string                            `json:"minimum_release_version"`
	ReleaseManifestAsset  string                            `json:"release_manifest_asset"`
	ReleaseManifestSchema int                               `json:"release_manifest_schema"`
	MinimumReceiptSchema  int                               `json:"minimum_receipt_schema_version"`
	DeployArtifactsSchema int                               `json:"deploy_artifacts_schema_version"`
	LambdaBundle          ManagedLesserLambdaBundleContract `json:"lambda_bundle"`
}

func CurrentManagedLesserCompatibilityContract added in v0.2.3

func CurrentManagedLesserCompatibilityContract() ManagedLesserCompatibilityContract

type ManagedLesserLambdaBundleContract added in v0.2.3

type ManagedLesserLambdaBundleContract struct {
	Path                  string `json:"path"`
	ManifestPath          string `json:"manifest_path"`
	ManifestKind          string `json:"manifest_kind"`
	ManifestSchemaVersion int    `json:"manifest_schema_version"`
}

type ManagedReleaseChecksumsContract added in v0.2.3

type ManagedReleaseChecksumsContract struct {
	Path      string `json:"path"`
	Algorithm string `json:"algorithm"`
}

type Server

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

Server processes provisioning jobs from the worker queue.

func NewServer

func NewServer(cfg config.Config, st *store.Store, org organizationsAPI, r53 route53API, stsClient stsAPI, sqsClient sqsAPI, cbClient codebuildAPI, s3Client s3API) *Server

NewServer constructs a Server with AWS service clients and a store.

func (*Server) Register

func (s *Server) Register(app *apptheory.App)

Register registers SQS handlers with the provided app.

Jump to

Keyboard shortcuts

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