aws

package
v0.0.0-...-78c8ff7 Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ELBType           resourceType = "elb"
	HostedZoneType    resourceType = "hosted zone"
	GatewayType       resourceType = "gateway"
	InstanceType      resourceType = "instance"
	RouteTableType    resourceType = "route table"
	RouteType         resourceType = "route"
	SecurityGroupType resourceType = "security group"
	SubnetType        resourceType = "subnet"
	VPCType           resourceType = "vpc"
)
View Source
const (
	RoleNameTemplate         = "EC2-K8S-Role"
	PolicyNameTemplate       = "EC2-K8S-Policy"
	ProfileNameTemplate      = "EC2-K8S-Role"
	AssumeRolePolicyDocument = `` /* 163-byte string literal not displayed */

	PolicyDocumentTempl = `` /* 481-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func IsAttributeEmpty

func IsAttributeEmpty(err error) bool

IsPortsToOpenEmpty asserts portsToOpenEmptyError.

func IsClientNotInitialized

func IsClientNotInitialized(err error) bool

IsClientNotInitialized asserts clientNotInitializedError.

func IsKMSKeyAliasEmpty

func IsKMSKeyAliasEmpty(err error) bool

IsKMSKeyAliasEmpty asserts kmsKeyAliasEmptyError.

func IsKeyPairCannotCreateAndNotFound

func IsKeyPairCannotCreateAndNotFound(err error) bool

IsKeyPairCannotCreateAndNotFound asserts keyPairCannotCreateAndNotFoundError.

func IsNoBucketInBucketObject

func IsNoBucketInBucketObject(err error) bool

IsNoBucketInBucketObject asserts noBucketInBucketObjectError.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound asserts NotFoundError.

func IsNotImplementedMethod

func IsNotImplementedMethod(err error) bool

IsNotImplementedMethod asserts notImplementedMethodError.

func IsResourceDelete

func IsResourceDelete(err error) bool

IsResourceDelete asserts resourceDeleteError.

func NewCustomExponentialBackoff

func NewCustomExponentialBackoff() *backoff.ExponentialBackOff

NewCustomExponentialBackoff returns pointer to a backoff.ExponentialBackOff, initialized with custom values. At the moment, we only override the MaxElapsedTime.

func NewNotify

func NewNotify(logger micrologger.Logger, operationName string) func(error, time.Duration)

Types

type AWSEntity

type AWSEntity struct {
	Clients awsutil.Clients
}

type Bucket

type Bucket struct {
	Name string
	AWSEntity
}

func (*Bucket) CreateIfNotExists

func (b *Bucket) CreateIfNotExists() (bool, error)

func (*Bucket) CreateOrFail

func (b *Bucket) CreateOrFail() error

func (*Bucket) Delete

func (b *Bucket) Delete() error

type BucketObject

type BucketObject struct {
	Name   string
	Data   string
	Bucket *Bucket
	AWSEntity
}

func (*BucketObject) CreateIfNotExists

func (bo *BucketObject) CreateIfNotExists() (bool, error)

func (*BucketObject) CreateOrFail

func (bo *BucketObject) CreateOrFail() error

func (*BucketObject) Delete

func (bo *BucketObject) Delete() error

type EC2StateCode

type EC2StateCode int
const (
	// http://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#InstanceState
	EC2PendingState      EC2StateCode = 0
	EC2RunningState      EC2StateCode = 16
	EC2ShuttingDownState EC2StateCode = 32
	EC2TerminatedState   EC2StateCode = 48
	EC2StoppingState     EC2StateCode = 64
	EC2StoppedState      EC2StateCode = 80
)

type ELB

type ELB struct {
	Name string

	AZ            string
	SecurityGroup string
	SubnetID      string
	Tags          []string
	PortsToOpen   PortPairs
	Client        *elb.ELB
	// contains filtered or unexported fields
}

ELB is an Elastic Load Balancer

func NewELBFromExisting

func NewELBFromExisting(name string, client *elb.ELB) (*ELB, error)

NewELBFromExisting initializes an ELB struct with some fields retrieved from the API, such as its FQDN and its Hosted Zone ID. We need these fields when deleting a Record Set. This method doesn't create a new ELB on AWS.

func (*ELB) AssignProxyProtocolPolicy

func (lb *ELB) AssignProxyProtocolPolicy() error

AssignProxyPolicy creates a ProxyProtocol policy and assigns it to the Load Balancer. This is needed for ELBs that listen/forward over TCP, in order to add a header with the address, port of the source and destination. Without this, `kubectl log/exec` don't work. See https://github.com/kubernetes/ingress/tree/4601775c18f5c6968e56e1eeaa26efc629590bb0/controllers/nginx#proxy-protocol

func (*ELB) CreateIfNotExists

func (lb *ELB) CreateIfNotExists() (bool, error)

func (*ELB) CreateOrFail

func (lb *ELB) CreateOrFail() error

func (ELB) DNSName

func (lb ELB) DNSName() string

func (ELB) Delete

func (lb ELB) Delete() error

func (ELB) HostedZoneID

func (lb ELB) HostedZoneID() string

func (*ELB) RegisterInstances

func (lb *ELB) RegisterInstances(instanceIDs []string) error

type FSKeyPairProvider

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

func NewFSKeyPairProvider

func NewFSKeyPairProvider(pubKeyFile string) *FSKeyPairProvider

type FindInstancesInput

type FindInstancesInput struct {
	Clients awsutil.Clients
	Logger  micrologger.Logger
	Pattern string
}

type Gateway

type Gateway struct {
	Name  string
	VpcID string

	// Dependencies.
	Logger micrologger.Logger
	AWSEntity
	// contains filtered or unexported fields
}

func (*Gateway) CreateIfNotExists

func (g *Gateway) CreateIfNotExists() (bool, error)

func (*Gateway) CreateOrFail

func (g *Gateway) CreateOrFail() error

func (*Gateway) Delete

func (g *Gateway) Delete() error

func (Gateway) GetID

func (g Gateway) GetID() (string, error)

type HostedZone

type HostedZone struct {
	Name string

	Private bool
	Comment string
	Client  *route53.Route53
	// contains filtered or unexported fields
}

func NewHostedZoneFromExisting

func NewHostedZoneFromExisting(name string, client *route53.Route53) (*HostedZone, error)

NewHostedZoneFromExisting initializes a Hosted Zone, setting some fields it has retrieved from an existing HZ It's used when deleting a RecordSet. It does not create a new HZ on AWS.

func (*HostedZone) CreateIfNotExists

func (hz *HostedZone) CreateIfNotExists() (bool, error)

func (*HostedZone) CreateOrFail

func (hz *HostedZone) CreateOrFail() error

func (HostedZone) Delete

func (hz HostedZone) Delete() error

func (HostedZone) GetID

func (hz HostedZone) GetID() string

type Instance

type Instance struct {
	Name                   string
	ClusterName            string
	ImageID                string
	InstanceType           string
	KeyName                string
	MinCount               int
	MaxCount               int
	UserData               string
	SmallCloudconfig       string
	IamInstanceProfileName string
	PlacementAZ            string
	SecurityGroupID        string
	SubnetID               string

	// Dependencies.
	Logger micrologger.Logger
	AWSEntity
	// contains filtered or unexported fields
}

func FindInstances

func FindInstances(input FindInstancesInput) ([]*Instance, error)

func (*Instance) CreateIfNotExists

func (i *Instance) CreateIfNotExists() (bool, error)

func (*Instance) CreateOrFail

func (i *Instance) CreateOrFail() error

func (*Instance) Delete

func (i *Instance) Delete() error

func (Instance) ID

func (i Instance) ID() string

type InstanceProfile

type InstanceProfile struct {
	ClusterID string

	AWSEntity
	// contains filtered or unexported fields
}

func (*InstanceProfile) CreateIfNotExists

func (ip *InstanceProfile) CreateIfNotExists() (bool, error)

func (*InstanceProfile) CreateOrFail

func (ip *InstanceProfile) CreateOrFail() error

func (*InstanceProfile) Delete

func (ip *InstanceProfile) Delete() error

func (InstanceProfile) GetName

func (ip InstanceProfile) GetName() string

type KMSKey

type KMSKey struct {
	Name string

	AWSEntity
	// contains filtered or unexported fields
}

func (KMSKey) Arn

func (kk KMSKey) Arn() string

func (*KMSKey) CreateIfNotExists

func (kk *KMSKey) CreateIfNotExists() (bool, error)

func (*KMSKey) CreateOrFail

func (kk *KMSKey) CreateOrFail() error

func (*KMSKey) Delete

func (kk *KMSKey) Delete() error

type KeyPair

type KeyPair struct {
	ClusterName string
	Provider    KeyPairProvider
	AWSEntity
}

func (*KeyPair) CreateIfNotExists

func (k *KeyPair) CreateIfNotExists() (bool, error)

func (*KeyPair) CreateOrFail

func (k *KeyPair) CreateOrFail() error

func (*KeyPair) Delete

func (k *KeyPair) Delete() error

type KeyPairProvider

type KeyPairProvider interface {
	// contains filtered or unexported methods
}

type Policy

type Policy struct {
	ClusterID string
	KMSKeyArn string
	S3Bucket  string

	AWSEntity
	// contains filtered or unexported fields
}

func (*Policy) CreateIfNotExists

func (p *Policy) CreateIfNotExists() (bool, error)

func (*Policy) CreateOrFail

func (p *Policy) CreateOrFail() error

func (*Policy) Delete

func (p *Policy) Delete() error

func (Policy) GetName

func (p Policy) GetName() string

type PortPair

type PortPair struct {
	// PortELB is the port the ELB should listen on.
	PortELB int
	// PortInstance is the port on the instance the ELB forwards traffic to.
	PortInstance int
}

PortPair is a pair of ports.

type PortPairs

type PortPairs []PortPair

PortPairs is an array of PortPair.

type RecordSet

type RecordSet struct {
	// Domain is the domain name for the record.
	Domain string
	// HostedZoneID is the ID of the Hosted Zone the record should be created in.
	HostedZoneID string
	// Client is the AWS client.
	Client *route53.Route53
	// Resource is the AWS resource the record should be created for.
	Resource resources.DNSNamedResource
}

func (RecordSet) CreateIfNotExists

func (record RecordSet) CreateIfNotExists() (bool, error)

CreateIfNotExists is not implemented because AWS provides UPSERT functionality for DNS records

func (RecordSet) CreateOrFail

func (record RecordSet) CreateOrFail() error

func (RecordSet) Delete

func (record RecordSet) Delete() error

type RouteTable

type RouteTable struct {
	Name  string
	VpcID string

	Client *ec2.EC2
	// contains filtered or unexported fields
}

func (*RouteTable) CreateIfNotExists

func (r *RouteTable) CreateIfNotExists() (bool, error)

func (*RouteTable) CreateOrFail

func (r *RouteTable) CreateOrFail() error

func (*RouteTable) Delete

func (r *RouteTable) Delete() error

func (RouteTable) GetID

func (r RouteTable) GetID() (string, error)

func (RouteTable) MakePublic

func (r RouteTable) MakePublic() error

MakePublic creates a route that allows traffic from outside the VPC. To do that, it needs to add a route on the Internet Gateway of the VPC.

type SecurityGroup

type SecurityGroup struct {
	Description string
	GroupName   string
	VpcID       string
	Rules       []SecurityGroupRule

	AWSEntity
	// contains filtered or unexported fields
}

func (SecurityGroup) ApplyRules

func (s SecurityGroup) ApplyRules(rules []SecurityGroupRule) error

func (*SecurityGroup) CreateIfNotExists

func (s *SecurityGroup) CreateIfNotExists() (bool, error)

func (*SecurityGroup) CreateOrFail

func (s *SecurityGroup) CreateOrFail() error

func (*SecurityGroup) Delete

func (s *SecurityGroup) Delete() error

func (SecurityGroup) GetID

func (s SecurityGroup) GetID() (string, error)

type SecurityGroupRule

type SecurityGroupRule struct {
	Port int
	// SourceCIDR is the CIDR of the source.
	SourceCIDR string
	// SecurityGroupID is the ID of the source Security Group.
	SecurityGroupID string
}

SecurityGroupRule is an AWS security group rule.

type Subnet

type Subnet struct {
	AvailabilityZone string
	CidrBlock        string
	Name             string
	VpcID            string

	// Dependencies.
	Logger micrologger.Logger
	AWSEntity
	// contains filtered or unexported fields
}

func (*Subnet) CreateIfNotExists

func (s *Subnet) CreateIfNotExists() (bool, error)

func (*Subnet) CreateOrFail

func (s *Subnet) CreateOrFail() error

func (*Subnet) Delete

func (s *Subnet) Delete() error

func (Subnet) GetID

func (s Subnet) GetID() (string, error)

func (*Subnet) MakePublic

func (s *Subnet) MakePublic(routeTable *RouteTable) error

type VPC

type VPC struct {
	CidrBlock string
	Name      string

	AWSEntity
	// contains filtered or unexported fields
}

func (*VPC) CreateIfNotExists

func (v *VPC) CreateIfNotExists() (bool, error)

func (*VPC) CreateOrFail

func (v *VPC) CreateOrFail() error

func (*VPC) Delete

func (v *VPC) Delete() error

func (VPC) GetID

func (v VPC) GetID() (string, error)

Jump to

Keyboard shortcuts

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