client

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	EC2 ec2iface.EC2API
	STS stsiface.STSAPI
	S3  s3iface.S3API

	ELB   elbiface.ELBAPI
	ELBv2 elbv2iface.ELBV2API
}

Client is a struct containing several clients for the different AWS services it needs to interact with. * EC2 is the standard client for the EC2 service. * STS is the standard client for the STS service. * S3 is the standard client for the S3 service. * ELB is the standard client for the ELB service. * ELBv2 is the standard client for the ELBv2 service.

func (*Client) CreateBucketIfNotExists

func (c *Client) CreateBucketIfNotExists(ctx context.Context, bucket, region string) error

CreateBucketIfNotExists creates the s3 bucket with name <bucket> in <region>. If it already exist, no error is returned.

func (*Client) DeleteBucketIfExists

func (c *Client) DeleteBucketIfExists(ctx context.Context, bucket string) error

DeleteBucketIfExists deletes the s3 bucket with name <bucket>. If it does not exist, no error is returned.

func (*Client) DeleteELB

func (c *Client) DeleteELB(ctx context.Context, name string) error

DeleteELB deletes the loadbalancer with the specific <name>. If it does not exist, no error is returned.

func (*Client) DeleteELBV2

func (c *Client) DeleteELBV2(ctx context.Context, arn *string) error

DeleteELBV2 deletes the loadbalancer (NLB or ALB) as well as its target groups with its Amazon Resource Name (ARN) . If it does not exist, no error is returned.

func (*Client) DeleteObjectsWithPrefix

func (c *Client) DeleteObjectsWithPrefix(ctx context.Context, bucket, prefix string) error

DeleteObjectsWithPrefix deletes the s3 objects with the specific <prefix> from <bucket>. If it does not exist, no error is returned.

func (*Client) DeleteSecurityGroup

func (c *Client) DeleteSecurityGroup(ctx context.Context, id string) error

DeleteSecurityGroup deletes the security group with the specific <id>. If it does not exist, no error is returned.

func (*Client) GetAccountID

func (c *Client) GetAccountID(ctx context.Context) (string, error)

GetAccountID returns the ID of the AWS account the Client is interacting with.

func (*Client) GetInternetGateway

func (c *Client) GetInternetGateway(ctx context.Context, vpcID string) (string, error)

GetInternetGateway returns the ID of the internet gateway attached to the given VPC <vpcID>. If there is no internet gateway attached, the returned string will be empty.

func (*Client) ListKubernetesELBs

func (c *Client) ListKubernetesELBs(ctx context.Context, vpcID, clusterName string) ([]string, error)

ListKubernetesELBs returns the list of ELB loadbalancers in the given <vpcID> tagged with <clusterName>.

func (*Client) ListKubernetesELBsV2

func (c *Client) ListKubernetesELBsV2(ctx context.Context, vpcID, clusterName string) ([]LoadBalancer, error)

ListKubernetesELBsV2 returns a slice of loadbalancer tuples (of types either NLB or ALB) in the given <vpcID> tagged with <clusterName>.

func (*Client) ListKubernetesSecurityGroups

func (c *Client) ListKubernetesSecurityGroups(ctx context.Context, vpcID, clusterName string) ([]string, error)

ListKubernetesSecurityGroups returns the list of security groups in the given <vpcID> tagged with <clusterName>.

type Interface

type Interface interface {
	GetAccountID(ctx context.Context) (string, error)
	GetInternetGateway(ctx context.Context, vpcID string) (string, error)

	// S3 wrappers
	DeleteObjectsWithPrefix(ctx context.Context, bucket, prefix string) error
	CreateBucketIfNotExists(ctx context.Context, bucket, region string) error
	DeleteBucketIfExists(ctx context.Context, bucket string) error

	// The following functions are only temporary needed due to https://github.com/gardener/gardener/issues/129.
	ListKubernetesELBs(ctx context.Context, vpcID, clusterName string) ([]string, error)
	ListKubernetesELBsV2(ctx context.Context, vpcID, clusterName string) ([]LoadBalancer, error)
	ListKubernetesSecurityGroups(ctx context.Context, vpcID, clusterName string) ([]string, error)
	DeleteELB(ctx context.Context, name string) error
	DeleteELBV2(ctx context.Context, arn *string) error
	DeleteSecurityGroup(ctx context.Context, id string) error
}

Interface is an interface which must be implemented by AWS clients.

func NewClient

func NewClient(accessKeyID, secretAccessKey, region string) (Interface, error)

NewClient creates a new Client for the given AWS credentials <accessKeyID>, <secretAccessKey>, and the AWS region <region>. It initializes the clients for the various services like EC2, ELB, etc.

type LoadBalancer

type LoadBalancer struct {
	Name *string
	Type *string
	Arn  *string
}

LoadBalancer is a struct wrapper that holds loadbalancer metadata such as name, type, and arn.

Jump to

Keyboard shortcuts

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