client

package
v1.25.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: Apache-2.0, MIT Imports: 18 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
	IAM   iamiface.IAMAPI
	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. * IAM is the standard client for the IAM 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 NewClient

func NewClient(accessKeyID, secretAccessKey, region string) (*Client, 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.

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

ListKubernetesELBsV2 returns the list of ELBv2 loadbalancers 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>.

func (*Client) VerifyVPCAttributes added in v1.13.0

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

VerifyVPCAttributes checks whether the VPC attributes are correct.

type Interface

type Interface interface {
	GetAccountID(ctx context.Context) (string, error)
	GetInternetGateway(ctx context.Context, vpcID string) (string, error)
	VerifyVPCAttributes(ctx context.Context, vpcID 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) ([]string, 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.

Jump to

Keyboard shortcuts

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