aws

package
v0.6.12 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package aws provides AWS-specific configuration types and utilities for Fablab models. This includes security group definitions, EC2 volume configurations, and network rules.

Index

Constants

This section is empty.

Variables

View Source
var DefaultSecurityGroup = &SecurityGroup{
	Id:                  "default",
	ExcludeDefaultRules: false,
}

DefaultSecurityGroup is a pre-configured security group with standard default rules. It includes SSH ingress on port 22 and unrestricted egress traffic.

Functions

This section is empty.

Types

type Component

type Component struct {
	// SecurityGroup optionally specifies a custom security group ID for this component
	SecurityGroup string
}

Component defines AWS-specific configuration for a Fablab component.

type EC2Host

type EC2Host struct {
	// Volume specifies the EBS volume configuration
	Volume EC2Volume
	// SecurityGroup optionally specifies a custom security group ID for this host
	SecurityGroup string
}

EC2Host defines AWS-specific configuration for a Fablab host.

type EC2Volume

type EC2Volume struct {
	// Type specifies the EBS volume type (e.g., "gp3", "gp2", "io1", "io2")
	Type string
	// SizeGB is the volume size in gigabytes
	SizeGB uint32
	// IOPS specifies the provisioned IOPS (only for io1/io2 volume types)
	IOPS uint32
}

EC2Volume defines the configuration for an EBS volume attached to an EC2 instance.

type Env

type Env interface {
	MangleName(name string) string
}

Env represents an environment that can mangle names for AWS resource uniqueness. Implementations typically prefix names with environment identifiers.

type Model

type Model struct {
	// SecurityGroups defines the security groups available for use by hosts and components
	SecurityGroups map[string]*SecurityGroup
}

Model represents the AWS-specific configuration within a Fablab model.

func (*Model) Init

func (self *Model) Init(env Env) error

Init initializes all security groups in the model with the given environment context. Returns an error if any security group fails to initialize.

type NetworkRule

type NetworkRule struct {
	// Direction specifies whether this rule applies to ingress or egress traffic
	Direction RuleDirection
	// Port specifies the network port (0 for all ports when Protocol is "-1")
	Port uint16
	// Protocol must be "tcp", "udp", or "-1" (all protocols)
	Protocol string
	// CidrBlocks defines the IP ranges this rule applies to (defaults to "0.0.0.0/0" if empty)
	CidrBlocks []string
}

NetworkRule defines a single network access rule for a security group.

func (*NetworkRule) CidrBlockList

func (self *NetworkRule) CidrBlockList() string

CidrBlockList returns a Terraform-formatted array string of CIDR blocks. CIDR blocks containing "/" are quoted as literals, others are treated as Terraform variables.

type RuleDirection

type RuleDirection string

RuleDirection specifies whether a network rule applies to incoming or outgoing traffic.

const (
	// Ingress represents inbound traffic rules
	Ingress RuleDirection = "ingress"
	// Egress represents outbound traffic rules
	Egress RuleDirection = "egress"
)

type SecurityGroup

type SecurityGroup struct {
	// Id is the unique identifier for this security group
	Id string
	// Rules defines the network access rules for this security group
	Rules []*NetworkRule

	// ExcludeDefaultRules when true prevents automatic addition of SSH and egress rules
	ExcludeDefaultRules bool
	// contains filtered or unexported fields
}

SecurityGroup defines an AWS security group with network access rules. Security groups control inbound and outbound traffic for EC2 instances.

func (*SecurityGroup) Name

func (self *SecurityGroup) Name() string

Name returns the environment-mangled name for this security group. This ensures uniqueness across different environments.

type SecurityGroups

type SecurityGroups map[string]*SecurityGroup

Jump to

Keyboard shortcuts

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