lightsail

package
v1.5.9 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lightsail talks to Amazon Lightsail over the signed JSON 1.1 API (target prefix Lightsail_20161128). Reads are open; creates go through the guard and changes need the managed tag.

Index

Constants

View Source
const ServiceName = "lightsail"

ServiceName is the key used in the guard ServicesEnabled map.

Variables

View Source
var (
	ErrRefused      = errors.New("lightsail: refused")
	ErrNotManaged   = errors.New("lightsail: resource is not managed by this control plane")
	ErrNeedsConfirm = errors.New("lightsail: delete needs the resource name typed as confirmation")
	ErrNoTimer      = errors.New("lightsail: a teardown timer (expires tag) is required")
)

Errors the API layer maps to HTTP statuses.

View Source
var ManagedTag = tagPrefix + "managed"

ManagedTag marks resources this control plane owns.

View Source
var Service = awsx.Service{Name: "lightsail", Prefix: "lightsail", SigningName: "lightsail", TargetPrefix: "Lightsail_20161128"}

Service is the Lightsail JSON API.

Functions

This section is empty.

Types

type Blueprint

type Blueprint struct {
	ID, Name, Group, Type, Version, Platform string
	Active                                   bool
}

Blueprint is one OS or app image.

type Bundle

type Bundle struct {
	ID, Name           string
	PriceUSD           float64
	CPUs               int
	RAMGB, DiskGB      float64
	TransferGB         int
	Active             bool
	SupportedPlatforms []string
}

Bundle is one size and price plan. PriceUSD comes from AWS, never from a table here.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the lazy Lightsail module; it makes no call until a method runs.

func New

func New(c *awsx.Client, g Guard) *Client

New wraps a shared client and guard.

func (*Client) Create

func (c *Client) Create(ctx context.Context, in CreateInput) error

Create makes one managed instance after the guard, bundle allowlist and instance cap pass. The price is read from GetBundles, so the monthly cap and per create limit see the real figure.

func (*Client) CreateSnapshot

func (c *Client) CreateSnapshot(ctx context.Context, region, instance, name string, m Meta) error

CreateSnapshot snapshots a managed instance and tags the snapshot as managed.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, in DeleteInput) error

Delete removes a managed instance after a typed confirm. Add-ons are not force deleted.

func (*Client) DeleteSnapshot

func (c *Client) DeleteSnapshot(ctx context.Context, region, name string) error

DeleteSnapshot deletes a snapshot this control plane created.

func (*Client) GetBlueprints

func (c *Client) GetBlueprints(ctx context.Context, region string) ([]Blueprint, error)

GetBlueprints lists blueprints (all pages).

func (*Client) GetBundles

func (c *Client) GetBundles(ctx context.Context, region string) ([]Bundle, error)

GetBundles lists bundles (all pages).

func (*Client) GetInstance

func (c *Client) GetInstance(ctx context.Context, region, name string) (Instance, error)

GetInstance reads one instance by name.

func (*Client) GetInstanceSnapshots

func (c *Client) GetInstanceSnapshots(ctx context.Context, region string) ([]Snapshot, error)

GetInstanceSnapshots lists instance snapshots (all pages).

func (*Client) GetInstances

func (c *Client) GetInstances(ctx context.Context, region string) ([]Instance, error)

GetInstances lists instances (all pages) in a region.

func (*Client) GetRegions

func (c *Client) GetRegions(ctx context.Context, region string) ([]Region, error)

GetRegions lists Lightsail regions with their availability zones.

func (*Client) GetStaticIps

func (c *Client) GetStaticIps(ctx context.Context, region string) ([]StaticIP, error)

GetStaticIps lists static addresses (all pages).

func (*Client) Reboot

func (c *Client) Reboot(ctx context.Context, region, name string) error

Reboot reboots a managed instance.

func (*Client) Start

func (c *Client) Start(ctx context.Context, region, name string) error

Start starts a managed instance.

func (*Client) Stop

func (c *Client) Stop(ctx context.Context, region, name string) error

Stop stops a managed instance.

type CreateInput

type CreateInput struct {
	Account, Region, Name, Zone string
	Blueprint, Bundle, KeyPair  string
	Meta                        Meta
	AllowedBundles              []string
	// MaxManaged is the most managed instances the account may hold in the region; 0 refuses every create.
	MaxManaged int
}

CreateInput describes one instance create. AllowedBundles and MaxManaged come from runtime settings.

type DeleteInput

type DeleteInput struct{ Region, Name, Confirm string }

DeleteInput is a delete request. Confirm must repeat the instance name.

type Guard

type Guard interface {
	Check(ctx context.Context, r cloudguard.CreateRequest) cloudguard.Decision
	Tags(m cloudguard.TagMeta) map[string]string
}

Guard is the create gate and tag source.

type Instance

type Instance struct {
	Name, ARN, State, BlueprintID, BundleID string
	PublicIP, PrivateIP, Zone, Region       string
	CPUs                                    int
	RAMGB, DiskGB                           float64
	CreatedAt                               time.Time
	Managed                                 bool
	Tags                                    map[string]string
}

Instance is the read view of one instance.

type Meta

type Meta = cloudguard.TagMeta

Meta carries the values behind the mandatory tags.

type Region

type Region struct {
	Name, DisplayName string
	Zones             []string
}

Region is one Lightsail region with its zones.

type Snapshot

type Snapshot struct {
	Name, ARN, State, FromInstance, FromBundle string
	SizeGB                                     int
	CreatedAt                                  time.Time
	Managed                                    bool
}

Snapshot is the read view of one instance snapshot.

type StaticIP

type StaticIP struct {
	Name, IP, AttachedTo string
	Attached             bool
}

StaticIP is one static address.

Jump to

Keyboard shortcuts

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