govultr

package module
v3.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 13 Imported by: 52

README

GoVultr

Automatic Releaser PkgGoDev Unit/Coverage Tests Go Report Card

The official Vultr Go client - GoVultr allows you to interact with the Vultr V2 API.

Installation

go get -u github.com/vultr/govultr/v3

Usage

Vultr uses a personal access token (PAT) to interact/authenticate with the APIs. Generate an API Key from the API menu in the Vultr Customer Portal.

To instantiate a GoVultr client, invoke NewClient(). Most operations require that you pass a PAT to an oauth2 library to create the *http.Client, which configures the Authorization header with your PAT as the bearer api-key. If a PAT is not provided, public operations like listing plans or applications will still work.

The client has three optional parameters:

  • BaseUrl: Change the Vultr default base URL
  • UserAgent: Change the Vultr default UserAgent
  • RateLimit: Set a delay between calls. Vultr limits the rate of back-to-back calls. Use this parameter to avoid rate-limit errors.
Example Client Setup
package main

import (
  "context"
  "os"

  "github.com/vultr/govultr/v3"
  "golang.org/x/oauth2"
)

func main() {
  apiKey := os.Getenv("VultrAPIKey")

  config := &oauth2.Config{}
  ctx := context.Background()
  ts := config.TokenSource(ctx, &oauth2.Token{AccessToken: apiKey})
  vultrClient := govultr.NewClient(oauth2.NewClient(ctx, ts))

  // Optional changes
  _ = vultrClient.SetBaseURL("https://api.vultr.com")
  vultrClient.SetUserAgent("mycool-app")
  vultrClient.SetRateLimit(500)
}

Passing nil to NewClient will work for routes that do not require authentication.

  ... 

  vultrClient := govultr.NewClient(nil)
  ctx := context.Background()
  plans, _, _, err := vultrClient.Plan.List(ctx, "", nil)

  ...
Example Usage

Create a VPS

instanceOptions := &govultr.InstanceCreateReq{
  Label:                "awesome-go-app",
  Hostname:             "awesome-go.com",
  Backups:              "enabled",
  EnableIPv6:           BoolToBoolPtr(false),
  OsID:                 362,
  Plan:                 "vc2-1c-2gb",
  Region:               "ewr",
}

res, err := vultrClient.Instance.Create(context.Background(), instanceOptions)

if err != nil {
  fmt.Println(err)
}

Pagination

GoVultr v2 introduces pagination for all list calls. Each list call returns a meta struct containing the total amount of items in the list and next/previous links to navigate the paging.

// Meta represents the available pagination information
type Meta struct {
  Total int `json:"total"`
  Links *Links
}

// Links represent the next/previous cursor in your pagination calls
type Links struct {
  Next string `json:"next"`
  Prev string `json:"prev"`
}

Pass a per_page value to the list_options struct to adjust the number of items returned per call. The default is 100 items per page and max is 500 items per page.

This example demonstrates how to retrieve all of your instances, with one instance per page.

listOptions := &govultr.ListOptions{PerPage: 1}
for {
    i, meta, err := client.Instance.List(ctx, listOptions)
    if err != nil {
        return nil, err
    }
    for _, v := range i {
        fmt.Println(v)
    }

    if meta.Links.Next == "" {
        break
    } else {
        listOptions.Cursor = meta.Links.Next
        continue
    }
}

Versioning

This project follows SemVer for versioning. For the versions available, see the tags on this repository.

Documentation

See our documentation for detailed information about API v2.

See our GoDoc documentation for more details about this client's functionality.

Contributing

Feel free to send pull requests our way! Please see the contributing guidelines.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Documentation

Overview

Package govultr contains the functionality to interact with the Vultr public HTTP REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToBoolPtr

func BoolToBoolPtr(value bool) *bool

BoolToBoolPtr helper function that returns a pointer from your bool value

func IntToIntPtr

func IntToIntPtr(value int) *int

IntToIntPtr helper function that returns a pointer from your string value

func StringToStringPtr

func StringToStringPtr(value string) *string

StringToStringPtr helper function that returns a pointer from your string value

Types

type Account

type Account struct {
	Balance           float32  `json:"balance"`
	PendingCharges    float32  `json:"pending_charges"`
	LastPaymentDate   string   `json:"last_payment_date"`
	LastPaymentAmount float32  `json:"last_payment_amount"`
	Name              string   `json:"name"`
	Email             string   `json:"email"`
	ACL               []string `json:"acls"`
}

Account represents a Vultr account

type AccountService

type AccountService interface {
	Get(ctx context.Context) (*Account, *http.Response, error)
}

AccountService is the interface to interact with Accounts endpoint on the Vultr API Link : https://www.vultr.com/api/#tag/account

type AccountServiceHandler

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

AccountServiceHandler handles interaction with the account methods for the Vultr API

func (*AccountServiceHandler) Get

Get Vultr account info

type Application

type Application struct {
	ID         int    `json:"id"`
	Name       string `json:"name"`
	ShortName  string `json:"short_name"`
	DeployName string `json:"deploy_name"`
	Type       string `json:"type"`
	Vendor     string `json:"vendor"`
	ImageID    string `json:"image_id"`
}

Application represents all available apps that can be used to deployed with vultr Instances.

type ApplicationService

type ApplicationService interface {
	List(ctx context.Context, options *ListOptions) ([]Application, *Meta, *http.Response, error)
}

ApplicationService is the interface to interact with the Application endpoint on the Vultr API. Link : https://www.vultr.com/api/#tag/application

type ApplicationServiceHandler

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

ApplicationServiceHandler handles interaction with the application methods for the Vultr API.

func (*ApplicationServiceHandler) List

List retrieves a list of available applications that can be launched when creating a Vultr instance

type AttachVPC2Req added in v3.3.0

type AttachVPC2Req struct {
	VPCID     string  `json:"vpc_id,omitempty"`
	IPAddress *string `json:"ip_address,omitempty"`
}

AttachVPC2Req parameters for attaching a VPC 2.0 network

type AvailableOption

type AvailableOption struct {
	Name      string   `json:"name"`
	Type      string   `json:"type"`
	Enumerals []string `json:"enumerals,omitempty"`
	MinValue  *int     `json:"min_value,omitempty"`
	MaxValue  *int     `json:"max_value,omitempty"`
	AltValues []int    `json:"alt_values,omitempty"`
	Units     string   `json:"units,omitempty"`
}

AvailableOption represents an available advanced configuration option for a PostgreSQL Managed Database cluster

type BMBareMetalBase

type BMBareMetalBase struct {
	BareMetalBandwidth map[string]BareMetalServerBandwidth `json:"bandwidth"`
}

BMBareMetalBase represents the base struct for a Bare Metal server

type Backup

type Backup struct {
	ID          string `json:"id"`
	DateCreated string `json:"date_created"`
	Description string `json:"description"`
	Size        int    `json:"size"`
	Status      string `json:"status"`
}

Backup represents a Vultr backup

type BackupSchedule

type BackupSchedule struct {
	Enabled             *bool  `json:"enabled,omitempty"`
	Type                string `json:"type,omitempty"`
	NextScheduleTimeUTC string `json:"next_scheduled_time_utc,omitempty"`
	Hour                int    `json:"hour,omitempty"`
	Dow                 int    `json:"dow,omitempty"`
	Dom                 int    `json:"dom,omitempty"`
}

BackupSchedule information for a given instance.

type BackupScheduleReq

type BackupScheduleReq struct {
	Type string `json:"type"`
	Hour *int   `json:"hour,omitempty"`
	Dow  *int   `json:"dow,omitempty"`
	Dom  int    `json:"dom,omitempty"`
}

BackupScheduleReq struct used to create a backup schedule for an instance.

type BackupService

type BackupService interface {
	Get(ctx context.Context, backupID string) (*Backup, *http.Response, error)
	List(ctx context.Context, options *ListOptions) ([]Backup, *Meta, *http.Response, error)
}

BackupService is the interface to interact with the backup endpoint on the Vultr API Link : https://www.vultr.com/api/#tag/backup

type BackupServiceHandler

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

BackupServiceHandler handles interaction with the backup methods for the Vultr API

func (*BackupServiceHandler) Get

func (b *BackupServiceHandler) Get(ctx context.Context, backupID string) (*Backup, *http.Response, error)

Get retrieves a backup that matches the given backupID

func (*BackupServiceHandler) List

func (b *BackupServiceHandler) List(ctx context.Context, options *ListOptions) ([]Backup, *Meta, *http.Response, error)

List retrieves a list of all backups on the current account

type Bandwidth

type Bandwidth struct {
	Bandwidth map[string]struct {
		IncomingBytes int `json:"incoming_bytes"`
		OutgoingBytes int `json:"outgoing_bytes"`
	} `json:"bandwidth"`
}

Bandwidth used on a given instance.

type BareMetalCreate

type BareMetalCreate struct {
	Region          string   `json:"region,omitempty"`
	Plan            string   `json:"plan,omitempty"`
	OsID            int      `json:"os_id,omitempty"`
	StartupScriptID string   `json:"script_id,omitempty"`
	SnapshotID      string   `json:"snapshot_id,omitempty"`
	EnableIPv6      *bool    `json:"enable_ipv6,omitempty"`
	Label           string   `json:"label,omitempty"`
	SSHKeyIDs       []string `json:"sshkey_id,omitempty"`
	AppID           int      `json:"app_id,omitempty"`
	ImageID         string   `json:"image_id,omitempty"`
	UserData        string   `json:"user_data,omitempty"`
	ActivationEmail *bool    `json:"activation_email,omitempty"`
	Hostname        string   `json:"hostname,omitempty"`
	// Deprecated: Tag should no longer be used. Instead, use Tags.
	Tag           string            `json:"tag,omitempty"`
	ReservedIPv4  string            `json:"reserved_ipv4,omitempty"`
	PersistentPxe *bool             `json:"persistent_pxe,omitempty"`
	Tags          []string          `json:"tags"`
	AttachVPC2    []string          `json:"attach_vpc2,omitempty"`
	DetachVPC2    []string          `json:"detach_vpc2,omitempty"`
	EnableVPC2    *bool             `json:"enable_vpc2,omitempty"`
	AppVariables  map[string]string `json:"app_variables,omitempty"`
}

BareMetalCreate represents the optional parameters that can be set when creating a Bare Metal server

type BareMetalPlan

type BareMetalPlan struct {
	ID          string   `json:"id"`
	CPUCount    int      `json:"cpu_count"`
	CPUModel    string   `json:"cpu_model"`
	CPUThreads  int      `json:"cpu_threads"`
	RAM         int      `json:"ram"`
	Disk        int      `json:"disk"`
	DiskCount   int      `json:"disk_count"`
	Bandwidth   int      `json:"bandwidth"`
	MonthlyCost float32  `json:"monthly_cost"`
	Type        string   `json:"type"`
	Locations   []string `json:"locations"`
}

BareMetalPlan represents bare metal plans

type BareMetalServer

type BareMetalServer struct {
	ID              string `json:"id"`
	Os              string `json:"os"`
	RAM             string `json:"ram"`
	Disk            string `json:"disk"`
	MainIP          string `json:"main_ip"`
	CPUCount        int    `json:"cpu_count"`
	Region          string `json:"region"`
	DefaultPassword string `json:"default_password"`
	DateCreated     string `json:"date_created"`
	Status          string `json:"status"`
	NetmaskV4       string `json:"netmask_v4"`
	GatewayV4       string `json:"gateway_v4"`
	Plan            string `json:"plan"`
	V6Network       string `json:"v6_network"`
	V6MainIP        string `json:"v6_main_ip"`
	V6NetworkSize   int    `json:"v6_network_size"`
	MacAddress      int    `json:"mac_address"`
	Label           string `json:"label"`
	// Deprecated: Tag should no longer be used. Instead, use Tags.
	Tag      string   `json:"tag"`
	OsID     int      `json:"os_id"`
	AppID    int      `json:"app_id"`
	ImageID  string   `json:"image_id"`
	Features []string `json:"features"`
	Tags     []string `json:"tags"`
}

BareMetalServer represents a Bare Metal server on Vultr

type BareMetalServerBandwidth

type BareMetalServerBandwidth struct {
	IncomingBytes int `json:"incoming_bytes"`
	OutgoingBytes int `json:"outgoing_bytes"`
}

BareMetalServerBandwidth represents bandwidth information for a Bare Metal server

type BareMetalServerService

type BareMetalServerService interface {
	Create(ctx context.Context, bmCreate *BareMetalCreate) (*BareMetalServer, *http.Response, error)
	Get(ctx context.Context, serverID string) (*BareMetalServer, *http.Response, error)
	Update(ctx context.Context, serverID string, bmReq *BareMetalUpdate) (*BareMetalServer, *http.Response, error)
	Delete(ctx context.Context, serverID string) error
	List(ctx context.Context, options *ListOptions) ([]BareMetalServer, *Meta, *http.Response, error)

	GetBandwidth(ctx context.Context, serverID string) (*Bandwidth, *http.Response, error)
	GetUserData(ctx context.Context, serverID string) (*UserData, *http.Response, error)
	GetVNCUrl(ctx context.Context, serverID string) (*VNCUrl, *http.Response, error)

	ListIPv4s(ctx context.Context, serverID string, options *ListOptions) ([]IPv4, *Meta, *http.Response, error)
	ListIPv6s(ctx context.Context, serverID string, options *ListOptions) ([]IPv6, *Meta, *http.Response, error)

	Halt(ctx context.Context, serverID string) error
	Reboot(ctx context.Context, serverID string) error
	Start(ctx context.Context, serverID string) error
	Reinstall(ctx context.Context, serverID string) (*BareMetalServer, *http.Response, error)

	MassStart(ctx context.Context, serverList []string) error
	MassHalt(ctx context.Context, serverList []string) error
	MassReboot(ctx context.Context, serverList []string) error

	GetUpgrades(ctx context.Context, serverID string) (*Upgrades, *http.Response, error)

	ListVPCInfo(ctx context.Context, serverID string) ([]VPCInfo, *http.Response, error)
	AttachVPC(ctx context.Context, serverID, vpcID string) error
	DetachVPC(ctx context.Context, serverID, vpcID string) error

	ListVPC2Info(ctx context.Context, serverID string) ([]VPC2Info, *http.Response, error)
	AttachVPC2(ctx context.Context, serverID string, vpc2Req *AttachVPC2Req) error
	DetachVPC2(ctx context.Context, serverID, vpcID string) error
}

BareMetalServerService is the interface to interact with the Bare Metal endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/baremetal

type BareMetalServerServiceHandler

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

BareMetalServerServiceHandler handles interaction with the Bare Metal methods for the Vultr API

func (*BareMetalServerServiceHandler) AttachVPC added in v3.6.1

func (b *BareMetalServerServiceHandler) AttachVPC(ctx context.Context, serverID, vpcID string) error

AttachVPC serves to attach a VPC to a bare metal server.

func (*BareMetalServerServiceHandler) AttachVPC2 added in v3.3.0

func (b *BareMetalServerServiceHandler) AttachVPC2(ctx context.Context, serverID string, vpc2Req *AttachVPC2Req) error

AttachVPC2 to a Bare Metal server.

func (*BareMetalServerServiceHandler) Create

Create a new Bare Metal server.

func (*BareMetalServerServiceHandler) Delete

func (b *BareMetalServerServiceHandler) Delete(ctx context.Context, serverID string) error

Delete a Bare Metal server.

func (*BareMetalServerServiceHandler) DetachVPC added in v3.6.1

func (b *BareMetalServerServiceHandler) DetachVPC(ctx context.Context, serverID, vpcID string) error

DetachVPC will detach a VPC from a bare metal server.

func (*BareMetalServerServiceHandler) DetachVPC2 added in v3.3.0

func (b *BareMetalServerServiceHandler) DetachVPC2(ctx context.Context, serverID, vpcID string) error

DetachVPC2 from a Bare Metal server.

func (*BareMetalServerServiceHandler) Get

Get information for a Bare Metal instance.

func (*BareMetalServerServiceHandler) GetBandwidth

func (b *BareMetalServerServiceHandler) GetBandwidth(ctx context.Context, serverID string) (*Bandwidth, *http.Response, error)

GetBandwidth used by a Bare Metal server.

func (*BareMetalServerServiceHandler) GetUpgrades

func (b *BareMetalServerServiceHandler) GetUpgrades(ctx context.Context, serverID string) (*Upgrades, *http.Response, error)

GetUpgrades that are available for a Bare Metal server.

func (*BareMetalServerServiceHandler) GetUserData

func (b *BareMetalServerServiceHandler) GetUserData(ctx context.Context, serverID string) (*UserData, *http.Response, error)

GetUserData for a Bare Metal server. The userdata returned will be in base64 encoding.

func (*BareMetalServerServiceHandler) GetVNCUrl

func (b *BareMetalServerServiceHandler) GetVNCUrl(ctx context.Context, serverID string) (*VNCUrl, *http.Response, error)

GetVNCUrl gets the vnc url for a given Bare Metal server.

func (*BareMetalServerServiceHandler) Halt

func (b *BareMetalServerServiceHandler) Halt(ctx context.Context, serverID string) error

Halt a Bare Metal server. This is a hard power off, meaning that the power to the machine is severed. The data on the machine will not be modified, and you will still be billed for the machine.

func (*BareMetalServerServiceHandler) List

List all Bare Metal instances in your account.

func (*BareMetalServerServiceHandler) ListIPv4s

func (b *BareMetalServerServiceHandler) ListIPv4s(ctx context.Context, serverID string, options *ListOptions) ([]IPv4, *Meta, *http.Response, error)

ListIPv4s information of a Bare Metal server. IP information is only available for Bare Metal servers in the "active" state.

func (*BareMetalServerServiceHandler) ListIPv6s

func (b *BareMetalServerServiceHandler) ListIPv6s(ctx context.Context, serverID string, options *ListOptions) ([]IPv6, *Meta, *http.Response, error)

ListIPv6s information of a Bare Metal server. IP information is only available for Bare Metal servers in the "active" state. If the Bare Metal server does not have IPv6 enabled, then an empty array is returned.

func (*BareMetalServerServiceHandler) ListVPC2Info added in v3.3.0

func (b *BareMetalServerServiceHandler) ListVPC2Info(ctx context.Context, serverID string) ([]VPC2Info, *http.Response, error)

ListVPC2Info currently attached to a Bare Metal server.

func (*BareMetalServerServiceHandler) ListVPCInfo added in v3.6.1

func (b *BareMetalServerServiceHandler) ListVPCInfo(ctx context.Context, serverID string) ([]VPCInfo, *http.Response, error)

ListVPCInfo will list all currently attached VPC IP information for the given bare metal server.

func (*BareMetalServerServiceHandler) MassHalt

func (b *BareMetalServerServiceHandler) MassHalt(ctx context.Context, serverList []string) error

MassHalt a list of Bare Metal servers.

func (*BareMetalServerServiceHandler) MassReboot

func (b *BareMetalServerServiceHandler) MassReboot(ctx context.Context, serverList []string) error

MassReboot a list of Bare Metal servers.

func (*BareMetalServerServiceHandler) MassStart

func (b *BareMetalServerServiceHandler) MassStart(ctx context.Context, serverList []string) error

MassStart will start a list of Bare Metal servers the machine is already running, it will be restarted.

func (*BareMetalServerServiceHandler) Reboot

func (b *BareMetalServerServiceHandler) Reboot(ctx context.Context, serverID string) error

Reboot a Bare Metal server. This is a hard reboot, which means that the server is powered off, then back on.

func (*BareMetalServerServiceHandler) Reinstall

Reinstall the operating system on a Bare Metal server. All data will be permanently lost, but the IP address will remain the same.

func (*BareMetalServerServiceHandler) Start

func (b *BareMetalServerServiceHandler) Start(ctx context.Context, serverID string) error

Start a Bare Metal server.

func (*BareMetalServerServiceHandler) Update

Update a Bare Metal server

type BareMetalUpdate

type BareMetalUpdate struct {
	OsID       int    `json:"os_id,omitempty"`
	EnableIPv6 *bool  `json:"enable_ipv6,omitempty"`
	Label      string `json:"label,omitempty"`
	AppID      int    `json:"app_id,omitempty"`
	ImageID    string `json:"image_id,omitempty"`
	UserData   string `json:"user_data,omitempty"`
	// Deprecated: Tag should no longer be used. Instead, use Tags.
	Tag        *string  `json:"tag,omitempty"`
	Tags       []string `json:"tags"`
	AttachVPC2 []string `json:"attach_vpc2,omitempty"`
	DetachVPC2 []string `json:"detach_vpc2,omitempty"`
	EnableVPC2 *bool    `json:"enable_vpc2,omitempty"`
}

BareMetalUpdate represents the optional parameters that can be set when updating a Bare Metal server

type BillingService

type BillingService interface {
	ListHistory(ctx context.Context, options *ListOptions) ([]History, *Meta, *http.Response, error)
	ListInvoices(ctx context.Context, options *ListOptions) ([]Invoice, *Meta, *http.Response, error)
	GetInvoice(ctx context.Context, invoiceID string) (*Invoice, *http.Response, error)
	ListInvoiceItems(ctx context.Context, invoiceID int, options *ListOptions) ([]InvoiceItem, *Meta, *http.Response, error)
}

BillingService is the interface to interact with the billing endpoint on the Vultr API Link : https://www.vultr.com/api/#tag/billing

type BillingServiceHandler

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

BillingServiceHandler handles interaction with the billing methods for the Vultr API

func (*BillingServiceHandler) GetInvoice

func (b *BillingServiceHandler) GetInvoice(ctx context.Context, invoiceID string) (*Invoice, *http.Response, error)

GetInvoice retrieves an invoice that matches the given invoiceID

func (*BillingServiceHandler) ListHistory

func (b *BillingServiceHandler) ListHistory(ctx context.Context, options *ListOptions) ([]History, *Meta, *http.Response, error)

ListHistory retrieves a list of all billing history on the current account

func (*BillingServiceHandler) ListInvoiceItems

func (b *BillingServiceHandler) ListInvoiceItems(ctx context.Context, invoiceID int, options *ListOptions) ([]InvoiceItem, *Meta, *http.Response, error)

ListInvoiceItems retrieves items in an invoice that matches the given invoiceID

func (*BillingServiceHandler) ListInvoices

func (b *BillingServiceHandler) ListInvoices(ctx context.Context, options *ListOptions) ([]Invoice, *Meta, *http.Response, error)

ListInvoices retrieves a list of all billing invoices on the current account

type BlockStorage

type BlockStorage struct {
	ID                 string  `json:"id"`
	Cost               float32 `json:"cost"`
	Status             string  `json:"status"`
	SizeGB             int     `json:"size_gb"`
	Region             string  `json:"region"`
	DateCreated        string  `json:"date_created"`
	AttachedToInstance string  `json:"attached_to_instance"`
	Label              string  `json:"label"`
	MountID            string  `json:"mount_id"`
	BlockType          string  `json:"block_type"`
}

BlockStorage represents Vultr Block-Storage

type BlockStorageAttach

type BlockStorageAttach struct {
	InstanceID string `json:"instance_id"`
	Live       *bool  `json:"live,omitempty"`
}

BlockStorageAttach struct used to define if a attach should be restart the instance.

type BlockStorageCreate

type BlockStorageCreate struct {
	Region    string `json:"region"`
	SizeGB    int    `json:"size_gb"`
	Label     string `json:"label,omitempty"`
	BlockType string `json:"block_type,omitempty"`
}

BlockStorageCreate struct is used for creating Block Storage.

type BlockStorageDetach

type BlockStorageDetach struct {
	Live *bool `json:"live,omitempty"`
}

BlockStorageDetach struct used to define if a detach should be restart the instance.

type BlockStorageService

type BlockStorageService interface {
	Create(ctx context.Context, blockReq *BlockStorageCreate) (*BlockStorage, *http.Response, error)
	Get(ctx context.Context, blockID string) (*BlockStorage, *http.Response, error)
	Update(ctx context.Context, blockID string, blockReq *BlockStorageUpdate) error
	Delete(ctx context.Context, blockID string) error
	List(ctx context.Context, options *ListOptions) ([]BlockStorage, *Meta, *http.Response, error)

	Attach(ctx context.Context, blockID string, attach *BlockStorageAttach) error
	Detach(ctx context.Context, blockID string, detach *BlockStorageDetach) error
}

BlockStorageService is the interface to interact with Block-Storage endpoint on the Vultr API Link : https://www.vultr.com/api/#tag/block

type BlockStorageServiceHandler

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

BlockStorageServiceHandler handles interaction with the block-storage methods for the Vultr API

func (*BlockStorageServiceHandler) Attach

func (b *BlockStorageServiceHandler) Attach(ctx context.Context, blockID string, attach *BlockStorageAttach) error

Attach will link a given block storage to a given Vultr instance If Live is set to true the block storage will be attached without reloading the instance

func (*BlockStorageServiceHandler) Create

Create builds out a block storage

func (*BlockStorageServiceHandler) Delete

func (b *BlockStorageServiceHandler) Delete(ctx context.Context, blockID string) error

Delete a block storage subscription from your Vultr account

func (*BlockStorageServiceHandler) Detach

func (b *BlockStorageServiceHandler) Detach(ctx context.Context, blockID string, detach *BlockStorageDetach) error

Detach will de-link a given block storage to the Vultr instance it is attached to If Live is set to true the block storage will be detached without reloading the instance

func (*BlockStorageServiceHandler) Get

Get returns a single block storage instance based ony our blockID you provide from your Vultr Account

func (*BlockStorageServiceHandler) List

List returns a list of all block storage instances on your Vultr Account

func (*BlockStorageServiceHandler) Update

func (b *BlockStorageServiceHandler) Update(ctx context.Context, blockID string, blockReq *BlockStorageUpdate) error

Update a block storage subscription.

type BlockStorageUpdate

type BlockStorageUpdate struct {
	SizeGB int    `json:"size_gb,omitempty"`
	Label  string `json:"label,omitempty"`
}

BlockStorageUpdate struct is used to update Block Storage.

type Client

type Client struct {

	// BASE URL for APIs
	BaseURL *url.URL

	// User Agent for the client
	UserAgent string

	// Services used to interact with the API
	Account           AccountService
	Application       ApplicationService
	Backup            BackupService
	BareMetalServer   BareMetalServerService
	Billing           BillingService
	BlockStorage      BlockStorageService
	ContainerRegistry ContainerRegistryService
	Database          DatabaseService
	Domain            DomainService
	DomainRecord      DomainRecordService
	FirewallGroup     FirewallGroupService
	FirewallRule      FireWallRuleService
	Instance          InstanceService
	ISO               ISOService
	Kubernetes        KubernetesService
	LoadBalancer      LoadBalancerService
	Marketplace       MarketplaceService
	// Deprecated: Network should no longer be used. Instead, use VPC.
	Network       NetworkService
	ObjectStorage ObjectStorageService
	OS            OSService
	Plan          PlanService
	Region        RegionService
	ReservedIP    ReservedIPService
	Snapshot      SnapshotService
	SSHKey        SSHKeyService
	StartupScript StartupScriptService
	User          UserService
	VPC           VPCService
	VPC2          VPC2Service
	// contains filtered or unexported fields
}

Client manages interaction with the Vultr API

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a Vultr API Client

func (*Client) DoWithContext

func (c *Client) DoWithContext(ctx context.Context, r *http.Request, data interface{}) (*http.Response, error)

DoWithContext sends an API Request and returns back the response. The API response is checked to see if it was a successful call. A successful call is then checked to see if we need to unmarshal since some resources have their own implements of unmarshal.

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, uri string, body interface{}) (*http.Request, error)

NewRequest creates an API Request

func (*Client) OnRequestCompleted

func (c *Client) OnRequestCompleted(rc RequestCompletionCallback)

OnRequestCompleted sets the API request completion callback

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(baseURL string) error

SetBaseURL Overrides the default BaseUrl

func (*Client) SetRateLimit

func (c *Client) SetRateLimit(t time.Duration)

SetRateLimit Overrides the default rateLimit. For performance, exponential backoff is used with the minimum wait being 2/3rds the time provided.

func (*Client) SetRetryLimit

func (c *Client) SetRetryLimit(n int)

SetRetryLimit overrides the default RetryLimit

func (*Client) SetUserAgent

func (c *Client) SetUserAgent(ua string)

SetUserAgent Overrides the default UserAgent

type Cluster

type Cluster struct {
	ID              string     `json:"id"`
	Label           string     `json:"label"`
	DateCreated     string     `json:"date_created"`
	ClusterSubnet   string     `json:"cluster_subnet"`
	ServiceSubnet   string     `json:"service_subnet"`
	IP              string     `json:"ip"`
	Endpoint        string     `json:"endpoint"`
	Version         string     `json:"version"`
	Region          string     `json:"region"`
	Status          string     `json:"status"`
	HAControlPlanes bool       `json:"ha_controlplanes"`
	FirewallGroupID string     `json:"firewall_group_id"`
	NodePools       []NodePool `json:"node_pools"`
}

Cluster represents a full VKE cluster

type ClusterReq

type ClusterReq struct {
	Label           string        `json:"label"`
	Region          string        `json:"region"`
	Version         string        `json:"version"`
	HAControlPlanes bool          `json:"ha_controlplanes,omitempty"`
	EnableFirewall  bool          `json:"enable_firewall,omitempty"`
	NodePools       []NodePoolReq `json:"node_pools"`
}

ClusterReq struct used to create a cluster

type ClusterReqUpdate

type ClusterReqUpdate struct {
	Label string `json:"label"`
}

ClusterReqUpdate struct used to update update a cluster

type ClusterUpgradeReq

type ClusterUpgradeReq struct {
	UpgradeVersion string `json:"upgrade_version,omitempty"`
}

ClusterUpgradeReq struct for vke upgradse

type ContainerRegistry added in v3.4.0

type ContainerRegistry struct {
	ID          string                    `json:"id"`
	Name        string                    `json:"name"`
	URN         string                    `json:"urn"`
	Storage     ContainerRegistryStorage  `json:"storage"`
	DateCreated string                    `json:"date_created"`
	Public      bool                      `json:"public"`
	RootUser    ContainerRegistryUser     `json:"root_user"`
	Metadata    ContainerRegistryMetadata `json:"metadata"`
}

ContainerRegistry represents a Vultr container registry subscription.

type ContainerRegistryDockerCredentials added in v3.4.0

type ContainerRegistryDockerCredentials []byte

ContainerRegistryDockerCredentials represents the byte array of character data returned after creating a Docker credential

func (*ContainerRegistryDockerCredentials) String added in v3.4.0

String converts the ContainerRegistryDockerCredentials to a string

func (*ContainerRegistryDockerCredentials) UnmarshalJSON added in v3.4.0

func (c *ContainerRegistryDockerCredentials) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom unmarshal function for ContainerRegistryDockerCredentials

type ContainerRegistryMetadata added in v3.4.0

type ContainerRegistryMetadata struct {
	Region       ContainerRegistryRegion       `json:"region"`
	Subscription ContainerRegistrySubscription `json:"subscription"`
}

ContainerRegistryMetadata contains the meta data for the registry

type ContainerRegistryPlan added in v3.4.0

type ContainerRegistryPlan struct {
	VanityName   string `json:"vanity_name"`
	MaxStorageMB int    `json:"max_storage_mb"`
	MonthlyPrice int    `json:"monthly_price"`
}

ContainerRegistryPlan represent the plan data

type ContainerRegistryPlanTypes added in v3.4.0

type ContainerRegistryPlanTypes struct {
	StartUp    ContainerRegistryPlan `json:"start_up"`
	Business   ContainerRegistryPlan `json:"business"`
	Premium    ContainerRegistryPlan `json:"premium"`
	Enterprise ContainerRegistryPlan `json:"enterprise"`
}

ContainerRegistryPlanTypes represent the different plan types

type ContainerRegistryPlans added in v3.4.0

type ContainerRegistryPlans struct {
	Plans ContainerRegistryPlanTypes `json:"plans"`
}

ContainerRegistryPlans contains all plan types

type ContainerRegistryRegion added in v3.4.0

type ContainerRegistryRegion struct {
	ID           int                               `json:"id"`
	Name         string                            `json:"name"`
	URN          string                            `json:"urn"`
	BaseURL      string                            `json:"base_url"`
	Public       bool                              `json:"public"`
	DateCreated  string                            `json:"added_at"`
	DateModified string                            `json:"updated_at"`
	DataCenter   ContainerRegistryRegionDataCenter `json:"data_center"`
}

ContainerRegistryRegion represents the region data

type ContainerRegistryRegionDataCenter added in v3.4.0

type ContainerRegistryRegionDataCenter struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	SiteCode    string `json:"site_code"`
	Region      string `json:"region"`
	Country     string `json:"country"`
	Continent   string `json:"continent"`
	Description string `json:"description"`
	Airport     string `json:"airport"`
}

ContainerRegistryRegionDataCenter is the datacenter info for a given region

type ContainerRegistryRepo added in v3.4.0

type ContainerRegistryRepo struct {
	Name          string `json:"name"`
	Image         string `json:"image"`
	Description   string `json:"description"`
	DateCreated   string `json:"added_at"`
	DateModified  string `json:"updated_at"`
	PullCount     int    `json:"pull_count"`
	ArtifactCount int    `json:"artifact_count"`
}

ContainerRegistryRepo represents the data of a registry repository

type ContainerRegistryRepoUpdateReq added in v3.4.0

type ContainerRegistryRepoUpdateReq struct {
	Description string `json:"description"`
}

ContainerRegistryRepoUpdateReq is the data to update a registry repository

type ContainerRegistryReq added in v3.4.0

type ContainerRegistryReq struct {
	Name   string `json:"name"`
	Public bool   `json:"public"`
	Region string `json:"region"`
	Plan   string `json:"plan"`
}

ContainerRegistryReq represents the data used to create a registry

type ContainerRegistryService added in v3.4.0

type ContainerRegistryService interface {
	Create(ctx context.Context, createReq *ContainerRegistryReq) (*ContainerRegistry, *http.Response, error)
	Get(ctx context.Context, vcrID string) (*ContainerRegistry, *http.Response, error)
	Update(ctx context.Context, vcrID string, updateReq *ContainerRegistryUpdateReq) (*ContainerRegistry, *http.Response, error)
	Delete(ctx context.Context, vcrID string) error
	List(ctx context.Context, options *ListOptions) ([]ContainerRegistry, *Meta, *http.Response, error)
	ListRepositories(ctx context.Context, vcrID string, options *ListOptions) ([]ContainerRegistryRepo, *Meta, *http.Response, error)
	GetRepository(ctx context.Context, vcrID, imageName string) (*ContainerRegistryRepo, *http.Response, error)
	UpdateRepository(ctx context.Context, vcrID, imageName string, updateReq *ContainerRegistryRepoUpdateReq) (*ContainerRegistryRepo, *http.Response, error) //nolint:lll
	DeleteRepository(ctx context.Context, vcrID, imageName string) error
	CreateDockerCredentials(ctx context.Context, vcrID string, createOptions *DockerCredentialsOpt) (*ContainerRegistryDockerCredentials, *http.Response, error) //nolint:lll
	ListRegions(ctx context.Context) ([]ContainerRegistryRegion, *Meta, *http.Response, error)
	ListPlans(ctx context.Context) (*ContainerRegistryPlans, *http.Response, error)
}

ContainerRegistryService is the interface to interact with the container registry endpoints on the Vultr API. Link : https://www.vultr.com/api/#tag/Container-Registry

type ContainerRegistryServiceHandler added in v3.4.0

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

ContainerRegistryServiceHandler handles interaction between the container registry service and the Vultr API.

func (*ContainerRegistryServiceHandler) Create added in v3.4.0

Create creates a container registry

func (*ContainerRegistryServiceHandler) CreateDockerCredentials added in v3.4.0

CreateDockerCredentials will create new Docker credentials used by the Docker CLI

func (*ContainerRegistryServiceHandler) Delete added in v3.4.0

Delete will delete a container registry

func (*ContainerRegistryServiceHandler) DeleteRepository added in v3.4.0

func (h *ContainerRegistryServiceHandler) DeleteRepository(ctx context.Context, vcrID, imageName string) error

DeleteRepository remove a repository from the container registry

func (*ContainerRegistryServiceHandler) Get added in v3.4.0

Get retrieves a contrainer registry by ID

func (*ContainerRegistryServiceHandler) GetRepository added in v3.4.0

func (h *ContainerRegistryServiceHandler) GetRepository(ctx context.Context, vcrID, imageName string) (*ContainerRegistryRepo, *http.Response, error)

GetRepository will return an existing repository of the requested registry ID and image name

func (*ContainerRegistryServiceHandler) List added in v3.4.0

List retrieves the list of all container registries

func (*ContainerRegistryServiceHandler) ListPlans added in v3.4.0

ListPlans returns a list of plans relevant to the container registry offerings

func (*ContainerRegistryServiceHandler) ListRegions added in v3.4.0

ListRegions will return a list of regions relevant to the container registry API operations

func (*ContainerRegistryServiceHandler) ListRepositories added in v3.4.0

ListRepositories will get a list of the repositories for a existing container registry

func (*ContainerRegistryServiceHandler) Update added in v3.4.0

Update will update an existing container registry

func (*ContainerRegistryServiceHandler) UpdateRepository added in v3.4.0

UpdateRepository allows updating the repository with the specified registry ID and image name

type ContainerRegistryStorage added in v3.4.0

type ContainerRegistryStorage struct {
	Used    ContainerRegistryStorageCount `json:"used"`
	Allowed ContainerRegistryStorageCount `json:"allowed"`
}

ContainerRegistryStorage represents the storage usage and limit

type ContainerRegistryStorageCount added in v3.4.0

type ContainerRegistryStorageCount struct {
	Bytes        float32 `json:"bytes"`
	MegaBytes    float32 `json:"mb"`
	GigaBytes    float32 `json:"gb"`
	TeraBytes    float32 `json:"tb"`
	DateModified string  `json:"updated_at"`
}

ContainerRegistryStorageCount represents the different storage usage counts

type ContainerRegistrySubscription added in v3.4.0

type ContainerRegistrySubscription struct {
	Billing ContainerRegistrySubscriptionBilling `json:"billing"`
}

ContainerRegistrySubscription contains the subscription information for the registry

type ContainerRegistrySubscriptionBilling added in v3.4.0

type ContainerRegistrySubscriptionBilling struct {
	MonthlyPrice   float32 `json:"monthly_price"`
	PendingCharges float32 `json:"pending_charges"`
}

ContainerRegistrySubscriptionBilling represents the subscription billing data on the registry

type ContainerRegistryUpdateReq added in v3.4.0

type ContainerRegistryUpdateReq struct {
	Public *bool   `json:"public,omitempty"`
	Plan   *string `json:"plan,omitempty"`
}

ContainerRegistryUpdateReq represents the data used to update a registry

type ContainerRegistryUser added in v3.4.0

type ContainerRegistryUser struct {
	ID           int    `json:"id"`
	UserName     string `json:"username"`
	Password     string `json:"password"`
	Root         bool   `json:"root"`
	DateCreated  string `json:"added_at"`
	DateModified string `json:"updated_at"`
}

ContainerRegistryUser contains the user data

type DBListOptions

type DBListOptions struct {
	Label  string `url:"label,omitempty"`
	Tag    string `url:"tag,omitempty"`
	Region string `url:"region,omitempty"`
}

DBListOptions handles GET request parameters for the List endpoint

type DBPlanListOptions

type DBPlanListOptions struct {
	Engine string `url:"engine,omitempty"`
	Nodes  int    `url:"nodes,omitempty"`
	Region string `url:"region,omitempty"`
}

DBPlanListOptions handles GET request parameters for the ListPlans endpoint

type Database

type Database struct {
	ID                     string               `json:"id"`
	DateCreated            string               `json:"date_created"`
	Plan                   string               `json:"plan"`
	PlanDisk               int                  `json:"plan_disk"`
	PlanRAM                int                  `json:"plan_ram"`
	PlanVCPUs              int                  `json:"plan_vcpus"`
	PlanReplicas           int                  `json:"plan_replicas"`
	Region                 string               `json:"region"`
	DatabaseEngine         string               `json:"database_engine"`
	DatabaseEngineVersion  string               `json:"database_engine_version"`
	VPCID                  string               `json:"vpc_id"`
	Status                 string               `json:"status"`
	Label                  string               `json:"label"`
	Tag                    string               `json:"tag"`
	DBName                 string               `json:"dbname,omitempty"`
	FerretDBCredentials    *FerretDBCredentials `json:"ferretdb_credentials,omitempty"`
	Host                   string               `json:"host"`
	PublicHost             string               `json:"public_host,omitempty"`
	User                   string               `json:"user"`
	Password               string               `json:"password"`
	Port                   string               `json:"port"`
	MaintenanceDOW         string               `json:"maintenance_dow"`
	MaintenanceTime        string               `json:"maintenance_time"`
	LatestBackup           string               `json:"latest_backup"`
	TrustedIPs             []string             `json:"trusted_ips"`
	MySQLSQLModes          []string             `json:"mysql_sql_modes,omitempty"`
	MySQLRequirePrimaryKey *bool                `json:"mysql_require_primary_key,omitempty"`
	MySQLSlowQueryLog      *bool                `json:"mysql_slow_query_log,omitempty"`
	MySQLLongQueryTime     int                  `json:"mysql_long_query_time,omitempty"`
	PGAvailableExtensions  []PGExtension        `json:"pg_available_extensions,omitempty"`
	RedisEvictionPolicy    string               `json:"redis_eviction_policy,omitempty"`
	ClusterTimeZone        string               `json:"cluster_time_zone,omitempty"`
	ReadReplicas           []Database           `json:"read_replicas,omitempty"`
}

Database represents a Managed Database subscription

type DatabaseAddReplicaReq

type DatabaseAddReplicaReq struct {
	Region string `json:"region,omitempty"`
	Label  string `json:"label,omitempty"`
}

DatabaseAddReplicaReq struct used to add a read-only replica to a Managed Database.

type DatabaseAdvancedOptions

type DatabaseAdvancedOptions struct {
	AutovacuumAnalyzeScaleFactor    float32 `json:"autovacuum_analyze_scale_factor,omitempty"`
	AutovacuumAnalyzeThreshold      int     `json:"autovacuum_analyze_threshold,omitempty"`
	AutovacuumFreezeMaxAge          int     `json:"autovacuum_freeze_max_age,omitempty"`
	AutovacuumMaxWorkers            int     `json:"autovacuum_max_workers,omitempty"`
	AutovacuumNaptime               int     `json:"autovacuum_naptime,omitempty"`
	AutovacuumVacuumCostDelay       int     `json:"autovacuum_vacuum_cost_delay,omitempty"`
	AutovacuumVacuumCostLimit       int     `json:"autovacuum_vacuum_cost_limit,omitempty"`
	AutovacuumVacuumScaleFactor     float32 `json:"autovacuum_vacuum_scale_factor,omitempty"`
	AutovacuumVacuumThreshold       int     `json:"autovacuum_vacuum_threshold,omitempty"`
	BGWRITERDelay                   int     `json:"bgwriter_delay,omitempty"`
	BGWRITERFlushAFter              int     `json:"bgwriter_flush_after,omitempty"`
	BGWRITERLRUMaxPages             int     `json:"bgwriter_lru_maxpages,omitempty"`
	BGWRITERLRUMultiplier           float32 `json:"bgwriter_lru_multiplier,omitempty"`
	DeadlockTimeout                 int     `json:"deadlock_timeout,omitempty"`
	DefaultToastCompression         string  `json:"default_toast_compression,omitempty"`
	IdleInTransactionSessionTimeout int     `json:"idle_in_transaction_session_timeout,omitempty"`
	Jit                             *bool   `json:"jit,omitempty"`
	LogAutovacuumMinDuration        int     `json:"log_autovacuum_min_duration,omitempty"`
	LogErrorVerbosity               string  `json:"log_error_verbosity,omitempty"`
	LogLinePrefix                   string  `json:"log_line_prefix,omitempty"`
	LogMinDurationStatement         int     `json:"log_min_duration_statement,omitempty"`
	MaxFilesPerProcess              int     `json:"max_files_per_process,omitempty"`
	MaxLocksPerTransaction          int     `json:"max_locks_per_transaction,omitempty"`
	MaxLogicalReplicationWorkers    int     `json:"max_logical_replication_workers,omitempty"`
	MaxParallelWorkers              int     `json:"max_parallel_workers,omitempty"`
	MaxParallelWorkersPerGather     int     `json:"max_parallel_workers_per_gather,omitempty"`
	MaxPredLocksPerTransaction      int     `json:"max_pred_locks_per_transaction,omitempty"`
	MaxPreparedTransactions         int     `json:"max_prepared_transactions,omitempty"`
	MaxReplicationSlots             int     `json:"max_replication_slots,omitempty"`
	MaxStackDepth                   int     `json:"max_stack_depth,omitempty"`
	MaxStandbyArchiveDelay          int     `json:"max_standby_archive_delay,omitempty"`
	MaxStandbyStreamingDelay        int     `json:"max_standby_streaming_delay,omitempty"`
	MaxWalSenders                   int     `json:"max_wal_senders,omitempty"`
	MaxWorkerProcesses              int     `json:"max_worker_processes,omitempty"`
	PGPartmanBGWInterval            int     `json:"pg_partman_bgw.interval,omitempty"`
	PGPartmanBGWRole                string  `json:"pg_partman_bgw.role,omitempty"`
	PGStateStatementsTrack          string  `json:"pg_stat_statements.track,omitempty"`
	TempFileLimit                   int     `json:"temp_file_limit,omitempty"`
	TrackActivityQuerySize          int     `json:"track_activity_query_size,omitempty"`
	TrackCommitTimestamp            string  `json:"track_commit_timestamp,omitempty"`
	TrackFunctions                  string  `json:"track_functions,omitempty"`
	TrackIOTiming                   string  `json:"track_io_timing,omitempty"`
	WALSenderTImeout                int     `json:"wal_sender_timeout,omitempty"`
	WALWriterDelay                  int     `json:"wal_writer_delay,omitempty"`
}

DatabaseAdvancedOptions represents user configurable advanced options within a PostgreSQL Managed Database cluster

type DatabaseAlert

type DatabaseAlert struct {
	Timestamp            string `json:"timestamp"`
	MessageType          string `json:"message_type"`
	Description          string `json:"description"`
	Recommendation       string `json:"recommendation,omitempty"`
	MaintenanceScheduled string `json:"maintenance_scheduled,omitempty"`
	ResourceType         string `json:"resource_type,omitempty"`
	TableCount           int    `json:"table_count,omitempty"`
}

DatabaseAlert represents a service alert for a Managed Database cluster

type DatabaseAvailableVersions

type DatabaseAvailableVersions struct {
	AvailableVersions []string `json:"available_versions"`
}

DatabaseAvailableVersions represents available versions upgrades for a Managed Database cluster

type DatabaseBackup

type DatabaseBackup struct {
	Date string `json:"date"`
	Time string `json:"time"`
}

DatabaseBackup represents individual backup details for a Managed Database cluster

type DatabaseBackupRestoreReq

type DatabaseBackupRestoreReq struct {
	Label string `json:"label,omitempty"`
	Type  string `json:"type,omitempty"`
	Date  string `json:"date,omitempty"`
	Time  string `json:"time,omitempty"`
}

DatabaseBackupRestoreReq struct used to restore the backup of a Managed Database to a new subscription.

type DatabaseBackups

type DatabaseBackups struct {
	LatestBackup DatabaseBackup `json:"latest_backup,omitempty"`
	OldestBackup DatabaseBackup `json:"oldest_backup,omitempty"`
}

DatabaseBackups represents backup information for a Managed Database cluster

type DatabaseCPUUsage added in v3.4.1

type DatabaseCPUUsage struct {
	Percentage float32 `json:"percentage"`
}

DatabaseCPUUsage represents average CPU usage for a Managed Database

type DatabaseConnectionPool

type DatabaseConnectionPool struct {
	Name     string `json:"name"`
	Database string `json:"database"`
	Username string `json:"username"`
	Mode     string `json:"mode"`
	Size     int    `json:"size"`
}

DatabaseConnectionPool represents a PostgreSQL connection pool within a Managed Database cluster

type DatabaseConnectionPoolCreateReq

type DatabaseConnectionPoolCreateReq struct {
	Name     string `json:"name,omitempty"`
	Database string `json:"database,omitempty"`
	Username string `json:"username,omitempty"`
	Mode     string `json:"mode,omitempty"`
	Size     int    `json:"size,omitempty"`
}

DatabaseConnectionPoolCreateReq struct used to create a connection pool within a PostgreSQL Managed Database.

type DatabaseConnectionPoolUpdateReq

type DatabaseConnectionPoolUpdateReq struct {
	Database string `json:"database,omitempty"`
	Username string `json:"username,omitempty"`
	Mode     string `json:"mode,omitempty"`
	Size     int    `json:"size,omitempty"`
}

DatabaseConnectionPoolUpdateReq struct used to update a connection pool within a PostgreSQL Managed Database.

type DatabaseConnections

type DatabaseConnections struct {
	Used      int `json:"used"`
	Available int `json:"available"`
	Max       int `json:"max"`
}

DatabaseConnections represents a an object containing used and available connections for a PostgreSQL Managed Database cluster

type DatabaseCreateReq

type DatabaseCreateReq struct {
	DatabaseEngine         string   `json:"database_engine,omitempty"`
	DatabaseEngineVersion  string   `json:"database_engine_version,omitempty"`
	Region                 string   `json:"region,omitempty"`
	Plan                   string   `json:"plan,omitempty"`
	Label                  string   `json:"label,omitempty"`
	Tag                    string   `json:"tag,omitempty"`
	VPCID                  string   `json:"vpc_id,omitempty"`
	MaintenanceDOW         string   `json:"maintenance_dow,omitempty"`
	MaintenanceTime        string   `json:"maintenance_time,omitempty"`
	TrustedIPs             []string `json:"trusted_ips,omitempty"`
	MySQLSQLModes          []string `json:"mysql_sql_modes,omitempty"`
	MySQLRequirePrimaryKey *bool    `json:"mysql_require_primary_key,omitempty"`
	MySQLSlowQueryLog      *bool    `json:"mysql_slow_query_log,omitempty"`
	MySQLLongQueryTime     int      `json:"mysql_long_query_time,omitempty"`
	RedisEvictionPolicy    string   `json:"redis_eviction_policy,omitempty"`
}

DatabaseCreateReq struct used to create a database.

type DatabaseCredentials

type DatabaseCredentials struct {
	Host             string `json:"host"`
	Port             int    `json:"port"`
	Username         string `json:"username"`
	Password         string `json:"password"`
	Database         string `json:"database,omitempty"`
	IgnoredDatabases string `json:"ignored_databases,omitempty"`
	SSL              *bool  `json:"ssl"`
}

DatabaseCredentials represents migration credentials for migration within a Managed Database cluster

type DatabaseDB

type DatabaseDB struct {
	Name string `json:"name"`
}

DatabaseDB represents a logical database within a Managed Database cluster

type DatabaseDBCreateReq

type DatabaseDBCreateReq struct {
	Name string `json:"name"`
}

DatabaseDBCreateReq struct used to create a logical database within a Managed Database.

type DatabaseDiskUsage added in v3.4.1

type DatabaseDiskUsage struct {
	CurrentGB  float32 `json:"current_gb"`
	MaxGB      int     `json:"max_gb"`
	Percentage float32 `json:"percentage"`
}

DatabaseDiskUsage represents disk usage details for a Managed Database

type DatabaseForkReq

type DatabaseForkReq struct {
	Label  string `json:"label,omitempty"`
	Region string `json:"region,omitempty"`
	Plan   string `json:"plan,omitempty"`
	Type   string `json:"type,omitempty"`
	Date   string `json:"date,omitempty"`
	Time   string `json:"time,omitempty"`
}

DatabaseForkReq struct used to fork a Managed Database to a new subscription from a backup.

type DatabaseListAlertsReq

type DatabaseListAlertsReq struct {
	Period string `json:"period"`
}

DatabaseListAlertsReq struct used to query service alerts for a Managed Database.

type DatabaseMemoryUsage added in v3.4.1

type DatabaseMemoryUsage struct {
	CurrentMB  float32 `json:"current_mb"`
	MaxMB      int     `json:"max_mb"`
	Percentage float32 `json:"percentage"`
}

DatabaseMemoryUsage represents memory usage details for a Managed Database

type DatabaseMigration

type DatabaseMigration struct {
	Status      string              `json:"status"`
	Method      string              `json:"method,omitempty"`
	Error       string              `json:"error,omitempty"`
	Credentials DatabaseCredentials `json:"credentials"`
}

DatabaseMigration represents migration details for a Managed Database cluster

type DatabaseMigrationStartReq

type DatabaseMigrationStartReq struct {
	Host             string `json:"host"`
	Port             int    `json:"port"`
	Username         string `json:"username"`
	Password         string `json:"password"`
	Database         string `json:"database,omitempty"`
	IgnoredDatabases string `json:"ignored_databases,omitempty"`
	SSL              *bool  `json:"ssl"`
}

DatabaseMigrationStartReq struct used to start a migration for a Managed Database.

type DatabasePlan

type DatabasePlan struct {
	ID               string           `json:"id"`
	NumberOfNodes    int              `json:"number_of_nodes"`
	Type             string           `json:"type"`
	VCPUCount        int              `json:"vcpu_count"`
	RAM              int              `json:"ram"`
	Disk             int              `json:"disk"`
	MonthlyCost      int              `json:"monthly_cost"`
	SupportedEngines SupportedEngines `json:"supported_engines"`
	MaxConnections   *MaxConnections  `json:"max_connections,omitempty"`
	Locations        []string         `json:"locations"`
}

DatabasePlan represents a Managed Database plan

type DatabaseService

type DatabaseService interface {
	ListPlans(ctx context.Context, options *DBPlanListOptions) ([]DatabasePlan, *Meta, *http.Response, error)

	List(ctx context.Context, options *DBListOptions) ([]Database, *Meta, *http.Response, error)
	Create(ctx context.Context, databaseReq *DatabaseCreateReq) (*Database, *http.Response, error)
	Get(ctx context.Context, databaseID string) (*Database, *http.Response, error)
	Update(ctx context.Context, databaseID string, databaseReq *DatabaseUpdateReq) (*Database, *http.Response, error)
	Delete(ctx context.Context, databaseID string) error

	GetUsage(ctx context.Context, databaseID string) (*DatabaseUsage, *http.Response, error)

	ListUsers(ctx context.Context, databaseID string) ([]DatabaseUser, *Meta, *http.Response, error)
	CreateUser(ctx context.Context, databaseID string, databaseUserReq *DatabaseUserCreateReq) (*DatabaseUser, *http.Response, error)
	GetUser(ctx context.Context, databaseID string, username string) (*DatabaseUser, *http.Response, error)
	UpdateUser(ctx context.Context, databaseID string, username string, databaseUserReq *DatabaseUserUpdateReq) (*DatabaseUser, *http.Response, error) //nolint:lll
	DeleteUser(ctx context.Context, databaseID string, username string) error
	UpdateUserACL(ctx context.Context, databaseID string, username string, databaseUserACLReq *DatabaseUserACLReq) (*DatabaseUser, *http.Response, error) //nolint:lll

	ListDBs(ctx context.Context, databaseID string) ([]DatabaseDB, *Meta, *http.Response, error)
	CreateDB(ctx context.Context, databaseID string, databaseDBReq *DatabaseDBCreateReq) (*DatabaseDB, *http.Response, error)
	GetDB(ctx context.Context, databaseID string, dbname string) (*DatabaseDB, *http.Response, error)
	DeleteDB(ctx context.Context, databaseID string, dbname string) error

	ListMaintenanceUpdates(ctx context.Context, databaseID string) ([]string, *http.Response, error)
	StartMaintenance(ctx context.Context, databaseID string) (string, *http.Response, error)

	ListServiceAlerts(ctx context.Context, databaseID string, databaseAlertsReq *DatabaseListAlertsReq) ([]DatabaseAlert, *http.Response, error) //nolint:lll

	GetMigrationStatus(ctx context.Context, databaseID string) (*DatabaseMigration, *http.Response, error)
	StartMigration(ctx context.Context, databaseID string, databaseMigrationReq *DatabaseMigrationStartReq) (*DatabaseMigration, *http.Response, error) //nolint:lll
	DetachMigration(ctx context.Context, databaseID string) error

	AddReadOnlyReplica(ctx context.Context, databaseID string, databaseReplicaReq *DatabaseAddReplicaReq) (*Database, *http.Response, error)
	PromoteReadReplica(ctx context.Context, databaseID string) error

	GetBackupInformation(ctx context.Context, databaseID string) (*DatabaseBackups, *http.Response, error)
	RestoreFromBackup(ctx context.Context, databaseID string, databaseRestoreReq *DatabaseBackupRestoreReq) (*Database, *http.Response, error)
	Fork(ctx context.Context, databaseID string, databaseForkReq *DatabaseForkReq) (*Database, *http.Response, error)

	ListConnectionPools(ctx context.Context, databaseID string) (*DatabaseConnections, []DatabaseConnectionPool, *Meta, *http.Response, error)
	CreateConnectionPool(ctx context.Context, databaseID string, databaseConnectionPoolReq *DatabaseConnectionPoolCreateReq) (*DatabaseConnectionPool, *http.Response, error) //nolint:lll
	GetConnectionPool(ctx context.Context, databaseID string, poolName string) (*DatabaseConnectionPool, *http.Response, error)
	UpdateConnectionPool(ctx context.Context, databaseID string, poolName string, databaseConnectionPoolReq *DatabaseConnectionPoolUpdateReq) (*DatabaseConnectionPool, *http.Response, error) //nolint:lll
	DeleteConnectionPool(ctx context.Context, databaseID string, poolName string) error

	ListAdvancedOptions(ctx context.Context, databaseID string) (*DatabaseAdvancedOptions, []AvailableOption, *http.Response, error)
	UpdateAdvancedOptions(ctx context.Context, databaseID string, databaseAdvancedOptionsReq *DatabaseAdvancedOptions) (*DatabaseAdvancedOptions, []AvailableOption, *http.Response, error) //nolint:lll

	ListAvailableVersions(ctx context.Context, databaseID string) ([]string, *http.Response, error)
	StartVersionUpgrade(ctx context.Context, databaseID string, databaseVersionUpgradeReq *DatabaseVersionUpgradeReq) (string, *http.Response, error) //nolint:lll
}

DatabaseService is the interface to interact with the Database endpoints on the Vultr API Link: https://www.vultr.com/api/#tag/managed-databases

type DatabaseServiceHandler

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

DatabaseServiceHandler handles interaction with the server methods for the Vultr API

func (*DatabaseServiceHandler) AddReadOnlyReplica

func (d *DatabaseServiceHandler) AddReadOnlyReplica(ctx context.Context, databaseID string, databaseReplicaReq *DatabaseAddReplicaReq) (*Database, *http.Response, error)

AddReadOnlyReplica will add a read-only replica node to the Managed Database with the given parameters

func (*DatabaseServiceHandler) Create

Create will create the Managed Database with the given parameters

func (*DatabaseServiceHandler) CreateConnectionPool

func (d *DatabaseServiceHandler) CreateConnectionPool(ctx context.Context, databaseID string, databaseConnectionPoolReq *DatabaseConnectionPoolCreateReq) (*DatabaseConnectionPool, *http.Response, error)

CreateConnectionPool will create a connection pool within the PostgreSQL Managed Database with the given parameters

func (*DatabaseServiceHandler) CreateDB

func (d *DatabaseServiceHandler) CreateDB(ctx context.Context, databaseID string, databaseDBReq *DatabaseDBCreateReq) (*DatabaseDB, *http.Response, error)

CreateDB will create a logical database within the Managed Database with the given parameters

func (*DatabaseServiceHandler) CreateUser

func (d *DatabaseServiceHandler) CreateUser(ctx context.Context, databaseID string, databaseUserReq *DatabaseUserCreateReq) (*DatabaseUser, *http.Response, error)

CreateUser will create a user within the Managed Database with the given parameters

func (*DatabaseServiceHandler) Delete

func (d *DatabaseServiceHandler) Delete(ctx context.Context, databaseID string) error

Delete a Managed database. All data will be permanently lost.

func (*DatabaseServiceHandler) DeleteConnectionPool

func (d *DatabaseServiceHandler) DeleteConnectionPool(ctx context.Context, databaseID, poolName string) error

DeleteConnectionPool will delete a user within the Managed database. All data will be permanently lost.

func (*DatabaseServiceHandler) DeleteDB

func (d *DatabaseServiceHandler) DeleteDB(ctx context.Context, databaseID, dbname string) error

DeleteDB will delete a user within the Managed database

func (*DatabaseServiceHandler) DeleteUser

func (d *DatabaseServiceHandler) DeleteUser(ctx context.Context, databaseID, username string) error

DeleteUser will delete a user within the Managed database. All data will be permanently lost.

func (*DatabaseServiceHandler) DetachMigration

func (d *DatabaseServiceHandler) DetachMigration(ctx context.Context, databaseID string) error

DetachMigration will detach a migration from the Managed database.

func (*DatabaseServiceHandler) Fork

func (d *DatabaseServiceHandler) Fork(ctx context.Context, databaseID string, databaseForkReq *DatabaseForkReq) (*Database, *http.Response, error)

Fork will create a new subscription of any plan from a backup of the Managed Database using the given parameters

func (*DatabaseServiceHandler) Get

func (d *DatabaseServiceHandler) Get(ctx context.Context, databaseID string) (*Database, *http.Response, error)

Get will get the Managed Database with the given databaseID

func (*DatabaseServiceHandler) GetBackupInformation

func (d *DatabaseServiceHandler) GetBackupInformation(ctx context.Context, databaseID string) (*DatabaseBackups, *http.Response, error)

GetBackupInformation retrieves backup information for your Managed Database.

func (*DatabaseServiceHandler) GetConnectionPool

func (d *DatabaseServiceHandler) GetConnectionPool(ctx context.Context, databaseID, poolName string) (*DatabaseConnectionPool, *http.Response, error)

GetConnectionPool retrieves information on an individual connection pool within a PostgreSQL Managed Database based on a poolName and databaseID

func (*DatabaseServiceHandler) GetDB

func (d *DatabaseServiceHandler) GetDB(ctx context.Context, databaseID, dbname string) (*DatabaseDB, *http.Response, error)

GetDB retrieves information on an individual logical database within a Managed Database based on a dbname and databaseID

func (*DatabaseServiceHandler) GetMigrationStatus

func (d *DatabaseServiceHandler) GetMigrationStatus(ctx context.Context, databaseID string) (*DatabaseMigration, *http.Response, error)

GetMigrationStatus retrieves the migration status for your Managed Database.

func (*DatabaseServiceHandler) GetUsage added in v3.4.1

func (d *DatabaseServiceHandler) GetUsage(ctx context.Context, databaseID string) (*DatabaseUsage, *http.Response, error)

GetUsage retrieves disk, memory, and CPU usage information for your Managed Database.

func (*DatabaseServiceHandler) GetUser

func (d *DatabaseServiceHandler) GetUser(ctx context.Context, databaseID, username string) (*DatabaseUser, *http.Response, error)

GetUser retrieves information on an individual user within a Managed Database based on a username and databaseID

func (*DatabaseServiceHandler) List

List retrieves all databases on your account

func (*DatabaseServiceHandler) ListAdvancedOptions

func (d *DatabaseServiceHandler) ListAdvancedOptions(ctx context.Context, databaseID string) (*DatabaseAdvancedOptions, []AvailableOption, *http.Response, error)

ListAdvancedOptions retrieves all connection pools within your PostgreSQL Managed Database.

func (*DatabaseServiceHandler) ListAvailableVersions

func (d *DatabaseServiceHandler) ListAvailableVersions(ctx context.Context, databaseID string) ([]string, *http.Response, error)

ListAvailableVersions retrieves all available version upgrades for your Managed Database.

func (*DatabaseServiceHandler) ListConnectionPools

ListConnectionPools retrieves all connection pools within your PostgreSQL Managed Database.

func (*DatabaseServiceHandler) ListDBs

func (d *DatabaseServiceHandler) ListDBs(ctx context.Context, databaseID string) ([]DatabaseDB, *Meta, *http.Response, error)

ListDBs retrieves all logical databases on your Managed Database.

func (*DatabaseServiceHandler) ListMaintenanceUpdates

func (d *DatabaseServiceHandler) ListMaintenanceUpdates(ctx context.Context, databaseID string) ([]string, *http.Response, error)

ListMaintenanceUpdates retrieves all available maintenance updates for your Managed Database.

func (*DatabaseServiceHandler) ListPlans

ListPlans retrieves all database plans

func (*DatabaseServiceHandler) ListServiceAlerts

func (d *DatabaseServiceHandler) ListServiceAlerts(ctx context.Context, databaseID string, databaseAlertsReq *DatabaseListAlertsReq) ([]DatabaseAlert, *http.Response, error)

ListServiceAlerts queries for service alerts for the Managed Database using the given parameters

func (*DatabaseServiceHandler) ListUsers

func (d *DatabaseServiceHandler) ListUsers(ctx context.Context, databaseID string) ([]DatabaseUser, *Meta, *http.Response, error)

ListUsers retrieves all database users on your Managed Database.

func (*DatabaseServiceHandler) PromoteReadReplica added in v3.4.0

func (d *DatabaseServiceHandler) PromoteReadReplica(ctx context.Context, databaseID string) error

PromoteReadReplica will promote a read-only replica to its own standalone Managed Database subscription.

func (*DatabaseServiceHandler) RestoreFromBackup

func (d *DatabaseServiceHandler) RestoreFromBackup(ctx context.Context, databaseID string, databaseRestoreReq *DatabaseBackupRestoreReq) (*Database, *http.Response, error)

RestoreFromBackup will create a new subscription of the same plan from a backup of the Managed Database using the given parameters

func (*DatabaseServiceHandler) StartMaintenance

func (d *DatabaseServiceHandler) StartMaintenance(ctx context.Context, databaseID string) (string, *http.Response, error)

StartMaintenance will start the maintenance update process for your Managed Database

func (*DatabaseServiceHandler) StartMigration

func (d *DatabaseServiceHandler) StartMigration(ctx context.Context, databaseID string, databaseMigrationReq *DatabaseMigrationStartReq) (*DatabaseMigration, *http.Response, error)

StartMigration will start a migration for the Managed Database using the given credentials.

func (*DatabaseServiceHandler) StartVersionUpgrade

func (d *DatabaseServiceHandler) StartVersionUpgrade(ctx context.Context, databaseID string, databaseVersionUpgradeReq *DatabaseVersionUpgradeReq) (string, *http.Response, error)

StartVersionUpgrade will start a migration for the Managed Database using the given credentials.

func (*DatabaseServiceHandler) Update

func (d *DatabaseServiceHandler) Update(ctx context.Context, databaseID string, databaseReq *DatabaseUpdateReq) (*Database, *http.Response, error)

Update will update the Managed Database with the given parameters

func (*DatabaseServiceHandler) UpdateAdvancedOptions

func (d *DatabaseServiceHandler) UpdateAdvancedOptions(ctx context.Context, databaseID string, databaseAdvancedOptionsReq *DatabaseAdvancedOptions) (*DatabaseAdvancedOptions, []AvailableOption, *http.Response, error)

UpdateAdvancedOptions will update a connection pool within the PostgreSQL Managed Database with the given parameters

func (*DatabaseServiceHandler) UpdateConnectionPool

func (d *DatabaseServiceHandler) UpdateConnectionPool(ctx context.Context, databaseID, poolName string, databaseConnectionPoolReq *DatabaseConnectionPoolUpdateReq) (*DatabaseConnectionPool, *http.Response, error)

UpdateConnectionPool will update a connection pool within the PostgreSQL Managed Database with the given parameters

func (*DatabaseServiceHandler) UpdateUser

func (d *DatabaseServiceHandler) UpdateUser(ctx context.Context, databaseID, username string, databaseUserReq *DatabaseUserUpdateReq) (*DatabaseUser, *http.Response, error)

UpdateUser will update a user within the Managed Database with the given parameters

func (*DatabaseServiceHandler) UpdateUserACL added in v3.5.0

func (d *DatabaseServiceHandler) UpdateUserACL(ctx context.Context, databaseID, username string, databaseUserACLReq *DatabaseUserACLReq) (*DatabaseUser, *http.Response, error)

UpdateUserACL will update a user's access control within the Redis Managed Database

type DatabaseUpdateReq

type DatabaseUpdateReq struct {
	Region                 string   `json:"region,omitempty"`
	Plan                   string   `json:"plan,omitempty"`
	Label                  string   `json:"label,omitempty"`
	Tag                    string   `json:"tag,omitempty"`
	VPCID                  *string  `json:"vpc_id,omitempty"`
	MaintenanceDOW         string   `json:"maintenance_dow,omitempty"`
	MaintenanceTime        string   `json:"maintenance_time,omitempty"`
	ClusterTimeZone        string   `json:"cluster_time_zone,omitempty"`
	TrustedIPs             []string `json:"trusted_ips,omitempty"`
	MySQLSQLModes          []string `json:"mysql_sql_modes,omitempty"`
	MySQLRequirePrimaryKey *bool    `json:"mysql_require_primary_key,omitempty"`
	MySQLSlowQueryLog      *bool    `json:"mysql_slow_query_log,omitempty"`
	MySQLLongQueryTime     int      `json:"mysql_long_query_time,omitempty"`
	RedisEvictionPolicy    string   `json:"redis_eviction_policy,omitempty"`
}

DatabaseUpdateReq struct used to update a dataase.

type DatabaseUsage added in v3.4.1

type DatabaseUsage struct {
	Disk   DatabaseDiskUsage   `json:"disk"`
	Memory DatabaseMemoryUsage `json:"memory"`
	CPU    DatabaseCPUUsage    `json:"cpu"`
}

DatabaseUsage represents disk, memory, and CPU usage for a Managed Database

type DatabaseUser

type DatabaseUser struct {
	Username      string           `json:"username"`
	Password      string           `json:"password"`
	Encryption    string           `json:"encryption,omitempty"`
	AccessControl *DatabaseUserACL `json:"access_control,omitempty"`
}

DatabaseUser represents a user within a Managed Database cluster

type DatabaseUserACL added in v3.5.0

type DatabaseUserACL struct {
	RedisACLCategories []string `json:"redis_acl_categories"`
	RedisACLChannels   []string `json:"redis_acl_channels"`
	RedisACLCommands   []string `json:"redis_acl_commands"`
	RedisACLKeys       []string `json:"redis_acl_keys"`
}

DatabaseUserACL represents an access control configuration for a user within a Redis Managed Database cluster

type DatabaseUserACLReq added in v3.5.0

type DatabaseUserACLReq struct {
	RedisACLCategories *[]string `json:"redis_acl_categories,omitempty"`
	RedisACLChannels   *[]string `json:"redis_acl_channels,omitempty"`
	RedisACLCommands   *[]string `json:"redis_acl_commands,omitempty"`
	RedisACLKeys       *[]string `json:"redis_acl_keys,omitempty"`
}

DatabaseUserACLReq represents input for updating a user's access control within a Redis Managed Database cluster

type DatabaseUserCreateReq

type DatabaseUserCreateReq struct {
	Username   string `json:"username"`
	Password   string `json:"password,omitempty"`
	Encryption string `json:"encryption,omitempty"`
}

DatabaseUserCreateReq struct used to create a user within a Managed Database.

type DatabaseUserUpdateReq

type DatabaseUserUpdateReq struct {
	Password string `json:"password"`
}

DatabaseUserUpdateReq struct used to update a user within a Managed Database.

type DatabaseVersionUpgradeReq

type DatabaseVersionUpgradeReq struct {
	Version string `json:"version,omitempty"`
}

DatabaseVersionUpgradeReq struct used to initiate a version upgrade for a PostgreSQL Managed Database.

type DockerCredentialsOpt added in v3.4.0

type DockerCredentialsOpt struct {
	ExpirySeconds *int
	WriteAccess   *bool
}

DockerCredentialsOpt contains the options used to create Docker credentials

type Domain

type Domain struct {
	Domain      string `json:"domain,omitempty"`
	DateCreated string `json:"date_created,omitempty"`
	DNSSec      string `json:"dns_sec,omitempty"`
}

Domain represents a Domain entry on Vultr

type DomainRecord

type DomainRecord struct {
	ID       string `json:"id,omitempty"`
	Type     string `json:"type,omitempty"`
	Name     string `json:"name,omitempty"`
	Data     string `json:"data,omitempty"`
	Priority int    `json:"priority,omitempty"`
	TTL      int    `json:"ttl,omitempty"`
}

DomainRecord represents a DNS record on Vultr

type DomainRecordReq

type DomainRecordReq struct {
	Name     string `json:"name"`
	Type     string `json:"type,omitempty"`
	Data     string `json:"data,omitempty"`
	TTL      int    `json:"ttl,omitempty"`
	Priority *int   `json:"priority,omitempty"`
}

DomainRecordReq struct to use for create/update domain record calls.

type DomainRecordService

type DomainRecordService interface {
	Create(ctx context.Context, domain string, domainRecordReq *DomainRecordReq) (*DomainRecord, *http.Response, error)
	Get(ctx context.Context, domain, recordID string) (*DomainRecord, *http.Response, error)
	Update(ctx context.Context, domain, recordID string, domainRecordReq *DomainRecordReq) error
	Delete(ctx context.Context, domain, recordID string) error
	List(ctx context.Context, domain string, options *ListOptions) ([]DomainRecord, *Meta, *http.Response, error)
}

DomainRecordService is the interface to interact with the DNS Records endpoints on the Vultr API Link: https://www.vultr.com/api/#tag/dns

type DomainRecordsServiceHandler

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

DomainRecordsServiceHandler handles interaction with the DNS Records methods for the Vultr API

func (*DomainRecordsServiceHandler) Create

func (d *DomainRecordsServiceHandler) Create(ctx context.Context, domain string, domainRecordReq *DomainRecordReq) (*DomainRecord, *http.Response, error)

Create will add a DNS record.

func (*DomainRecordsServiceHandler) Delete

func (d *DomainRecordsServiceHandler) Delete(ctx context.Context, domain, recordID string) error

Delete will delete a domain name and all associated records.

func (*DomainRecordsServiceHandler) Get

func (d *DomainRecordsServiceHandler) Get(ctx context.Context, domain, recordID string) (*DomainRecord, *http.Response, error)

Get record from a domain

func (*DomainRecordsServiceHandler) List

List will list all the records associated with a particular domain on Vultr.

func (*DomainRecordsServiceHandler) Update

func (d *DomainRecordsServiceHandler) Update(ctx context.Context, domain, recordID string, domainRecordReq *DomainRecordReq) error

Update will update a Domain record

type DomainReq

type DomainReq struct {
	Domain string `json:"domain,omitempty"`
	IP     string `json:"ip,omitempty"`
	DNSSec string `json:"dns_sec,omitempty"`
}

DomainReq is the struct to create a domain If IP is omitted then an empty DNS entry will be created. If supplied the domain will be pre populated with entries

type DomainService

type DomainService interface {
	Create(ctx context.Context, domainReq *DomainReq) (*Domain, *http.Response, error)
	Get(ctx context.Context, domain string) (*Domain, *http.Response, error)
	Update(ctx context.Context, domain, dnsSec string) error
	Delete(ctx context.Context, domain string) error
	List(ctx context.Context, options *ListOptions) ([]Domain, *Meta, *http.Response, error)

	GetSoa(ctx context.Context, domain string) (*Soa, *http.Response, error)
	UpdateSoa(ctx context.Context, domain string, soaReq *Soa) error

	GetDNSSec(ctx context.Context, domain string) ([]string, *http.Response, error)
}

DomainService is the interface to interact with the DNS endpoints on the Vultr API https://www.vultr.com/api/#tag/dns

type DomainServiceHandler

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

DomainServiceHandler handles interaction with the DNS methods for the Vultr API

func (*DomainServiceHandler) Create

func (d *DomainServiceHandler) Create(ctx context.Context, domainReq *DomainReq) (*Domain, *http.Response, error)

Create a domain entry

func (*DomainServiceHandler) Delete

func (d *DomainServiceHandler) Delete(ctx context.Context, domain string) error

Delete a domain with all associated records.

func (*DomainServiceHandler) Get

func (d *DomainServiceHandler) Get(ctx context.Context, domain string) (*Domain, *http.Response, error)

Get a domain from your Vultr account.

func (*DomainServiceHandler) GetDNSSec

func (d *DomainServiceHandler) GetDNSSec(ctx context.Context, domain string) ([]string, *http.Response, error)

GetDNSSec gets the DNSSec keys for a domain (if enabled)

func (*DomainServiceHandler) GetSoa

func (d *DomainServiceHandler) GetSoa(ctx context.Context, domain string) (*Soa, *http.Response, error)

GetSoa gets the SOA record information for a domain

func (*DomainServiceHandler) List

func (d *DomainServiceHandler) List(ctx context.Context, options *ListOptions) ([]Domain, *Meta, *http.Response, error)

List gets all domains associated with the current Vultr account.

func (*DomainServiceHandler) Update

func (d *DomainServiceHandler) Update(ctx context.Context, domain, dnsSec string) error

Update allows you to enable or disable DNS Sec on the domain. The two valid options for dnsSec are "enabled" or "disabled"

func (*DomainServiceHandler) UpdateSoa

func (d *DomainServiceHandler) UpdateSoa(ctx context.Context, domain string, soaReq *Soa) error

UpdateSoa will update the SOA record information for a domain.

type FerretDBCredentials added in v3.3.4

type FerretDBCredentials struct {
	Host      string `json:"host"`
	Port      int    `json:"port"`
	User      string `json:"user"`
	Password  string `json:"password"`
	PublicIP  string `json:"public_ip"`
	PrivateIP string `json:"private_ip,omitempty"`
}

FerretDBCredentials represents connection details and IP address information for FerretDB engine type subscriptions

type FireWallGroupServiceHandler

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

FireWallGroupServiceHandler handles interaction with the firewall group methods for the Vultr API

func (*FireWallGroupServiceHandler) Create

Create will create a new firewall group on your Vultr account

func (*FireWallGroupServiceHandler) Delete

func (f *FireWallGroupServiceHandler) Delete(ctx context.Context, fwGroupID string) error

Delete will delete a firewall group from your Vultr account

func (*FireWallGroupServiceHandler) Get

Get will return a firewall group based on provided groupID from your Vultr account

func (*FireWallGroupServiceHandler) List

List will return a list of all firewall groups on your Vultr account

func (*FireWallGroupServiceHandler) Update

func (f *FireWallGroupServiceHandler) Update(ctx context.Context, fwGroupID string, fwGroupReq *FirewallGroupReq) error

Update will change the description of a firewall group

type FireWallRuleService

type FireWallRuleService interface {
	Create(ctx context.Context, fwGroupID string, fwRuleReq *FirewallRuleReq) (*FirewallRule, *http.Response, error)
	Get(ctx context.Context, fwGroupID string, fwRuleID int) (*FirewallRule, *http.Response, error)
	Delete(ctx context.Context, fwGroupID string, fwRuleID int) error
	List(ctx context.Context, fwGroupID string, options *ListOptions) ([]FirewallRule, *Meta, *http.Response, error)
}

FireWallRuleService is the interface to interact with the firewall rule endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/firewall

type FireWallRuleServiceHandler

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

FireWallRuleServiceHandler handles interaction with the firewall rule methods for the Vultr API

func (*FireWallRuleServiceHandler) Create

func (f *FireWallRuleServiceHandler) Create(ctx context.Context, fwGroupID string, fwRuleReq *FirewallRuleReq) (*FirewallRule, *http.Response, error)

Create will create a rule in a firewall group.

func (*FireWallRuleServiceHandler) Delete

func (f *FireWallRuleServiceHandler) Delete(ctx context.Context, fwGroupID string, fwRuleID int) error

Delete will delete a firewall rule on your Vultr account

func (*FireWallRuleServiceHandler) Get

func (f *FireWallRuleServiceHandler) Get(ctx context.Context, fwGroupID string, fwRuleID int) (*FirewallRule, *http.Response, error)

Get will get a rule in a firewall group.

func (*FireWallRuleServiceHandler) List

func (f *FireWallRuleServiceHandler) List(ctx context.Context, fwGroupID string, options *ListOptions) ([]FirewallRule, *Meta, *http.Response, error)

List will return both ipv4 an ipv6 firewall rules that are defined within a firewall group

type FirewallGroup

type FirewallGroup struct {
	ID            string `json:"id"`
	Description   string `json:"description"`
	DateCreated   string `json:"date_created"`
	DateModified  string `json:"date_modified"`
	InstanceCount int    `json:"instance_count"`
	RuleCount     int    `json:"rule_count"`
	MaxRuleCount  int    `json:"max_rule_count"`
}

FirewallGroup represents a Vultr firewall group

type FirewallGroupReq

type FirewallGroupReq struct {
	Description string `json:"description"`
}

FirewallGroupReq struct is used to create and update a Firewall Group.

type FirewallGroupService

type FirewallGroupService interface {
	Create(ctx context.Context, fwGroupReq *FirewallGroupReq) (*FirewallGroup, *http.Response, error)
	Get(ctx context.Context, groupID string) (*FirewallGroup, *http.Response, error)
	Update(ctx context.Context, fwGroupID string, fwGroupReq *FirewallGroupReq) error
	Delete(ctx context.Context, fwGroupID string) error
	List(ctx context.Context, options *ListOptions) ([]FirewallGroup, *Meta, *http.Response, error)
}

FirewallGroupService is the interface to interact with the firewall group endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/firewall

type FirewallRule

type FirewallRule struct {
	ID     int    `json:"id"`
	Action string `json:"action"`
	// Deprecated:  Type should no longer be used. Instead, use IPType.
	Type       string `json:"type"`
	IPType     string `json:"ip_type"`
	Protocol   string `json:"protocol"`
	Port       string `json:"port"`
	Subnet     string `json:"subnet"`
	SubnetSize int    `json:"subnet_size"`
	Source     string `json:"source"`
	Notes      string `json:"notes"`
}

FirewallRule represents a Vultr firewall rule

type FirewallRuleReq

type FirewallRuleReq struct {
	IPType     string `json:"ip_type"`
	Protocol   string `json:"protocol"`
	Subnet     string `json:"subnet"`
	SubnetSize int    `json:"subnet_size"`
	Port       string `json:"port,omitempty"`
	Source     string `json:"source,omitempty"`
	Notes      string `json:"notes,omitempty"`
}

FirewallRuleReq struct used to create a FirewallRule.

type ForwardingRule

type ForwardingRule struct {
	RuleID           string `json:"id,omitempty"`
	FrontendProtocol string `json:"frontend_protocol,omitempty"`
	FrontendPort     int    `json:"frontend_port,omitempty"`
	BackendProtocol  string `json:"backend_protocol,omitempty"`
	BackendPort      int    `json:"backend_port,omitempty"`
}

ForwardingRule represent a single forwarding rule

type ForwardingRules

type ForwardingRules struct {
	ForwardRuleList []ForwardingRule `json:"forwarding_rules,omitempty"`
}

ForwardingRules represent a list of forwarding rules

type GenericInfo

type GenericInfo struct {
	BalancingAlgorithm string          `json:"balancing_algorithm,omitempty"`
	SSLRedirect        *bool           `json:"ssl_redirect,omitempty"`
	StickySessions     *StickySessions `json:"sticky_sessions,omitempty"`
	ProxyProtocol      *bool           `json:"proxy_protocol,omitempty"`
	// Deprecated:  PrivateNetwork should no longer be used. Instead, use VPC.
	PrivateNetwork string `json:"private_network,omitempty"`
	VPC            string `json:"vpc,omitempty"`
}

GenericInfo represents generic configuration of your load balancer

type HealthCheck

type HealthCheck struct {
	Protocol           string `json:"protocol,omitempty"`
	Port               int    `json:"port,omitempty"`
	Path               string `json:"path,omitempty"`
	CheckInterval      int    `json:"check_interval,omitempty"`
	ResponseTimeout    int    `json:"response_timeout,omitempty"`
	UnhealthyThreshold int    `json:"unhealthy_threshold,omitempty"`
	HealthyThreshold   int    `json:"healthy_threshold,omitempty"`
}

HealthCheck represents your health check configuration for your load balancer.

type History

type History struct {
	ID          int     `json:"id"`
	Date        string  `json:"date"`
	Type        string  `json:"type"`
	Description string  `json:"description"`
	Amount      float32 `json:"amount"`
	Balance     float32 `json:"balance"`
}

History represents a billing history item on an account

type IPv4

type IPv4 struct {
	IP      string `json:"ip,omitempty"`
	Netmask string `json:"netmask,omitempty"`
	Gateway string `json:"gateway,omitempty"`
	Type    string `json:"type,omitempty"`
	Reverse string `json:"reverse,omitempty"`
}

IPv4 struct

type IPv6

type IPv6 struct {
	IP          string `json:"ip,omitempty"`
	Network     string `json:"network,omitempty"`
	NetworkSize int    `json:"network_size,omitempty"`
	Type        string `json:"type,omitempty"`
}

IPv6 struct

type ISO

type ISO struct {
	ID          string `json:"id"`
	DateCreated string `json:"date_created"`
	FileName    string `json:"filename"`
	Size        int    `json:"size,omitempty"`
	MD5Sum      string `json:"md5sum,omitempty"`
	SHA512Sum   string `json:"sha512sum,omitempty"`
	Status      string `json:"status"`
}

ISO represents ISOs currently available on this account.

type ISOReq

type ISOReq struct {
	URL string `json:"url"`
}

ISOReq is used for creating ISOs.

type ISOService

type ISOService interface {
	Create(ctx context.Context, isoReq *ISOReq) (*ISO, *http.Response, error)
	Get(ctx context.Context, isoID string) (*ISO, *http.Response, error)
	Delete(ctx context.Context, isoID string) error
	List(ctx context.Context, options *ListOptions) ([]ISO, *Meta, *http.Response, error)
	ListPublic(ctx context.Context, options *ListOptions) ([]PublicISO, *Meta, *http.Response, error)
}

ISOService is the interface to interact with the ISO endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/iso

type ISOServiceHandler

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

ISOServiceHandler handles interaction with the ISO methods for the Vultr API

func (*ISOServiceHandler) Create

func (i *ISOServiceHandler) Create(ctx context.Context, isoReq *ISOReq) (*ISO, *http.Response, error)

Create will create a new ISO image on your account

func (*ISOServiceHandler) Delete

func (i *ISOServiceHandler) Delete(ctx context.Context, isoID string) error

Delete will delete an ISO image from your account

func (*ISOServiceHandler) Get

func (i *ISOServiceHandler) Get(ctx context.Context, isoID string) (*ISO, *http.Response, error)

Get an ISO

func (*ISOServiceHandler) List

func (i *ISOServiceHandler) List(ctx context.Context, options *ListOptions) ([]ISO, *Meta, *http.Response, error)

List will list all ISOs currently available on your account

func (*ISOServiceHandler) ListPublic

func (i *ISOServiceHandler) ListPublic(ctx context.Context, options *ListOptions) ([]PublicISO, *Meta, *http.Response, error)

ListPublic will list public ISOs offered in the Vultr ISO library.

type Instance

type Instance struct {
	ID               string `json:"id"`
	Os               string `json:"os"`
	RAM              int    `json:"ram"`
	Disk             int    `json:"disk"`
	Plan             string `json:"plan"`
	MainIP           string `json:"main_ip"`
	VCPUCount        int    `json:"vcpu_count"`
	Region           string `json:"region"`
	DefaultPassword  string `json:"default_password,omitempty"`
	DateCreated      string `json:"date_created"`
	Status           string `json:"status"`
	AllowedBandwidth int    `json:"allowed_bandwidth"`
	NetmaskV4        string `json:"netmask_v4"`
	GatewayV4        string `json:"gateway_v4"`
	PowerStatus      string `json:"power_status"`
	ServerStatus     string `json:"server_status"`
	V6Network        string `json:"v6_network"`
	V6MainIP         string `json:"v6_main_ip"`
	V6NetworkSize    int    `json:"v6_network_size"`
	Label            string `json:"label"`
	InternalIP       string `json:"internal_ip"`
	KVM              string `json:"kvm"`
	// Deprecated: Tag should no longer be used. Instead, use Tags.
	Tag             string   `json:"tag"`
	OsID            int      `json:"os_id"`
	AppID           int      `json:"app_id"`
	ImageID         string   `json:"image_id"`
	FirewallGroupID string   `json:"firewall_group_id"`
	Features        []string `json:"features"`
	Hostname        string   `json:"hostname"`
	Tags            []string `json:"tags"`
}

Instance represents a VPS

type InstanceCreateReq

type InstanceCreateReq struct {
	Region string `json:"region,omitempty"`
	Plan   string `json:"plan,omitempty"`
	Label  string `json:"label,omitempty"`
	// Deprecated: Tag should no longer be used. Instead, use Tags.
	Tag               string   `json:"tag,omitempty"`
	Tags              []string `json:"tags"`
	OsID              int      `json:"os_id,omitempty"`
	ISOID             string   `json:"iso_id,omitempty"`
	AppID             int      `json:"app_id,omitempty"`
	ImageID           string   `json:"image_id,omitempty"`
	FirewallGroupID   string   `json:"firewall_group_id,omitempty"`
	Hostname          string   `json:"hostname,omitempty"`
	IPXEChainURL      string   `json:"ipxe_chain_url,omitempty"`
	ScriptID          string   `json:"script_id,omitempty"`
	SnapshotID        string   `json:"snapshot_id,omitempty"`
	EnableIPv6        *bool    `json:"enable_ipv6,omitempty"`
	DisablePublicIPv4 *bool    `json:"disable_public_ipv4,omitempty"`
	// Deprecated:  EnablePrivateNetwork should no longer be used. Instead, use EnableVPC.
	EnablePrivateNetwork *bool `json:"enable_private_network,omitempty"`
	// Deprecated:  AttachPrivateNetwork should no longer be used. Instead, use AttachVPC.
	AttachPrivateNetwork []string          `json:"attach_private_network,omitempty"`
	EnableVPC            *bool             `json:"enable_vpc,omitempty"`
	AttachVPC            []string          `json:"attach_vpc,omitempty"`
	EnableVPC2           *bool             `json:"enable_vpc2,omitempty"`
	AttachVPC2           []string          `json:"attach_vpc2,omitempty"`
	SSHKeys              []string          `json:"sshkey_id,omitempty"`
	Backups              string            `json:"backups,omitempty"`
	DDOSProtection       *bool             `json:"ddos_protection,omitempty"`
	UserData             string            `json:"user_data,omitempty"`
	ReservedIPv4         string            `json:"reserved_ipv4,omitempty"`
	ActivationEmail      *bool             `json:"activation_email,omitempty"`
	AppVariables         map[string]string `json:"app_variables,omitempty"`
}

InstanceCreateReq struct used to create an instance.

type InstanceList

type InstanceList struct {
	InstanceList []string
}

InstanceList represents instances that are attached to your load balancer

type InstanceService

type InstanceService interface {
	Create(ctx context.Context, instanceReq *InstanceCreateReq) (*Instance, *http.Response, error)
	Get(ctx context.Context, instanceID string) (*Instance, *http.Response, error)
	Update(ctx context.Context, instanceID string, instanceReq *InstanceUpdateReq) (*Instance, *http.Response, error)
	Delete(ctx context.Context, instanceID string) error
	List(ctx context.Context, options *ListOptions) ([]Instance, *Meta, *http.Response, error)

	Start(ctx context.Context, instanceID string) error
	Halt(ctx context.Context, instanceID string) error
	Reboot(ctx context.Context, instanceID string) error
	Reinstall(ctx context.Context, instanceID string, reinstallReq *ReinstallReq) (*Instance, *http.Response, error)

	MassStart(ctx context.Context, instanceList []string) error
	MassHalt(ctx context.Context, instanceList []string) error
	MassReboot(ctx context.Context, instanceList []string) error

	Restore(ctx context.Context, instanceID string, restoreReq *RestoreReq) (*http.Response, error)

	GetBandwidth(ctx context.Context, instanceID string) (*Bandwidth, *http.Response, error)
	GetNeighbors(ctx context.Context, instanceID string) (*Neighbors, *http.Response, error)

	// Deprecated: ListPrivateNetworks should no longer be used. Instead, use ListVPCInfo.
	ListPrivateNetworks(ctx context.Context, instanceID string, options *ListOptions) ([]PrivateNetwork, *Meta, *http.Response, error)
	// Deprecated: AttachPrivateNetwork should no longer be used. Instead, use AttachVPC.
	AttachPrivateNetwork(ctx context.Context, instanceID, networkID string) error
	// Deprecated: DetachPrivateNetwork should no longer be used. Instead, use DetachVPC.
	DetachPrivateNetwork(ctx context.Context, instanceID, networkID string) error

	ListVPCInfo(ctx context.Context, instanceID string, options *ListOptions) ([]VPCInfo, *Meta, *http.Response, error)
	AttachVPC(ctx context.Context, instanceID, vpcID string) error
	DetachVPC(ctx context.Context, instanceID, vpcID string) error

	ListVPC2Info(ctx context.Context, instanceID string, options *ListOptions) ([]VPC2Info, *Meta, *http.Response, error)
	AttachVPC2(ctx context.Context, instanceID string, vpc2Req *AttachVPC2Req) error
	DetachVPC2(ctx context.Context, instanceID, vpcID string) error

	ISOStatus(ctx context.Context, instanceID string) (*Iso, *http.Response, error)
	AttachISO(ctx context.Context, instanceID, isoID string) (*http.Response, error)
	DetachISO(ctx context.Context, instanceID string) (*http.Response, error)

	GetBackupSchedule(ctx context.Context, instanceID string) (*BackupSchedule, *http.Response, error)
	SetBackupSchedule(ctx context.Context, instanceID string, backup *BackupScheduleReq) (*http.Response, error)

	CreateIPv4(ctx context.Context, instanceID string, reboot *bool) (*IPv4, *http.Response, error)
	ListIPv4(ctx context.Context, instanceID string, option *ListOptions) ([]IPv4, *Meta, *http.Response, error)
	DeleteIPv4(ctx context.Context, instanceID, ip string) error
	ListIPv6(ctx context.Context, instanceID string, option *ListOptions) ([]IPv6, *Meta, *http.Response, error)

	CreateReverseIPv6(ctx context.Context, instanceID string, reverseReq *ReverseIP) error
	ListReverseIPv6(ctx context.Context, instanceID string) ([]ReverseIP, *http.Response, error)
	DeleteReverseIPv6(ctx context.Context, instanceID, ip string) error

	CreateReverseIPv4(ctx context.Context, instanceID string, reverseReq *ReverseIP) error
	DefaultReverseIPv4(ctx context.Context, instanceID, ip string) error

	GetUserData(ctx context.Context, instanceID string) (*UserData, *http.Response, error)

	GetUpgrades(ctx context.Context, instanceID string) (*Upgrades, *http.Response, error)
}

InstanceService is the interface to interact with the instance endpoints on the Vultr API Link: https://www.vultr.com/api/#tag/instances

type InstanceServiceHandler

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

InstanceServiceHandler handles interaction with the server methods for the Vultr API

func (*InstanceServiceHandler) AttachISO

func (i *InstanceServiceHandler) AttachISO(ctx context.Context, instanceID, isoID string) (*http.Response, error)

AttachISO will attach an ISO to the given instance and reboot it

func (*InstanceServiceHandler) AttachPrivateNetwork

func (i *InstanceServiceHandler) AttachPrivateNetwork(ctx context.Context, instanceID, networkID string) error

AttachPrivateNetwork to an instance Deprecated: AttachPrivateNetwork should no longer be used. Instead, use AttachVPC

func (*InstanceServiceHandler) AttachVPC

func (i *InstanceServiceHandler) AttachVPC(ctx context.Context, instanceID, vpcID string) error

AttachVPC to an instance

func (*InstanceServiceHandler) AttachVPC2 added in v3.3.0

func (i *InstanceServiceHandler) AttachVPC2(ctx context.Context, instanceID string, vpc2Req *AttachVPC2Req) error

AttachVPC2 to an instance

func (*InstanceServiceHandler) Create

Create will create the server with the given parameters

func (*InstanceServiceHandler) CreateIPv4

func (i *InstanceServiceHandler) CreateIPv4(ctx context.Context, instanceID string, reboot *bool) (*IPv4, *http.Response, error)

CreateIPv4 an additional IPv4 address for given instance.

func (*InstanceServiceHandler) CreateReverseIPv4

func (i *InstanceServiceHandler) CreateReverseIPv4(ctx context.Context, instanceID string, reverseReq *ReverseIP) error

CreateReverseIPv4 for a given IP on a given instance.

func (*InstanceServiceHandler) CreateReverseIPv6

func (i *InstanceServiceHandler) CreateReverseIPv6(ctx context.Context, instanceID string, reverseReq *ReverseIP) error

CreateReverseIPv6 for a given instance.

func (*InstanceServiceHandler) DefaultReverseIPv4

func (i *InstanceServiceHandler) DefaultReverseIPv4(ctx context.Context, instanceID, ip string) error

DefaultReverseIPv4 will set the IPs reverse setting back to the original one supplied by Vultr.

func (*InstanceServiceHandler) Delete

func (i *InstanceServiceHandler) Delete(ctx context.Context, instanceID string) error

Delete an instance. All data will be permanently lost, and the IP address will be released

func (*InstanceServiceHandler) DeleteIPv4

func (i *InstanceServiceHandler) DeleteIPv4(ctx context.Context, instanceID, ip string) error

DeleteIPv4 address from a given instance.

func (*InstanceServiceHandler) DeleteReverseIPv6

func (i *InstanceServiceHandler) DeleteReverseIPv6(ctx context.Context, instanceID, ip string) error

DeleteReverseIPv6 a given reverse IPv6.

func (*InstanceServiceHandler) DetachISO

func (i *InstanceServiceHandler) DetachISO(ctx context.Context, instanceID string) (*http.Response, error)

DetachISO will detach the currently mounted ISO and reboot the instance.

func (*InstanceServiceHandler) DetachPrivateNetwork

func (i *InstanceServiceHandler) DetachPrivateNetwork(ctx context.Context, instanceID, networkID string) error

DetachPrivateNetwork from an instance. Deprecated: DetachPrivateNetwork should no longer be used. Instead, use DetachVPC

func (*InstanceServiceHandler) DetachVPC

func (i *InstanceServiceHandler) DetachVPC(ctx context.Context, instanceID, vpcID string) error

DetachVPC from an instance.

func (*InstanceServiceHandler) DetachVPC2 added in v3.3.0

func (i *InstanceServiceHandler) DetachVPC2(ctx context.Context, instanceID, vpcID string) error

DetachVPC2 from an instance.

func (*InstanceServiceHandler) Get

func (i *InstanceServiceHandler) Get(ctx context.Context, instanceID string) (*Instance, *http.Response, error)

Get will get the server with the given instanceID

func (*InstanceServiceHandler) GetBackupSchedule

func (i *InstanceServiceHandler) GetBackupSchedule(ctx context.Context, instanceID string) (*BackupSchedule, *http.Response, error)

GetBackupSchedule retrieves the backup schedule for a given instance - all time values are in UTC

func (*InstanceServiceHandler) GetBandwidth

func (i *InstanceServiceHandler) GetBandwidth(ctx context.Context, instanceID string) (*Bandwidth, *http.Response, error)

GetBandwidth for a given instance.

func (*InstanceServiceHandler) GetNeighbors

func (i *InstanceServiceHandler) GetNeighbors(ctx context.Context, instanceID string) (*Neighbors, *http.Response, error)

GetNeighbors gets a list of other instances in the same location as this Instance.

func (*InstanceServiceHandler) GetUpgrades

func (i *InstanceServiceHandler) GetUpgrades(ctx context.Context, instanceID string) (*Upgrades, *http.Response, error)

GetUpgrades that are available for a given instance.

func (*InstanceServiceHandler) GetUserData

func (i *InstanceServiceHandler) GetUserData(ctx context.Context, instanceID string) (*UserData, *http.Response, error)

GetUserData from given instance. The userdata returned will be in base64 encoding.

func (*InstanceServiceHandler) Halt

func (i *InstanceServiceHandler) Halt(ctx context.Context, instanceID string) error

Halt will pause an instance.

func (*InstanceServiceHandler) ISOStatus

func (i *InstanceServiceHandler) ISOStatus(ctx context.Context, instanceID string) (*Iso, *http.Response, error)

ISOStatus retrieves the current ISO state for a given VPS. The returned state may be one of: ready | isomounting | isomounted.

func (*InstanceServiceHandler) List

List all instances on your account.

func (*InstanceServiceHandler) ListIPv4

func (i *InstanceServiceHandler) ListIPv4(ctx context.Context, instanceID string, options *ListOptions) ([]IPv4, *Meta, *http.Response, error)

ListIPv4 addresses that are currently assigned to a given instance.

func (*InstanceServiceHandler) ListIPv6

func (i *InstanceServiceHandler) ListIPv6(ctx context.Context, instanceID string, options *ListOptions) ([]IPv6, *Meta, *http.Response, error)

ListIPv6 addresses that are currently assigned to a given instance.

func (*InstanceServiceHandler) ListPrivateNetworks

func (i *InstanceServiceHandler) ListPrivateNetworks(ctx context.Context, instanceID string, options *ListOptions) ([]PrivateNetwork, *Meta, *http.Response, error)

ListPrivateNetworks currently attached to an instance. Deprecated: ListPrivateNetworks should no longer be used. Instead, use ListVPCInfo

func (*InstanceServiceHandler) ListReverseIPv6

func (i *InstanceServiceHandler) ListReverseIPv6(ctx context.Context, instanceID string) ([]ReverseIP, *http.Response, error)

ListReverseIPv6 currently assigned to a given instance.

func (*InstanceServiceHandler) ListVPC2Info added in v3.3.0

func (i *InstanceServiceHandler) ListVPC2Info(ctx context.Context, instanceID string, options *ListOptions) ([]VPC2Info, *Meta, *http.Response, error)

ListVPC2Info currently attached to an instance.

func (*InstanceServiceHandler) ListVPCInfo

func (i *InstanceServiceHandler) ListVPCInfo(ctx context.Context, instanceID string, options *ListOptions) ([]VPCInfo, *Meta, *http.Response, error)

ListVPCInfo currently attached to an instance.

func (*InstanceServiceHandler) MassHalt

func (i *InstanceServiceHandler) MassHalt(ctx context.Context, instanceList []string) error

MassHalt will pause a list of instances.

func (*InstanceServiceHandler) MassReboot

func (i *InstanceServiceHandler) MassReboot(ctx context.Context, instanceList []string) error

MassReboot reboots a list of instances.

func (*InstanceServiceHandler) MassStart

func (i *InstanceServiceHandler) MassStart(ctx context.Context, instanceList []string) error

MassStart will start a list of instances the machine is already running, it will be restarted.

func (*InstanceServiceHandler) Reboot

func (i *InstanceServiceHandler) Reboot(ctx context.Context, instanceID string) error

Reboot an instance.

func (*InstanceServiceHandler) Reinstall

func (i *InstanceServiceHandler) Reinstall(ctx context.Context, instanceID string, reinstallReq *ReinstallReq) (*Instance, *http.Response, error)

Reinstall an instance.

func (*InstanceServiceHandler) Restore

func (i *InstanceServiceHandler) Restore(ctx context.Context, instanceID string, restoreReq *RestoreReq) (*http.Response, error)

Restore an instance.

func (*InstanceServiceHandler) SetBackupSchedule

func (i *InstanceServiceHandler) SetBackupSchedule(ctx context.Context, instanceID string, backup *BackupScheduleReq) (*http.Response, error)

SetBackupSchedule sets the backup schedule for a given instance - all time values are in UTC.

func (*InstanceServiceHandler) Start

func (i *InstanceServiceHandler) Start(ctx context.Context, instanceID string) error

Start will start a vps instance the machine is already running, it will be restarted.

func (*InstanceServiceHandler) Update

func (i *InstanceServiceHandler) Update(ctx context.Context, instanceID string, instanceReq *InstanceUpdateReq) (*Instance, *http.Response, error)

Update will update the server with the given parameters

type InstanceUpdateReq

type InstanceUpdateReq struct {
	Plan  string `json:"plan,omitempty"`
	Label string `json:"label,omitempty"`
	// Deprecated: Tag should no longer be used. Instead, use Tags.
	Tag        *string  `json:"tag,omitempty"`
	Tags       []string `json:"tags"`
	OsID       int      `json:"os_id,omitempty"`
	AppID      int      `json:"app_id,omitempty"`
	ImageID    string   `json:"image_id,omitempty"`
	EnableIPv6 *bool    `json:"enable_ipv6,omitempty"`
	// Deprecated:  EnablePrivateNetwork should no longer be used. Instead, use EnableVPC.
	EnablePrivateNetwork *bool `json:"enable_private_network,omitempty"`
	// Deprecated:  AttachPrivateNetwork should no longer be used. Instead, use AttachVPC.
	AttachPrivateNetwork []string `json:"attach_private_network,omitempty"`
	// Deprecated:  DetachPrivateNetwork should no longer be used. Instead, use DetachVPC.
	DetachPrivateNetwork []string `json:"detach_private_network,omitempty"`
	EnableVPC            *bool    `json:"enable_vpc,omitempty"`
	AttachVPC            []string `json:"attach_vpc,omitempty"`
	DetachVPC            []string `json:"detach_vpc,omitempty"`
	EnableVPC2           *bool    `json:"enable_vpc2,omitempty"`
	AttachVPC2           []string `json:"attach_vpc2,omitempty"`
	DetachVPC2           []string `json:"detach_vpc2,omitempty"`
	Backups              string   `json:"backups,omitempty"`
	DDOSProtection       *bool    `json:"ddos_protection"`
	UserData             string   `json:"user_data,omitempty"`
	FirewallGroupID      string   `json:"firewall_group_id,omitempty"`
}

InstanceUpdateReq struct used to update an instance.

type Invoice

type Invoice struct {
	ID          int     `json:"id"`
	Date        string  `json:"date"`
	Description string  `json:"description"`
	Amount      float32 `json:"amount"`
	Balance     float32 `json:"balance"`
}

Invoice represents an invoice on an account

type InvoiceItem

type InvoiceItem struct {
	Description string  `json:"description"`
	Product     string  `json:"product"`
	StartDate   string  `json:"start_date"`
	EndDate     string  `json:"end_date"`
	Units       int     `json:"units"`
	UnitType    string  `json:"unit_type"`
	UnitPrice   float32 `json:"unit_price"`
	Total       float32 `json:"total"`
}

InvoiceItem represents an item on an accounts invoice

type Iso

type Iso struct {
	State string `json:"state"`
	IsoID string `json:"iso_id"`
}

Iso information for a given instance.

type KubeConfig

type KubeConfig struct {
	KubeConfig string `json:"kube_config"`
}

KubeConfig will contain the kubeconfig b64 encoded

type KubernetesHandler

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

KubernetesHandler handles interaction with the kubernetes methods for the Vultr API

func (*KubernetesHandler) CreateCluster

func (k *KubernetesHandler) CreateCluster(ctx context.Context, createReq *ClusterReq) (*Cluster, *http.Response, error)

CreateCluster will create a Kubernetes cluster.

func (*KubernetesHandler) CreateNodePool

func (k *KubernetesHandler) CreateNodePool(ctx context.Context, vkeID string, nodePoolReq *NodePoolReq) (*NodePool, *http.Response, error)

CreateNodePool creates a nodepool on a VKE cluster

func (*KubernetesHandler) DeleteCluster

func (k *KubernetesHandler) DeleteCluster(ctx context.Context, id string) error

DeleteCluster will delete a Kubernetes cluster.

func (*KubernetesHandler) DeleteClusterWithResources

func (k *KubernetesHandler) DeleteClusterWithResources(ctx context.Context, id string) error

DeleteClusterWithResources will delete a Kubernetes cluster and all related resources.

func (*KubernetesHandler) DeleteNodePool

func (k *KubernetesHandler) DeleteNodePool(ctx context.Context, vkeID, nodePoolID string) error

DeleteNodePool will remove a nodepool from a VKE cluster

func (*KubernetesHandler) DeleteNodePoolInstance

func (k *KubernetesHandler) DeleteNodePoolInstance(ctx context.Context, vkeID, nodePoolID, nodeID string) error

DeleteNodePoolInstance will remove a specified node from a nodepool

func (*KubernetesHandler) GetCluster

func (k *KubernetesHandler) GetCluster(ctx context.Context, id string) (*Cluster, *http.Response, error)

GetCluster will return a Kubernetes cluster.

func (*KubernetesHandler) GetKubeConfig

func (k *KubernetesHandler) GetKubeConfig(ctx context.Context, vkeID string) (*KubeConfig, *http.Response, error)

GetKubeConfig returns the kubeconfig for the specified VKE cluster

func (*KubernetesHandler) GetNodePool

func (k *KubernetesHandler) GetNodePool(ctx context.Context, vkeID, nodePoolID string) (*NodePool, *http.Response, error)

GetNodePool will return a single nodepool

func (*KubernetesHandler) GetUpgrades

func (k *KubernetesHandler) GetUpgrades(ctx context.Context, vkeID string) ([]string, *http.Response, error)

GetUpgrades returns all version a VKE cluster can upgrade to

func (*KubernetesHandler) GetVersions

func (k *KubernetesHandler) GetVersions(ctx context.Context) (*Versions, *http.Response, error)

GetVersions returns the supported kubernetes versions

func (*KubernetesHandler) ListClusters

func (k *KubernetesHandler) ListClusters(ctx context.Context, options *ListOptions) ([]Cluster, *Meta, *http.Response, error)

ListClusters will return all kubernetes clusters.

func (*KubernetesHandler) ListNodePools

func (k *KubernetesHandler) ListNodePools(ctx context.Context, vkeID string, options *ListOptions) ([]NodePool, *Meta, *http.Response, error)

ListNodePools will return all nodepools for a given VKE cluster

func (*KubernetesHandler) RecycleNodePoolInstance

func (k *KubernetesHandler) RecycleNodePoolInstance(ctx context.Context, vkeID, nodePoolID, nodeID string) error

RecycleNodePoolInstance will recycle (destroy + redeploy) a given node on a nodepool

func (*KubernetesHandler) UpdateCluster

func (k *KubernetesHandler) UpdateCluster(ctx context.Context, vkeID string, updateReq *ClusterReqUpdate) error

UpdateCluster updates label on VKE cluster

func (*KubernetesHandler) UpdateNodePool

func (k *KubernetesHandler) UpdateNodePool(ctx context.Context, vkeID, nodePoolID string, updateReq *NodePoolReqUpdate) (*NodePool, *http.Response, error)

UpdateNodePool will allow you change the quantity of nodes within a nodepool

func (*KubernetesHandler) Upgrade

func (k *KubernetesHandler) Upgrade(ctx context.Context, vkeID string, body *ClusterUpgradeReq) error

Upgrade beings a VKE cluster upgrade

type KubernetesService

type KubernetesService interface {
	CreateCluster(ctx context.Context, createReq *ClusterReq) (*Cluster, *http.Response, error)
	GetCluster(ctx context.Context, id string) (*Cluster, *http.Response, error)
	ListClusters(ctx context.Context, options *ListOptions) ([]Cluster, *Meta, *http.Response, error)
	UpdateCluster(ctx context.Context, vkeID string, updateReq *ClusterReqUpdate) error
	DeleteCluster(ctx context.Context, id string) error
	DeleteClusterWithResources(ctx context.Context, id string) error

	CreateNodePool(ctx context.Context, vkeID string, nodePoolReq *NodePoolReq) (*NodePool, *http.Response, error)
	ListNodePools(ctx context.Context, vkeID string, options *ListOptions) ([]NodePool, *Meta, *http.Response, error)
	GetNodePool(ctx context.Context, vkeID, nodePoolID string) (*NodePool, *http.Response, error)
	UpdateNodePool(ctx context.Context, vkeID, nodePoolID string, updateReq *NodePoolReqUpdate) (*NodePool, *http.Response, error)
	DeleteNodePool(ctx context.Context, vkeID, nodePoolID string) error

	DeleteNodePoolInstance(ctx context.Context, vkeID, nodePoolID, nodeID string) error
	RecycleNodePoolInstance(ctx context.Context, vkeID, nodePoolID, nodeID string) error

	GetKubeConfig(ctx context.Context, vkeID string) (*KubeConfig, *http.Response, error)
	GetVersions(ctx context.Context) (*Versions, *http.Response, error)

	GetUpgrades(ctx context.Context, vkeID string) ([]string, *http.Response, error)
	Upgrade(ctx context.Context, vkeID string, body *ClusterUpgradeReq) error
}

KubernetesService is the interface to interact with kubernetes endpoint on the Vultr API Link : https://www.vultr.com/api/#tag/kubernetes

type LBFirewallRule

type LBFirewallRule struct {
	RuleID string `json:"id,omitempty"`
	Port   int    `json:"port,omitempty"`
	IPType string `json:"ip_type,omitempty"`
	Source string `json:"source,omitempty"`
}

LBFirewallRule represent a single firewall rule

type Links struct {
	Next string `json:"next"`
	Prev string `json:"prev"`
}

Links represent the next/previous cursor in your pagination calls

type ListOptions

type ListOptions struct {
	// These query params are used for all list calls that support pagination
	PerPage int    `url:"per_page,omitempty"`
	Cursor  string `url:"cursor,omitempty"`

	// These three query params are currently used for the list instance call
	// These may be extended to other list calls
	// https://www.vultr.com/api/#operation/list-instances
	MainIP string `url:"main_ip,omitempty"`
	Label  string `url:"label,omitempty"`
	Tag    string `url:"tag,omitempty"`
	Region string `url:"region,omitempty"`

	// Query params that can be used on the list snapshots call
	// https://www.vultr.com/api/#operation/list-snapshots
	Description string `url:"description,omitempty"`
}

ListOptions are the available query params

type LoadBalancer

type LoadBalancer struct {
	ID              string           `json:"id,omitempty"`
	DateCreated     string           `json:"date_created,omitempty"`
	Region          string           `json:"region,omitempty"`
	Label           string           `json:"label,omitempty"`
	Status          string           `json:"status,omitempty"`
	IPV4            string           `json:"ipv4,omitempty"`
	IPV6            string           `json:"ipv6,omitempty"`
	Instances       []string         `json:"instances,omitempty"`
	Nodes           int              `json:"nodes,omitempty"`
	HealthCheck     *HealthCheck     `json:"health_check,omitempty"`
	GenericInfo     *GenericInfo     `json:"generic_info,omitempty"`
	SSLInfo         *bool            `json:"has_ssl,omitempty"`
	ForwardingRules []ForwardingRule `json:"forwarding_rules,omitempty"`
	FirewallRules   []LBFirewallRule `json:"firewall_rules,omitempty"`
}

LoadBalancer represent the structure of a load balancer

type LoadBalancerHandler

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

LoadBalancerHandler handles interaction with the server methods for the Vultr API

func (*LoadBalancerHandler) Create

Create a load balancer

func (*LoadBalancerHandler) CreateForwardingRule

func (l *LoadBalancerHandler) CreateForwardingRule(ctx context.Context, lbID string, rule *ForwardingRule) (*ForwardingRule, *http.Response, error)

CreateForwardingRule will create a new forwarding rule for your load balancer subscription. Note the RuleID will be returned in the ForwardingRule struct

func (*LoadBalancerHandler) Delete

func (l *LoadBalancerHandler) Delete(ctx context.Context, lbID string) error

Delete a load balancer subscription.

func (*LoadBalancerHandler) DeleteForwardingRule

func (l *LoadBalancerHandler) DeleteForwardingRule(ctx context.Context, lbID, ruleID string) error

DeleteForwardingRule removes a forwarding rule from a load balancer subscription

func (*LoadBalancerHandler) Get

Get a load balancer

func (*LoadBalancerHandler) GetFirewallRule

func (l *LoadBalancerHandler) GetFirewallRule(ctx context.Context, lbID, ruleID string) (*LBFirewallRule, *http.Response, error)

GetFirewallRule will get a firewall rule from your load balancer subscription.

func (*LoadBalancerHandler) GetForwardingRule

func (l *LoadBalancerHandler) GetForwardingRule(ctx context.Context, lbID, ruleID string) (*ForwardingRule, *http.Response, error)

GetForwardingRule will get a forwarding rule from your load balancer subscription.

func (*LoadBalancerHandler) List

List all load balancer subscriptions on the current account.

func (*LoadBalancerHandler) ListFirewallRules

func (l *LoadBalancerHandler) ListFirewallRules(ctx context.Context, lbID string, options *ListOptions) ([]LBFirewallRule, *Meta, *http.Response, error)

ListFirewallRules lists all firewall rules for a load balancer subscription

func (*LoadBalancerHandler) ListForwardingRules

func (l *LoadBalancerHandler) ListForwardingRules(ctx context.Context, lbID string, options *ListOptions) ([]ForwardingRule, *Meta, *http.Response, error)

ListForwardingRules lists all forwarding rules for a load balancer subscription

func (*LoadBalancerHandler) Update

func (l *LoadBalancerHandler) Update(ctx context.Context, lbID string, updateReq *LoadBalancerReq) error

Update updates your your load balancer

type LoadBalancerReq

type LoadBalancerReq struct {
	Region             string           `json:"region,omitempty"`
	Label              string           `json:"label,omitempty"`
	Instances          []string         `json:"instances,omitempty"`
	Nodes              int              `json:"nodes,omitempty"`
	HealthCheck        *HealthCheck     `json:"health_check,omitempty"`
	StickySessions     *StickySessions  `json:"sticky_session,omitempty"`
	ForwardingRules    []ForwardingRule `json:"forwarding_rules,omitempty"`
	SSL                *SSL             `json:"ssl,omitempty"`
	SSLRedirect        *bool            `json:"ssl_redirect,omitempty"`
	ProxyProtocol      *bool            `json:"proxy_protocol,omitempty"`
	BalancingAlgorithm string           `json:"balancing_algorithm,omitempty"`
	FirewallRules      []LBFirewallRule `json:"firewall_rules"`
	// Deprecated:  PrivateNetwork should no longer be used. Instead, use VPC.
	PrivateNetwork *string `json:"private_network,omitempty"`
	VPC            *string `json:"vpc,omitempty"`
}

LoadBalancerReq gives options for creating or updating a load balancer

type LoadBalancerService

type LoadBalancerService interface {
	Create(ctx context.Context, createReq *LoadBalancerReq) (*LoadBalancer, *http.Response, error)
	Get(ctx context.Context, lbID string) (*LoadBalancer, *http.Response, error)
	Update(ctx context.Context, lbID string, updateReq *LoadBalancerReq) error
	Delete(ctx context.Context, lbID string) error
	List(ctx context.Context, options *ListOptions) ([]LoadBalancer, *Meta, *http.Response, error)
	CreateForwardingRule(ctx context.Context, lbID string, rule *ForwardingRule) (*ForwardingRule, *http.Response, error)
	GetForwardingRule(ctx context.Context, lbID string, ruleID string) (*ForwardingRule, *http.Response, error)
	DeleteForwardingRule(ctx context.Context, lbID string, RuleID string) error
	ListForwardingRules(ctx context.Context, lbID string, options *ListOptions) ([]ForwardingRule, *Meta, *http.Response, error)
	ListFirewallRules(ctx context.Context, lbID string, options *ListOptions) ([]LBFirewallRule, *Meta, *http.Response, error)
	GetFirewallRule(ctx context.Context, lbID string, ruleID string) (*LBFirewallRule, *http.Response, error)
}

LoadBalancerService is the interface to interact with the server endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/load-balancer

type MarketplaceAppVariable added in v3.6.0

type MarketplaceAppVariable struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Required    *bool  `json:"required"`
}

MarketplaceAppVariable represents a user-supplied variable for a Marketplace app

type MarketplaceService added in v3.6.0

type MarketplaceService interface {
	ListAppVariables(ctx context.Context, imageID string) ([]MarketplaceAppVariable, *http.Response, error)
}

MarketplaceService is the interface to interact with the Marketplace endpoints on the Vultr API Link: https://www.vultr.com/api/#tag/marketplace

type MarketplaceServiceHandler added in v3.6.0

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

MarketplaceServiceHandler handles interaction with the server methods for the Vultr API

func (*MarketplaceServiceHandler) ListAppVariables added in v3.6.0

func (d *MarketplaceServiceHandler) ListAppVariables(ctx context.Context, imageID string) ([]MarketplaceAppVariable, *http.Response, error)

ListAppVariables retrieves all user-supplied variables for a Marketplace app

type MaxConnections

type MaxConnections struct {
	MySQL int `json:"mysql,omitempty"`
	PG    int `json:"pg,omitempty"`
}

MaxConnections represents an object containing the maximum number of connections by engine type for Managed Database plans

type Meta

type Meta struct {
	Total int    `json:"total"`
	Links *Links `json:"links"`
}

Meta represents the available pagination information

type Neighbors

type Neighbors struct {
	Neighbors []string `json:"neighbors"`
}

Neighbors that might exist on the same host.

type Network

type Network struct {
	NetworkID    string `json:"id"`
	Region       string `json:"region"`
	Description  string `json:"description"`
	V4Subnet     string `json:"v4_subnet"`
	V4SubnetMask int    `json:"v4_subnet_mask"`
	DateCreated  string `json:"date_created"`
}

Network represents a Vultr private network Deprecated: Network should no longer be used. Instead, use VPC.

type NetworkReq

type NetworkReq struct {
	Region       string `json:"region"`
	Description  string `json:"description"`
	V4Subnet     string `json:"v4_subnet"`
	V4SubnetMask int    `json:"v4_subnet_mask"`
}

NetworkReq represents parameters to create or update Network resource Deprecated: NetworkReq should no longer be used. Instead, use VPCReq.

type NetworkService

type NetworkService interface {
	// Deprecated: NetworkService Create should no longer be used. Instead, use VPCService Create.
	Create(ctx context.Context, createReq *NetworkReq) (*Network, *http.Response, error)
	// Deprecated: NetworkService Get should no longer be used. Instead, use VPCService Get.
	Get(ctx context.Context, networkID string) (*Network, *http.Response, error)
	// Deprecated: NetworkService Update should no longer be used. Instead, use VPCService Update.
	Update(ctx context.Context, networkID string, description string) error
	// Deprecated: NetworkService Delete should no longer be used. Instead, use VPCService Delete.
	Delete(ctx context.Context, networkID string) error
	// Deprecated: NetworkService List should no longer be used. Instead, use VPCService List.
	List(ctx context.Context, options *ListOptions) ([]Network, *Meta, *http.Response, error)
}

NetworkService is the interface to interact with the network endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/private-Networks Deprecated: NetworkService should no longer be used. Instead, use VPCService.

type NetworkServiceHandler

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

NetworkServiceHandler handles interaction with the network methods for the Vultr API Deprecated: NetworkServiceHandler should no longer be used. Instead, use VPCServiceHandler.

func (*NetworkServiceHandler) Create

func (n *NetworkServiceHandler) Create(ctx context.Context, createReq *NetworkReq) (*Network, *http.Response, error)

Create a new private network. A private network can only be used at the location for which it was created. Deprecated: NetworkServiceHandler Create should no longer be used. Instead, use VPCServiceHandler Create.

func (*NetworkServiceHandler) Delete

func (n *NetworkServiceHandler) Delete(ctx context.Context, networkID string) error

Delete a private network. Before deleting, a network must be disabled from all instances Deprecated: NetworkServiceHandler Delete should no longer be used. Instead, use VPCServiceHandler Delete.

func (*NetworkServiceHandler) Get

func (n *NetworkServiceHandler) Get(ctx context.Context, networkID string) (*Network, *http.Response, error)

Get gets the private networks of the requested ID Deprecated: NetworkServiceHandler Get should no longer be used. Instead use VPCServiceHandler Create.

func (*NetworkServiceHandler) List

List lists all private networks on the current account Deprecated: NetworkServiceHandler List should no longer be used. Instead, use VPCServiceHandler List.

func (*NetworkServiceHandler) Update

func (n *NetworkServiceHandler) Update(ctx context.Context, networkID, description string) error

Update updates a private network Deprecated: NetworkServiceHandler Update should no longer be used. Instead, use VPCServiceHandler Update.

type Node

type Node struct {
	ID          string `json:"id"`
	DateCreated string `json:"date_created"`
	Label       string `json:"label"`
	Status      string `json:"status"`
}

Node represents a node that will live within a nodepool

type NodePool

type NodePool struct {
	ID           string            `json:"id"`
	DateCreated  string            `json:"date_created"`
	DateUpdated  string            `json:"date_updated"`
	Label        string            `json:"label"`
	Plan         string            `json:"plan"`
	Status       string            `json:"status"`
	NodeQuantity int               `json:"node_quantity"`
	MinNodes     int               `json:"min_nodes"`
	MaxNodes     int               `json:"max_nodes"`
	AutoScaler   bool              `json:"auto_scaler"`
	Tag          string            `json:"tag"`
	Labels       map[string]string `json:"labels"`
	Nodes        []Node            `json:"nodes"`
}

NodePool represents a pool of nodes that are grouped by their label and plan type

type NodePoolReq

type NodePoolReq struct {
	NodeQuantity int               `json:"node_quantity"`
	Label        string            `json:"label"`
	Plan         string            `json:"plan"`
	Tag          string            `json:"tag"`
	MinNodes     int               `json:"min_nodes,omitempty"`
	MaxNodes     int               `json:"max_nodes,omitempty"`
	AutoScaler   *bool             `json:"auto_scaler"`
	Labels       map[string]string `json:"labels,omitempty"`
}

NodePoolReq struct used to create a node pool

type NodePoolReqUpdate

type NodePoolReqUpdate struct {
	NodeQuantity int               `json:"node_quantity,omitempty"`
	Tag          *string           `json:"tag,omitempty"`
	MinNodes     int               `json:"min_nodes,omitempty"`
	MaxNodes     int               `json:"max_nodes,omitempty"`
	AutoScaler   *bool             `json:"auto_scaler,omitempty"`
	Labels       map[string]string `json:"labels,omitempty"`
}

NodePoolReqUpdate struct used to update a node pool

type OS

type OS struct {
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Arch   string `json:"arch"`
	Family string `json:"family"`
}

OS represents a Vultr operating system

type OSService

type OSService interface {
	List(ctx context.Context, options *ListOptions) ([]OS, *Meta, *http.Response, error)
}

OSService is the interface to interact with the operating system endpoint on the Vultr API Link : https://www.vultr.com/api/#tag/os

type OSServiceHandler

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

OSServiceHandler handles interaction with the operating system methods for the Vultr API

func (*OSServiceHandler) List

func (o *OSServiceHandler) List(ctx context.Context, options *ListOptions) ([]OS, *Meta, *http.Response, error)

List retrieves a list of available operating systems.

type ObjectStorage

type ObjectStorage struct {
	ID                   string `json:"id"`
	DateCreated          string `json:"date_created"`
	ObjectStoreClusterID int    `json:"cluster_id"`
	Region               string `json:"region"`
	Location             string `json:"location"`
	Label                string `json:"label"`
	Status               string `json:"status"`
	S3Keys
}

ObjectStorage represents a Vultr Object Storage subscription.

type ObjectStorageCluster

type ObjectStorageCluster struct {
	ID       int    `json:"id"`
	Region   string `json:"region"`
	Hostname string `json:"hostname"`
	Deploy   string `json:"deploy"`
}

ObjectStorageCluster represents a Vultr Object Storage cluster.

type ObjectStorageService

type ObjectStorageService interface {
	Create(ctx context.Context, clusterID int, label string) (*ObjectStorage, *http.Response, error)
	Get(ctx context.Context, id string) (*ObjectStorage, *http.Response, error)
	Update(ctx context.Context, id, label string) error
	Delete(ctx context.Context, id string) error
	List(ctx context.Context, options *ListOptions) ([]ObjectStorage, *Meta, *http.Response, error)

	ListCluster(ctx context.Context, options *ListOptions) ([]ObjectStorageCluster, *Meta, *http.Response, error)
	RegenerateKeys(ctx context.Context, id string) (*S3Keys, *http.Response, error)
}

ObjectStorageService is the interface to interact with the object storage endpoints on the Vultr API. Link : https://www.vultr.com/api/#tag/s3

type ObjectStorageServiceHandler

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

ObjectStorageServiceHandler handles interaction between the object storage service and the Vultr API.

func (*ObjectStorageServiceHandler) Create

func (o *ObjectStorageServiceHandler) Create(ctx context.Context, clusterID int, label string) (*ObjectStorage, *http.Response, error)

Create an object storage subscription

func (*ObjectStorageServiceHandler) Delete

Delete a object storage subscription.

func (*ObjectStorageServiceHandler) Get

Get returns a specified object storage by the provided ID

func (*ObjectStorageServiceHandler) List

List all object storage subscriptions on the current account. This includes both pending and active subscriptions.

func (*ObjectStorageServiceHandler) ListCluster

ListCluster returns back your object storage clusters. Clusters may be removed over time. The "deploy" field can be used to determine whether or not new deployments are allowed in the cluster.

func (*ObjectStorageServiceHandler) RegenerateKeys

func (o *ObjectStorageServiceHandler) RegenerateKeys(ctx context.Context, id string) (*S3Keys, *http.Response, error)

RegenerateKeys of the S3 API Keys for an object storage subscription

func (*ObjectStorageServiceHandler) Update

func (o *ObjectStorageServiceHandler) Update(ctx context.Context, id, label string) error

Update a Object Storage Subscription.

type PGExtension

type PGExtension struct {
	Name     string   `json:"name"`
	Versions []string `json:"versions,omitempty"`
}

PGExtension represents an object containing extension name and version information

type Plan

type Plan struct {
	ID          string   `json:"id"`
	VCPUCount   int      `json:"vcpu_count"`
	RAM         int      `json:"ram"`
	Disk        int      `json:"disk"`
	DiskCount   int      `json:"disk_count"`
	Bandwidth   int      `json:"bandwidth"`
	MonthlyCost float32  `json:"monthly_cost"`
	Type        string   `json:"type"`
	GPUVRAM     int      `json:"gpu_vram_gb,omitempty"`
	GPUType     string   `json:"gpu_type,omitempty"`
	Locations   []string `json:"locations"`
}

Plan represents vc2, vdc, or vhf

type PlanAvailability

type PlanAvailability struct {
	AvailablePlans []string `json:"available_plans"`
}

PlanAvailability contains all available plans.

type PlanService

type PlanService interface {
	List(ctx context.Context, planType string, options *ListOptions) ([]Plan, *Meta, *http.Response, error)
	ListBareMetal(ctx context.Context, options *ListOptions) ([]BareMetalPlan, *Meta, *http.Response, error)
}

PlanService is the interface to interact with the Plans endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/plans

type PlanServiceHandler

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

PlanServiceHandler handles interaction with the Plans methods for the Vultr API

func (*PlanServiceHandler) List

func (p *PlanServiceHandler) List(ctx context.Context, planType string, options *ListOptions) ([]Plan, *Meta, *http.Response, error)

List retrieves a list of all active plans. planType is optional - pass an empty string to get all plans

func (*PlanServiceHandler) ListBareMetal

func (p *PlanServiceHandler) ListBareMetal(ctx context.Context, options *ListOptions) ([]BareMetalPlan, *Meta, *http.Response, error)

ListBareMetal all active bare metal plans.

type PrivateNetwork

type PrivateNetwork struct {
	NetworkID  string `json:"network_id"`
	MacAddress string `json:"mac_address"`
	IPAddress  string `json:"ip_address"`
}

PrivateNetwork information for a given instance. Deprecated: PrivateNetwork should no longer be used. Instead, use VPCInfo.

type PublicISO

type PublicISO struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	MD5Sum      string `json:"md5sum,omitempty"`
}

PublicISO represents public ISOs offered in the Vultr ISO library.

type Region

type Region struct {
	ID        string   `json:"id"`
	City      string   `json:"city"`
	Country   string   `json:"country"`
	Continent string   `json:"continent,omitempty"`
	Options   []string `json:"options"`
}

Region represents a Vultr region

type RegionService

type RegionService interface {
	Availability(ctx context.Context, regionID string, planType string) (*PlanAvailability, *http.Response, error)
	List(ctx context.Context, options *ListOptions) ([]Region, *Meta, *http.Response, error)
}

RegionService is the interface to interact with Region endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/region

type RegionServiceHandler

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

RegionServiceHandler handles interaction with the region methods for the Vultr API

func (*RegionServiceHandler) Availability

func (r *RegionServiceHandler) Availability(ctx context.Context, regionID, planType string) (*PlanAvailability, *http.Response, error)

Availability retrieves a list of the plan IDs currently available for a given location.

func (*RegionServiceHandler) List

func (r *RegionServiceHandler) List(ctx context.Context, options *ListOptions) ([]Region, *Meta, *http.Response, error)

List returns all available regions

type ReinstallReq

type ReinstallReq struct {
	Hostname string `json:"hostname,omitempty"`
}

ReinstallReq struct used to allow changes during a reinstall

type RequestBody

type RequestBody map[string]interface{}

RequestBody is used to create JSON bodies for one off calls

type RequestCompletionCallback

type RequestCompletionCallback func(*http.Request, *http.Response)

RequestCompletionCallback defines the type of the request callback function

type ReservedIP

type ReservedIP struct {
	ID         string `json:"id"`
	Region     string `json:"region"`
	IPType     string `json:"ip_type"`
	Subnet     string `json:"subnet"`
	SubnetSize int    `json:"subnet_size"`
	Label      string `json:"label"`
	InstanceID string `json:"instance_id"`
}

ReservedIP represents an reserved IP on Vultr

type ReservedIPConvertReq

type ReservedIPConvertReq struct {
	IPAddress string `json:"ip_address,omitempty"`
	Label     string `json:"label,omitempty"`
}

ReservedIPConvertReq is the struct used for create and update calls.

type ReservedIPReq

type ReservedIPReq struct {
	Region     string `json:"region,omitempty"`
	IPType     string `json:"ip_type,omitempty"`
	IPAddress  string `json:"ip_address,omitempty"`
	Label      string `json:"label,omitempty"`
	InstanceID string `json:"instance_id,omitempty"`
}

ReservedIPReq represents the parameters for creating a new Reserved IP on Vultr

type ReservedIPService

type ReservedIPService interface {
	Create(ctx context.Context, ripCreate *ReservedIPReq) (*ReservedIP, *http.Response, error)
	Update(ctx context.Context, id string, ripUpdate *ReservedIPUpdateReq) (*ReservedIP, *http.Response, error)
	Get(ctx context.Context, id string) (*ReservedIP, *http.Response, error)
	Delete(ctx context.Context, id string) error
	List(ctx context.Context, options *ListOptions) ([]ReservedIP, *Meta, *http.Response, error)

	Convert(ctx context.Context, ripConvert *ReservedIPConvertReq) (*ReservedIP, *http.Response, error)
	Attach(ctx context.Context, id, instance string) error
	Detach(ctx context.Context, id string) error
}

ReservedIPService is the interface to interact with the reserved IP endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/reserved-ip

type ReservedIPServiceHandler

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

ReservedIPServiceHandler handles interaction with the reserved IP methods for the Vultr API

func (*ReservedIPServiceHandler) Attach

func (r *ReservedIPServiceHandler) Attach(ctx context.Context, id, instance string) error

Attach a reserved IP to an existing subscription

func (*ReservedIPServiceHandler) Convert

Convert an existing IP on a subscription to a reserved IP.

func (*ReservedIPServiceHandler) Create

Create adds the specified reserved IP to your Vultr account

func (*ReservedIPServiceHandler) Delete

Delete removes the specified reserved IP from your Vultr account

func (*ReservedIPServiceHandler) Detach

Detach a reserved IP from an existing subscription.

func (*ReservedIPServiceHandler) Get

Get gets the reserved IP associated with provided ID

func (*ReservedIPServiceHandler) List

List lists all the reserved IPs associated with your Vultr account

func (*ReservedIPServiceHandler) Update

Update updates label on the Reserved IP

type ReservedIPUpdateReq

type ReservedIPUpdateReq struct {
	Label *string `json:"label"`
}

ReservedIPUpdateReq represents the parameters for updating a Reserved IP on Vultr

type RestoreReq

type RestoreReq struct {
	BackupID   string `json:"backup_id,omitempty"`
	SnapshotID string `json:"snapshot_id,omitempty"`
}

RestoreReq struct used to supply whether a restore should be from a backup or snapshot.

type ReverseIP

type ReverseIP struct {
	IP      string `json:"ip"`
	Reverse string `json:"reverse"`
}

ReverseIP information for a given instance.

type S3Keys

type S3Keys struct {
	S3Hostname  string `json:"s3_hostname"`
	S3AccessKey string `json:"s3_access_key"`
	S3SecretKey string `json:"s3_secret_key"`
}

S3Keys define your api access to your cluster

type SSHKey

type SSHKey struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	SSHKey      string `json:"ssh_key"`
	DateCreated string `json:"date_created"`
}

SSHKey represents an SSH Key on Vultr

type SSHKeyReq

type SSHKeyReq struct {
	Name   string `json:"name,omitempty"`
	SSHKey string `json:"ssh_key,omitempty"`
}

SSHKeyReq is the ssh key struct for create and update calls

type SSHKeyService

type SSHKeyService interface {
	Create(ctx context.Context, sshKeyReq *SSHKeyReq) (*SSHKey, *http.Response, error)
	Get(ctx context.Context, sshKeyID string) (*SSHKey, *http.Response, error)
	Update(ctx context.Context, sshKeyID string, sshKeyReq *SSHKeyReq) error
	Delete(ctx context.Context, sshKeyID string) error
	List(ctx context.Context, options *ListOptions) ([]SSHKey, *Meta, *http.Response, error)
}

SSHKeyService is the interface to interact with the SSH Key endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/ssh

type SSHKeyServiceHandler

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

SSHKeyServiceHandler handles interaction with the SSH Key methods for the Vultr API

func (*SSHKeyServiceHandler) Create

func (s *SSHKeyServiceHandler) Create(ctx context.Context, sshKeyReq *SSHKeyReq) (*SSHKey, *http.Response, error)

Create a ssh key

func (*SSHKeyServiceHandler) Delete

func (s *SSHKeyServiceHandler) Delete(ctx context.Context, sshKeyID string) error

Delete a specific ssh-key.

func (*SSHKeyServiceHandler) Get

func (s *SSHKeyServiceHandler) Get(ctx context.Context, sshKeyID string) (*SSHKey, *http.Response, error)

Get a specific ssh key.

func (*SSHKeyServiceHandler) List

func (s *SSHKeyServiceHandler) List(ctx context.Context, options *ListOptions) ([]SSHKey, *Meta, *http.Response, error)

List all available SSH Keys.

func (*SSHKeyServiceHandler) Update

func (s *SSHKeyServiceHandler) Update(ctx context.Context, sshKeyID string, sshKeyReq *SSHKeyReq) error

Update will update the given SSH Key. Empty strings will be ignored.

type SSL

type SSL struct {
	PrivateKey  string `json:"private_key,omitempty"`
	Certificate string `json:"certificate,omitempty"`
	Chain       string `json:"chain,omitempty"`
}

SSL represents valid SSL config

type Snapshot

type Snapshot struct {
	ID             string `json:"id"`
	DateCreated    string `json:"date_created"`
	Description    string `json:"description"`
	Size           int    `json:"size"`
	CompressedSize int    `json:"compressed_size"`
	Status         string `json:"status"`
	OsID           int    `json:"os_id"`
	AppID          int    `json:"app_id"`
}

Snapshot represents a Vultr snapshot

type SnapshotReq

type SnapshotReq struct {
	InstanceID  string `json:"instance_id,omitempty"`
	Description string `json:"description,omitempty"`
}

SnapshotReq struct is used to create snapshots.

type SnapshotService

type SnapshotService interface {
	Create(ctx context.Context, snapshotReq *SnapshotReq) (*Snapshot, *http.Response, error)
	CreateFromURL(ctx context.Context, snapshotURLReq *SnapshotURLReq) (*Snapshot, *http.Response, error)
	Get(ctx context.Context, snapshotID string) (*Snapshot, *http.Response, error)
	Delete(ctx context.Context, snapshotID string) error
	List(ctx context.Context, options *ListOptions) ([]Snapshot, *Meta, *http.Response, error)
}

SnapshotService is the interface to interact with Snapshot endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/snapshot

type SnapshotServiceHandler

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

SnapshotServiceHandler handles interaction with the snapshot methods for the Vultr API

func (*SnapshotServiceHandler) Create

func (s *SnapshotServiceHandler) Create(ctx context.Context, snapshotReq *SnapshotReq) (*Snapshot, *http.Response, error)

Create makes a snapshot of a provided server

func (*SnapshotServiceHandler) CreateFromURL

func (s *SnapshotServiceHandler) CreateFromURL(ctx context.Context, snapshotURLReq *SnapshotURLReq) (*Snapshot, *http.Response, error)

CreateFromURL will create a snapshot based on an image iso from a URL you provide

func (*SnapshotServiceHandler) Delete

func (s *SnapshotServiceHandler) Delete(ctx context.Context, snapshotID string) error

Delete a snapshot.

func (*SnapshotServiceHandler) Get

func (s *SnapshotServiceHandler) Get(ctx context.Context, snapshotID string) (*Snapshot, *http.Response, error)

Get a specific snapshot

func (*SnapshotServiceHandler) List

List all available snapshots.

type SnapshotURLReq

type SnapshotURLReq struct {
	URL         string `json:"url"`
	Description string `json:"description,omitempty"`
}

SnapshotURLReq struct is used to create snapshots from a URL.

type Soa

type Soa struct {
	NSPrimary string `json:"nsprimary,omitempty"`
	Email     string `json:"email,omitempty"`
}

Soa information for the Domain

type StartupScript

type StartupScript struct {
	ID           string `json:"id"`
	DateCreated  string `json:"date_created"`
	DateModified string `json:"date_modified"`
	Name         string `json:"name"`
	Type         string `json:"type"`
	Script       string `json:"script"`
}

StartupScript represents an startup script on Vultr

type StartupScriptReq

type StartupScriptReq struct {
	Name   string `json:"name,omitempty"`
	Type   string `json:"type,omitempty"`
	Script string `json:"script,omitempty"`
}

StartupScriptReq is the user struct for create and update calls

type StartupScriptService

type StartupScriptService interface {
	Create(ctx context.Context, req *StartupScriptReq) (*StartupScript, *http.Response, error)
	Get(ctx context.Context, scriptID string) (*StartupScript, *http.Response, error)
	Update(ctx context.Context, scriptID string, scriptReq *StartupScriptReq) error
	Delete(ctx context.Context, scriptID string) error
	List(ctx context.Context, options *ListOptions) ([]StartupScript, *Meta, *http.Response, error)
}

StartupScriptService is the interface to interact with the startup script endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/startup

type StartupScriptServiceHandler

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

StartupScriptServiceHandler handles interaction with the startup script methods for the Vultr API

func (*StartupScriptServiceHandler) Create

Create a startup script

func (*StartupScriptServiceHandler) Delete

func (s *StartupScriptServiceHandler) Delete(ctx context.Context, scriptID string) error

Delete the specified startup script from your account.

func (*StartupScriptServiceHandler) Get

Get a single startup script

func (*StartupScriptServiceHandler) List

List all the startup scripts associated with your Vultr account

func (*StartupScriptServiceHandler) Update

func (s *StartupScriptServiceHandler) Update(ctx context.Context, scriptID string, scriptReq *StartupScriptReq) error

Update will update the given startup script. Empty strings will be ignored.

type StickySessions

type StickySessions struct {
	CookieName string `json:"cookie_name,omitempty"`
}

StickySessions represents cookie for your load balancer

type SupportedEngines

type SupportedEngines struct {
	MySQL *bool `json:"mysql"`
	PG    *bool `json:"pg"`
	Redis *bool `json:"redis"`
}

SupportedEngines represents an object containing supported database engine types for Managed Database plans

type Upgrades

type Upgrades struct {
	Applications []Application `json:"applications,omitempty"`
	OS           []OS          `json:"os,omitempty"`
	Plans        []string      `json:"plans,omitempty"`
}

Upgrades that are available for a given Instance.

type User

type User struct {
	ID         string   `json:"id"`
	Name       string   `json:"name"`
	Email      string   `json:"email"`
	APIEnabled *bool    `json:"api_enabled"`
	APIKey     string   `json:"api_key,omitempty"`
	ACL        []string `json:"acls,omitempty"`
}

User represents an user on Vultr

type UserData

type UserData struct {
	Data string `json:"data"`
}

UserData information for a given struct.

type UserReq

type UserReq struct {
	Email      string   `json:"email,omitempty"`
	Name       string   `json:"name,omitempty"`
	APIEnabled *bool    `json:"api_enabled,omitempty"`
	ACL        []string `json:"acls,omitempty"`
	Password   string   `json:"password,omitempty"`
}

UserReq is the user struct for create and update calls

type UserService

type UserService interface {
	Create(ctx context.Context, userCreate *UserReq) (*User, *http.Response, error)
	Get(ctx context.Context, userID string) (*User, *http.Response, error)
	Update(ctx context.Context, userID string, userReq *UserReq) error
	Delete(ctx context.Context, userID string) error
	List(ctx context.Context, options *ListOptions) ([]User, *Meta, *http.Response, error)
}

UserService is the interface to interact with the user management endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/users

type UserServiceHandler

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

UserServiceHandler handles interaction with the user methods for the Vultr API

func (*UserServiceHandler) Create

func (u *UserServiceHandler) Create(ctx context.Context, userCreate *UserReq) (*User, *http.Response, error)

Create will add the specified user to your Vultr account

func (*UserServiceHandler) Delete

func (u *UserServiceHandler) Delete(ctx context.Context, userID string) error

Delete will remove the specified user from your Vultr account

func (*UserServiceHandler) Get

func (u *UserServiceHandler) Get(ctx context.Context, userID string) (*User, *http.Response, error)

Get will retrieve a specific user account

func (*UserServiceHandler) List

func (u *UserServiceHandler) List(ctx context.Context, options *ListOptions) ([]User, *Meta, *http.Response, error)

List will list all the users associated with your Vultr account

func (*UserServiceHandler) Update

func (u *UserServiceHandler) Update(ctx context.Context, userID string, userReq *UserReq) error

Update will update the given user. Empty strings will be ignored.

type VNCUrl

type VNCUrl struct {
	URL string `json:"url"`
}

VNCUrl contains the URL for a given Bare Metals VNC

type VPC

type VPC struct {
	ID           string `json:"id"`
	Region       string `json:"region"`
	Description  string `json:"description"`
	V4Subnet     string `json:"v4_subnet"`
	V4SubnetMask int    `json:"v4_subnet_mask"`
	DateCreated  string `json:"date_created"`
}

VPC represents a Vultr VPC

type VPC2 added in v3.3.0

type VPC2 struct {
	ID           string `json:"id"`
	Region       string `json:"region"`
	Description  string `json:"description"`
	IPBlock      string `json:"ip_block"`
	PrefixLength int    `json:"prefix_length"`
	DateCreated  string `json:"date_created"`
}

VPC2 represents a Vultr VPC 2.0

type VPC2AttachDetachReq added in v3.3.1

type VPC2AttachDetachReq struct {
	Nodes []string `json:"nodes"`
}

VPC2AttachDetachReq represents parameters to mass attach or detach nodes from VPC 2.0 networks

type VPC2Info added in v3.3.0

type VPC2Info struct {
	ID         string `json:"id"`
	MacAddress string `json:"mac_address"`
	IPAddress  string `json:"ip_address"`
}

VPC2Info information for a given instance.

type VPC2Node added in v3.3.1

type VPC2Node struct {
	ID          string `json:"id"`
	IPAddress   string `json:"ip_address"`
	MACAddress  int    `json:"mac_address"`
	Description string `json:"description"`
	Type        string `json:"type"`
	NodeStatus  string `json:"node_status"`
}

VPC2Node represents a node attached to a VPC 2.0 network

type VPC2Req added in v3.3.0

type VPC2Req struct {
	Region       string `json:"region"`
	Description  string `json:"description"`
	IPType       string `json:"ip_type"`
	IPBlock      string `json:"ip_block"`
	PrefixLength int    `json:"prefix_length"`
}

VPC2Req represents parameters to create or update a VPC 2.0 resource

type VPC2Service added in v3.3.0

type VPC2Service interface {
	Create(ctx context.Context, createReq *VPC2Req) (*VPC2, *http.Response, error)
	Get(ctx context.Context, vpcID string) (*VPC2, *http.Response, error)
	Update(ctx context.Context, vpcID string, description string) error
	Delete(ctx context.Context, vpcID string) error
	List(ctx context.Context, options *ListOptions) ([]VPC2, *Meta, *http.Response, error)
	ListNodes(ctx context.Context, vpc2ID string, options *ListOptions) ([]VPC2Node, *Meta, *http.Response, error)
	Attach(ctx context.Context, vpcID string, attachReq *VPC2AttachDetachReq) error
	Detach(ctx context.Context, vpcID string, detachReq *VPC2AttachDetachReq) error
}

VPC2Service is the interface to interact with the VPC 2.0 endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/vpc2

type VPC2ServiceHandler added in v3.3.0

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

VPC2ServiceHandler handles interaction with the VPC 2.0 methods for the Vultr API

func (*VPC2ServiceHandler) Attach added in v3.3.1

func (n *VPC2ServiceHandler) Attach(ctx context.Context, vpcID string, attachReq *VPC2AttachDetachReq) error

Attach attaches nodes to a VPC 2.0 network

func (*VPC2ServiceHandler) Create added in v3.3.0

func (n *VPC2ServiceHandler) Create(ctx context.Context, createReq *VPC2Req) (*VPC2, *http.Response, error)

Create creates a new VPC 2.0. A VPC 2.0 can only be used at the location for which it was created.

func (*VPC2ServiceHandler) Delete added in v3.3.0

func (n *VPC2ServiceHandler) Delete(ctx context.Context, vpcID string) error

Delete deletes a VPC 2.0. Before deleting, a VPC 2.0 must be disabled from all instances

func (*VPC2ServiceHandler) Detach added in v3.3.1

func (n *VPC2ServiceHandler) Detach(ctx context.Context, vpcID string, detachReq *VPC2AttachDetachReq) error

Detach detaches nodes from a VPC 2.0 network

func (*VPC2ServiceHandler) Get added in v3.3.0

func (n *VPC2ServiceHandler) Get(ctx context.Context, vpcID string) (*VPC2, *http.Response, error)

Get gets the VPC 2.0 of the requested ID

func (*VPC2ServiceHandler) List added in v3.3.0

func (n *VPC2ServiceHandler) List(ctx context.Context, options *ListOptions) ([]VPC2, *Meta, *http.Response, error)

List lists all VPCs 2.0 on the current account

func (*VPC2ServiceHandler) ListNodes added in v3.3.1

func (n *VPC2ServiceHandler) ListNodes(ctx context.Context, vpc2ID string, options *ListOptions) ([]VPC2Node, *Meta, *http.Response, error)

ListNodes lists all nodes attached to a VPC 2.0 network

func (*VPC2ServiceHandler) Update added in v3.3.0

func (n *VPC2ServiceHandler) Update(ctx context.Context, vpcID, description string) error

Update updates a VPC 2.0

type VPCInfo

type VPCInfo struct {
	ID         string `json:"id"`
	MacAddress string `json:"mac_address"`
	IPAddress  string `json:"ip_address"`
}

VPCInfo information for a given instance.

type VPCReq

type VPCReq struct {
	Region       string `json:"region"`
	Description  string `json:"description"`
	V4Subnet     string `json:"v4_subnet"`
	V4SubnetMask int    `json:"v4_subnet_mask"`
}

VPCReq represents parameters to create or update a VPC resource

type VPCService

type VPCService interface {
	Create(ctx context.Context, createReq *VPCReq) (*VPC, *http.Response, error)
	Get(ctx context.Context, vpcID string) (*VPC, *http.Response, error)
	Update(ctx context.Context, vpcID string, description string) error
	Delete(ctx context.Context, vpcID string) error
	List(ctx context.Context, options *ListOptions) ([]VPC, *Meta, *http.Response, error)
}

VPCService is the interface to interact with the VPC endpoints on the Vultr API Link : https://www.vultr.com/api/#tag/vpcs

type VPCServiceHandler

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

VPCServiceHandler handles interaction with the VPC methods for the Vultr API

func (*VPCServiceHandler) Create

func (n *VPCServiceHandler) Create(ctx context.Context, createReq *VPCReq) (*VPC, *http.Response, error)

Create creates a new VPC. A VPC can only be used at the location for which it was created.

func (*VPCServiceHandler) Delete

func (n *VPCServiceHandler) Delete(ctx context.Context, vpcID string) error

Delete deletes a VPC. Before deleting, a VPC must be disabled from all instances

func (*VPCServiceHandler) Get

func (n *VPCServiceHandler) Get(ctx context.Context, vpcID string) (*VPC, *http.Response, error)

Get gets the VPC of the requested ID

func (*VPCServiceHandler) List

func (n *VPCServiceHandler) List(ctx context.Context, options *ListOptions) ([]VPC, *Meta, *http.Response, error)

List lists all VPCs on the current account

func (*VPCServiceHandler) Update

func (n *VPCServiceHandler) Update(ctx context.Context, vpcID, description string) error

Update updates a VPC

type Versions

type Versions struct {
	Versions []string `json:"versions"`
}

Versions that are supported for VKE

Jump to

Keyboard shortcuts

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