ec2

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 69 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EBS_ProviderType = storage.ProviderType("ebs")

	// EBS_VolumeType is the ebs volume type (default standard):
	//   "gp2" for General Purpose (SSD) volumes
	//   "io1" for Provisioned IOPS (SSD) volumes,
	//   "standard" for Magnetic volumes.
	//   see volumes types below for more.
	EBS_VolumeType = "volume-type"

	// EBS_IOPS is the number of I/O operations per second (IOPS) per GiB
	// to provision for the volume. Only valid for io1 io2 and gp3 volumes.
	EBS_IOPS = "iops"

	// EBS_Throughput is the max transfer troughput for gp3 volumes.
	EBS_Throughput = "throughput"

	// EBS_Encrypted specifies whether the volume should be encrypted.
	EBS_Encrypted = "encrypted"

	// EBS_KMSKeyID specifies what encryption key to use for the EBS volume.
	EBS_KMSKeyID = "kms-key-id"
)
View Source
const (
	// AWSClientContextKey defines a way to change the aws client func within
	// a context.
	AWSClientContextKey corecontext.ContextKey = "aws-client-func"
)

Variables

This section is empty.

Functions

func IsInstanceProfileAssociated

func IsInstanceProfileAssociated(
	ctx context.ProviderCallContext,
	client instanceProfileClient,
	associationId,
	instanceId string,
) error

Types

type AmazonRenderer

type AmazonRenderer struct{}

func (AmazonRenderer) Render

type AvailabilityZoner

type AvailabilityZoner interface {
	AvailabilityZone() (string, bool)
}

AvailabilityZoner defines a institute interface for getting an az from an instance.

type Client

type Client interface {
	// STOP!!
	// Are you about to add a new function to this interface?
	// If so please make sure you update Juju permission policy on discourse
	// here https://discourse.charmhub.io/t/juju-aws-permissions/5307
	// We must keep this policy inline with our usage for operators that are
	// using very strict permissions for Juju.
	//
	// You must also update the controllerRolePolicy document found in
	// iam_docs.go.
	AssociateIamInstanceProfile(context.Context, *ec2.AssociateIamInstanceProfileInput, ...func(*ec2.Options)) (*ec2.AssociateIamInstanceProfileOutput, error)
	DescribeIamInstanceProfileAssociations(context.Context, *ec2.DescribeIamInstanceProfileAssociationsInput, ...func(*ec2.Options)) (*ec2.DescribeIamInstanceProfileAssociationsOutput, error)
	DescribeInstances(context.Context, *ec2.DescribeInstancesInput, ...func(*ec2.Options)) (*ec2.DescribeInstancesOutput, error)
	DescribeInstanceTypeOfferings(context.Context, *ec2.DescribeInstanceTypeOfferingsInput, ...func(*ec2.Options)) (*ec2.DescribeInstanceTypeOfferingsOutput, error)
	DescribeInstanceTypes(context.Context, *ec2.DescribeInstanceTypesInput, ...func(*ec2.Options)) (*ec2.DescribeInstanceTypesOutput, error)
	DescribeSpotPriceHistory(context.Context, *ec2.DescribeSpotPriceHistoryInput, ...func(*ec2.Options)) (*ec2.DescribeSpotPriceHistoryOutput, error)

	DescribeAvailabilityZones(context.Context, *ec2.DescribeAvailabilityZonesInput, ...func(*ec2.Options)) (*ec2.DescribeAvailabilityZonesOutput, error)
	RunInstances(context.Context, *ec2.RunInstancesInput, ...func(*ec2.Options)) (*ec2.RunInstancesOutput, error)
	TerminateInstances(context.Context, *ec2.TerminateInstancesInput, ...func(*ec2.Options)) (*ec2.TerminateInstancesOutput, error)

	DescribeAccountAttributes(context.Context, *ec2.DescribeAccountAttributesInput, ...func(*ec2.Options)) (*ec2.DescribeAccountAttributesOutput, error)

	DescribeSecurityGroups(context.Context, *ec2.DescribeSecurityGroupsInput, ...func(*ec2.Options)) (*ec2.DescribeSecurityGroupsOutput, error)
	CreateSecurityGroup(context.Context, *ec2.CreateSecurityGroupInput, ...func(*ec2.Options)) (*ec2.CreateSecurityGroupOutput, error)
	DeleteSecurityGroup(context.Context, *ec2.DeleteSecurityGroupInput, ...func(*ec2.Options)) (*ec2.DeleteSecurityGroupOutput, error)
	AuthorizeSecurityGroupIngress(context.Context, *ec2.AuthorizeSecurityGroupIngressInput, ...func(*ec2.Options)) (*ec2.AuthorizeSecurityGroupIngressOutput, error)
	RevokeSecurityGroupIngress(context.Context, *ec2.RevokeSecurityGroupIngressInput, ...func(*ec2.Options)) (*ec2.RevokeSecurityGroupIngressOutput, error)

	CreateTags(context.Context, *ec2.CreateTagsInput, ...func(*ec2.Options)) (*ec2.CreateTagsOutput, error)

	CreateVolume(context.Context, *ec2.CreateVolumeInput, ...func(*ec2.Options)) (*ec2.CreateVolumeOutput, error)
	AttachVolume(context.Context, *ec2.AttachVolumeInput, ...func(*ec2.Options)) (*ec2.AttachVolumeOutput, error)
	DetachVolume(context.Context, *ec2.DetachVolumeInput, ...func(*ec2.Options)) (*ec2.DetachVolumeOutput, error)
	DeleteVolume(context.Context, *ec2.DeleteVolumeInput, ...func(*ec2.Options)) (*ec2.DeleteVolumeOutput, error)
	DescribeVolumes(context.Context, *ec2.DescribeVolumesInput, ...func(*ec2.Options)) (*ec2.DescribeVolumesOutput, error)

	DescribeNetworkInterfaces(context.Context, *ec2.DescribeNetworkInterfacesInput, ...func(*ec2.Options)) (*ec2.DescribeNetworkInterfacesOutput, error)
	DescribeSubnets(context.Context, *ec2.DescribeSubnetsInput, ...func(*ec2.Options)) (*ec2.DescribeSubnetsOutput, error)
	DescribeVpcs(context.Context, *ec2.DescribeVpcsInput, ...func(*ec2.Options)) (*ec2.DescribeVpcsOutput, error)
	DescribeInternetGateways(context.Context, *ec2.DescribeInternetGatewaysInput, ...func(*ec2.Options)) (*ec2.DescribeInternetGatewaysOutput, error)
	DescribeRouteTables(context.Context, *ec2.DescribeRouteTablesInput, ...func(*ec2.Options)) (*ec2.DescribeRouteTablesOutput, error)
}

Client defines the subset of *ec2.Client methods that we currently use.

type ClientFunc

type ClientFunc = func(context.Context, cloudspec.CloudSpec, ...ClientOption) (Client, error)

type ClientOption

type ClientOption func(*clientOptions)

ClientOption to be passed into the transport construction to customize the default transport.

func WithHTTPClient

func WithHTTPClient(value *http.Client) ClientOption

WithHTTPClient allows to define the http.Client to use.

type IAMClient

type IAMClient interface {
	// STOP!!
	// Are you about to add a new function to this interface?
	// If so please make sure you update Juju permission policy on discourse
	// here https://discourse.charmhub.io/t/juju-aws-permissions/5307
	// We must keep this policy inline with our usage for operators that are
	// using very strict permissions for Juju.
	//
	// You must also update the controllerRolePolicy document found in
	// iam_docs.go.
	AddRoleToInstanceProfile(stdcontext.Context, *iam.AddRoleToInstanceProfileInput, ...func(*iam.Options)) (*iam.AddRoleToInstanceProfileOutput, error)
	CreateInstanceProfile(stdcontext.Context, *iam.CreateInstanceProfileInput, ...func(*iam.Options)) (*iam.CreateInstanceProfileOutput, error)
	CreateRole(stdcontext.Context, *iam.CreateRoleInput, ...func(*iam.Options)) (*iam.CreateRoleOutput, error)
	DeleteInstanceProfile(stdcontext.Context, *iam.DeleteInstanceProfileInput, ...func(*iam.Options)) (*iam.DeleteInstanceProfileOutput, error)
	DeleteRole(stdcontext.Context, *iam.DeleteRoleInput, ...func(*iam.Options)) (*iam.DeleteRoleOutput, error)
	DeleteRolePolicy(stdcontext.Context, *iam.DeleteRolePolicyInput, ...func(*iam.Options)) (*iam.DeleteRolePolicyOutput, error)
	GetInstanceProfile(stdcontext.Context, *iam.GetInstanceProfileInput, ...func(*iam.Options)) (*iam.GetInstanceProfileOutput, error)
	GetRole(stdcontext.Context, *iam.GetRoleInput, ...func(*iam.Options)) (*iam.GetRoleOutput, error)
	PutRolePolicy(stdcontext.Context, *iam.PutRolePolicyInput, ...func(*iam.Options)) (*iam.PutRolePolicyOutput, error)
	RemoveRoleFromInstanceProfile(stdcontext.Context, *iam.RemoveRoleFromInstanceProfileInput, ...func(*iam.Options)) (*iam.RemoveRoleFromInstanceProfileOutput, error)
}

IAMClient is a subset interface of the AWS IAM client. This interface aims to define the small set of what Juju's needs from the larger client.

type IAMClientFunc

type IAMClientFunc = func(stdcontext.Context, cloudspec.CloudSpec, ...ClientOption) (IAMClient, error)

IAMClientFunc defines a type that can generate an AWS IAMClient from a provided cloudspec.

type SecurityGroupCleaner

type SecurityGroupCleaner interface {
	// DeleteSecurityGroup deletes security group on the provider.
	DeleteSecurityGroup(stdcontext.Context, *ec2.DeleteSecurityGroupInput, ...func(*ec2.Options)) (*ec2.DeleteSecurityGroupOutput, error)
}

SecurityGroupCleaner defines provider instance methods needed to delete a security group.

type SubnetMatcher

type SubnetMatcher interface {
	Match(types.Subnet) bool
}

func CreateSubnetMatcher

func CreateSubnetMatcher(subnetQuery string) SubnetMatcher

CreateSubnetMatcher creates a SubnetMatcher that handles a particular method of comparison based on the content of the subnet query. If the query looks like a CIDR, then we will match subnets with the same CIDR. If it follows the syntax of a "subnet-XXXX" then we will match the Subnet ID. Everything else is just matched as a Name.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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