stack

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTemplate

func GenerateTemplate(opts TemplateOptions) string

GenerateTemplate returns a CloudFormation JSON template that provisions:

  • IAM role for GameLift container fleet
  • Container group definition
  • Container fleet with inbound UDP permissions

Template parameters (ImageURI, ServerPort, InstanceType) allow stack updates without regenerating the template.

Types

type StackDeployer

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

StackDeployer manages CloudFormation stack lifecycle for GameLift resources.

func NewStackDeployer

func NewStackDeployer(opts StackOptions, awsCfg aws.Config) *StackDeployer

NewStackDeployer creates a new CloudFormation stack deployer.

func (*StackDeployer) CreateGameSession

func (d *StackDeployer) CreateGameSession(ctx context.Context, fleetID string, maxPlayers int) (*deploy.SessionInfo, error)

CreateGameSession creates a game session on the fleet managed by this stack.

func (*StackDeployer) Deploy

func (d *StackDeployer) Deploy(ctx context.Context) (*StackResult, error)

Deploy creates or updates the CloudFormation stack and waits for completion.

func (*StackDeployer) DescribeGameSession

func (d *StackDeployer) DescribeGameSession(ctx context.Context, sessionID string) (string, error)

DescribeGameSession returns the current status of a game session.

func (*StackDeployer) Destroy

func (d *StackDeployer) Destroy(ctx context.Context) error

Destroy deletes the CloudFormation stack and waits for completion.

func (*StackDeployer) GetFleetID

func (d *StackDeployer) GetFleetID(ctx context.Context) (string, error)

GetFleetID reads the FleetId output from the stack.

func (*StackDeployer) Status

func (d *StackDeployer) Status(ctx context.Context) (*StackStatus, error)

Status returns the current status of the CloudFormation stack.

type StackOptions

type StackOptions struct {
	// StackName is the CloudFormation stack name.
	StackName string
	// Region is the AWS region.
	Region string
	// ImageURI is the ECR image URI for the game server container.
	ImageURI string
	// FleetName is the GameLift fleet name (used for tagging).
	FleetName string
	// InstanceType is the EC2 instance type for the fleet.
	InstanceType string
	// ContainerGroupName is the container group definition name.
	ContainerGroupName string
	// ServerPort is the game server port.
	ServerPort int
	// ServerSDKVersion is the GameLift Server SDK version.
	ServerSDKVersion string
	// Tags are applied to the stack and all its resources.
	Tags map[string]string
}

StackOptions configures a CloudFormation stack deployment.

type StackResult

type StackResult struct {
	StackName string
	StackID   string
	Status    string
	FleetID   string
}

StackResult holds the outcome of a stack deployment.

type StackStatus

type StackStatus struct {
	StackName string
	Status    string
	FleetID   string
	Outputs   map[string]string
}

StackStatus holds the current state of a CloudFormation stack.

type TargetAdapter

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

TargetAdapter wraps a StackDeployer to implement deploy.Target and deploy.SessionManager.

func NewTargetAdapter

func NewTargetAdapter(d *StackDeployer) *TargetAdapter

NewTargetAdapter creates a TargetAdapter wrapping the given StackDeployer.

func (*TargetAdapter) Capabilities

func (a *TargetAdapter) Capabilities() deploy.Capabilities

func (*TargetAdapter) CreateSession

func (a *TargetAdapter) CreateSession(ctx context.Context, maxPlayers int) (*deploy.SessionInfo, error)

CreateSession implements deploy.SessionManager.

func (*TargetAdapter) Deploy

func (*TargetAdapter) Deployer

func (a *TargetAdapter) Deployer() *StackDeployer

Deployer returns the underlying StackDeployer for direct access.

func (*TargetAdapter) DescribeSession

func (a *TargetAdapter) DescribeSession(ctx context.Context, sessionID string) (string, error)

DescribeSession implements deploy.SessionManager.

func (*TargetAdapter) Destroy

func (a *TargetAdapter) Destroy(ctx context.Context) error

func (*TargetAdapter) Name

func (a *TargetAdapter) Name() string

func (*TargetAdapter) Status

type TemplateOptions

type TemplateOptions struct {
	ContainerGroupName string
	ServerPort         int
	ServerSDKVersion   string
	Tags               map[string]string
}

TemplateOptions configures the CloudFormation template generation.

Jump to

Keyboard shortcuts

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