providers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package providers defines the Provider interface and DeployTarget compatibility matrix for workflow-plugin-eventbus. Each provider (nats, kafka, kinesis) implements Provider and emits typed IaC resource declarations for its supported deploy targets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateProviderTarget

func ValidateProviderTarget(provider string, target DeployTarget) error

ValidateProviderTarget returns an error if the provider × target combination is unsupported. It is called at config-load time so misconfigured deployments are rejected before any IaC resources are emitted.

Types

type DeployTarget

type DeployTarget string

DeployTarget identifies the deployment platform for an event-bus cluster.

const (
	// TargetDigitalOceanApp deploys to DigitalOcean App Platform.
	TargetDigitalOceanApp DeployTarget = "digitalocean.app_platform"
	// TargetDigitalOceanManagedKafka deploys to DigitalOcean Managed Kafka.
	TargetDigitalOceanManagedKafka DeployTarget = "digitalocean.managed_kafka"
	// TargetAWSECS deploys to AWS ECS (Elastic Container Service).
	TargetAWSECS DeployTarget = "aws.ecs"
	// TargetAWSEKS deploys to AWS EKS (Elastic Kubernetes Service).
	TargetAWSEKS DeployTarget = "aws.eks"
	// TargetAWSManagedKafka deploys to AWS MSK (Managed Streaming for Apache Kafka).
	TargetAWSManagedKafka DeployTarget = "aws.msk"
	// TargetAWSKinesis deploys to AWS Kinesis Data Streams.
	TargetAWSKinesis DeployTarget = "aws.kinesis"
	// TargetKubernetes deploys to a generic Kubernetes cluster.
	TargetKubernetes DeployTarget = "kubernetes"
	// TargetSelfHosted deploys to a self-managed host (Docker, bare metal).
	TargetSelfHosted DeployTarget = "self_hosted"
)

type HealthCheck

type HealthCheck struct {
	// URI is the address that was probed.
	URI string
	// Status is the typed health state.
	Status HealthStatus
	// Err is non-nil when Status is HealthStatusDegraded or HealthStatusUnreachable.
	Err error
}

HealthCheck is the result of a liveness probe against an event-bus URI.

type HealthStatus

type HealthStatus string

HealthStatus is the typed health state returned by Provider.Probe.

const (
	// HealthStatusHealthy indicates the broker is reachable and fully operational.
	HealthStatusHealthy HealthStatus = "healthy"
	// HealthStatusDegraded indicates the broker is reachable but impaired
	// (e.g. a replica is down, JetStream is slow).
	HealthStatusDegraded HealthStatus = "degraded"
	// HealthStatusUnreachable indicates the broker did not respond within the probe timeout.
	HealthStatusUnreachable HealthStatus = "unreachable"
)

type Provider

type Provider interface {
	// Name returns the provider identifier: "nats", "kafka", or "kinesis".
	Name() string

	// Resources returns the IaC resource declarations required to provision
	// the event-bus cluster described by cfg on the given deploy target.
	// cfg is passed as a pointer because proto messages embed sync.Mutex via
	// protoimpl.MessageState and must not be copied by value.
	// Returns an error if the provider × target combination is unsupported
	// or if cfg is invalid for this provider.
	Resources(cfg *eventbusv1.ClusterConfig, target DeployTarget) ([]iac.Resource, error)

	// ConnectionString derives the broker connection string from provisioned state.
	// env selects environment-specific outputs (e.g. "prod", "staging").
	ConnectionString(state iac.State, env string) (string, error)

	// StreamResources returns the IaC resource declarations required to
	// declare the given streams against an already-provisioned cluster
	// (represented by state). Streams are pointers for the same reason as cfg.
	StreamResources(streams []*eventbusv1.StreamConfig, state iac.State) ([]iac.Resource, error)

	// Probe probes the event-bus cluster at uri and returns its health state.
	Probe(uri string) HealthCheck
}

Provider is the interface all event-bus provider adapters must implement. Each provider translates a ClusterConfig + DeployTarget into a set of typed IaC resource declarations without directly calling cloud APIs.

Implementations live at providers/{nats,kafka,kinesis}/.

Directories

Path Synopsis
Package kafka provides a stub implementation of the kafka event-bus Provider.
Package kafka provides a stub implementation of the kafka event-bus Provider.
Package kinesis provides a stub implementation of the kinesis event-bus Provider.
Package kinesis provides a stub implementation of the kinesis event-bus Provider.
Package nats provides the NATS event-bus Provider implementation.
Package nats provides the NATS event-bus Provider implementation.

Jump to

Keyboard shortcuts

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