govultr

package module
v2.17.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 12 Imported by: 32

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.

GoVultr V1 that interacts with Vultr V1 API is now on the v1 branch

Installation

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

Usage

Vultr uses a PAT (Personal Access token) 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(). You must pass your PAT to an oauth2 library to create the *http.Client, which configures the Authorization header with your PAT as the bearer api-key.

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/v2"
  "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)
}
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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToBoolPtr added in v2.2.0

func BoolToBoolPtr(value bool) *bool

BoolToBoolPtr helper function that returns a pointer from your bool value

func IntToIntPtr added in v2.5.1

func IntToIntPtr(value int) *int

IntToIntPtr helper function that returns a pointer from your string value

func StringToStringPtr added in v2.5.0

func StringToStringPtr(value string) *string

StringToStringPtr helper function that returns a pointer from your string value

Types

type APIKey

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

APIKey contains a users API Key for interacting with the API

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, 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, 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 BMBareMetalBase

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

BMBareMetalBase ...

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, error)
	List(ctx context.Context, options *ListOptions) ([]Backup, *Meta, 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, error)

Get retrieves a backup that matches the given backupID

func (*BackupServiceHandler) List

func (b *BackupServiceHandler) List(ctx context.Context, options *ListOptions) ([]Backup, *Meta, 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"`
}

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, error)
	Get(ctx context.Context, serverID string) (*BareMetalServer, error)
	Update(ctx context.Context, serverID string, bmReq *BareMetalUpdate) (*BareMetalServer, error)
	Delete(ctx context.Context, serverID string) error
	List(ctx context.Context, options *ListOptions) ([]BareMetalServer, *Meta, error)

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

	ListIPv4s(ctx context.Context, serverID string, options *ListOptions) ([]IPv4, *Meta, error)
	ListIPv6s(ctx context.Context, serverID string, options *ListOptions) ([]IPv6, *Meta, 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, 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, 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) 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) Get

Get information for a Bare Metal instance.

func (*BareMetalServerServiceHandler) GetBandwidth

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

GetBandwidth used by a Bare Metal server.

func (*BareMetalServerServiceHandler) GetUpgrades

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

GetUpgrades that are available for a Bare Metal server.

func (*BareMetalServerServiceHandler) GetUserData

func (b *BareMetalServerServiceHandler) GetUserData(ctx context.Context, serverID string) (*UserData, 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, 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, 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, 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) 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

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

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 added in v2.3.0

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"`
}

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

type BillingService added in v2.10.0

type BillingService interface {
	ListHistory(ctx context.Context, options *ListOptions) ([]History, *Meta, error)
	ListInvoices(ctx context.Context, options *ListOptions) ([]Invoice, *Meta, error)
	GetInvoice(ctx context.Context, invoiceID string) (*Invoice, error)
	ListInvoiceItems(ctx context.Context, invoiceID int, options *ListOptions) ([]InvoiceItem, *Meta, 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 added in v2.10.0

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

BillingServiceHandler handles interaction with the billing methods for the Vultr API

func (*BillingServiceHandler) GetInvoice added in v2.10.0

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

GetInvoice retrieves an invoice that matches the given invoiceID

func (*BillingServiceHandler) ListHistory added in v2.10.0

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

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

func (*BillingServiceHandler) ListInvoiceItems added in v2.10.0

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

ListInvoiceItems retrieves items in an invoice that matches the given invoiceID

func (*BillingServiceHandler) ListInvoices added in v2.10.0

func (b *BillingServiceHandler) ListInvoices(ctx context.Context, options *ListOptions) ([]Invoice, *Meta, 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, error)
	Get(ctx context.Context, blockID string) (*BlockStorage, 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, 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
	Domain          DomainService
	DomainRecord    DomainRecordService
	FirewallGroup   FirewallGroupService
	FirewallRule    FireWallRuleService
	Instance        InstanceService
	ISO             ISOService
	Kubernetes      KubernetesService
	LoadBalancer    LoadBalancerService
	// 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
	// contains filtered or unexported fields
}

Client manages interaction with the Vultr V1 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{}) 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(time 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 added in v2.8.0

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"`
	NodePools     []NodePool `json:"node_pools"`
}

Cluster represents a full VKE cluster

type ClusterReq added in v2.8.0

type ClusterReq struct {
	Label     string        `json:"label"`
	Region    string        `json:"region"`
	Version   string        `json:"version"`
	NodePools []NodePoolReq `json:"node_pools"`
}

ClusterReq struct used to create a cluster

type ClusterReqUpdate added in v2.8.0

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

ClusterReqUpdate struct used to update update a cluster

type ClusterUpgradeReq added in v2.16.0

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

ClusterUpgradeReq struct for vke upgradse

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, error)
	Get(ctx context.Context, domain, recordID string) (*DomainRecord, 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, 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, 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, error)

Get record from a domain

func (*DomainRecordsServiceHandler) List

func (d *DomainRecordsServiceHandler) List(ctx context.Context, domain string, options *ListOptions) ([]DomainRecord, *Meta, error)

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, error)
	Get(ctx context.Context, domain string) (*Domain, error)
	Update(ctx context.Context, domain, dnsSec string) error
	Delete(ctx context.Context, domain string) error
	List(ctx context.Context, options *ListOptions) ([]Domain, *Meta, error)

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

	GetDNSSec(ctx context.Context, domain string) ([]string, 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, 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, error)

Get a domain from your Vultr account.

func (*DomainServiceHandler) GetDNSSec

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

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

func (*DomainServiceHandler) GetSoa

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

GetSoa gets the SOA record information for a domain

func (*DomainServiceHandler) List

func (d *DomainServiceHandler) List(ctx context.Context, options *ListOptions) ([]Domain, *Meta, 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 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, error)
	Get(ctx context.Context, fwGroupID string, fwRuleID int) (*FirewallRule, error)
	Delete(ctx context.Context, fwGroupID string, fwRuleID int) error
	List(ctx context.Context, fwGroupID string, options *ListOptions) ([]FirewallRule, *Meta, 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, 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, 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, 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, error)
	Get(ctx context.Context, groupID string) (*FirewallGroup, 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, 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 added in v2.10.0

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, error)
	Get(ctx context.Context, isoID string) (*ISO, error)
	Delete(ctx context.Context, isoID string) error
	List(ctx context.Context, options *ListOptions) ([]ISO, *Meta, error)
	ListPublic(ctx context.Context, options *ListOptions) ([]PublicISO, *Meta, 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, 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, error)

Get an ISO

func (*ISOServiceHandler) List

func (i *ISOServiceHandler) List(ctx context.Context, options *ListOptions) ([]ISO, *Meta, 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, 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"`
	// 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"`
	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"`
}

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, error)
	Get(ctx context.Context, instanceID string) (*Instance, error)
	Update(ctx context.Context, instanceID string, instanceReq *InstanceUpdateReq) (*Instance, error)
	Delete(ctx context.Context, instanceID string) error
	List(ctx context.Context, options *ListOptions) ([]Instance, *Meta, 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, 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) error

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

	// Deprecated: ListPrivateNetworks should no longer be used. Instead, use ListVPCInfo.
	ListPrivateNetworks(ctx context.Context, instanceID string, options *ListOptions) ([]PrivateNetwork, *Meta, 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, error)
	AttachVPC(ctx context.Context, instanceID, vpcID string) error
	DetachVPC(ctx context.Context, instanceID, vpcID string) error

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

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

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

	CreateReverseIPv6(ctx context.Context, instanceID string, reverseReq *ReverseIP) error
	ListReverseIPv6(ctx context.Context, instanceID string) ([]ReverseIP, 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, error)

	GetUpgrades(ctx context.Context, instanceID string) (*Upgrades, 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) 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 added in v2.15.0

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

AttachVPC to an instance

func (*InstanceServiceHandler) Create

func (i *InstanceServiceHandler) Create(ctx context.Context, instanceReq *InstanceCreateReq) (*Instance, error)

Create will create the server with the given parameters

func (*InstanceServiceHandler) CreateIPv4

func (i *InstanceServiceHandler) CreateIPv4(ctx context.Context, instanceID string, reboot *bool) (*IPv4, 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) 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 added in v2.15.0

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

DetachVPC from an instance.

func (*InstanceServiceHandler) Get

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

Get will get the server with the given instanceID

func (*InstanceServiceHandler) GetBackupSchedule

func (i *InstanceServiceHandler) GetBackupSchedule(ctx context.Context, instanceID string) (*BackupSchedule, 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, error)

GetBandwidth for a given instance.

func (*InstanceServiceHandler) GetNeighbors

func (i *InstanceServiceHandler) GetNeighbors(ctx context.Context, instanceID string) (*Neighbors, 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, error)

GetUpgrades that are available for a given instance.

func (*InstanceServiceHandler) GetUserData

func (i *InstanceServiceHandler) GetUserData(ctx context.Context, instanceID string) (*UserData, 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, error)

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

func (*InstanceServiceHandler) List

func (i *InstanceServiceHandler) List(ctx context.Context, options *ListOptions) ([]Instance, *Meta, error)

List all instances on your account.

func (*InstanceServiceHandler) ListIPv4

func (i *InstanceServiceHandler) ListIPv4(ctx context.Context, instanceID string, options *ListOptions) ([]IPv4, *Meta, 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, 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, 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, error)

ListReverseIPv6 currently assigned to a given instance.

func (*InstanceServiceHandler) ListVPCInfo added in v2.15.0

func (i *InstanceServiceHandler) ListVPCInfo(ctx context.Context, instanceID string, options *ListOptions) ([]VPCInfo, *Meta, 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, error)

Reinstall an instance.

func (*InstanceServiceHandler) Restore

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

Restore an instance.

func (*InstanceServiceHandler) SetBackupSchedule

func (i *InstanceServiceHandler) SetBackupSchedule(ctx context.Context, instanceID string, backup *BackupScheduleReq) 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, 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"`
	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 added in v2.10.0

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 added in v2.10.0

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 added in v2.8.0

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

KubeConfig will contain the kubeconfig b64 encoded

type KubernetesHandler added in v2.8.0

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

KubernetesHandler handles interaction with the kubernetes methods for the Vultr API

func (*KubernetesHandler) CreateCluster added in v2.8.0

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

CreateCluster will create a Kubernetes cluster.

func (*KubernetesHandler) CreateNodePool added in v2.8.0

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

CreateNodePool creates a nodepool on a VKE cluster

func (*KubernetesHandler) DeleteCluster added in v2.8.0

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

DeleteCluster will delete a Kubernetes cluster.

func (*KubernetesHandler) DeleteClusterWithResources added in v2.8.1

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

DeleteClusterWithResources will delete a Kubernetes cluster and all related resources.

func (*KubernetesHandler) DeleteNodePool added in v2.8.0

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

DeleteNodePool will remove a nodepool from a VKE cluster

func (*KubernetesHandler) DeleteNodePoolInstance added in v2.8.0

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

DeleteNodePoolInstance will remove a specified node from a nodepool

func (*KubernetesHandler) GetCluster added in v2.8.0

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

GetCluster will return a Kubernetes cluster.

func (*KubernetesHandler) GetKubeConfig added in v2.8.0

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

GetKubeConfig returns the kubeconfig for the specified VKE cluster

func (*KubernetesHandler) GetNodePool added in v2.8.0

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

GetNodePool will return a single nodepool

func (*KubernetesHandler) GetUpgrades added in v2.16.0

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

GetUpgrades returns all version a VKE cluster can upgrade to

func (*KubernetesHandler) GetVersions added in v2.8.1

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

GetVersions returns the supported kubernetes versions

func (*KubernetesHandler) ListClusters added in v2.8.0

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

ListClusters will return all kubernetes clusters.

func (*KubernetesHandler) ListNodePools added in v2.8.0

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

ListNodePools will return all nodepools for a given VKE cluster

func (*KubernetesHandler) RecycleNodePoolInstance added in v2.8.0

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 added in v2.8.0

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

UpdateCluster updates label on VKE cluster

func (*KubernetesHandler) UpdateNodePool added in v2.8.0

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

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

func (*KubernetesHandler) Upgrade added in v2.16.0

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

Upgrade beings a VKE cluster upgrade

type KubernetesService added in v2.8.0

type KubernetesService interface {
	CreateCluster(ctx context.Context, createReq *ClusterReq) (*Cluster, error)
	GetCluster(ctx context.Context, id string) (*Cluster, error)
	ListClusters(ctx context.Context, options *ListOptions) ([]Cluster, *Meta, 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, error)
	ListNodePools(ctx context.Context, vkeID string, options *ListOptions) ([]NodePool, *Meta, error)
	GetNodePool(ctx context.Context, vkeID, nodePoolID string) (*NodePool, error)
	UpdateNodePool(ctx context.Context, vkeID, nodePoolID string, updateReq *NodePoolReqUpdate) (*NodePool, 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, error)
	GetVersions(ctx context.Context) (*Versions, error)

	GetUpgrades(ctx context.Context, vkeID string) ([]string, 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 added in v2.5.0

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"`
	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

func (l *LoadBalancerHandler) Create(ctx context.Context, createReq *LoadBalancerReq) (*LoadBalancer, error)

Create a load balancer

func (*LoadBalancerHandler) CreateForwardingRule

func (l *LoadBalancerHandler) CreateForwardingRule(ctx context.Context, ID string, rule *ForwardingRule) (*ForwardingRule, 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, ID string) error

Delete a load balancer subscription.

func (*LoadBalancerHandler) DeleteForwardingRule

func (l *LoadBalancerHandler) DeleteForwardingRule(ctx context.Context, ID string, RuleID string) error

DeleteForwardingRule removes a forwarding rule from a load balancer subscription

func (*LoadBalancerHandler) Get

Get a load balancer

func (*LoadBalancerHandler) GetFirewallRule added in v2.5.0

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

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

func (*LoadBalancerHandler) GetForwardingRule

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

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

func (*LoadBalancerHandler) List

func (l *LoadBalancerHandler) List(ctx context.Context, options *ListOptions) ([]LoadBalancer, *Meta, error)

List all load balancer subscriptions on the current account.

func (*LoadBalancerHandler) ListFirewallRules added in v2.5.0

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

ListFirewallRules lists all firewall rules for a load balancer subscription

func (*LoadBalancerHandler) ListForwardingRules

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

ListForwardingRules lists all forwarding rules for a load balancer subscription

func (*LoadBalancerHandler) Update

func (l *LoadBalancerHandler) Update(ctx context.Context, ID 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"`
	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, error)
	Get(ctx context.Context, ID string) (*LoadBalancer, error)
	Update(ctx context.Context, ID string, updateReq *LoadBalancerReq) error
	Delete(ctx context.Context, ID string) error
	List(ctx context.Context, options *ListOptions) ([]LoadBalancer, *Meta, error)
	CreateForwardingRule(ctx context.Context, ID string, rule *ForwardingRule) (*ForwardingRule, error)
	GetForwardingRule(ctx context.Context, ID string, ruleID string) (*ForwardingRule, error)
	DeleteForwardingRule(ctx context.Context, ID string, RuleID string) error
	ListForwardingRules(ctx context.Context, ID string, options *ListOptions) ([]ForwardingRule, *Meta, error)
	ListFirewallRules(ctx context.Context, ID string, options *ListOptions) ([]LBFirewallRule, *Meta, error)
	GetFirewallRule(ctx context.Context, ID string, ruleID string) (*LBFirewallRule, 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 Meta

type Meta struct {
	Total int `json:"total"`
	Links *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, error)
	// Deprecated: NetworkService Get should no longer be used. Instead, use VPCService Get.
	Get(ctx context.Context, networkID string) (*Network, 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, 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, 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, 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

func (n *NetworkServiceHandler) List(ctx context.Context, options *ListOptions) ([]Network, *Meta, error)

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 string, description string) error

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

type Node added in v2.8.0

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 added in v2.8.0

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"`
	Nodes        []Node `json:"nodes"`
}

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

type NodePoolReq added in v2.8.0

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"`
}

NodePoolReq struct used to create a node pool

type NodePoolReqUpdate added in v2.8.0

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"`
}

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, 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, 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, error)
	Get(ctx context.Context, id string) (*ObjectStorage, error)
	Update(ctx context.Context, id, label string) error
	Delete(ctx context.Context, id string) error
	List(ctx context.Context, options *ListOptions) ([]ObjectStorage, *Meta, error)

	ListCluster(ctx context.Context, options *ListOptions) ([]ObjectStorageCluster, *Meta, error)
	RegenerateKeys(ctx context.Context, id string) (*S3Keys, 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 with the firewall rule methods for the Vultr API.

func (*ObjectStorageServiceHandler) Create

func (o *ObjectStorageServiceHandler) Create(ctx context.Context, clusterID int, label string) (*ObjectStorage, 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, 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 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, error)
	ListBareMetal(ctx context.Context, options *ListOptions) ([]BareMetalPlan, *Meta, 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, 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, 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, error)
	List(ctx context.Context, options *ListOptions) ([]Region, *Meta, 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 string, planType string) (*PlanAvailability, 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, error)

List returns all available regions

type ReinstallReq added in v2.11.0

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, error)
	Update(ctx context.Context, id string, ripUpdate *ReservedIPUpdateReq) (*ReservedIP, error)
	Get(ctx context.Context, id string) (*ReservedIP, error)
	Delete(ctx context.Context, id string) error
	List(ctx context.Context, options *ListOptions) ([]ReservedIP, *Meta, error)

	Convert(ctx context.Context, ripConvert *ReservedIPConvertReq) (*ReservedIP, 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

func (r *ReservedIPServiceHandler) Create(ctx context.Context, ripCreate *ReservedIPReq) (*ReservedIP, error)

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 added in v2.17.2

Update updates label on the Reserved IP

type ReservedIPUpdateReq added in v2.17.2

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, error)
	Get(ctx context.Context, sshKeyID string) (*SSHKey, 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, 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, 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, error)

Get a specific ssh key.

func (*SSHKeyServiceHandler) List

func (s *SSHKeyServiceHandler) List(ctx context.Context, options *ListOptions) ([]SSHKey, *Meta, 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, error)
	CreateFromURL(ctx context.Context, snapshotURLReq *SnapshotURLReq) (*Snapshot, error)
	Get(ctx context.Context, snapshotID string) (*Snapshot, error)
	Delete(ctx context.Context, snapshotID string) error
	List(ctx context.Context, options *ListOptions) ([]Snapshot, *Meta, 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, error)

Create makes a snapshot of a provided server

func (*SnapshotServiceHandler) CreateFromURL

func (s *SnapshotServiceHandler) CreateFromURL(ctx context.Context, snapshotURLReq *SnapshotURLReq) (*Snapshot, 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, error)

Get a specific snapshot

func (*SnapshotServiceHandler) List

func (s *SnapshotServiceHandler) List(ctx context.Context, options *ListOptions) ([]Snapshot, *Meta, error)

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"`
	Type   string `json:"type"`
	Script string `json:"script"`
}

StartupScriptReq is the user struct for create and update calls

type StartupScriptService

type StartupScriptService interface {
	Create(ctx context.Context, req *StartupScriptReq) (*StartupScript, error)
	Get(ctx context.Context, scriptID string) (*StartupScript, 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, 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 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, error)
	Get(ctx context.Context, userID string) (*User, 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, 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, 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, error)

Get will retrieve a specific user account

func (*UserServiceHandler) List

func (u *UserServiceHandler) List(ctx context.Context, options *ListOptions) ([]User, *Meta, 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 added in v2.15.0

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 VPCInfo added in v2.15.0

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 added in v2.15.0

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 added in v2.15.0

type VPCService interface {
	Create(ctx context.Context, createReq *VPCReq) (*VPC, error)
	Get(ctx context.Context, vpcID string) (*VPC, 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, 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 added in v2.15.0

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

VPCServiceHandler handles interaction with the VPC methods for the Vultr API

func (*VPCServiceHandler) Create added in v2.15.0

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

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

func (*VPCServiceHandler) Delete added in v2.15.0

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 added in v2.15.0

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

Get gets the VPC of the requested ID

func (*VPCServiceHandler) List added in v2.15.0

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

List lists all VPCs on the current account

func (*VPCServiceHandler) Update added in v2.15.0

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

Update updates a VPC

type Versions added in v2.8.1

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