aws

package
v0.0.0-...-ff7c0be Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBaseDomain

func GetBaseDomain() (string, error)

GetBaseDomain returns a base domain chosen from among the account's public routes.

func GetPublicZone

func GetPublicZone(sess *session.Session, name string) (*route53.HostedZone, error)

GetPublicZone returns a public route53 zone that matches the name.

func GetSession

func GetSession() (*session.Session, error)

GetSession returns an AWS session by checking credentials and, if no creds are found, asks for them and stores them on disk in a config file

func GetSessionWithOptions

func GetSessionWithOptions(optFuncs ...SessionOptions) (*session.Session, error)

GetSessionWithOptions returns an AWS session by checking credentials and, if no creds are found, asks for them and stores them on disk in a config file

func IsForbidden

func IsForbidden(err error) bool

IsForbidden returns true if and only if the input error is an HTTP 403 error from the AWS API.

func IsKnownPublicRegion

func IsKnownPublicRegion(region string, architecture types.Architecture) bool

IsKnownPublicRegion returns true if a specified region is Known to the installer. A known region is the subset of public AWS regions where RHEL CoreOS images are published.

func IsStaticCredentials

func IsStaticCredentials(credsValue credentials.Value) bool

IsStaticCredentials returns whether the credentials value provider are static credentials safe for installer to transfer to cluster for use as-is.

func Platform

func Platform() (*aws.Platform, error)

Platform collects AWS-specific configuration.

func Validate

func Validate(ctx context.Context, meta *Metadata, config *types.InstallConfig) error

Validate executes platform-specific validation.

func ValidateForProvisioning

func ValidateForProvisioning(client API, ic *types.InstallConfig, metadata *Metadata) error

ValidateForProvisioning validates if the install config is valid for provisioning the cluster.

Types

type API

type API interface {
	GetHostedZone(hostedZone string) (*route53.GetHostedZoneOutput, error)
	ValidateZoneRecords(zone *route53.HostedZone, zoneName string, zonePath *field.Path, ic *types.InstallConfig) field.ErrorList
	GetBaseDomain(baseDomainName string) (*route53.HostedZone, error)
	GetSubDomainDNSRecords(hostedZone *route53.HostedZone, ic *types.InstallConfig) ([]string, error)
}

API represents the calls made to the API.

type Client

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

Client makes calls to the AWS Route53 API.

func NewClient

func NewClient(ssn *awss.Session) *Client

NewClient initializes a client with a session.

func (*Client) GetBaseDomain

func (c *Client) GetBaseDomain(baseDomainName string) (*route53.HostedZone, error)

GetBaseDomain Gets the Domain Zone with the matching domain name from the session

func (*Client) GetHostedZone

func (c *Client) GetHostedZone(hostedZone string) (*route53.GetHostedZoneOutput, error)

GetHostedZone attempts to get the hosted zone from the AWS Route53 instance

func (*Client) GetSubDomainDNSRecords

func (c *Client) GetSubDomainDNSRecords(hostedZone *route53.HostedZone, ic *types.InstallConfig) ([]string, error)

GetSubDomainDNSRecords Validates the hostedZone against the cluster domain, and ensures that the cluster domain does not have a current record set for the hostedZone

func (*Client) ValidateZoneRecords

func (c *Client) ValidateZoneRecords(zone *route53.HostedZone, zoneName string, zonePath *field.Path, ic *types.InstallConfig) field.ErrorList

ValidateZoneRecords Attempts to validate each of the candidate HostedZones against the Config

type InstanceType

type InstanceType struct {
	DefaultVCpus int64
	MemInMiB     int64
}

InstanceType holds metadata for an instance type.

type Metadata

type Metadata struct {
	Region   string                     `json:"region,omitempty"`
	Subnets  []string                   `json:"subnets,omitempty"`
	Services []typesaws.ServiceEndpoint `json:"services,omitempty"`
	// contains filtered or unexported fields
}

Metadata holds additional metadata for InstallConfig resources that does not need to be user-supplied (e.g. because it can be retrieved from external APIs).

func NewMetadata

func NewMetadata(region string, subnets []string, services []typesaws.ServiceEndpoint) *Metadata

func (*Metadata) AvailabilityZones

func (m *Metadata) AvailabilityZones(ctx context.Context) ([]string, error)

AvailabilityZones retrieves a list of availability zones for the configured region.

func (*Metadata) InstanceTypes

func (m *Metadata) InstanceTypes(ctx context.Context) (map[string]InstanceType, error)

InstanceTypes retrieves instance type metadata indexed by InstanceType for the configured region.

func (*Metadata) PrivateSubnets

func (m *Metadata) PrivateSubnets(ctx context.Context) (map[string]Subnet, error)

PrivateSubnets retrieves subnet metadata indexed by subnet ID, for subnets that the cloud-provider logic considers to be private (i.e. not public).

func (*Metadata) PublicSubnets

func (m *Metadata) PublicSubnets(ctx context.Context) (map[string]Subnet, error)

PublicSubnets retrieves subnet metadata indexed by subnet ID, for subnets that the cloud-provider logic considers to be public (e.g. with suitable routing for hosting public load balancers).

func (*Metadata) Session

func (m *Metadata) Session(ctx context.Context) (*session.Session, error)

Session holds an AWS session which can be used for AWS API calls during asset generation.

func (*Metadata) VPC

func (m *Metadata) VPC(ctx context.Context) (string, error)

VPC retrieves the VPC ID containing PublicSubnets and PrivateSubnets.

type SessionOptions

type SessionOptions func(sess *session.Options)

SessionOptions is a function that modifies the provided session.Option.

func WithRegion

func WithRegion(region string) SessionOptions

WithRegion configures the session.Option to set the AWS region.

type Subnet

type Subnet struct {
	// ARN is the subnet's Amazon Resource Name.
	ARN string

	// Zone is the subnet's availability zone.
	Zone string

	// CIDR is the subnet's CIDR block.
	CIDR string
}

Subnet holds metadata for a subnet.

Jump to

Keyboard shortcuts

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