aws

package
v0.0.0-...-3aec24a Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 6 Imported by: 9

Documentation

Index

Constants

View Source
const (
	// ElastiCacheConfigurationEndpoint is the configuration endpoint that used
	// for cluster mode connection.
	ElastiCacheConfigurationEndpoint = "configuration"
	// ElastiCachePrimaryEndpoint is the endpoint of the primary node in the
	// node group.
	ElastiCachePrimaryEndpoint = "primary"
	// ElastiCacheReaderEndpoint is the endpoint of the replica nodes in the
	// node group.
	ElastiCacheReaderEndpoint = "reader"
	// ElastiCacheNodeEndpoint is the endpoint that used to connect to an
	// individual node.
	ElastiCacheNodeEndpoint = "node"

	// MemoryDBClusterEndpoint is the cluster configuration endpoint for a
	// MemoryDB cluster.
	MemoryDBClusterEndpoint = "cluster"
	// MemoryDBNodeEndpoint is the endpoint of an individual MemoryDB node.
	MemoryDBNodeEndpoint = "node"
)
View Source
const (
	// AWSEndpointSuffix is the endpoint suffix for AWS Standard and AWS US
	// GovCloud regions.
	//
	// https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints
	// https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/using-govcloud-endpoints.html
	AWSEndpointSuffix = ".amazonaws.com"

	// AWSCNEndpointSuffix is the endpoint suffix for AWS China regions.
	//
	// https://docs.amazonaws.cn/en_us/aws/latest/userguide/endpoints-arns.html
	AWSCNEndpointSuffix = ".amazonaws.com.cn"

	// RDSServiceName is the service name for AWS RDS.
	RDSServiceName = "rds"

	// RedshiftServiceName is the service name for AWS Redshift.
	RedshiftServiceName = "redshift"

	// RedshiftServerlessServiceName is the service name for AWS Redshift Serverless.
	RedshiftServerlessServiceName = "redshift-serverless"

	// ElastiCacheServiceName is the service name for AWS ElastiCache.
	ElastiCacheServiceName = "cache"

	// MemoryDBSServiceName is the service name for AWS MemoryDB.
	MemoryDBSServiceName = "memorydb"
)
View Source
const (
	// StandardPartition is the partition ID of the AWS Standard partition.
	StandardPartition = "aws"

	// CNPartition is the partition ID of the AWS China partition.
	CNPartition = "aws-cn"

	// USGovPartition is the partition ID of the AWS GovCloud partition.
	USGovPartition = "aws-us-gov"
)
View Source
const (
	// CNRegionPrefix is the prefix for all AWS China regions.
	CNRegionPrefix = "cn-"

	// USGovRegionPrefix is the prefix for all AWS US GovCloud regions.
	USGovRegionPrefix = "us-gov-"
)

Variables

This section is empty.

Functions

func CassandraEndpointRegion

func CassandraEndpointRegion(endpoint string) (string, error)

CassandraEndpointRegion returns an AWS region from cassandra endpoint: where endpoint looks like cassandra.us-east-2.amazonaws.com https://docs.aws.amazon.com/keyspaces/latest/devguide/programmatic.endpoints.html

func CassandraEndpointURLForRegion

func CassandraEndpointURLForRegion(region string) string

CassandraEndpointURLForRegion returns a Cassandra endpoint based on the provided region. https://docs.aws.amazon.com/keyspaces/latest/devguide/programmatic.endpoints.html

func GetPartitionFromRegion

func GetPartitionFromRegion(region string) string

GetPartitionFromRegion get aws partition from region example, region "us-east-1" corresponds to partition "aws" region "cn-north-1" corresponds to partition "aws-cn"

func IsAWSEndpoint

func IsAWSEndpoint(uri string) bool

IsAWSEndpoint returns true if the input URI is an AWS endpoint.

func IsCNRegion

func IsCNRegion(region string) bool

IsCNRegion returns true if the region is an AWS China region.

func IsElastiCacheEndpoint

func IsElastiCacheEndpoint(uri string) bool

IsElastiCacheEndpoint returns true if the input URI is an ElastiCache endpoint.

func IsKeyspacesEndpoint

func IsKeyspacesEndpoint(uri string) bool

IsKeyspacesEndpoint returns true if input URI is an AWS Keyspaces endpoint. https://docs.aws.amazon.com/keyspaces/latest/devguide/programmatic.endpoints.html

func IsMemoryDBEndpoint

func IsMemoryDBEndpoint(uri string) bool

IsMemoryDBEndpoint returns true if the input URI is an MemoryDB endpoint.

func IsRDSEndpoint

func IsRDSEndpoint(uri string) bool

IsRDSEndpoint returns true if the input URI is an RDS endpoint.

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Overview.Endpoints.html

func IsRedshiftEndpoint

func IsRedshiftEndpoint(uri string) bool

IsRedshiftEndpoint returns true if the input URI is an Redshift endpoint.

https://docs.aws.amazon.com/redshift/latest/mgmt/connecting-from-psql.html

func IsRedshiftServerlessEndpoint

func IsRedshiftServerlessEndpoint(uri string) bool

IsRedshiftServerlessEndpoint returns true if the input URI is an Redshift Serverless endpoint.

https://docs.aws.amazon.com/redshift/latest/mgmt/serverless-connecting.html

func IsUSGovRegion

func IsUSGovRegion(region string) bool

IsUSGovRegion returns true if the region is an AWS US GovCloud region.

func ParseRedshiftEndpoint

func ParseRedshiftEndpoint(endpoint string) (clusterID, region string, err error)

ParseRedshiftEndpoint extracts cluster ID and region from the provided Redshift endpoint.

func ShortRegionToRegion

func ShortRegionToRegion(shortRegion string) (string, bool)

ShortRegionToRegion converts short region codes to regular region names. For example, a short region "use1" maps to region "us-east-1".

There is no official documentation on this mapping. Here is gist of others collecting these naming schemes: https://gist.github.com/colinvh/14e4b7fb6b66c29f79d3

This function currently does not support regions in secert partitions.

Types

type RDSEndpointDetails

type RDSEndpointDetails struct {
	// InstanceID is the identifier of an RDS instance.
	InstanceID string
	// ClusterID is the identifier of an RDS Aurora cluster.
	ClusterID string
	// ClusterCustomEndpointName is the identifier of an Aurora cluster custom endpoint.
	ClusterCustomEndpointName string
	// ProxyName is the identifier of an RDS proxy.
	ProxyName string
	// ProxyCustomEndpointName is the identifier of an RDS proxy custom endpoint.
	ProxyCustomEndpointName string
	// Region is the AWS region the database resides in.
	Region string
}

RDSEndpointDetails contains information about an RDS endpoint.

func ParseRDSEndpoint

func ParseRDSEndpoint(endpoint string) (d *RDSEndpointDetails, err error)

ParseRDSEndpoint extracts the identifier and region from the provided RDS endpoint.

func (RDSEndpointDetails) IsProxy

func (d RDSEndpointDetails) IsProxy() bool

IsProxy returns true if the RDS endpoint is an RDS Proxy.

type RedisEndpointInfo

type RedisEndpointInfo struct {
	// ID is the identifier of the endpoint.
	ID string
	// Region is the AWS region for the endpoint.
	Region string
	// TransitEncryptionEnabled specifies if in-transit encryption (TLS) is
	// enabled.
	TransitEncryptionEnabled bool
	// EndpointType specifies the type of the endpoint.
	EndpointType string
}

RedisEndpointInfo describes details extracted from a ElastiCache or MemoryDB Redis endpoint.

func ParseElastiCacheEndpoint

func ParseElastiCacheEndpoint(endpoint string) (*RedisEndpointInfo, error)

ParseElastiCacheEndpoint extracts the details from the provided ElastiCache Redis endpoint.

https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/GettingStarted.ConnectToCacheNode.html

func ParseMemoryDBEndpoint

func ParseMemoryDBEndpoint(endpoint string) (*RedisEndpointInfo, error)

ParseMemoryDBEndpoint extracts the details from the provided MemoryDB endpoint.

https://docs.aws.amazon.com/memorydb/latest/devguide/endpoints.html

type RedshiftServerlessEndpointDetails

type RedshiftServerlessEndpointDetails struct {
	// WorkgroupName is the name of the workgroup.
	WorkgroupName string
	// EndpointName is the name of the VPC endpoint.
	EndpointName string
	// AccountID is the AWS Account ID.
	AccountID string
	// Region is the AWS region the database resides in.
	Region string
}

RedshiftServerlessEndpointDetails contains information about an Redshift Serverless endpoint.

func ParseRedshiftServerlessEndpoint

func ParseRedshiftServerlessEndpoint(endpoint string) (details *RedshiftServerlessEndpointDetails, err error)

ParseRedshiftServerlessEndpoint extracts name, AWS Account ID, and region from the provided Redshift Serverless endpoint.

Jump to

Keyboard shortcuts

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