Documentation ¶
Index ¶
- Constants
- func CreateTagSpecification(resourceType types.ResourceType, tags map[string]string) types.TagSpecification
- func FetchInstanceTypeInfo(ctx context.ProviderCallContext, ec2Client FetchInstanceClient) ([]types.InstanceTypeInfo, error)
- func IsInstanceProfileAssociated(ctx context.ProviderCallContext, client instanceProfileClient, ...) error
- type AmazonRenderer
- type AvailabilityZoner
- type Client
- type ClientFunc
- type ClientOption
- type FetchInstanceClient
- type IAMClient
- type IAMClientFunc
- type SecurityGroupCleaner
- type SubnetMatcher
Constants ¶
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" )
const ( // AWSClientContextKey defines a way to change the aws client func within // a context. AWSClientContextKey corecontext.ContextKey = "aws-client-func" // AWSIAMClientContextKey defines a way to change the aws iam client func // within a context. AWSIAMClientContextKey corecontext.ContextKey = "aws-iam-client-func" )
Variables ¶
This section is empty.
Functions ¶
func CreateTagSpecification ¶
func CreateTagSpecification(resourceType types.ResourceType, tags map[string]string) types.TagSpecification
CreateTagSpecification creates an AWS tag specification for the given resource type and tags.
func FetchInstanceTypeInfo ¶
func FetchInstanceTypeInfo( ctx context.ProviderCallContext, ec2Client FetchInstanceClient, ) ([]types.InstanceTypeInfo, error)
FetchInstanceTypeInfo is responsible for fetching all of the available instance types for an AWS region. This func assumes that the ec2 client provided is scoped to a region already.
func IsInstanceProfileAssociated ¶
func IsInstanceProfileAssociated( ctx context.ProviderCallContext, client instanceProfileClient, associationId, instanceId string, ) error
Types ¶
type AmazonRenderer ¶
type AmazonRenderer struct{}
func (AmazonRenderer) Render ¶
func (AmazonRenderer) Render(cfg cloudinit.CloudConfig, os ostype.OSType) ([]byte, error)
type AvailabilityZoner ¶
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) 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 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 FetchInstanceClient ¶
type FetchInstanceClient interface { // DescribeInstanceTypes is the same func as that of the ec2 client. See: // https://github.com/aws/aws-sdk-go-v2/blob/service/ec2/v1.123.0/service/ec2/api_op_DescribeInstanceTypes.go#L21 DescribeInstanceTypes(stdcontext.Context, *ec2.DescribeInstanceTypesInput, ...func(*ec2.Options)) (*ec2.DescribeInstanceTypesOutput, error) }
FetchInstanceClient describes the funcs needed from the EC2 client for fetching instance types in a region. It's assumed that the ec2 client conforming to this interface is scoped to the region that instances are being requested for.
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) ListInstanceProfiles(stdcontext.Context, *iam.ListInstanceProfilesInput, ...func(*iam.Options)) (*iam.ListInstanceProfilesOutput, error) ListRolePolicies(stdcontext.Context, *iam.ListRolePoliciesInput, ...func(*iam.Options)) (*iam.ListRolePoliciesOutput, error) ListRoles(stdcontext.Context, *iam.ListRolesInput, ...func(*iam.Options)) (*iam.ListRolesOutput, 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 ¶
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.