gitdrops

package
v0.0.0-...-7b08950 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachVolume

func AttachVolume(ctx context.Context, client *godo.Client, volID string, dropletID int) error

AttachVolume attempts to attach a volume to a droplet

func CreateDroplet

func CreateDroplet(ctx context.Context, client *godo.Client, dropletCreateRequest *godo.DropletCreateRequest) error

DeleteDroplet attempts to create droplet on DO by dropletCreateRequest

func CreateVolume

func CreateVolume(ctx context.Context, client *godo.Client, volumeCreateRequest *godo.VolumeCreateRequest) error

CreateVolume attempts to create droplet on DO by dropletCreateRequest

func DeleteDroplet

func DeleteDroplet(ctx context.Context, client *godo.Client, id int) error

DeleteDroplet attempts to delete droplet from DO by ID

func DeleteVolume

func DeleteVolume(ctx context.Context, client *godo.Client, id string) error

DeleteVolume attempts to delete volume from DO by ID

func DetachVolume

func DetachVolume(ctx context.Context, client *godo.Client, volID string, dropletID int) error

AttachVolume attempts to attach a volume to a droplet

func ListDroplets

func ListDroplets(ctx context.Context, client *godo.Client) ([]godo.Droplet, error)

ListDroplets lists all active droplets on DO account

func ListVolumes

func ListVolumes(ctx context.Context, client *godo.Client) ([]godo.Volume, error)

ListVolumes lists all active volumes on DO account

func ResizeVolume

func ResizeVolume(ctx context.Context, client *godo.Client, volID, region string, value interface{}) error

ResizeVolume attempts to perform an action (resize) on an active volume on DO by ID

func UpdateDroplet

func UpdateDroplet(ctx context.Context, client *godo.Client, id int, action, value string) error

UpdateDroplet attempts to perform an action (resize or rebuild) on an active droplet on DO by ID

Types

type Droplet

type Droplet struct {
	Name   string `yaml:"name"`
	Region string `yaml:"region"`
	Size   string `yaml:"size"`
	// Image represents the image name for the droplet. It is the equivalient of
	// godo.DropletCreateRequest.Image.Slug
	Image string `yaml:"image"`
	// SSHKeyFingerprint represents the SSH key fingerprints for the droplet.
	// It is the equivalient of godo.DropletCreateRequest.[]SSHKeys.FingerPrint
	SSHKeyFingerprints []string `yaml:"sshKeyFingerprints"`
	Backups            bool     `yaml:"backups"`
	IPv6               bool     `yaml:"ipv6"`
	Monitoring         bool     `yaml:"monitoring"`
	// See type UserData
	UserData UserData `yaml:"userData,omitempty"`
	// Volumes is a []string of the volume names to be attached to the droplet.
	Volumes []string `yaml:"volumes,omitempty"`
	Tags    []string `yaml:"tags"`
	VPCUUID string   `yaml:"vpcuuid,omitempty"`
}

Droplet is a simplified gitdrops representation of godo.DropletCreateRequest

type GitDrops

type GitDrops struct {
	Privileges Privileges `yaml:"privileges"`
	Droplets   []Droplet  `yaml:"droplets"`
	Volumes    []Volume   `yaml:"volumes"`
}

func ReadGitDrops

func ReadGitDrops() (GitDrops, error)

ReadGitDrops reads and unmarshals from gitdrops.yaml

type Privileges

type Privileges struct {
	Create bool `yaml:"create"`
	Update bool `yaml:"update"`
	Delete bool `yaml:"delete"`
}

type UserData

type UserData struct {
	Path string `yaml:"path,omitempty"`
	Data string `yaml:"data,omitempty"`
}

UserData stores the Path of a userdata file and/or the Data itself. In the event that path is defined, Data is populated with contents of the file at Path. Thus Path takes precedence over Data.

type Volume

type Volume struct {
	Name            string   `yaml:"name"`
	Region          string   `yaml:"region"`
	SizeGigaBytes   int64    `yaml:"sizeGigaBytes"`
	SnapshotID      string   `yaml:"snapShotID"`
	FilesystemType  string   `yaml:"filesystemType"`
	FilesystemLabel string   `yaml:"filesystemLabel"`
	Tags            []string `yaml:"tags"`
}

Volume is a simplified gitdrops representation of godo.VolumeCreateRequest

Jump to

Keyboard shortcuts

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