Documentation
¶
Index ¶
- Variables
- func CommandArgsSSMTunneling(instanceID string, localPort int) ([]string, error)
- func CreateDevpodInstanceProfile(ctx context.Context, provider *AwsProvider) (string, error)
- func CreateDevpodSecurityGroup(ctx context.Context, provider *AwsProvider, vpcID string) (string, error)
- func Delete(ctx context.Context, provider *AwsProvider, machine Machine) error
- func DeleteDevpodRoute53Record(ctx context.Context, provider *AwsProvider, zone route53Zone, machine Machine) error
- func Describe(ctx context.Context, provider *AwsProvider, name string) (string, error)
- func GetAMIRootDevice(ctx context.Context, cfg aws.Config, diskImage string) (string, error)
- func GetDefaultAMI(ctx context.Context, cfg aws.Config, instanceType string) (string, error)
- func GetDevpodInstanceProfile(ctx context.Context, provider *AwsProvider) (string, error)
- func GetDevpodRoute53Zone(ctx context.Context, provider *AwsProvider) (route53Zone, error)
- func GetDevpodSecurityGroups(ctx context.Context, provider *AwsProvider, vpcID string) ([]string, error)
- func GetDevpodVPC(ctx context.Context, provider *AwsProvider) (string, error)
- func GetInjectKeypairScript(config *options.Options) (string, error)
- func GetInstance(ctx context.Context, cfg aws.Config, name string, states []string) (types.Instance, error)
- func GetInstanceTags(providerAws *AwsProvider, zone route53Zone) []types.TagSpecification
- func GetSubnet(ctx context.Context, provider *AwsProvider) (subnetResult, error)
- func NewAWSConfig(ctx context.Context, log log.Logger, options *options.Options) (aws.Config, error)
- func Start(ctx context.Context, provider *AwsProvider, instanceID string) error
- func Status(ctx context.Context, provider *AwsProvider, name string) (client.Status, error)
- func Stop(ctx context.Context, provider *AwsProvider, instanceID string) error
- func UpsertDevpodRoute53Record(ctx context.Context, provider *AwsProvider, record route53Record) error
- type AwsProvider
- type Machine
- func Create(ctx context.Context, cfg aws.Config, providerAws *AwsProvider) (Machine, error)
- func GetDevpodInstance(ctx context.Context, cfg aws.Config, name string) (Machine, error)
- func GetDevpodRunningInstance(ctx context.Context, cfg aws.Config, name string) (Machine, error)
- func GetDevpodStoppedInstance(ctx context.Context, cfg aws.Config, name string) (Machine, error)
- func GetMachine(ctx context.Context, cfg aws.Config, name string, states []string) (Machine, error)
- func NewMachineFromInstance(instance types.Instance) Machine
- type PolicyDocument
- type PolicyPrincipal
- type PolicyStatement
Constants ¶
This section is empty.
Variables ¶
var ErrInstanceNotFound = errors.New("instance not found")
ErrInstanceNotFound is returned when no matching EC2 instance exists.
Functions ¶
func CommandArgsSSMTunneling ¶
func CreateDevpodInstanceProfile ¶
func CreateDevpodInstanceProfile(ctx context.Context, provider *AwsProvider) (string, error)
func DeleteDevpodRoute53Record ¶
func DeleteDevpodRoute53Record( ctx context.Context, provider *AwsProvider, zone route53Zone, machine Machine, ) error
DeleteDevpodRoute53Record deletes a Route53 A record for the devsy hostname in the specified zone.
func GetAMIRootDevice ¶
func GetDefaultAMI ¶
func GetDevpodInstanceProfile ¶
func GetDevpodInstanceProfile(ctx context.Context, provider *AwsProvider) (string, error)
func GetDevpodRoute53Zone ¶
func GetDevpodRoute53Zone(ctx context.Context, provider *AwsProvider) (route53Zone, error)
GetDevpodRoute53Zone retrieves the Route53 zone for the devsy if applicable. A zone name can either be specified in the provider configuration or be detected by looking for a Route53 zone with a tag "devsy" with value "devsy".
func GetDevpodSecurityGroups ¶
func GetDevpodVPC ¶
func GetDevpodVPC(ctx context.Context, provider *AwsProvider) (string, error)
func GetInstance ¶
func GetInstanceTags ¶
func GetInstanceTags(providerAws *AwsProvider, zone route53Zone) []types.TagSpecification
func NewAWSConfig ¶
func UpsertDevpodRoute53Record ¶
func UpsertDevpodRoute53Record( ctx context.Context, provider *AwsProvider, record route53Record, ) error
UpsertDevpodRoute53Record creates or updates a Route53 A record for the devsy hostname in the specified zone.
Types ¶
type AwsProvider ¶
type AwsProvider struct {
Config *options.Options
AwsConfig aws.Config
Log log.Logger
WorkingDirectory string
// contains filtered or unexported fields
}
func NewProvider ¶
type Machine ¶
type Machine struct {
Status string
InstanceID string
SpotInstanceRequestId string
PublicIP string
PrivateIP string
Hostname string
}
func GetDevpodInstance ¶
func GetMachine ¶
func NewMachineFromInstance ¶
NewMachineFromInstance creates a new Machine struct from an AWS ec2 Instance struct.
type PolicyDocument ¶
type PolicyDocument struct {
Version string `json:"Version"`
Statement []PolicyStatement `json:"Statement"`
}
PolicyDocument represents an IAM policy document.
func NewDevsyEC2Policy ¶
func NewDevsyEC2Policy() PolicyDocument
NewDevsyEC2Policy returns the policy allowing EC2 instance to describe and stop itself.
func NewEC2AssumeRolePolicy ¶
func NewEC2AssumeRolePolicy() PolicyDocument
NewEC2AssumeRolePolicy returns the trust policy for EC2 to assume the role.
func NewSSMKMSDecryptPolicy ¶
func NewSSMKMSDecryptPolicy(kmsArn string) PolicyDocument
NewSSMKMSDecryptPolicy returns the policy allowing SSM to decrypt with the specified KMS key.
type PolicyPrincipal ¶
type PolicyPrincipal struct {
Service any `json:"Service,omitempty"` // string or []string
AWS any `json:"AWS,omitempty"` // string or []string
}
PolicyPrincipal represents the principal in a policy statement.
type PolicyStatement ¶
type PolicyStatement struct {
Sid string `json:"Sid,omitempty"`
Effect string `json:"Effect"`
Principal *PolicyPrincipal `json:"Principal,omitempty"`
Action any `json:"Action"` // string or []string
Resource any `json:"Resource,omitempty"` // string or []string
Condition map[string]any `json:"Condition,omitempty"`
}
PolicyStatement represents a statement in an IAM policy.