Documentation ¶
Index ¶
- Constants
- Variables
- func VerifyRole(zone string, bucket string)
- type AWS
- func (a *AWS) AttachVolume(ctx *lepton.Context, instanceName, name string, attachID int) error
- func (p *AWS) BuildImage(ctx *lepton.Context) (string, error)
- func (p *AWS) BuildImageWithPackage(ctx *lepton.Context, pkgpath string) (string, error)
- func (p *AWS) CreateImage(ctx *lepton.Context, imagePath string) error
- func (p *AWS) CreateInstance(ctx *lepton.Context) error
- func (p *AWS) CreateSG(ctx *lepton.Context, svc *ec2.EC2, iname string, vpcID string) (sg *ec2.SecurityGroup, err error)
- func (p *AWS) CreateSubnet(ctx *lepton.Context, vpc *ec2.Vpc) (subnet *ec2.Subnet, err error)
- func (p *AWS) CreateVPC(ctx *lepton.Context, svc *ec2.EC2) (vpc *ec2.Vpc, err error)
- func (a *AWS) CreateVolume(ctx *lepton.Context, cv types.CloudVolume, data string, provider string) (lepton.NanosVolume, error)
- func (p *AWS) CreateZoneRecord(config *types.Config, zoneID string, record *lepton.DNSRecord) error
- func (p *AWS) CustomizeImage(ctx *lepton.Context) (string, error)
- func (p *AWS) DeleteImage(ctx *lepton.Context, imagename string) error
- func (p *AWS) DeleteInstance(ctx *lepton.Context, instanceName string) error
- func (p *AWS) DeleteSG(groupID *string)
- func (a *AWS) DeleteVolume(ctx *lepton.Context, name string) error
- func (p *AWS) DeleteZoneRecordIfExists(config *types.Config, zoneID string, recordName string) error
- func (a *AWS) DetachVolume(ctx *lepton.Context, instanceName, name string) error
- func (p *AWS) FindOrCreateZoneIDByName(config *types.Config, dnsName string) (string, error)
- func (a *AWS) GetAllVolumes(ctx *lepton.Context) (*[]lepton.NanosVolume, error)
- func (p *AWS) GetImages(ctx *lepton.Context, filter string) ([]lepton.CloudImage, error)
- func (p *AWS) GetInstanceByName(ctx *lepton.Context, name string) (*lepton.CloudInstance, error)
- func (p *AWS) GetInstanceLogs(ctx *lepton.Context, instanceName string) (string, error)
- func (p *AWS) GetInstances(ctx *lepton.Context) ([]lepton.CloudInstance, error)
- func (p *AWS) GetSecurityGroup(ctx *lepton.Context, svc *ec2.EC2, vpc *ec2.Vpc) (sg *ec2.SecurityGroup, err error)
- func (p *AWS) GetStorage() lepton.Storage
- func (p *AWS) GetSubnet(ctx *lepton.Context, svc *ec2.EC2, vpcID string) (*ec2.Subnet, error)
- func (p *AWS) GetVPC(ctx *lepton.Context, svc *ec2.EC2) (*ec2.Vpc, error)
- func (p *AWS) Initialize(config *types.ProviderConfig) error
- func (p *AWS) InstanceStats(ctx *lepton.Context, instancename string, watch bool) error
- func (p *AWS) ListImages(ctx *lepton.Context, filter string) error
- func (p *AWS) ListInstances(ctx *lepton.Context) error
- func (p *AWS) MirrorImage(ctx *lepton.Context, imageName, srcRegion, dstRegion string) (string, error)
- func (p *AWS) PrintInstanceLogs(ctx *lepton.Context, instancename string, watch bool) error
- func (p *AWS) RebootInstance(ctx *lepton.Context, instanceName string) error
- func (p *AWS) ResizeImage(ctx *lepton.Context, imagename string, hbytes string) error
- func (p *AWS) StartInstance(ctx *lepton.Context, instanceName string) error
- func (p *AWS) StopInstance(ctx *lepton.Context, instanceName string) error
- func (p *AWS) SyncImage(config *types.Config, target lepton.Provider, image string) error
- type LaunchTemplateInput
- type PutSnapshotBlockResult
- type PutSnapshotBlockResults
- type ResourceWrapper
- type RolePolicy
- type RoleStatement
- type S3
Constants ¶
const ( // SnapshotBlockDataLength define block length 512K SnapshotBlockDataLength = 524288 // PutSnapshotBlockLimit define limit requests per snapshot, each supported Region: 1,000 per second // https://docs.aws.amazon.com/general/latest/gr/ebs-service.html#limits_ebs // We config 80% of max for smooth concurrent PutSnapshotBlockLimit = 800 )
const ProviderName = "aws"
ProviderName of the cloud platform provider
Variables ¶
var ( // Architectures define architecture from instance family Architectures = map[string]string{ "a1": "arm64", "c1": "x86_64", "c3": "x86_64", "c4": "x86_64", "c5": "x86_64", "c5a": "x86_64", "c5ad": "x86_64", "c5d": "x86_64", "c5n": "x86_64", "c6a": "x86_64", "c6g": "arm64", "c6gd": "arm64", "c6gn": "arm64", "c6i": "x86_64", "c7g": "arm64", "cc2": "x86_64", "d3": "x86_64", "d3en": "x86_64", "dl1": "x86_64", "f1": "x86_64", "g2": "x86_64", "g3": "x86_64", "g3s": "x86_64", "g4ad": "x86_64", "g4dn": "x86_64", "g5": "x86_64", "g5g": "arm64", "h1": "x86_64", "i2": "x86_64", "i3": "x86_64", "i3en": "x86_64", "im4gn": "arm64", "inf1": "x86_64", "is4gen": "arm64", "m1": "x86_64", "m2": "x86_64", "m3": "x86_64", "m4": "x86_64", "m5": "x86_64", "m5a": "x86_64", "m5ad": "x86_64", "m5d": "x86_64", "m5dn": "x86_64", "m5n": "x86_64", "m5zn": "x86_64", "m6a": "x86_64", "m6g": "arm64", "m6gd": "arm64", "m7g": "arm64", "m7gd": "arm64", "m6i": "x86_64", "mac1": "x86_64_mac", "p2": "x86_64", "p3": "x86_64", "p3dn": "x86_64", "p4d": "x86_64", "r3": "x86_64", "r4": "x86_64", "r5": "x86_64", "r5a": "x86_64", "r5ad": "x86_64", "r5b": "x86_64", "r5d": "x86_64", "r5dn": "x86_64", "r5n": "x86_64", "r6g": "arm64", "r6gd": "arm64", "r7g": "arm64", "r7gd": "arm64", "r6i": "x86_64", "t1": "i386,", "t2": "x86_64", "t3": "x86_64", "t3a": "x86_64", "t4g": "arm64", "u-12tb1": "x86_64", "u-6tb1": "x86_64", "u-9tb1": "x86_64", "vt1": "x86_64", "x1": "x86_64", "x1e": "x86_64", "x2gd": "arm64", "x2iezn": "x86_64", "z1d": "x86_64", } )
Functions ¶
func VerifyRole ¶
VerifyRole ensures we have a role and attached policy for the vmie service to hit our bucket.
Types ¶
type AWS ¶
type AWS struct { Storage *S3 // contains filtered or unexported fields }
AWS Provider to interact with AWS cloud infrastructure
func (*AWS) AttachVolume ¶
AttachVolume attaches a volume to an instance
func (*AWS) BuildImage ¶
BuildImage to be upload on AWS
func (*AWS) BuildImageWithPackage ¶
BuildImageWithPackage to upload on AWS
func (*AWS) CreateImage ¶
CreateImage creates image on AWS using nanos images. First a snapshot in AWS is created from a image in local machine and, then the snapshot is used to create an AMI.
func (*AWS) CreateInstance ¶
CreateInstance - Creates instance on AWS Platform
func (*AWS) CreateSG ¶
func (p *AWS) CreateSG(ctx *lepton.Context, svc *ec2.EC2, iname string, vpcID string) (sg *ec2.SecurityGroup, err error)
CreateSG - Create security group instance specific
func (*AWS) CreateSubnet ¶
CreateSubnet creates a subnet on vpc
func (*AWS) CreateVolume ¶
func (a *AWS) CreateVolume(ctx *lepton.Context, cv types.CloudVolume, data string, provider string) (lepton.NanosVolume, error)
CreateVolume creates a snapshot and use it to create a volume
func (*AWS) CreateZoneRecord ¶
CreateZoneRecord creates a record in a DNS zone
func (*AWS) CustomizeImage ¶
CustomizeImage returns image path with adaptations needed by cloud provider
func (*AWS) DeleteImage ¶
DeleteImage deletes image from AWS by ami name
func (*AWS) DeleteInstance ¶
DeleteInstance deletes instance from AWS if deleting sgs created by ops it can take a while so might be worth optionally making this go into the background
func (*AWS) DeleteVolume ¶
DeleteVolume deletes a volume
func (*AWS) DeleteZoneRecordIfExists ¶
func (p *AWS) DeleteZoneRecordIfExists(config *types.Config, zoneID string, recordName string) error
DeleteZoneRecordIfExists deletes a record from a DNS zone if it exists
func (*AWS) DetachVolume ¶
DetachVolume detachs a volume from an instance
func (*AWS) FindOrCreateZoneIDByName ¶
FindOrCreateZoneIDByName searches for a DNS zone with the name passed by argument and if it doesn't exist it creates one
func (*AWS) GetAllVolumes ¶
GetAllVolumes finds and returns all volumes
func (*AWS) GetInstanceByName ¶
GetInstanceByName returns instance with given name
func (*AWS) GetInstanceLogs ¶
GetInstanceLogs gets instance related logs
func (*AWS) GetInstances ¶
GetInstances return all instances on AWS
func (*AWS) GetSecurityGroup ¶
func (p *AWS) GetSecurityGroup(ctx *lepton.Context, svc *ec2.EC2, vpc *ec2.Vpc) (sg *ec2.SecurityGroup, err error)
GetSecurityGroup checks whether the configuration security group exists and has the configuration VPC assigned
func (*AWS) GetStorage ¶
GetStorage returns storage interface for cloud provider
func (*AWS) GetSubnet ¶
GetSubnet returns a subnet with the context subnet name or the default subnet of vpc passed by argument
func (*AWS) Initialize ¶
func (p *AWS) Initialize(config *types.ProviderConfig) error
Initialize AWS related things
func (*AWS) InstanceStats ¶
InstanceStats show metrics for instances on aws.
func (*AWS) ListImages ¶
ListImages lists images on AWS
func (*AWS) ListInstances ¶
ListInstances lists instances on AWS
func (*AWS) MirrorImage ¶
func (p *AWS) MirrorImage(ctx *lepton.Context, imageName, srcRegion, dstRegion string) (string, error)
MirrorImage copies an image using its imageName from one region to another
func (*AWS) PrintInstanceLogs ¶
PrintInstanceLogs writes instance logs to console
func (*AWS) RebootInstance ¶
RebootInstance reboots the instance.
func (*AWS) ResizeImage ¶
ResizeImage is not supported on AWS.
func (*AWS) StartInstance ¶
StartInstance stops instance from AWS by ami name
func (*AWS) StopInstance ¶
StopInstance stops instance from AWS by ami name
type LaunchTemplateInput ¶
type LaunchTemplateInput struct { AutoScalingGroup string ImageID string InstanceNetworkInterface *ec2.InstanceNetworkInterfaceSpecification InstanceProfileName string InstanceType string LaunchTemplateName string Tags []*ec2.Tag }
LaunchTemplateInput The parameters for a launch template.
type PutSnapshotBlockResult ¶
PutSnapshotBlockResult define result from PutSnapshotBlock
type PutSnapshotBlockResults ¶
type PutSnapshotBlockResults struct { Data []PutSnapshotBlockResult // sync.Mutex to lock the slice sync.Mutex }
PutSnapshotBlockResults define array of PutSnapshotBlockResult
func (*PutSnapshotBlockResults) Len ¶
func (psb *PutSnapshotBlockResults) Len() int
Len get len of data
func (*PutSnapshotBlockResults) Set ¶
func (psb *PutSnapshotBlockResults) Set(result PutSnapshotBlockResult)
Set a PutSnapshotBlockResult to slice Data
type ResourceWrapper ¶
ResourceWrapper wraps the resource block as it can be 2 types, an array of strings or wildcard.
func (ResourceWrapper) MarshalJSON ¶
func (w ResourceWrapper) MarshalJSON() ([]byte, error)
MarshalJSON is a custom unmarshaller to support multiple types for Resource.
func (*ResourceWrapper) UnmarshalJSON ¶
func (w *ResourceWrapper) UnmarshalJSON(data []byte) (err error)
UnmarshalJSON is a custom unmarshaller to support multiple types for Resource.
type RolePolicy ¶
type RolePolicy struct { Version string Statement []RoleStatement }
RolePolicy is the representation of an aws role policy.
type RoleStatement ¶
type RoleStatement struct { Effect string Action []string Resource ResourceWrapper }
RoleStatement is the representation of a statement of a RolePolicy.
type S3 ¶
type S3 struct{}
S3 provides AWS storage related operations
func (*S3) CopyToBucket ¶
CopyToBucket copies archive to bucket