service

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: Apache-2.0 Imports: 25 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
	DefaultRoute53  *Route53
	DefaultAwsumILB *AwsumILBService
)

Functions

func Setup

func Setup(awsConfig aws.Config)

Types

type ACM

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

func NewACM

func NewACM(awsConfig aws.Config) *ACM

func (*ACM) Client

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

func (*ACM) GenerateLoadBalanceCertificateListFromCertificateNames

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

type AttachDomainsToLoadBalancerOptions added in v1.1.3

type AttachDomainsToLoadBalancerOptions struct {
	Ctx              context.Context
	LoadBalancerName string
	ELBService       *ELBv2
	EC2Service       *EC2
	Private          bool
	DomainNames      []string
}

type AwsumILBService

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

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

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, vpcIds ...string) ([]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

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

func (*ELBv2) SearchForTargetGroupByName

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

type ILBServiceResources

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) RunCommand added in v1.1.5

func (i *Instance) RunCommand(sshUser string, command string, quiet bool) 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 Route53 added in v1.1.3

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

func NewRoute53 added in v1.1.3

func NewRoute53(awsConfig aws.Config) *Route53

func (*Route53) AttachDomainsToLoadBalancer added in v1.1.3

func (svc *Route53) AttachDomainsToLoadBalancer(opts AttachDomainsToLoadBalancerOptions) error

func (*Route53) Client added in v1.1.3

func (svc *Route53) Client() *route53.Client

func (*Route53) GetAllHostedZoneARecords added in v1.1.3

func (svc *Route53) GetAllHostedZoneARecords(ctx context.Context, hostedZoneId string) ([]types.ResourceRecordSet, error)

func (*Route53) GetAllHostedZones added in v1.1.3

func (svc *Route53) GetAllHostedZones(ctx context.Context) ([]types.HostedZone, error)

func (*Route53) GetAssumedHostedZoneByDomainName added in v1.1.3

func (svc *Route53) GetAssumedHostedZoneByDomainName(ctx context.Context, domainName string, private bool) (*types.HostedZone, error)

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
	DomainNames                  []string
	Private                      bool
}

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