digitalocean

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Email        string `json:"email"`
	UUID         string `json:"uuid"`
	Status       string `json:"status"`
	DropletLimit int    `json:"droplet_limit"`
}

Account represents a DigitalOcean account

type Client

type Client struct {
	Token string

	BaseURL string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(http core.HTTPContext, ctx core.IntegrationContext) (*Client, error)

func (*Client) CreateDroplet

func (c *Client) CreateDroplet(req CreateDropletRequest) (*Droplet, error)

CreateDroplet creates a new droplet

func (*Client) CreateDropletSnapshot added in v0.12.0

func (c *Client) CreateDropletSnapshot(dropletID int, name string) (*DOAction, error)

CreateDropletSnapshot creates a snapshot of a droplet

func (*Client) DeleteDroplet added in v0.12.0

func (c *Client) DeleteDroplet(dropletID int) error

DeleteDroplet deletes a droplet by its ID

func (*Client) DeleteSnapshot added in v0.12.0

func (c *Client) DeleteSnapshot(snapshotID string) error

DeleteSnapshot deletes a snapshot by ID

func (*Client) GetAccount

func (c *Client) GetAccount() (*Account, error)

GetAccount validates the API token by fetching account info

func (*Client) GetAction added in v0.12.0

func (c *Client) GetAction(actionID int) (*DOAction, error)

GetAction retrieves an action by its ID

func (*Client) GetDroplet

func (c *Client) GetDroplet(dropletID int) (*Droplet, error)

GetDroplet retrieves a droplet by its ID

func (*Client) GetDropletSnapshots added in v0.12.0

func (c *Client) GetDropletSnapshots(dropletID int) ([]Snapshot, error)

GetDropletSnapshots lists snapshots for a given droplet

func (*Client) GetSnapshot added in v0.12.0

func (c *Client) GetSnapshot(snapshotID string) (*Snapshot, error)

GetSnapshot retrieves a single snapshot by ID

func (*Client) ListActions

func (c *Client) ListActions(resourceType string) ([]DOAction, error)

ListActions retrieves actions filtered by resource type. The DigitalOcean /v2/actions API does not support resource_type as a query parameter, so we fetch all recent actions and filter client-side.

func (*Client) ListDroplets added in v0.12.0

func (c *Client) ListDroplets() ([]Droplet, error)

ListDroplets retrieves all droplets in the account

func (*Client) ListImages

func (c *Client) ListImages(imageType string) ([]Image, error)

ListImages retrieves images of a given type (e.g., "distribution")

func (*Client) ListRegions

func (c *Client) ListRegions() ([]Region, error)

ListRegions retrieves all available regions

func (*Client) ListSizes

func (c *Client) ListSizes() ([]Size, error)

ListSizes retrieves all available droplet sizes

func (*Client) ListSnapshots added in v0.12.0

func (c *Client) ListSnapshots() ([]Snapshot, error)

ListSnapshots retrieves all droplet snapshots

func (*Client) PostDropletAction added in v0.12.0

func (c *Client) PostDropletAction(dropletID int, actionType string) (*DOAction, error)

PostDropletAction initiates a power action on a droplet

type Configuration

type Configuration struct {
	APIToken string `json:"apiToken"`
}

type CreateDroplet

type CreateDroplet struct{}

func (*CreateDroplet) Actions

func (c *CreateDroplet) Actions() []core.Action

func (*CreateDroplet) Cancel

func (c *CreateDroplet) Cancel(ctx core.ExecutionContext) error

func (*CreateDroplet) Cleanup

func (c *CreateDroplet) Cleanup(ctx core.SetupContext) error

func (*CreateDroplet) Color

func (c *CreateDroplet) Color() string

func (*CreateDroplet) Configuration

func (c *CreateDroplet) Configuration() []configuration.Field

func (*CreateDroplet) Description

func (c *CreateDroplet) Description() string

func (*CreateDroplet) Documentation

func (c *CreateDroplet) Documentation() string

func (*CreateDroplet) ExampleOutput

func (c *CreateDroplet) ExampleOutput() map[string]any

func (*CreateDroplet) Execute

func (c *CreateDroplet) Execute(ctx core.ExecutionContext) error

func (*CreateDroplet) HandleAction

func (c *CreateDroplet) HandleAction(ctx core.ActionContext) error

func (*CreateDroplet) HandleWebhook

func (*CreateDroplet) Icon

func (c *CreateDroplet) Icon() string

func (*CreateDroplet) Label

func (c *CreateDroplet) Label() string

func (*CreateDroplet) Name

func (c *CreateDroplet) Name() string

func (*CreateDroplet) OutputChannels

func (c *CreateDroplet) OutputChannels(configuration any) []core.OutputChannel

func (*CreateDroplet) ProcessQueueItem

func (c *CreateDroplet) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*CreateDroplet) Setup

func (c *CreateDroplet) Setup(ctx core.SetupContext) error

type CreateDropletRequest

type CreateDropletRequest struct {
	Name     string   `json:"name"`
	Region   string   `json:"region"`
	Size     string   `json:"size"`
	Image    string   `json:"image"`
	SSHKeys  []string `json:"ssh_keys,omitempty"`
	Tags     []string `json:"tags,omitempty"`
	UserData string   `json:"user_data,omitempty"`
}

CreateDropletRequest is the payload for creating a droplet

type CreateDropletSpec

type CreateDropletSpec struct {
	Name     string   `json:"name"`
	Region   string   `json:"region"`
	Size     string   `json:"size"`
	Image    string   `json:"image"`
	SSHKeys  []string `json:"sshKeys"`
	Tags     []string `json:"tags"`
	UserData string   `json:"userData"`
}

type CreateSnapshot added in v0.12.0

type CreateSnapshot struct{}

func (*CreateSnapshot) Actions added in v0.12.0

func (c *CreateSnapshot) Actions() []core.Action

func (*CreateSnapshot) Cancel added in v0.12.0

func (c *CreateSnapshot) Cancel(ctx core.ExecutionContext) error

func (*CreateSnapshot) Cleanup added in v0.12.0

func (c *CreateSnapshot) Cleanup(ctx core.SetupContext) error

func (*CreateSnapshot) Color added in v0.12.0

func (c *CreateSnapshot) Color() string

func (*CreateSnapshot) Configuration added in v0.12.0

func (c *CreateSnapshot) Configuration() []configuration.Field

func (*CreateSnapshot) Description added in v0.12.0

func (c *CreateSnapshot) Description() string

func (*CreateSnapshot) Documentation added in v0.12.0

func (c *CreateSnapshot) Documentation() string

func (*CreateSnapshot) ExampleOutput added in v0.12.0

func (c *CreateSnapshot) ExampleOutput() map[string]any

func (*CreateSnapshot) Execute added in v0.12.0

func (c *CreateSnapshot) Execute(ctx core.ExecutionContext) error

func (*CreateSnapshot) HandleAction added in v0.12.0

func (c *CreateSnapshot) HandleAction(ctx core.ActionContext) error

func (*CreateSnapshot) HandleWebhook added in v0.12.0

func (*CreateSnapshot) Icon added in v0.12.0

func (c *CreateSnapshot) Icon() string

func (*CreateSnapshot) Label added in v0.12.0

func (c *CreateSnapshot) Label() string

func (*CreateSnapshot) Name added in v0.12.0

func (c *CreateSnapshot) Name() string

func (*CreateSnapshot) OutputChannels added in v0.12.0

func (c *CreateSnapshot) OutputChannels(configuration any) []core.OutputChannel

func (*CreateSnapshot) ProcessQueueItem added in v0.12.0

func (c *CreateSnapshot) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*CreateSnapshot) Setup added in v0.12.0

func (c *CreateSnapshot) Setup(ctx core.SetupContext) error

type CreateSnapshotSpec added in v0.12.0

type CreateSnapshotSpec struct {
	Droplet string `json:"droplet" mapstructure:"droplet"`
	Name    string `json:"name" mapstructure:"name"`
}

type DOAPIError

type DOAPIError struct {
	StatusCode int
	Body       []byte
}

func (*DOAPIError) Error

func (e *DOAPIError) Error() string

type DOAction

type DOAction struct {
	ID           int    `json:"id"`
	Status       string `json:"status"`
	Type         string `json:"type"`
	StartedAt    string `json:"started_at"`
	CompletedAt  string `json:"completed_at"`
	ResourceID   int    `json:"resource_id"`
	ResourceType string `json:"resource_type"`
	RegionSlug   string `json:"region_slug"`
}

DOAction represents a DigitalOcean action

type DeleteDroplet added in v0.12.0

type DeleteDroplet struct{}

func (*DeleteDroplet) Actions added in v0.12.0

func (d *DeleteDroplet) Actions() []core.Action

func (*DeleteDroplet) Cancel added in v0.12.0

func (d *DeleteDroplet) Cancel(ctx core.ExecutionContext) error

func (*DeleteDroplet) Cleanup added in v0.12.0

func (d *DeleteDroplet) Cleanup(ctx core.SetupContext) error

func (*DeleteDroplet) Color added in v0.12.0

func (d *DeleteDroplet) Color() string

func (*DeleteDroplet) Configuration added in v0.12.0

func (d *DeleteDroplet) Configuration() []configuration.Field

func (*DeleteDroplet) Description added in v0.12.0

func (d *DeleteDroplet) Description() string

func (*DeleteDroplet) Documentation added in v0.12.0

func (d *DeleteDroplet) Documentation() string

func (*DeleteDroplet) ExampleOutput added in v0.12.0

func (d *DeleteDroplet) ExampleOutput() map[string]any

func (*DeleteDroplet) Execute added in v0.12.0

func (d *DeleteDroplet) Execute(ctx core.ExecutionContext) error

func (*DeleteDroplet) HandleAction added in v0.12.0

func (d *DeleteDroplet) HandleAction(ctx core.ActionContext) error

func (*DeleteDroplet) HandleWebhook added in v0.12.0

func (*DeleteDroplet) Icon added in v0.12.0

func (d *DeleteDroplet) Icon() string

func (*DeleteDroplet) Label added in v0.12.0

func (d *DeleteDroplet) Label() string

func (*DeleteDroplet) Name added in v0.12.0

func (d *DeleteDroplet) Name() string

func (*DeleteDroplet) OutputChannels added in v0.12.0

func (d *DeleteDroplet) OutputChannels(configuration any) []core.OutputChannel

func (*DeleteDroplet) ProcessQueueItem added in v0.12.0

func (d *DeleteDroplet) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*DeleteDroplet) Setup added in v0.12.0

func (d *DeleteDroplet) Setup(ctx core.SetupContext) error

type DeleteDropletSpec added in v0.12.0

type DeleteDropletSpec struct {
	Droplet string `json:"droplet"`
}

type DeleteSnapshot added in v0.12.0

type DeleteSnapshot struct{}

func (*DeleteSnapshot) Actions added in v0.12.0

func (c *DeleteSnapshot) Actions() []core.Action

func (*DeleteSnapshot) Cancel added in v0.12.0

func (c *DeleteSnapshot) Cancel(ctx core.ExecutionContext) error

func (*DeleteSnapshot) Cleanup added in v0.12.0

func (c *DeleteSnapshot) Cleanup(ctx core.SetupContext) error

func (*DeleteSnapshot) Color added in v0.12.0

func (c *DeleteSnapshot) Color() string

func (*DeleteSnapshot) Configuration added in v0.12.0

func (c *DeleteSnapshot) Configuration() []configuration.Field

func (*DeleteSnapshot) Description added in v0.12.0

func (c *DeleteSnapshot) Description() string

func (*DeleteSnapshot) Documentation added in v0.12.0

func (c *DeleteSnapshot) Documentation() string

func (*DeleteSnapshot) ExampleOutput added in v0.12.0

func (c *DeleteSnapshot) ExampleOutput() map[string]any

func (*DeleteSnapshot) Execute added in v0.12.0

func (c *DeleteSnapshot) Execute(ctx core.ExecutionContext) error

func (*DeleteSnapshot) HandleAction added in v0.12.0

func (c *DeleteSnapshot) HandleAction(ctx core.ActionContext) error

func (*DeleteSnapshot) HandleWebhook added in v0.12.0

func (*DeleteSnapshot) Icon added in v0.12.0

func (c *DeleteSnapshot) Icon() string

func (*DeleteSnapshot) Label added in v0.12.0

func (c *DeleteSnapshot) Label() string

func (*DeleteSnapshot) Name added in v0.12.0

func (c *DeleteSnapshot) Name() string

func (*DeleteSnapshot) OutputChannels added in v0.12.0

func (c *DeleteSnapshot) OutputChannels(configuration any) []core.OutputChannel

func (*DeleteSnapshot) ProcessQueueItem added in v0.12.0

func (c *DeleteSnapshot) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*DeleteSnapshot) Setup added in v0.12.0

func (c *DeleteSnapshot) Setup(ctx core.SetupContext) error

type DeleteSnapshotSpec added in v0.12.0

type DeleteSnapshotSpec struct {
	Snapshot string `json:"snapshot" mapstructure:"snapshot"`
}

type DigitalOcean

type DigitalOcean struct{}

func (*DigitalOcean) Actions

func (d *DigitalOcean) Actions() []core.Action

func (*DigitalOcean) Cleanup

func (*DigitalOcean) Components

func (d *DigitalOcean) Components() []core.Component

func (*DigitalOcean) Configuration

func (d *DigitalOcean) Configuration() []configuration.Field

func (*DigitalOcean) Description

func (d *DigitalOcean) Description() string

func (*DigitalOcean) HandleAction

func (d *DigitalOcean) HandleAction(ctx core.IntegrationActionContext) error

func (*DigitalOcean) HandleRequest

func (d *DigitalOcean) HandleRequest(ctx core.HTTPRequestContext)

func (*DigitalOcean) Icon

func (d *DigitalOcean) Icon() string

func (*DigitalOcean) Instructions

func (d *DigitalOcean) Instructions() string

func (*DigitalOcean) Label

func (d *DigitalOcean) Label() string

func (*DigitalOcean) ListResources

func (d *DigitalOcean) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)

func (*DigitalOcean) Name

func (d *DigitalOcean) Name() string

func (*DigitalOcean) Sync

func (d *DigitalOcean) Sync(ctx core.SyncContext) error

func (*DigitalOcean) Triggers

func (d *DigitalOcean) Triggers() []core.Trigger

type Droplet

type Droplet struct {
	ID       int             `json:"id"`
	Name     string          `json:"name"`
	Memory   int             `json:"memory"`
	VCPUs    int             `json:"vcpus"`
	Disk     int             `json:"disk"`
	Status   string          `json:"status"`
	Region   DropletRegion   `json:"region"`
	Image    DropletImage    `json:"image"`
	SizeSlug string          `json:"size_slug"`
	Networks DropletNetworks `json:"networks"`
	Tags     []string        `json:"tags"`
}

Droplet represents a DigitalOcean droplet

type DropletImage

type DropletImage struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

type DropletNetworkV4

type DropletNetworkV4 struct {
	IPAddress string `json:"ip_address"`
	Type      string `json:"type"`
}

type DropletNetworks

type DropletNetworks struct {
	V4 []DropletNetworkV4 `json:"v4"`
}

type DropletNodeMetadata added in v0.12.0

type DropletNodeMetadata struct {
	DropletID   int    `json:"dropletId" mapstructure:"dropletId"`
	DropletName string `json:"dropletName" mapstructure:"dropletName"`
}

DropletNodeMetadata stores metadata about a droplet for display in the UI

type DropletRegion

type DropletRegion struct {
	Name string `json:"name"`
	Slug string `json:"slug"`
}

type GetDroplet added in v0.12.0

type GetDroplet struct{}

func (*GetDroplet) Actions added in v0.12.0

func (g *GetDroplet) Actions() []core.Action

func (*GetDroplet) Cancel added in v0.12.0

func (g *GetDroplet) Cancel(ctx core.ExecutionContext) error

func (*GetDroplet) Cleanup added in v0.12.0

func (g *GetDroplet) Cleanup(ctx core.SetupContext) error

func (*GetDroplet) Color added in v0.12.0

func (g *GetDroplet) Color() string

func (*GetDroplet) Configuration added in v0.12.0

func (g *GetDroplet) Configuration() []configuration.Field

func (*GetDroplet) Description added in v0.12.0

func (g *GetDroplet) Description() string

func (*GetDroplet) Documentation added in v0.12.0

func (g *GetDroplet) Documentation() string

func (*GetDroplet) ExampleOutput added in v0.12.0

func (g *GetDroplet) ExampleOutput() map[string]any

func (*GetDroplet) Execute added in v0.12.0

func (g *GetDroplet) Execute(ctx core.ExecutionContext) error

func (*GetDroplet) HandleAction added in v0.12.0

func (g *GetDroplet) HandleAction(ctx core.ActionContext) error

func (*GetDroplet) HandleWebhook added in v0.12.0

func (*GetDroplet) Icon added in v0.12.0

func (g *GetDroplet) Icon() string

func (*GetDroplet) Label added in v0.12.0

func (g *GetDroplet) Label() string

func (*GetDroplet) Name added in v0.12.0

func (g *GetDroplet) Name() string

func (*GetDroplet) OutputChannels added in v0.12.0

func (g *GetDroplet) OutputChannels(configuration any) []core.OutputChannel

func (*GetDroplet) ProcessQueueItem added in v0.12.0

func (g *GetDroplet) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*GetDroplet) Setup added in v0.12.0

func (g *GetDroplet) Setup(ctx core.SetupContext) error

type GetDropletSpec added in v0.12.0

type GetDropletSpec struct {
	Droplet string `json:"droplet"`
}

type Image

type Image struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	Slug         string `json:"slug"`
	Type         string `json:"type"`
	Distribution string `json:"distribution"`
}

Image represents a DigitalOcean image

type ManageDropletPower added in v0.12.0

type ManageDropletPower struct{}

func (*ManageDropletPower) Actions added in v0.12.0

func (m *ManageDropletPower) Actions() []core.Action

func (*ManageDropletPower) Cancel added in v0.12.0

func (*ManageDropletPower) Cleanup added in v0.12.0

func (m *ManageDropletPower) Cleanup(ctx core.SetupContext) error

func (*ManageDropletPower) Color added in v0.12.0

func (m *ManageDropletPower) Color() string

func (*ManageDropletPower) Configuration added in v0.12.0

func (m *ManageDropletPower) Configuration() []configuration.Field

func (*ManageDropletPower) Description added in v0.12.0

func (m *ManageDropletPower) Description() string

func (*ManageDropletPower) Documentation added in v0.12.0

func (m *ManageDropletPower) Documentation() string

func (*ManageDropletPower) ExampleOutput added in v0.12.0

func (m *ManageDropletPower) ExampleOutput() map[string]any

func (*ManageDropletPower) Execute added in v0.12.0

func (*ManageDropletPower) HandleAction added in v0.12.0

func (m *ManageDropletPower) HandleAction(ctx core.ActionContext) error

func (*ManageDropletPower) HandleWebhook added in v0.12.0

func (*ManageDropletPower) Icon added in v0.12.0

func (m *ManageDropletPower) Icon() string

func (*ManageDropletPower) Label added in v0.12.0

func (m *ManageDropletPower) Label() string

func (*ManageDropletPower) Name added in v0.12.0

func (m *ManageDropletPower) Name() string

func (*ManageDropletPower) OutputChannels added in v0.12.0

func (m *ManageDropletPower) OutputChannels(configuration any) []core.OutputChannel

func (*ManageDropletPower) ProcessQueueItem added in v0.12.0

func (m *ManageDropletPower) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*ManageDropletPower) Setup added in v0.12.0

func (m *ManageDropletPower) Setup(ctx core.SetupContext) error

type ManageDropletPowerSpec added in v0.12.0

type ManageDropletPowerSpec struct {
	Droplet   string `json:"droplet"`
	Operation string `json:"operation"`
}

type Metadata

type Metadata struct {
	AccountEmail string `json:"accountEmail"`
	AccountUUID  string `json:"accountUUID"`
}

type Region

type Region struct {
	Slug      string `json:"slug"`
	Name      string `json:"name"`
	Available bool   `json:"available"`
}

Region represents a DigitalOcean region

type Size

type Size struct {
	Slug         string  `json:"slug"`
	Memory       int     `json:"memory"`
	VCPUs        int     `json:"vcpus"`
	Disk         int     `json:"disk"`
	PriceMonthly float64 `json:"price_monthly"`
	Available    bool    `json:"available"`
}

Size represents a DigitalOcean droplet size

type Snapshot added in v0.12.0

type Snapshot struct {
	ID            json.Number `json:"id"`
	Name          string      `json:"name"`
	CreatedAt     string      `json:"created_at"`
	ResourceID    string      `json:"resource_id"`
	ResourceType  string      `json:"resource_type"`
	Regions       []string    `json:"regions"`
	MinDiskSize   int         `json:"min_disk_size"`
	SizeGigabytes float64     `json:"size_gigabytes"`
}

Snapshot represents a DigitalOcean snapshot

type SnapshotNodeMetadata added in v0.12.0

type SnapshotNodeMetadata struct {
	SnapshotID   string `json:"snapshotId" mapstructure:"snapshotId"`
	SnapshotName string `json:"snapshotName" mapstructure:"snapshotName"`
}

SnapshotNodeMetadata stores metadata about a snapshot for display in the UI

Jump to

Keyboard shortcuts

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