service

package
v1.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTargetGroupNotReturnedAfterCreation = errors.New("target group not returned after creation")
	ErrTargetInstancesMustAllBeInSameVPC   = errors.New("target instances must all be in the same vpc")
)
View Source
var (
	DefaultEC2      *EC2
	DefaultELBv2    *ELBv2
	DefaultACM      *ACM
	DefaultAwsumILB *AwsumILBService
)

Functions

func Setup

func Setup(awsConfig aws.Config)

Types

type ACM added in v1.1.1

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

func NewACM added in v1.1.1

func NewACM(awsConfig aws.Config) *ACM

func (*ACM) Client added in v1.1.1

func (svc *ACM) Client() *acm.Client

func (*ACM) GenerateLoadBalanceCertificateListFromCertificateNames added in v1.1.1

func (svc *ACM) GenerateLoadBalanceCertificateListFromCertificateNames(
	ctx context.Context,
	certificateNames []string,
) ([]types.Certificate, error)

type AwsumILBService

type AwsumILBService struct {
	EC2   *EC2
	ELBv2 *ELBv2
	ACM   *ACM
}

AwsumILBService is a struct used to encompass all the logic of services on instances that are load balanced by resources created by awsum.

func NewAwsumILBService

func NewAwsumILBService(awsConfig aws.Config) *AwsumILBService

func (*AwsumILBService) SetupNewILBService

func (svc *AwsumILBService) SetupNewILBService(opts SetupNewILBServiceOptions) (*ILBServiceResources, error)

type CreateInstanceTargetGroupOptions

type CreateInstanceTargetGroupOptions struct {
	Ctx             context.Context
	VpcId           string
	ServiceName     string
	TrafficPort     int32
	TrafficProtocol types.ProtocolEnum
}

type EC2

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

func NewEC2

func NewEC2(awsConfig aws.Config) *EC2

func (*EC2) Client

func (svc *EC2) Client() *ec2.Client

func (*EC2) CreateEmptySecurityGroup

func (svc *EC2) CreateEmptySecurityGroup(ctx context.Context, name string) (*ec2.CreateSecurityGroupOutput, error)

func (*EC2) GetAllRunningInstances

func (svc *EC2) GetAllRunningInstances(ctx context.Context) ([]*Instance, error)

func (*EC2) GetAllSecurityGroupRules added in v1.1.1

func (svc *EC2) GetAllSecurityGroupRules(ctx context.Context) ([]types.SecurityGroupRule, error)

func (*EC2) GetAllSubnets

func (svc *EC2) GetAllSubnets(ctx context.Context) ([]types.Subnet, error)

func (*EC2) GetAllVPCs

func (svc *EC2) GetAllVPCs(ctx context.Context) ([]types.Vpc, error)

func (*EC2) SearchForSecurityGroupByName

func (svc *EC2) SearchForSecurityGroupByName(ctx context.Context, name string) (*types.SecurityGroup, error)

SearchForSecurityGroupByName will return a security group matching the name given, if there are no matches then it will return a nil pointer and a nil error.

type ELBv2

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

func NewELBv2

func NewELBv2(awsConfig aws.Config) *ELBv2

func (*ELBv2) Client

func (svc *ELBv2) Client() *elbv2.Client

func (*ELBv2) DeleteAllListenersInLoadBalancer

func (svc *ELBv2) DeleteAllListenersInLoadBalancer(ctx context.Context, loadBalancerArn string) error

func (*ELBv2) DeregisterAllTargetsInTargetGroup

func (svc *ELBv2) DeregisterAllTargetsInTargetGroup(ctx context.Context, targetGroupArn string) error

func (*ELBv2) GenerateAwsumServiceName

func (svc *ELBv2) GenerateAwsumServiceName(serviceName string) string

func (*ELBv2) GetAllListenersInLoadBalancer

func (svc *ELBv2) GetAllListenersInLoadBalancer(ctx context.Context, loadBalancerArn string) ([]types.Listener, error)

func (*ELBv2) SearchForLoadBalancerByName added in v1.1.1

func (svc *ELBv2) SearchForLoadBalancerByName(ctx context.Context, name string) (*types.LoadBalancer, error)

func (*ELBv2) SearchForTargetGroupByName added in v1.1.1

func (svc *ELBv2) SearchForTargetGroupByName(ctx context.Context, name string) (*types.TargetGroup, error)

type ILBServiceResources added in v1.1.1

type ILBServiceResources struct {
	TargetGroupArn      string
	SecurityGroupId     string
	LoadBalancerArn     string
	LoadBalancerDNSName string
}

type Instance

type Instance struct {
	Info    types.Instance
	Service *EC2
}

func NewInstanceFromEC2

func NewInstanceFromEC2(ec2Instance types.Instance) *Instance

func (*Instance) AttachShell

func (i *Instance) AttachShell(sshUser string) error

func (*Instance) DialSSH

func (i *Instance) DialSSH(user string) (*ssh.Client, error)

func (*Instance) GenerateSSHClientConfigFromAssumedUserKey

func (i *Instance) GenerateSSHClientConfigFromAssumedUserKey(user string) (*ssh.ClientConfig, error)

GenerateSSHClientConfigFromAssumedUserKey generates an ssh client config with keys from the user's ssh directory. Assumed to be '~/.ssh'. The given user will be used in authentication.

func (*Instance) GetFormattedBestIpAddress

func (i *Instance) GetFormattedBestIpAddress() string

GetFormattedBestIpAddress returns a string containing the 'best' ip address to display for the instance. By 'best', meaning return the EC2 instance's public ip address if it is available, if not, return the private ip address.

func (*Instance) GetFormattedType

func (i *Instance) GetFormattedType() string

func (*Instance) GetName

func (i *Instance) GetName() string

func (*Instance) RunInteractiveCommand

func (i *Instance) RunInteractiveCommand(sshUser string, command string) error

type InstanceFilters

type InstanceFilters struct {
	Name string
}

func (InstanceFilters) DoesMatch

func (f InstanceFilters) DoesMatch(instance *Instance) bool

func (InstanceFilters) Matches

func (f InstanceFilters) Matches(instances []*Instance) []*Instance

type SetupNewILBServiceOptions

type SetupNewILBServiceOptions struct {
	Ctx                          context.Context
	ServiceName                  string
	TargetInstanceFilters        InstanceFilters
	LoadBalancerListenerProtocol types.ProtocolEnum
	LoadBalancerIpProtocol       string
	LoadBalancerPort             int32
	TrafficPort                  int32
	TrafficProtocol              types.ProtocolEnum
	CertificateNames             []string
}

func (SetupNewILBServiceOptions) AwsumResourceName

func (opts SetupNewILBServiceOptions) AwsumResourceName() string

Jump to

Keyboard shortcuts

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