aws

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// S3URL is the S3 URL for making bucket API calls.
	S3URL = "s3.amazonaws.com"

	// DefaultAWSRegion is the default AWS region for AWS resources.
	DefaultAWSRegion = "us-east-1"

	// VpcAvailableTagKey is the tag key to determine if a VPC is currently in
	// use by a cluster or not.
	VpcAvailableTagKey = "tag:Available"

	// VpcAvailableTagValueTrue is the tag value for VpcAvailableTagKey when the
	// VPC is currently not in use by a cluster and can be claimed.
	VpcAvailableTagValueTrue = "true"

	// VpcAvailableTagValueFalse is the tag value for VpcAvailableTagKey when the
	// VPC is currently in use by a cluster and cannot be claimed.
	VpcAvailableTagValueFalse = "false"

	// VpcClusterIDTagKey is the tag key used to store the cluster ID of the
	// cluster running in that VPC.
	VpcClusterIDTagKey = "tag:CloudClusterID"

	// VpcClusterOwnerKey is the tag key  used to store the owner of the
	// cluster's human name so that the VPC's owner can be identified
	VpcClusterOwnerKey = "tag:CloudClusterOwner"

	// VpcClusterOwnerValueNone is the tag value for VpcClusterOwnerKey when
	// there is no cluster running in the VPC.
	VpcClusterOwnerValueNone = "none"

	// VpcClusterIDTagValueNone is the tag value for VpcClusterIDTagKey when
	// there is no cluster running in the VPC.
	VpcClusterIDTagValueNone = "none"

	// DefaultDBSubnetGroupName is the default DB subnet group name used when
	// creating DB clusters. This group name is defined by the owner of the AWS
	// accounts and can be the same across all accounts.
	// Note: This needs to be manually created before RDS databases can be used.
	DefaultDBSubnetGroupName = "mattermost-databases"

	// DefaultDBSecurityGroupTagKey is the default DB security group tag key
	// that is used to find security groups to use in configuration of the RDS
	// database.
	// Note: This needs to be manually created before RDS databases can be used.
	DefaultDBSecurityGroupTagKey = "tag:MattermostCloudInstallationDatabase"

	// DefaultDBSecurityGroupTagValue is the default DB security group tag value
	// that is used to find security groups to use in configuration of the RDS
	// database.
	// Note: This needs to be manually created before RDS databases can be used.
	DefaultDBSecurityGroupTagValue = "MYSQL/Aurora"

	// DefaultDBSubnetGroupTagKey is the default DB subnet group tag key that is
	// used to find subnet groups to use in configuration of the RDS database.
	// Note: This needs to be manually created before RDS databases can be used.
	DefaultDBSubnetGroupTagKey = "tag:MattermostCloudInstallationDatabase"

	// DefaultDBSubnetGroupTagValue is the default DB subnet group tag value
	// that is used to find subnet groups to use in configuration of the RDS
	// database.
	// Note: This needs to be manually created before RDS databases can be used.
	DefaultDBSubnetGroupTagValue = "MYSQL/Aurora"

	// DefaultInstallCertificatesTagKey is the default key used to find the server
	// TLS certificate ARN.
	DefaultInstallCertificatesTagKey = "tag:MattermostCloudInstallationCertificates"

	// DefaultInstallCertificatesTagValue is the default value used to find the server
	// TLS certificate ARN.
	DefaultInstallCertificatesTagValue = "true"

	// DefaultCloudDNSTagKey is the default key used to find private and public hosted
	// zone IDs in AWS Route53.
	DefaultCloudDNSTagKey = "tag:MattermostCloudDNS"

	// DefaultPrivateCloudDNSTagValue is the default value used to find private hosted zone ID
	// in AWS Route53.
	DefaultPrivateCloudDNSTagValue = "private"

	// DefaultPublicCloudDNSTagValue is the default value used to find public hosted zone ID
	// in AWS Route53.
	DefaultPublicCloudDNSTagValue = "public"
)

Variables

This section is empty.

Functions

func CloudID added in v0.7.0

func CloudID(id string) string

CloudID returns the standard ID used for AWS resource names. This ID is used to correlate installations to AWS resources.

func GetSecurityGroupsWithFilters added in v0.9.0

func GetSecurityGroupsWithFilters(filters []*ec2.Filter) ([]*ec2.SecurityGroup, error)

GetSecurityGroupsWithFilters returns SGs matching a given filter.

func GetSubnetsWithFilters added in v0.9.0

func GetSubnetsWithFilters(filters []*ec2.Filter) ([]*ec2.Subnet, error)

GetSubnetsWithFilters returns subnets matching a given filter.

func GetVpcsWithFilters added in v0.9.0

func GetVpcsWithFilters(filters []*ec2.Filter) ([]*ec2.Vpc, error)

GetVpcsWithFilters returns VPCs matching a given filter.

func IAMSecretName added in v0.8.0

func IAMSecretName(cloudID string) string

IAMSecretName returns the IAM Access Key secret name for a given Cloud ID.

func RDSSecretName added in v0.8.0

func RDSSecretName(cloudID string) string

RDSSecretName returns the RDS secret name for a given Cloud ID.

Types

type AWS

type AWS interface {
	GetCertificateSummaryByTag(key, value string) (*acm.CertificateSummary, error)

	GetAndClaimVpcResources(clusterID, owner string, logger log.FieldLogger) (ClusterResources, error)
	ReleaseVpc(clusterID string, logger log.FieldLogger) error

	GetPrivateZoneDomainName(logger log.FieldLogger) (string, error)
	CreatePrivateCNAME(dnsName string, dnsEndpoints []string, logger log.FieldLogger) error
	CreatePublicCNAME(dnsName string, dnsEndpoints []string, logger log.FieldLogger) error

	DeletePrivateCNAME(dnsName string, logger log.FieldLogger) error
	DeletePublicCNAME(dnsName string, logger log.FieldLogger) error

	TagResource(resourceID, key, value string, logger log.FieldLogger) error
	UntagResource(resourceID, key, value string, logger log.FieldLogger) error
	IsValidAMI(AMIImage string) (bool, error)
}

AWS interface for use by other packages.

type Client

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

Client is a client for interacting with AWS resources.

func New

func New() *Client

New returns a new AWS client.

func (*Client) AddSQLStore added in v0.10.0

func (c *Client) AddSQLStore(store model.InstallationDatabaseStoreInterface)

AddSQLStore adds SQLStore functionality to the AWS client.

func (*Client) CreatePrivateCNAME added in v0.11.0

func (a *Client) CreatePrivateCNAME(dnsName string, dnsEndpoints []string, logger log.FieldLogger) error

CreatePrivateCNAME creates a record in Route53 for a private domain name.

func (*Client) CreatePublicCNAME added in v0.11.0

func (a *Client) CreatePublicCNAME(dnsName string, dnsEndpoints []string, logger log.FieldLogger) error

CreatePublicCNAME creates a record in Route53 for a public domain name.

func (*Client) DeletePrivateCNAME added in v0.11.0

func (a *Client) DeletePrivateCNAME(dnsName string, logger log.FieldLogger) error

DeletePrivateCNAME deletes a AWS route53 record for a private domain name.

func (*Client) DeletePublicCNAME added in v0.11.0

func (a *Client) DeletePublicCNAME(dnsName string, logger log.FieldLogger) error

DeletePublicCNAME deletes a AWS route53 record for a public domain name.

func (*Client) GetAndClaimVpcResources added in v0.9.0

func (a *Client) GetAndClaimVpcResources(clusterID, owner string, logger log.FieldLogger) (ClusterResources, error)

GetAndClaimVpcResources creates ClusterResources from an available VPC and tags them appropriately.

func (*Client) GetCertificateSummaryByTag added in v0.11.0

func (a *Client) GetCertificateSummaryByTag(key, value string) (*acm.CertificateSummary, error)

GetCertificateSummaryByTag returns the certificate summary associated with a valid tag key and value in AWS.

func (*Client) GetPrivateZoneDomainName added in v0.13.0

func (a *Client) GetPrivateZoneDomainName(logger log.FieldLogger) (string, error)

GetPrivateZoneDomainName gets the private Route53 domain name.

func (*Client) HasSQLStore added in v0.10.0

func (c *Client) HasSQLStore() bool

HasSQLStore returns whether the AWS client has a SQL store or not.

func (*Client) IsValidAMI added in v0.11.0

func (a *Client) IsValidAMI(AMIImage string) (bool, error)

IsValidAMI check if the provided AMI exists

func (*Client) ReleaseVpc added in v0.9.0

func (a *Client) ReleaseVpc(clusterID string, logger log.FieldLogger) error

ReleaseVpc changes the tags on a VPC to mark it as "available" again.

func (*Client) TagResource

func (a *Client) TagResource(resourceID, key, value string, logger log.FieldLogger) error

TagResource tags an AWS EC2 resource.

func (*Client) UntagResource

func (a *Client) UntagResource(resourceID, key, value string, logger log.FieldLogger) error

UntagResource deletes tags from an AWS EC2 resource.

type ClusterResources added in v0.9.0

type ClusterResources struct {
	VpcID                  string
	PrivateSubnetIDs       []string
	PublicSubnetsIDs       []string
	MasterSecurityGroupIDs []string
	WorkerSecurityGroupIDs []string
}

ClusterResources is a collection of AWS resources that will be used to create a kops cluster.

func (*ClusterResources) IsValid added in v0.9.0

func (cr *ClusterResources) IsValid() error

IsValid returns whether or not ClusterResources is valid or not.

type IAMAccessKey added in v0.7.0

type IAMAccessKey struct {
	ID     string
	Secret string
}

IAMAccessKey is the ID and Secret of an AWS IAM user's access key.

func (*IAMAccessKey) Validate added in v0.8.0

func (s *IAMAccessKey) Validate() error

Validate performs a basic sanity check on the IAM Access Key secret.

type RDSDatabase added in v0.8.0

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

RDSDatabase is a database backed by AWS RDS.

func NewRDSDatabase added in v0.8.0

func NewRDSDatabase(installationID string) *RDSDatabase

NewRDSDatabase returns a new RDSDatabase interface.

func (*RDSDatabase) GenerateDatabaseSpecAndSecret added in v0.8.0

func (d *RDSDatabase) GenerateDatabaseSpecAndSecret(logger log.FieldLogger) (*mmv1alpha1.Database, *corev1.Secret, error)

GenerateDatabaseSpecAndSecret creates the k8s database spec and secret for accessing the RDS database.

func (*RDSDatabase) Provision added in v0.8.0

Provision completes all the steps necessary to provision a RDS database.

func (*RDSDatabase) Teardown added in v0.8.0

func (d *RDSDatabase) Teardown(keepData bool, logger log.FieldLogger) error

Teardown removes all AWS resources related to a RDS database.

type RDSSecret added in v0.8.0

type RDSSecret struct {
	MasterUsername string
	MasterPassword string
}

RDSSecret is the Secret payload for RDS configuration.

func (*RDSSecret) Validate added in v0.8.0

func (s *RDSSecret) Validate() error

Validate performs a basic sanity check on the RDS secret.

type S3Filestore added in v0.7.0

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

S3Filestore is a filestore backed by AWS S3.

func NewS3Filestore added in v0.7.0

func NewS3Filestore(installationID string) *S3Filestore

NewS3Filestore returns a new S3Filestore interface.

func (*S3Filestore) GenerateFilestoreSpecAndSecret added in v0.7.0

func (f *S3Filestore) GenerateFilestoreSpecAndSecret(logger log.FieldLogger) (*mmv1alpha1.Minio, *corev1.Secret, error)

GenerateFilestoreSpecAndSecret creates the k8s filestore spec and secret for accessing the S3 bucket.

func (*S3Filestore) Provision added in v0.7.0

func (f *S3Filestore) Provision(logger log.FieldLogger) error

Provision completes all the steps necessary to provision an S3 filestore.

func (*S3Filestore) Teardown added in v0.7.0

func (f *S3Filestore) Teardown(keepData bool, logger log.FieldLogger) error

Teardown removes all AWS resources related to an S3 filestore.

type Tag added in v0.11.0

type Tag struct {
	Key   string
	Value string
}

Tag is a package specific tag with convenient methods for interacting with AWS Route53 resource tags.

func (*Tag) Compare added in v0.11.0

func (t *Tag) Compare(tag *route53.Tag) bool

Compare a package specific tag with a AWS Route53 resource tag.

func (*Tag) String added in v0.11.0

func (t *Tag) String() string

String prints tag's key/value.

Jump to

Keyboard shortcuts

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