Documentation ¶
Index ¶
- func IsNoSuchHostedZoneError(err error) bool
- func IsNotFoundError(err error) bool
- func IsNotPermittedInZoneError(err error) bool
- func IsThrottlingError(err error) bool
- type Client
- func (c *Client) CreateBucketIfNotExists(ctx context.Context, bucket, region string) error
- func (c *Client) CreateDNSHostedZone(ctx context.Context, name, comment string) (string, error)
- func (c *Client) CreateOrUpdateDNSRecordSet(ctx context.Context, zoneId, name, recordType string, values []string, ...) error
- func (c *Client) DeleteBucketIfExists(ctx context.Context, bucket string) error
- func (c *Client) DeleteDNSHostedZone(ctx context.Context, zoneId string) error
- func (c *Client) DeleteDNSRecordSet(ctx context.Context, zoneId, name, recordType string, values []string, ...) error
- func (c *Client) DeleteELB(ctx context.Context, name string) error
- func (c *Client) DeleteELBV2(ctx context.Context, arn string) error
- func (c *Client) DeleteObjectsWithPrefix(ctx context.Context, bucket, prefix string) error
- func (c *Client) DeleteSecurityGroup(ctx context.Context, id string) error
- func (c *Client) GetAccountID(ctx context.Context) (string, error)
- func (c *Client) GetDHCPOptions(ctx context.Context, vpcID string) (map[string]string, error)
- func (c *Client) GetDNSHostedZones(ctx context.Context) (map[string]string, error)
- func (c *Client) GetDNSRecordSet(ctx context.Context, zoneId, name, recordType string) (*route53.ResourceRecordSet, error)
- func (c *Client) GetElasticIPsAssociationIDForAllocationIDs(ctx context.Context, allocationIDs []string) (map[string]*string, error)
- func (c *Client) GetNATGatewayAddressAllocations(ctx context.Context, shootNamespace string) (sets.Set[string], error)
- func (c *Client) GetVPCAttribute(ctx context.Context, vpcID string, attribute string) (bool, error)
- func (c *Client) GetVPCInternetGateway(ctx context.Context, vpcID string) (string, error)
- func (c *Client) ListKubernetesELBs(ctx context.Context, vpcID, clusterName string) ([]string, error)
- func (c *Client) ListKubernetesELBsV2(ctx context.Context, vpcID, clusterName string) ([]string, error)
- func (c *Client) ListKubernetesSecurityGroups(ctx context.Context, vpcID, clusterName string) ([]string, error)
- type Factory
- type FactoryFunc
- type Interface
- type Route53RateLimiterWaitError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNoSuchHostedZoneError ¶ added in v1.28.0
IsNoSuchHostedZoneError returns true if the error indicates a non-existing route53 hosted zone.
func IsNotFoundError ¶ added in v1.29.0
IsNotFoundError returns true if the given error is a awserr.Error indicating that a AWS resource was not found.
func IsNotPermittedInZoneError ¶ added in v1.28.0
IsNotPermittedInZoneError returns true if the error indicates that the DNS name is not permitted in the route53 hosted zone.
func IsThrottlingError ¶ added in v1.33.0
IsThrottlingError returns true if the error is a throttling error.
Types ¶
type Client ¶
type Client struct { EC2 ec2iface.EC2API STS stsiface.STSAPI IAM iamiface.IAMAPI S3 s3iface.S3API ELB elbiface.ELBAPI ELBv2 elbv2iface.ELBV2API Route53 route53iface.Route53API Route53RateLimiter *rate.Limiter Route53RateLimiterWaitTimeout time.Duration Logger logr.Logger }
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. * Route53 is the standard client for the Route53 service.
func NewClient ¶
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 ¶
CreateBucketIfNotExists creates the s3 bucket with name <bucket> in <region>. If it already exist, no error is returned.
func (*Client) CreateDNSHostedZone ¶ added in v1.27.0
CreateDNSHostedZone creates the DNS hosted zone with the given name and comment, and returns the ID of the newly created zone.
func (*Client) CreateOrUpdateDNSRecordSet ¶ added in v1.27.0
func (c *Client) CreateOrUpdateDNSRecordSet(ctx context.Context, zoneId, name, recordType string, values []string, ttl int64) error
CreateOrUpdateDNSRecordSet creates or updates the DNS recordset in the DNS hosted zone with the given zone ID, with the given name, type, values, and TTL.
func (*Client) DeleteBucketIfExists ¶
DeleteBucketIfExists deletes the s3 bucket with name <bucket>. If it does not exist, no error is returned.
func (*Client) DeleteDNSHostedZone ¶ added in v1.27.0
DeleteDNSHostedZone deletes the DNS hosted zone with the given ID.
func (*Client) DeleteDNSRecordSet ¶ added in v1.27.0
func (c *Client) DeleteDNSRecordSet(ctx context.Context, zoneId, name, recordType string, values []string, ttl int64) error
DeleteDNSRecordSet deletes the DNS recordset in the DNS hosted zone with the given zone ID, with the given name, type, values, and TTL. If values is empty and TTL is 0, the actual state will be determined by reading the recordset from the zone. Otherwise, an attempt will be made to delete the recordset with the given values / TTL. If this results in a "values do not match" error, the actual state will again be determined by reading the recordset from the zone, and a second attempt to delete it will be made. The idea is to ensure a consistent and foolproof behavior while sending as few requests as possible to avoid rate limit issues.
func (*Client) DeleteELB ¶
DeleteELB deletes the loadbalancer with the specific <name>. If it does not exist, no error is returned.
func (*Client) DeleteELBV2 ¶
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 ¶
DeleteObjectsWithPrefix deletes the s3 objects with the specific <prefix> from <bucket>. If it does not exist, no error is returned.
func (*Client) DeleteSecurityGroup ¶
DeleteSecurityGroup deletes the security group with the specific <id>. If it does not exist, no error is returned.
func (*Client) GetAccountID ¶
GetAccountID returns the ID of the AWS account the Client is interacting with.
func (*Client) GetDHCPOptions ¶ added in v1.41.0
GetDHCPOptions returns DHCP options for the specified VPC ID.
func (*Client) GetDNSHostedZones ¶ added in v1.27.0
GetDNSHostedZones returns a map of all DNS hosted zone names mapped to their IDs.
func (*Client) GetDNSRecordSet ¶ added in v1.27.0
func (c *Client) GetDNSRecordSet(ctx context.Context, zoneId, name, recordType string) (*route53.ResourceRecordSet, error)
GetDNSRecordSet returns the DNS recordset in the DNS hosted zone with the given zone ID, and with the given name and type.
func (*Client) GetElasticIPsAssociationIDForAllocationIDs ¶ added in v1.31.0
func (c *Client) GetElasticIPsAssociationIDForAllocationIDs(ctx context.Context, allocationIDs []string) (map[string]*string, error)
GetElasticIPsAssociationIDForAllocationIDs list existing elastic IP addresses for the given allocationIDs. returns a map[elasticIPAllocationID]elasticIPAssociationID or an error
func (*Client) GetNATGatewayAddressAllocations ¶ added in v1.31.0
func (c *Client) GetNATGatewayAddressAllocations(ctx context.Context, shootNamespace string) (sets.Set[string], error)
GetNATGatewayAddressAllocations get the allocation IDs for the NAT Gateway addresses for each existing NAT Gateway in the vpc returns a slice of allocation IDs or an error
func (*Client) GetVPCAttribute ¶ added in v1.29.0
GetVPCAttribute returns the value of the specified VPC attribute.
func (*Client) GetVPCInternetGateway ¶ added in v1.29.0
GetVPCInternetGateway 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>.
type Factory ¶ added in v1.27.0
type Factory interface { // NewClient creates a new instance of Interface for the given AWS credentials and region. NewClient(accessKeyID, secretAccessKey, region string) (Interface, error) }
Factory creates instances of Interface.
type FactoryFunc ¶ added in v1.27.0
FactoryFunc is a function that implements Factory.
type Interface ¶
type Interface interface { GetAccountID(ctx context.Context) (string, error) GetVPCInternetGateway(ctx context.Context, vpcID string) (string, error) GetVPCAttribute(ctx context.Context, vpcID string, attribute string) (bool, error) GetDHCPOptions(ctx context.Context, vpcID string) (map[string]string, error) GetElasticIPsAssociationIDForAllocationIDs(ctx context.Context, allocationIDs []string) (map[string]*string, error) GetNATGatewayAddressAllocations(ctx context.Context, shootNamespace string) (sets.Set[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 // Route53 wrappers GetDNSHostedZones(ctx context.Context) (map[string]string, error) CreateOrUpdateDNSRecordSet(ctx context.Context, zoneId, name, recordType string, values []string, ttl int64) error DeleteDNSRecordSet(ctx context.Context, zoneId, name, recordType string, values []string, ttl int64) 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.
func NewInterface ¶ added in v1.27.0
NewInterface creates a new instance of Interface for the given AWS credentials and region.
type Route53RateLimiterWaitError ¶ added in v1.33.0
type Route53RateLimiterWaitError struct {
Cause error
}
Route53RateLimiterWaitError is an error to be reported if waiting for a route53 rate limiter fails. This can only happen if the wait time would exceed the configured wait timeout.
func (*Route53RateLimiterWaitError) Error ¶ added in v1.33.0
func (e *Route53RateLimiterWaitError) Error() string