elbv1svc

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InService    = "InService"
	OutOfService = "OutOfService"
	Unknown      = "Unknown"
)

ELB backend instance states

View Source
const (
	AWSErrPermissionNotFound     = "InvalidPermission.NotFound"
	AWSErrPermissionDuplicate    = "InvalidPermission.Duplicate"
	AWSErrSecurityGroupNotFound  = "InvalidGroup.NotFound"
	AwsErrSecurityGroupDuplicate = "InvalidGroup.Duplicate"
	AWSErrTargetGroupNotFound    = "TargetGroupNotFound"
	AWSErrRuleNotFound           = "RuleNotFound"
	AWSErrDependendyViolation    = "DependencyViolation"
	AWSErrDryRunOperation        = "DryRunOperation"
	AWSErrLoadBalancerNotFound   = "LoadBalancerNotFound"
	AWSErrResourceInUse          = "ResourceInUse"
)
View Source
const SDKMaxRetries = 3

Variables

This section is empty.

Functions

func GetInstanceInfo

func GetInstanceInfo() (vpcID, region string, errOut error)

GetInstanceInfo returns the VPC ID and region of the EC2 instance on which the application is running.

func IsAWSErr

func IsAWSErr(err error, code string) bool

func NewEC2Filter

func NewEC2Filter(name string, values ...string) *ec2.Filter

Types

type EC2Instance

type EC2Instance struct {
	// The ID of the instance.
	ID string
	// The private IP address assigned to the instance.
	PrivateIPAddress string
	// The public IP address assigned to the instance
	PublicIPAddress string
	// The ID of the subnet the instance is running in.
	SubnetID string
	// The IDs of one or more security group assigned to the instance.
	SecurityGroups []string
	// The ID of the VPC the instance is running in.
	VpcID string
}

EC2Instance represents an EC2 instance on AWS

type ELBClassicService

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

ELBClassicService is an abstraction over the AWS SDK that provides methods required to manage ELB Classic Load Balancers in a specific region and VPC.

func NewService

func NewService(accessKey, secretKey, region, vpcID string) (*ELBClassicService, error)

NewService initializes and returns a new ELBClassicService instance for the specified region and VPC using either the specified static credentials or the Instance IAM role.

func (*ELBClassicService) AddLBTags

func (svc *ELBClassicService) AddLBTags(loadBalancerName string, tags map[string]string) error

AddLBTags adds the specified tags to the specified load balancer.

func (*ELBClassicService) CheckAPIConnection

func (svc *ELBClassicService) CheckAPIConnection() error

CheckAPIConnection checks the connection to the AWS API.

func (*ELBClassicService) DeregisterInstances

func (svc *ELBClassicService) DeregisterInstances(loadBalancerName string, instanceIds []string) error

DergisterInstances deregisters the specified EC2 instances from the specified load balancer.

func (*ELBClassicService) DescribeInstanceHealth

func (svc *ELBClassicService) DescribeInstanceHealth(loadBalancerName string, instanceIds ...string) ([]*elb.InstanceState, error)

DescribeInstanceHealth returns the state of the specified or all instances that are currently registered with the specified load balancer.

func (*ELBClassicService) DescribeLBTags

func (svc *ELBClassicService) DescribeLBTags(loadBalancerNames []string) (map[string]map[string]string, error)

DescribeLBTags returns the tags for the specified load balancers as map of load balancer name => map[string]string.

func (*ELBClassicService) DescribeSubnets

func (svc *ELBClassicService) DescribeSubnets(ids []string) ([]*ec2.Subnet, error)

DescribeSubnets returns the ec2.Subnet structs for the specified subnet IDs.

func (*ELBClassicService) EnsureHealthCheckPort

func (svc *ELBClassicService) EnsureHealthCheckPort(
	loadBalancerName string, instancePort int64, healthcheck *elb.HealthCheck) error

EnsureHealthCheckPort ensures that the specified healthcheck uses the specified instance port. If not, it configures it so, while maintaining all it's other properties.

func (*ELBClassicService) EnsureListenerInstancePort

func (svc *ELBClassicService) EnsureListenerInstancePort(
	loadBalancerName string, instancePort int64, listenerDesc *elb.ListenerDescription) error

EnsureListenerInstancePort ensures that the specified listener is configured to forward traffic to the specified instance port. If not, it recreates the listener and configures it so, while maintaining all it's other properties.

func (*ELBClassicService) GetAzSubnets

func (svc *ELBClassicService) GetAzSubnets() (map[string]string, error)

AzSubnets returns a map of all availability zones in the service's VPC as keys and the ID of one active subnet in that zone as value.

func (*ELBClassicService) GetInstancesByID

func (svc *ELBClassicService) GetInstancesByID(ids []string) ([]*EC2Instance, error)

GetInstancesByID returns the EC2 instances with the specified IDs.

func (*ELBClassicService) GetLoadBalancerByName

func (svc *ELBClassicService) GetLoadBalancerByName(name string) (*elb.LoadBalancerDescription, error)

GetLoadBalancers returns the LoadBalancerDescription struct for the specified load balancer or nil if it was not found.

func (*ELBClassicService) GetLoadBalancers

func (svc *ELBClassicService) GetLoadBalancers(names ...string) ([]*elb.LoadBalancerDescription, error)

GetLoadBalancers returns the LoadBalancerDescription structs for the specified load balancer. Otherwise returns all.

func (*ELBClassicService) GetRegisteredInstances

func (svc *ELBClassicService) GetRegisteredInstances(loadBalancerName string) ([]string, error)

GetRegisteredInstances returns the IDs of all instances that are currently registered to the load balancer. Includes instances whose registration is currently in progress and excludes those whose deregistration is currently in progress.

func (*ELBClassicService) IsDefaultVPC

func (svc *ELBClassicService) IsDefaultVPC(vpcID string) (bool, error)

IsDefaultVPC returns true if the specified VPC is the default VPC in the service's region.

func (*ELBClassicService) LookupInstancesByFilter

func (svc *ELBClassicService) LookupInstancesByFilter(filters []*ec2.Filter) ([]*EC2Instance, error)

LookupInstancesByFilter looks up EC2 instances using the specified filters. It returns nil if no matching instances were found.

func (*ELBClassicService) LookupInstancesByIPAddress

func (svc *ELBClassicService) LookupInstancesByIPAddress(ipAddresses []string, privateIP bool) ([]*EC2Instance, error)

LookupInstancesByIPAddress looks up the EC2 instances with the specified IP addresses. The privateIP parameter specifies whether the given IPs are public or private IP addresses.

func (*ELBClassicService) RegisterInstances

func (svc *ELBClassicService) RegisterInstances(loadBalancerName string, instanceIds []string) error

RegisterInstances registers the specified EC2 instances with the specified load balancer.

func (*ELBClassicService) RemoveLBTag

func (svc *ELBClassicService) RemoveLBTag(loadBalancerName string, tagKey string) error

RemoveLBTags adds the specified tags to the specified load balancer.

Jump to

Keyboard shortcuts

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