patterns

package
v1.0.58 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoScalingConfig

type AutoScalingConfig struct {
	MinCapacity             *float64
	MaxCapacity             *float64
	TargetCPUUtilization    *float64
	TargetMemoryUtilization *float64
	ScaleInCooldown         *awscdk.Duration
	ScaleOutCooldown        *awscdk.Duration
	RequestsPerTarget       *float64
	EnablePredictiveScaling *bool
	EnableScheduledScaling  *bool
	ScheduledScalingActions *[]ScheduledScalingAction
}

AutoScalingConfig defines auto-scaling configuration

type BasicAPI

type BasicAPI struct {
	constructs.Construct
	Api      *liftconstructs.LiftAPI
	Function *liftconstructs.LiftFunction
}

BasicAPI is a pattern that creates an API Gateway with a Lambda function backend

func NewBasicAPI

func NewBasicAPI(scope constructs.Construct, id *string, props *BasicAPIProps) *BasicAPI

NewBasicAPI creates a new basic API pattern with sensible defaults

func (*BasicAPI) AddRoute

func (api *BasicAPI) AddRoute(path *string, method awsapigatewayv2.HttpMethod, handler awslambda.IFunction)

AddRoute adds a new route to the API

func (*BasicAPI) GetApi

func (api *BasicAPI) GetApi() *liftconstructs.LiftAPI

GetApi returns the API Gateway construct

func (*BasicAPI) GetApiUrl

func (api *BasicAPI) GetApiUrl() *string

GetApiUrl returns the API URL

func (*BasicAPI) GetFunction

func (api *BasicAPI) GetFunction() awslambda.Function

GetFunction returns the Lambda function

type BasicAPIProps

type BasicAPIProps struct {
	// API name
	ApiName *string
	// Lambda function code
	Code awslambda.Code
	// Handler (defaults to "bootstrap" for Go)
	Handler *string
	// Enable CORS
	EnableCORS *bool
	// Enable monitoring with CloudWatch dashboard
	EnableMonitoring *bool
	// Memory size in MB (default: 512)
	MemorySize *float64
	// Timeout in seconds (default: 30)
	Timeout *float64
	// Environment variables
	Environment *map[string]*string
}

BasicAPIProps defines properties for creating a basic API pattern

type ContainerConfig

type ContainerConfig struct {
	Platform          awsecs.CpuArchitecture
	Secrets           *map[string]awsecs.Secret
	CodeAssetPath     *string
	CPU               *float64
	Memory            *float64
	Environment       *map[string]*string
	ImageURI          *string
	EnableXRayTracing *bool
	EnableFirelens    *bool
	Command           *[]*string
	EntryPoint        *[]*string
	WorkingDirectory  *string
	User              *string
	LogRetentionDays  awslogs.RetentionDays
}

ContainerConfig defines container configuration

type EventDrivenAPI

type EventDrivenAPI struct {
	constructs.Construct

	// The HTTP API
	API *liftconstructs.LiftAPI

	// API handler function
	APIFunction *liftconstructs.LiftFunction

	// EventBridge handler
	EventHandler *liftconstructs.EventBridgeHandler

	// Request tracking table (DynamORM-based)
	RequestTrackingTable *liftconstructs.RequestTrackingTable
}

EventDrivenAPI represents an API Gateway + EventBridge pattern for async processing

func NewEventDrivenAPI

func NewEventDrivenAPI(scope constructs.Construct, id *string, props *EventDrivenAPIProps) *EventDrivenAPI

NewEventDrivenAPI creates a new event-driven API pattern using DynamORM

func (*EventDrivenAPI) AddAPIRoute

func (e *EventDrivenAPI) AddAPIRoute(path *string, method string, handler awslambda.IFunction)

AddAPIRoute adds a new route to the API

func (*EventDrivenAPI) GetAPIEndpoint

func (e *EventDrivenAPI) GetAPIEndpoint() *string

GetAPIEndpoint returns the API endpoint URL

func (*EventDrivenAPI) GetRequestTrackingTableName

func (e *EventDrivenAPI) GetRequestTrackingTableName() *string

GetRequestTrackingTableName returns the request tracking table name

func (*EventDrivenAPI) GrantRequestTrackingAccess

func (e *EventDrivenAPI) GrantRequestTrackingAccess(grantee awslambda.IFunction)

GrantRequestTrackingAccess grants read/write access to the request tracking table

type EventDrivenAPIProps

type EventDrivenAPIProps struct {
	// Application name
	AppName *string

	// API configuration
	ApiName             *string
	Description         *string
	EnableCORS          *bool
	EnableAccessLogging *bool
	ThrottleRateLimit   *float64
	ThrottleBurstLimit  *float64

	// Lambda function configuration
	FunctionProps awslambda.FunctionProps
	MemorySize    *float64
	Timeout       *float64
	Environment   *map[string]*string

	// EventBridge configuration
	EventBusName *string
	EventSource  *string
	DetailType   *string

	// Request tracking configuration
	RequestTrackingTableProps *liftconstructs.RequestTrackingTableProps
	EnableRequestTracking     *bool
	RequestRetentionDays      *float64

	// Lift-specific settings
	EnableTracing     *bool
	EnableMultiTenant *bool
	EnableMonitoring  *bool
}

EventDrivenAPIProps defines properties for an event-driven API pattern

type EventOrchestrator

type EventOrchestrator struct {
	constructs.Construct

	// Event routing table (DynamORM-based)
	EventRoutingTable *liftconstructs.EventRoutingTable

	// Event source handlers
	EventHandlers map[string]*liftconstructs.EventBridgeHandler

	// Orchestration function
	OrchestratorFunction *liftconstructs.LiftFunction

	// Correlation function (if enabled)
	CorrelationFunction *liftconstructs.LiftFunction

	// Dead letter handler
	DLQHandler *liftconstructs.LiftFunction

	// Dead letter queue (created by the orchestrator by default)
	DLQQueue awssqs.IQueue
}

EventOrchestrator represents a multi-source event orchestration pattern

func NewEventOrchestrator

func NewEventOrchestrator(scope constructs.Construct, id *string, props *EventOrchestratorProps) *EventOrchestrator

NewEventOrchestrator creates a new event orchestrator pattern using DynamORM

func (*EventOrchestrator) AddEventSource

func (e *EventOrchestrator) AddEventSource(_ EventSourceConfig)

AddEventSource adds a new event source to the orchestrator

func (*EventOrchestrator) GetEventHandler

func (e *EventOrchestrator) GetEventHandler(sourceName string) *liftconstructs.EventBridgeHandler

GetEventHandler returns the handler for a specific event source

func (*EventOrchestrator) GetEventRoutingTableName

func (e *EventOrchestrator) GetEventRoutingTableName() *string

GetEventRoutingTableName returns the event routing table name

func (*EventOrchestrator) GrantEventRoutingAccess

func (e *EventOrchestrator) GrantEventRoutingAccess(grantee awslambda.IFunction)

GrantEventRoutingAccess grants read/write access to the event routing table

type EventOrchestratorProps

type EventOrchestratorProps struct {
	// Pointers and maps first for better alignment
	DefaultEnvironment     *map[string]*string
	EventRoutingTableProps *liftconstructs.EventRoutingTableProps
	EventBusName           *string
	AppName                *string
	EnableEventArchive     *bool
	EnableEventRouting     *bool
	EnableSagaPattern      *bool
	EnableEventCorrelation *bool
	EnableTracing          *bool
	EnableMultiTenant      *bool
	EnableMonitoring       *bool
	MaxRetryAttempts       *float64
	RetryBackoffRate       *float64
	DefaultMemorySize      *float64
	DefaultTimeout         *float64
	EventRetentionDays     *float64
	ArchiveRetentionDays   *float64
	// Optional: specify the actual DLQ to monitor, or its name, to avoid relying on name conventions
	DLQQueue     awssqs.IQueue
	DLQQueueName *string
	// Non-pointer struct fields
	DefaultFunctionProps awslambda.FunctionProps
	EventSources         []EventSourceConfig
}

EventOrchestratorProps defines properties for an event orchestrator pattern

type EventSourceConfig

type EventSourceConfig struct {
	SourceName     *string
	HandlerProps   *awslambda.FunctionProps
	ProcessingMode *string
	EventFilters   map[string]interface{}
	EventTypes     []*string
}

EventSourceConfig defines configuration for an event source

type HealthCheckConfig

type HealthCheckConfig struct {
	Path               *string
	Port               *float64
	Protocol           *string
	Interval           *awscdk.Duration
	Timeout            *awscdk.Duration
	HealthyThreshold   *float64
	UnhealthyThreshold *float64
	GracePeriod        *awscdk.Duration
}

HealthCheckConfig defines health check configuration

type LiftApp

type LiftApp struct {
	constructs.Construct
	API            *liftconstructs.LiftAPI
	Function       *liftconstructs.LiftFunction
	Database       *liftconstructs.LiftTable
	RateLimitTable *liftconstructs.LiftTable
}

LiftApp is a complete Lift application pattern with API Gateway, Lambda, and DynamoDB

func NewLiftApp

func NewLiftApp(scope constructs.Construct, id *string, props *LiftAppProps) *LiftApp

NewLiftApp creates a complete Lift application stack

type LiftAppProps

type LiftAppProps struct {
	// Application name
	AppName *string
	// Lambda code asset path
	CodeAssetPath *string
	// Enable multi-tenant support
	EnableMultiTenant *bool
	// Enable API Gateway access logging
	EnableAccessLogging *bool
	// Custom domain configuration
	DomainName     *string
	CertificateArn *string
	// Environment variables for Lambda
	Environment *map[string]*string
	// Memory size for Lambda function
	MemorySize *float64
	// Timeout for Lambda function
	Timeout *float64
	// Enable DynamoDB table
	EnableDatabase *bool
	// Database table name (only used if DatabaseTable is not provided)
	DatabaseTableName *string
	// Database partition key field name (defaults to "ID" for simple models)
	DatabasePartitionKey *string
	// Database sort key field name (optional)
	DatabaseSortKey *string
	// Existing table to use (if provided, other database options are ignored)
	DatabaseTable *liftconstructs.LiftTable
	// Enable rate limiting table
	EnableRateLimiting *bool
	// Rate limiting table name
	RateLimitTableName *string
	// Enable idempotency
	EnableIdempotency *bool
}

LiftAppProps defines properties for a complete Lift application

type LoadBalancerConfig

type LoadBalancerConfig struct {
	Enabled                 *bool
	Certificate             awselasticloadbalancingv2.IListenerCertificate
	DomainName              *string
	EnableHTTP2             *bool
	EnableSSLRedirect       *bool
	IdleTimeout             *awscdk.Duration
	HealthCheckPath         *string
	HealthCheckInterval     *awscdk.Duration
	HealthCheckTimeout      *awscdk.Duration
	HealthyThresholdCount   *float64
	UnhealthyThresholdCount *float64
	DeregistrationDelay     *awscdk.Duration
	StickinessEnabled       *bool
	TargetGroupProtocol     awselasticloadbalancingv2.ApplicationProtocol
}

LoadBalancerConfig defines load balancer configuration

type MicroserviceComplete

type MicroserviceComplete struct {
	constructs.Construct
	// Infrastructure
	VPC            awsec2.IVpc
	Cluster        awsecs.ICluster
	Service        awsecs.FargateService
	TaskDefinition awsecs.FargateTaskDefinition
	// Service discovery
	Namespace        awsservicediscovery.IPrivateDnsNamespace
	ServiceDiscovery awsservicediscovery.IService
	// Load balancing
	LoadBalancer awselasticloadbalancingv2.IApplicationLoadBalancer
	TargetGroup  awselasticloadbalancingv2.IApplicationTargetGroup
	Listener     awselasticloadbalancingv2.IApplicationListener
	// Auto scaling
	ScalableTarget awsecs.ScalableTaskCount
	// Monitoring and security
	Monitoring *liftconstructs.EnhancedMonitoring
	Security   *liftconstructs.EnhancedSecurity
	// Outputs
	ServiceEndpoint          *string
	LoadBalancerDNS          *string
	ServiceDiscoveryEndpoint *string
}

MicroserviceComplete represents a complete microservice implementation

func NewMicroserviceComplete

func NewMicroserviceComplete(scope constructs.Construct, id *string, props *MicroserviceCompleteProps) *MicroserviceComplete

NewMicroserviceComplete creates a comprehensive microservice stack

func (*MicroserviceComplete) GetCluster

func (m *MicroserviceComplete) GetCluster() awsecs.ICluster

GetCluster returns the ECS cluster

func (*MicroserviceComplete) GetLoadBalancer

GetLoadBalancer returns the application load balancer

func (*MicroserviceComplete) GetMonitoring

GetMonitoring returns the enhanced monitoring construct

func (*MicroserviceComplete) GetSecurity

GetSecurity returns the enhanced security construct

func (*MicroserviceComplete) GetService

func (m *MicroserviceComplete) GetService() awsecs.FargateService

GetService returns the ECS Fargate service

func (*MicroserviceComplete) GetServiceDiscoveryEndpoint

func (m *MicroserviceComplete) GetServiceDiscoveryEndpoint() *string

GetServiceDiscoveryEndpoint returns the service discovery endpoint

func (*MicroserviceComplete) GetServiceEndpoint

func (m *MicroserviceComplete) GetServiceEndpoint() *string

GetServiceEndpoint returns the public service endpoint

type MicroserviceCompleteProps

type MicroserviceCompleteProps struct {
	awscdk.StackProps
	// Basic configuration
	ServiceName *string
	Environment *string
	// Network configuration
	NetworkConfig *NetworkConfig
	// Container configuration
	ContainerConfig *ContainerConfig
	// Service discovery
	ServiceDiscovery *ServiceDiscoveryConfig
	// Load balancer
	LoadBalancer *LoadBalancerConfig
	// Auto scaling
	AutoScaling *AutoScalingConfig
	// Health checks
	HealthCheck *HealthCheckConfig
	// Enable enhanced monitoring
	EnableEnhancedMonitoring *bool
	// Enable enhanced security
	EnableEnhancedSecurity *bool
	// Tags
	Tags *map[string]*string
}

MicroserviceCompleteProps defines comprehensive microservice properties

type NetworkConfig

type NetworkConfig struct {
	VPC                     awsec2.IVpc
	SubnetSelection         *awsec2.SubnetSelection
	SecurityGroups          *[]awsec2.ISecurityGroup
	AssignPublicIP          *bool
	EnableVPCLogs           *bool
	EnableContainerInsights *bool
}

NetworkConfig defines network configuration

type ScheduledScalingAction

type ScheduledScalingAction struct {
	MinCapacity     *float64
	MaxCapacity     *float64
	DesiredCapacity *float64
	Timezone        *string
	Name            string
	Schedule        string
}

ScheduledScalingAction defines a scheduled scaling action

type SecureAPI

SecureAPI is a pattern that creates a secure API with WAF, rate limiting, and VPC

func NewSecureAPI

func NewSecureAPI(scope constructs.Construct, id *string, props *SecureAPIProps) *SecureAPI

NewSecureAPI creates a new secure API pattern with enterprise-grade security

func (*SecureAPI) GetApi

func (api *SecureAPI) GetApi() *liftconstructs.LiftAPI

GetApi returns the API Gateway construct

func (*SecureAPI) GetApiUrl

func (api *SecureAPI) GetApiUrl() *string

GetApiUrl returns the API URL

func (*SecureAPI) GetFunction

func (api *SecureAPI) GetFunction() *liftconstructs.SecureFunction

GetFunction returns the secure Lambda function

func (*SecureAPI) GetWebACL

func (api *SecureAPI) GetWebACL() awswafv2.CfnWebACL

GetWebACL returns the WAF WebACL

type SecureAPIProps

type SecureAPIProps struct {
	Vpc                awsec2.IVpc
	Code               awslambda.Code
	AlarmTopic         awssns.ITopic
	EnableWAF          *bool
	EnableRateLimiting *bool
	RateLimitWindow    *float64
	RateLimitMax       *float64
	ApiName            *string
	DomainName         *string
	CertificateArn     *string
	Handler            *string
	MemorySize         *float64
	Timeout            *float64
	Environment        *map[string]*string
	AdditionalPolicies *[]awsiam.PolicyStatement
	RateLimitType      liftconstructs.RateLimitType
}

SecureAPIProps defines properties for creating a secure API pattern

type ServiceDiscoveryConfig

type ServiceDiscoveryConfig struct {
	Namespace               *string
	ServiceName             *string
	HealthCheckPath         *string
	HealthCheckInterval     *awscdk.Duration
	HealthCheckTimeout      *awscdk.Duration
	HealthyThresholdCount   *float64
	UnhealthyThresholdCount *float64
	TTL                     *awscdk.Duration
	DNSRecordType           awsservicediscovery.DnsRecordType
}

ServiceDiscoveryConfig defines service discovery configuration

Jump to

Keyboard shortcuts

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