awsutil

package
v0.1.89 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AccessDenied          = "AccessDenied"
	AuthFailure           = "AuthFailure"
	DependencyViolation   = "DependencyViolation"
	ExpiredTokenException = "ExpiredTokenException"
	IDPRejectedClaim      = "IDPRejectedClaim"
	InvalidIdentityToken  = "InvalidIdentityToken"
	UnauthorizedOperation = "UnauthorizedOperation"
	// NotAuthorizedException is how Route53 (and other non-EC2 services) report
	// permission errors, versus EC2's AuthFailure / UnauthorizedOperation.
	// AccessDenied is also used by these services and is declared above.
	NotAuthorizedException = "NotAuthorizedException"
)
View Source
const (
	HypershiftClusterNameTagKey = "hypershift.openshift.io/cluster-name"
	HypershiftInfraIDTagKey     = "hypershift.openshift.io/infra-id"
	HypershiftSourceTagKey      = "hypershift.openshift.io/source"
	HypershiftProwJobIDTagKey   = "hypershift.openshift.io/prow-job-id"
)

Variables

View Source
var (
	// ErrEmptyCredentials indicates that the STS response did not contain credentials.
	ErrEmptyCredentials = errors.New("STS response contains empty credentials")
)
View Source
var ErrZoneNotFound = errors.New("hosted zone not found")

ErrZoneNotFound indicates no matching hosted zone exists.

Functions

func AWSErrorCode added in v0.1.48

func AWSErrorCode(err error) string

func AssumeRole added in v0.1.32

func AssumeRole(ctx context.Context, cfg aws.Config, roleSessionName, roleArn string) (*aws.Credentials, error)

func AssumeRoleWithWebIdentity added in v0.1.2

func AssumeRoleWithWebIdentity(ctx context.Context, cfg *aws.Config, roleSessionName, roleArn, token string) (*aws.Credentials, error)

func CreatePrivateHostedZone added in v0.1.87

func CreatePrivateHostedZone(ctx context.Context, client awsapi.ROUTE53API, zoneName, vpcID, region string, resourceTags []hyperv1.AWSClusterResourceTag) (string, error)

CreatePrivateHostedZone creates a Route53 private hosted zone associated with the given VPC. It uses a get-first-create-if-not-exists pattern for idempotency. An existing zone is only reused when it is associated with the given VPC: Route53 allows same-name private zones on other VPCs, and those belong to someone else. Returns the zone ID.

func CreatePublicHostedZone added in v0.1.87

func CreatePublicHostedZone(ctx context.Context, client awsapi.ROUTE53API, zoneName string, resourceTags []hyperv1.AWSClusterResourceTag) (string, []string, error)

CreatePublicHostedZone creates a Route53 public hosted zone. It uses a get-first-create-if-not-exists pattern for idempotency. Returns the zone ID and the delegation set name servers.

func CreateRecord added in v0.1.87

func CreateRecord(ctx context.Context, client awsapi.ROUTE53API, zoneID, name, value string, recordType route53types.RRType) error

func DefaultWorkerSGIngressRules

func DefaultWorkerSGIngressRules(machineCIDRs []string, sgGroupID, sgUserID string) []ec2types.IpPermission

DefaultWorkerSGIngressRules templates out the required inbound security group rules for the default worker security group. This AWS security group is attached to worker node EC2 instances and the PrivateLink VPC Endpoint for the Hosted Control Plane. Sources: - https://github.com/openshift/installer/blob/da42a4d4020f8c8d8140c0cdc45ee11932343f7d/pkg/asset/manifests/aws/cluster.go#L48-L122 - https://github.com/openshift/installer/blob/da42a4d4020f8c8d8140c0cdc45ee11932343f7d/upi/aws/cloudformation/03_cluster_security.yaml

func DeleteHostedZoneWithRecords added in v0.1.87

func DeleteHostedZoneWithRecords(ctx context.Context, client awsapi.ROUTE53API, zoneID string) error

DeleteHostedZoneWithRecords drains all non-SOA/NS records from a zone and then deletes it.

func DeleteRecord added in v0.1.87

func DeleteRecord(ctx context.Context, client awsapi.ROUTE53API, id string, record *route53types.ResourceRecordSet) error

func DeleteZoneBestEffort added in v0.1.87

func DeleteZoneBestEffort(ctx context.Context, route53Client awsapi.ROUTE53API, zoneID, label string, log logr.Logger) error

DeleteZoneBestEffort deletes a hosted zone. Returns nil (skip) for NoSuchHostedZone (already gone) and permission errors (creds unavailable); returns the error for transient failures so the caller retries.

func EC2TagsToMap added in v0.1.66

func EC2TagsToMap(tags []ec2types.Tag) map[string]string

func FindRecord added in v0.1.87

func FindRecord(ctx context.Context, client awsapi.ROUTE53API, id, name string, recordType route53types.RRType) (*route53types.ResourceRecordSet, error)

func GetSecurityGroup added in v0.1.48

func GetSecurityGroup(ctx context.Context, ec2Client awsapi.EC2API, filter []ec2types.Filter) (*ec2types.SecurityGroup, error)

func GetSecurityGroupById added in v0.1.48

func GetSecurityGroupById(ctx context.Context, ec2Client awsapi.EC2API, id string) (*ec2types.SecurityGroup, error)

func IsPermissionsError added in v0.1.66

func IsPermissionsError(err error) bool

IsPermissionsError returns true if on aws permission errors.

func IsROSAHCP added in v0.1.73

func IsROSAHCP(hcp *hyperv1.HostedControlPlane) bool

IsROSAHCP returns true if the hosted control plane is a ROSA HCP cluster.

func LookupZoneID added in v0.1.87

func LookupZoneID(ctx context.Context, client awsapi.ROUTE53API, name string) (string, error)

LookupZoneID returns the ID of the private hosted zone with the given name, or ErrZoneNotFound.

func MapToEC2Tags added in v0.1.64

func MapToEC2Tags(m map[string]string) []ec2types.Tag

func UpdateResourceTags added in v0.1.64

func UpdateResourceTags(ctx context.Context, ec2Client awsapi.EC2API, resourceID string, create, remove map[string]string) error

func VPCEndpointSecurityGroupRules added in v0.1.48

func VPCEndpointSecurityGroupRules(machineCIDRs []string, port int32) []ec2types.IpPermission

Types

This section is empty.

Jump to

Keyboard shortcuts

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