Documentation ¶
Overview ¶
Package godo is the DigtalOcean API v2 client for Go
Index ¶
- Constants
- func Bool(v bool) *bool
- func CheckResponse(r *http.Response) error
- func DoRequest(ctx context.Context, req *http.Request) (*http.Response, error)
- func DoRequestWithClient(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)
- func Int(v int) *int
- func StreamToString(stream io.Reader) string
- func String(v string) *string
- func Stringify(message interface{}) string
- type Account
- type AccountService
- type AccountServiceOp
- type Action
- type ActionRequest
- type ActionsService
- type ActionsServiceOp
- type ArgError
- type BackupWindow
- type CDN
- type CDNCreateRequest
- type CDNFlushCacheRequest
- type CDNService
- type CDNServiceOp
- func (c CDNServiceOp) Create(ctx context.Context, createRequest *CDNCreateRequest) (*CDN, *Response, error)
- func (c CDNServiceOp) Delete(ctx context.Context, id string) (*Response, error)
- func (c CDNServiceOp) FlushCache(ctx context.Context, id string, flushCacheRequest *CDNFlushCacheRequest) (*Response, error)
- func (c CDNServiceOp) Get(ctx context.Context, id string) (*CDN, *Response, error)
- func (c CDNServiceOp) List(ctx context.Context, opt *ListOptions) ([]CDN, *Response, error)
- func (c CDNServiceOp) UpdateTTL(ctx context.Context, id string, updateRequest *CDNUpdateRequest) (*CDN, *Response, error)
- type CDNUpdateRequest
- type Certificate
- type CertificateRequest
- type CertificatesService
- type CertificatesServiceOp
- func (c *CertificatesServiceOp) Create(ctx context.Context, cr *CertificateRequest) (*Certificate, *Response, error)
- func (c *CertificatesServiceOp) Delete(ctx context.Context, cID string) (*Response, error)
- func (c *CertificatesServiceOp) Get(ctx context.Context, cID string) (*Certificate, *Response, error)
- func (c *CertificatesServiceOp) List(ctx context.Context, opt *ListOptions) ([]Certificate, *Response, error)
- type Client
- type ClientOpt
- type Destinations
- type Domain
- type DomainCreateRequest
- type DomainRecord
- type DomainRecordEditRequest
- type DomainsService
- type DomainsServiceOp
- func (s *DomainsServiceOp) Create(ctx context.Context, createRequest *DomainCreateRequest) (*Domain, *Response, error)
- func (s *DomainsServiceOp) CreateRecord(ctx context.Context, domain string, createRequest *DomainRecordEditRequest) (*DomainRecord, *Response, error)
- func (s *DomainsServiceOp) Delete(ctx context.Context, name string) (*Response, error)
- func (s *DomainsServiceOp) DeleteRecord(ctx context.Context, domain string, id int) (*Response, error)
- func (s *DomainsServiceOp) EditRecord(ctx context.Context, domain string, id int, ...) (*DomainRecord, *Response, error)
- func (s *DomainsServiceOp) Get(ctx context.Context, name string) (*Domain, *Response, error)
- func (s DomainsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Domain, *Response, error)
- func (s *DomainsServiceOp) Record(ctx context.Context, domain string, id int) (*DomainRecord, *Response, error)
- func (s *DomainsServiceOp) Records(ctx context.Context, domain string, opt *ListOptions) ([]DomainRecord, *Response, error)
- type Droplet
- type DropletActionsService
- type DropletActionsServiceOp
- func (s *DropletActionsServiceOp) ChangeKernel(ctx context.Context, id, kernelID int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) DisableBackups(ctx context.Context, id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) DisableBackupsByTag(ctx context.Context, tag string) ([]Action, *Response, error)
- func (s *DropletActionsServiceOp) EnableBackups(ctx context.Context, id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) EnableBackupsByTag(ctx context.Context, tag string) ([]Action, *Response, error)
- func (s *DropletActionsServiceOp) EnableIPv6(ctx context.Context, id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) EnableIPv6ByTag(ctx context.Context, tag string) ([]Action, *Response, error)
- func (s *DropletActionsServiceOp) EnablePrivateNetworking(ctx context.Context, id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) EnablePrivateNetworkingByTag(ctx context.Context, tag string) ([]Action, *Response, error)
- func (s *DropletActionsServiceOp) Get(ctx context.Context, dropletID, actionID int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) GetByURI(ctx context.Context, rawurl string) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) PasswordReset(ctx context.Context, id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) PowerCycle(ctx context.Context, id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) PowerCycleByTag(ctx context.Context, tag string) ([]Action, *Response, error)
- func (s *DropletActionsServiceOp) PowerOff(ctx context.Context, id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) PowerOffByTag(ctx context.Context, tag string) ([]Action, *Response, error)
- func (s *DropletActionsServiceOp) PowerOn(ctx context.Context, id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) PowerOnByTag(ctx context.Context, tag string) ([]Action, *Response, error)
- func (s *DropletActionsServiceOp) Reboot(ctx context.Context, id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) RebuildByImageID(ctx context.Context, id, imageID int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) RebuildByImageSlug(ctx context.Context, id int, slug string) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) Rename(ctx context.Context, id int, name string) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) Resize(ctx context.Context, id int, sizeSlug string, resizeDisk bool) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) Restore(ctx context.Context, id, imageID int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) Shutdown(ctx context.Context, id int) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) ShutdownByTag(ctx context.Context, tag string) ([]Action, *Response, error)
- func (s *DropletActionsServiceOp) Snapshot(ctx context.Context, id int, name string) (*Action, *Response, error)
- func (s *DropletActionsServiceOp) SnapshotByTag(ctx context.Context, tag string, name string) ([]Action, *Response, error)
- type DropletCreateImage
- type DropletCreateRequest
- type DropletCreateSSHKey
- type DropletCreateVolume
- type DropletMultiCreateRequest
- type DropletsService
- type DropletsServiceOp
- func (s *DropletsServiceOp) Actions(ctx context.Context, dropletID int, opt *ListOptions) ([]Action, *Response, error)
- func (s *DropletsServiceOp) Backups(ctx context.Context, dropletID int, opt *ListOptions) ([]Image, *Response, error)
- func (s *DropletsServiceOp) Create(ctx context.Context, createRequest *DropletCreateRequest) (*Droplet, *Response, error)
- func (s *DropletsServiceOp) CreateMultiple(ctx context.Context, createRequest *DropletMultiCreateRequest) ([]Droplet, *Response, error)
- func (s *DropletsServiceOp) Delete(ctx context.Context, dropletID int) (*Response, error)
- func (s *DropletsServiceOp) DeleteByTag(ctx context.Context, tag string) (*Response, error)
- func (s *DropletsServiceOp) Get(ctx context.Context, dropletID int) (*Droplet, *Response, error)
- func (s *DropletsServiceOp) Kernels(ctx context.Context, dropletID int, opt *ListOptions) ([]Kernel, *Response, error)
- func (s *DropletsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Droplet, *Response, error)
- func (s *DropletsServiceOp) ListByTag(ctx context.Context, tag string, opt *ListOptions) ([]Droplet, *Response, error)
- func (s *DropletsServiceOp) Neighbors(ctx context.Context, dropletID int) ([]Droplet, *Response, error)
- func (s *DropletsServiceOp) Snapshots(ctx context.Context, dropletID int, opt *ListOptions) ([]Image, *Response, error)
- type ErrorResponse
- type Firewall
- type FirewallRequest
- type FirewallRulesRequest
- type FirewallsService
- type FirewallsServiceOp
- func (fw *FirewallsServiceOp) AddDroplets(ctx context.Context, fID string, dropletIDs ...int) (*Response, error)
- func (fw *FirewallsServiceOp) AddRules(ctx context.Context, fID string, rr *FirewallRulesRequest) (*Response, error)
- func (fw *FirewallsServiceOp) AddTags(ctx context.Context, fID string, tags ...string) (*Response, error)
- func (fw *FirewallsServiceOp) Create(ctx context.Context, fr *FirewallRequest) (*Firewall, *Response, error)
- func (fw *FirewallsServiceOp) Delete(ctx context.Context, fID string) (*Response, error)
- func (fw *FirewallsServiceOp) Get(ctx context.Context, fID string) (*Firewall, *Response, error)
- func (fw *FirewallsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Firewall, *Response, error)
- func (fw *FirewallsServiceOp) ListByDroplet(ctx context.Context, dID int, opt *ListOptions) ([]Firewall, *Response, error)
- func (fw *FirewallsServiceOp) RemoveDroplets(ctx context.Context, fID string, dropletIDs ...int) (*Response, error)
- func (fw *FirewallsServiceOp) RemoveRules(ctx context.Context, fID string, rr *FirewallRulesRequest) (*Response, error)
- func (fw *FirewallsServiceOp) RemoveTags(ctx context.Context, fID string, tags ...string) (*Response, error)
- func (fw *FirewallsServiceOp) Update(ctx context.Context, fID string, fr *FirewallRequest) (*Firewall, *Response, error)
- type FloatingIP
- type FloatingIPActionsService
- type FloatingIPActionsServiceOp
- func (s *FloatingIPActionsServiceOp) Assign(ctx context.Context, ip string, dropletID int) (*Action, *Response, error)
- func (s *FloatingIPActionsServiceOp) Get(ctx context.Context, ip string, actionID int) (*Action, *Response, error)
- func (s *FloatingIPActionsServiceOp) List(ctx context.Context, ip string, opt *ListOptions) ([]Action, *Response, error)
- func (s *FloatingIPActionsServiceOp) Unassign(ctx context.Context, ip string) (*Action, *Response, error)
- type FloatingIPCreateRequest
- type FloatingIPsService
- type FloatingIPsServiceOp
- func (f *FloatingIPsServiceOp) Create(ctx context.Context, createRequest *FloatingIPCreateRequest) (*FloatingIP, *Response, error)
- func (f *FloatingIPsServiceOp) Delete(ctx context.Context, ip string) (*Response, error)
- func (f *FloatingIPsServiceOp) Get(ctx context.Context, ip string) (*FloatingIP, *Response, error)
- func (f *FloatingIPsServiceOp) List(ctx context.Context, opt *ListOptions) ([]FloatingIP, *Response, error)
- type ForwardingRule
- type HealthCheck
- type Image
- type ImageActionsService
- type ImageActionsServiceOp
- func (i *ImageActionsServiceOp) Convert(ctx context.Context, imageID int) (*Action, *Response, error)
- func (i *ImageActionsServiceOp) Get(ctx context.Context, imageID, actionID int) (*Action, *Response, error)
- func (i *ImageActionsServiceOp) Transfer(ctx context.Context, imageID int, transferRequest *ActionRequest) (*Action, *Response, error)
- type ImageUpdateRequest
- type ImagesService
- type ImagesServiceOp
- func (s *ImagesServiceOp) Delete(ctx context.Context, imageID int) (*Response, error)
- func (s *ImagesServiceOp) GetByID(ctx context.Context, imageID int) (*Image, *Response, error)
- func (s *ImagesServiceOp) GetBySlug(ctx context.Context, slug string) (*Image, *Response, error)
- func (s *ImagesServiceOp) List(ctx context.Context, opt *ListOptions) ([]Image, *Response, error)
- func (s *ImagesServiceOp) ListApplication(ctx context.Context, opt *ListOptions) ([]Image, *Response, error)
- func (s *ImagesServiceOp) ListDistribution(ctx context.Context, opt *ListOptions) ([]Image, *Response, error)
- func (s *ImagesServiceOp) ListUser(ctx context.Context, opt *ListOptions) ([]Image, *Response, error)
- func (s *ImagesServiceOp) Update(ctx context.Context, imageID int, updateRequest *ImageUpdateRequest) (*Image, *Response, error)
- type InboundRule
- type Kernel
- type Key
- type KeyCreateRequest
- type KeyUpdateRequest
- type KeysService
- type KeysServiceOp
- func (s *KeysServiceOp) Create(ctx context.Context, createRequest *KeyCreateRequest) (*Key, *Response, error)
- func (s *KeysServiceOp) DeleteByFingerprint(ctx context.Context, fingerprint string) (*Response, error)
- func (s *KeysServiceOp) DeleteByID(ctx context.Context, keyID int) (*Response, error)
- func (s *KeysServiceOp) GetByFingerprint(ctx context.Context, fingerprint string) (*Key, *Response, error)
- func (s *KeysServiceOp) GetByID(ctx context.Context, keyID int) (*Key, *Response, error)
- func (s *KeysServiceOp) List(ctx context.Context, opt *ListOptions) ([]Key, *Response, error)
- func (s *KeysServiceOp) UpdateByFingerprint(ctx context.Context, fingerprint string, updateRequest *KeyUpdateRequest) (*Key, *Response, error)
- func (s *KeysServiceOp) UpdateByID(ctx context.Context, keyID int, updateRequest *KeyUpdateRequest) (*Key, *Response, error)
- type LinkAction
- type Links
- type ListOptions
- type ListVolumeParams
- type LoadBalancer
- type LoadBalancerRequest
- type LoadBalancersService
- type LoadBalancersServiceOp
- func (l *LoadBalancersServiceOp) AddDroplets(ctx context.Context, lbID string, dropletIDs ...int) (*Response, error)
- func (l *LoadBalancersServiceOp) AddForwardingRules(ctx context.Context, lbID string, rules ...ForwardingRule) (*Response, error)
- func (l *LoadBalancersServiceOp) Create(ctx context.Context, lbr *LoadBalancerRequest) (*LoadBalancer, *Response, error)
- func (l *LoadBalancersServiceOp) Delete(ctx context.Context, ldID string) (*Response, error)
- func (l *LoadBalancersServiceOp) Get(ctx context.Context, lbID string) (*LoadBalancer, *Response, error)
- func (l *LoadBalancersServiceOp) List(ctx context.Context, opt *ListOptions) ([]LoadBalancer, *Response, error)
- func (l *LoadBalancersServiceOp) RemoveDroplets(ctx context.Context, lbID string, dropletIDs ...int) (*Response, error)
- func (l *LoadBalancersServiceOp) RemoveForwardingRules(ctx context.Context, lbID string, rules ...ForwardingRule) (*Response, error)
- func (l *LoadBalancersServiceOp) Update(ctx context.Context, lbID string, lbr *LoadBalancerRequest) (*LoadBalancer, *Response, error)
- type NetworkV4
- type NetworkV6
- type Networks
- type OutboundRule
- type Pages
- type PendingChange
- type Rate
- type Region
- type RegionsService
- type RegionsServiceOp
- type RequestCompletionCallback
- type Resource
- type ResourceType
- type Response
- type Size
- type SizesService
- type SizesServiceOp
- type Snapshot
- type SnapshotCreateRequest
- type SnapshotsService
- type SnapshotsServiceOp
- func (s *SnapshotsServiceOp) Delete(ctx context.Context, snapshotID string) (*Response, error)
- func (s *SnapshotsServiceOp) Get(ctx context.Context, snapshotID string) (*Snapshot, *Response, error)
- func (s *SnapshotsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Snapshot, *Response, error)
- func (s *SnapshotsServiceOp) ListDroplet(ctx context.Context, opt *ListOptions) ([]Snapshot, *Response, error)
- func (s *SnapshotsServiceOp) ListVolume(ctx context.Context, opt *ListOptions) ([]Snapshot, *Response, error)
- type Sources
- type StickySessions
- type StorageActionsService
- type StorageActionsServiceOp
- func (s *StorageActionsServiceOp) Attach(ctx context.Context, volumeID string, dropletID int) (*Action, *Response, error)
- func (s *StorageActionsServiceOp) DetachByDropletID(ctx context.Context, volumeID string, dropletID int) (*Action, *Response, error)
- func (s *StorageActionsServiceOp) Get(ctx context.Context, volumeID string, actionID int) (*Action, *Response, error)
- func (s *StorageActionsServiceOp) List(ctx context.Context, volumeID string, opt *ListOptions) ([]Action, *Response, error)
- func (s *StorageActionsServiceOp) Resize(ctx context.Context, volumeID string, sizeGigabytes int, regionSlug string) (*Action, *Response, error)
- type StorageAttachment
- type StorageService
- type StorageServiceOp
- func (svc *StorageServiceOp) CreateSnapshot(ctx context.Context, createRequest *SnapshotCreateRequest) (*Snapshot, *Response, error)
- func (svc *StorageServiceOp) CreateVolume(ctx context.Context, createRequest *VolumeCreateRequest) (*Volume, *Response, error)
- func (svc *StorageServiceOp) DeleteSnapshot(ctx context.Context, id string) (*Response, error)
- func (svc *StorageServiceOp) DeleteVolume(ctx context.Context, id string) (*Response, error)
- func (svc *StorageServiceOp) GetSnapshot(ctx context.Context, id string) (*Snapshot, *Response, error)
- func (svc *StorageServiceOp) GetVolume(ctx context.Context, id string) (*Volume, *Response, error)
- func (svc *StorageServiceOp) ListSnapshots(ctx context.Context, volumeID string, opt *ListOptions) ([]Snapshot, *Response, error)
- func (svc *StorageServiceOp) ListVolumes(ctx context.Context, params *ListVolumeParams) ([]Volume, *Response, error)
- type Tag
- type TagCreateRequest
- type TagResourcesRequest
- type TaggedDropletsResources
- type TaggedResources
- type TagsService
- type TagsServiceOp
- func (s *TagsServiceOp) Create(ctx context.Context, createRequest *TagCreateRequest) (*Tag, *Response, error)
- func (s *TagsServiceOp) Delete(ctx context.Context, name string) (*Response, error)
- func (s *TagsServiceOp) Get(ctx context.Context, name string) (*Tag, *Response, error)
- func (s *TagsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Tag, *Response, error)
- func (s *TagsServiceOp) TagResources(ctx context.Context, name string, tagRequest *TagResourcesRequest) (*Response, error)
- func (s *TagsServiceOp) UntagResources(ctx context.Context, name string, untagRequest *UntagResourcesRequest) (*Response, error)
- type Timestamp
- type UntagResourcesRequest
- type Volume
- type VolumeCreateRequest
Constants ¶
const ( // ActionInProgress is an in progress action status ActionInProgress = "in-progress" //ActionCompleted is a completed action status ActionCompleted = "completed" )
Variables ¶
This section is empty.
Functions ¶
func Bool ¶ added in v0.3.1
Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.
func CheckResponse ¶ added in v0.3.1
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
func DoRequestWithClient ¶ added in v1.4.1
func DoRequestWithClient( ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)
DoRequestWithClient submits an HTTP request using the specified client.
func Int ¶ added in v0.3.1
Int is a helper routine that allocates a new int32 value to store v and returns a pointer to it, but unlike Int32 its argument value is an int.
func StreamToString ¶ added in v0.3.1
StreamToString converts a reader to a string
Types ¶
type Account ¶ added in v0.9.0
type Account struct { DropletLimit int `json:"droplet_limit,omitempty"` FloatingIPLimit int `json:"floating_ip_limit,omitempty"` Email string `json:"email,omitempty"` UUID string `json:"uuid,omitempty"` EmailVerified bool `json:"email_verified,omitempty"` Status string `json:"status,omitempty"` StatusMessage string `json:"status_message,omitempty"` }
Account represents a DigitalOcean Account
type AccountService ¶ added in v0.9.0
AccountService is an interface for interfacing with the Account endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2/#account
type AccountServiceOp ¶ added in v0.9.0
type AccountServiceOp struct {
// contains filtered or unexported fields
}
AccountServiceOp handles communication with the Account related methods of the DigitalOcean API.
type Action ¶ added in v0.3.1
type Action struct { ID int `json:"id"` Status string `json:"status"` Type string `json:"type"` StartedAt *Timestamp `json:"started_at"` CompletedAt *Timestamp `json:"completed_at"` ResourceID int `json:"resource_id"` ResourceType string `json:"resource_type"` Region *Region `json:"region,omitempty"` RegionSlug string `json:"region_slug,omitempty"` }
Action represents a DigitalOcean Action
type ActionRequest ¶ added in v0.3.1
type ActionRequest map[string]interface{}
ActionRequest reprents DigitalOcean Action Request
type ActionsService ¶ added in v0.3.1
type ActionsService interface { List(context.Context, *ListOptions) ([]Action, *Response, error) Get(context.Context, int) (*Action, *Response, error) }
ActionsService handles communction with action related methods of the DigitalOcean API: https://developers.digitalocean.com/documentation/v2#actions
type ActionsServiceOp ¶ added in v0.3.1
type ActionsServiceOp struct {
// contains filtered or unexported fields
}
ActionsServiceOp handles communition with the image action related methods of the DigitalOcean API.
func (*ActionsServiceOp) List ¶ added in v0.3.1
func (s *ActionsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Action, *Response, error)
List all actions
type ArgError ¶ added in v0.9.0
type ArgError struct {
// contains filtered or unexported fields
}
ArgError is an error that represents an error with an input to godo. It identifies the argument and the cause (if possible).
func NewArgError ¶ added in v0.9.0
NewArgError creates an InputError.
type BackupWindow ¶ added in v1.1.1
type BackupWindow struct { Start *Timestamp `json:"start,omitempty"` End *Timestamp `json:"end,omitempty"` }
BackupWindow object
type CDN ¶ added in v1.4.1
type CDN struct { ID string `json:"id"` Origin string `json:"origin"` Endpoint string `json:"endpoint"` CreatedAt time.Time `json:"created_at"` TTL uint32 `json:"ttl"` }
CDN represents a DigitalOcean CDN
type CDNCreateRequest ¶ added in v1.4.1
CDNCreateRequest represents a request to create a CDN.
type CDNFlushCacheRequest ¶ added in v1.4.1
type CDNFlushCacheRequest struct {
Files []string `json:"files"`
}
CDNFlushCacheRequest represents a request to flush cache of a CDN.
type CDNService ¶ added in v1.4.1
type CDNService interface { List(context.Context, *ListOptions) ([]CDN, *Response, error) Get(context.Context, string) (*CDN, *Response, error) Create(context.Context, *CDNCreateRequest) (*CDN, *Response, error) UpdateTTL(context.Context, string, *CDNUpdateRequest) (*CDN, *Response, error) FlushCache(context.Context, string, *CDNFlushCacheRequest) (*Response, error) Delete(context.Context, string) (*Response, error) }
CDNService is an interface for managing Spaces CDN with the DigitalOcean API.
type CDNServiceOp ¶ added in v1.4.1
type CDNServiceOp struct {
// contains filtered or unexported fields
}
CDNServiceOp handles communication with the CDN related methods of the DigitalOcean API.
func (CDNServiceOp) Create ¶ added in v1.4.1
func (c CDNServiceOp) Create(ctx context.Context, createRequest *CDNCreateRequest) (*CDN, *Response, error)
Create a new CDN
func (CDNServiceOp) FlushCache ¶ added in v1.4.1
func (c CDNServiceOp) FlushCache(ctx context.Context, id string, flushCacheRequest *CDNFlushCacheRequest) (*Response, error)
FlushCache flushes the cache of an individual CDN. Requires a non-empty slice of file paths and/or wildcards
func (CDNServiceOp) List ¶ added in v1.4.1
func (c CDNServiceOp) List(ctx context.Context, opt *ListOptions) ([]CDN, *Response, error)
List all CDN endpoints
func (CDNServiceOp) UpdateTTL ¶ added in v1.4.1
func (c CDNServiceOp) UpdateTTL(ctx context.Context, id string, updateRequest *CDNUpdateRequest) (*CDN, *Response, error)
UpdateTTL updates the ttl of individual CDN
type CDNUpdateRequest ¶ added in v1.4.1
type CDNUpdateRequest struct {
TTL uint32 `json:"ttl"`
}
CDNUpdateRequest represents a request to update the ttl of a CDN.
type Certificate ¶ added in v1.1.1
type Certificate struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` DNSNames []string `json:"dns_names,omitempty"` NotAfter string `json:"not_after,omitempty"` SHA1Fingerprint string `json:"sha1_fingerprint,omitempty"` Created string `json:"created_at,omitempty"` State string `json:"state,omitempty"` Type string `json:"type,omitempty"` }
Certificate represents a DigitalOcean certificate configuration.
type CertificateRequest ¶ added in v1.1.1
type CertificateRequest struct { Name string `json:"name,omitempty"` DNSNames []string `json:"dns_names,omitempty"` PrivateKey string `json:"private_key,omitempty"` LeafCertificate string `json:"leaf_certificate,omitempty"` CertificateChain string `json:"certificate_chain,omitempty"` Type string `json:"type,omitempty"` }
CertificateRequest represents configuration for a new certificate.
type CertificatesService ¶ added in v1.1.1
type CertificatesService interface { Get(context.Context, string) (*Certificate, *Response, error) List(context.Context, *ListOptions) ([]Certificate, *Response, error) Create(context.Context, *CertificateRequest) (*Certificate, *Response, error) Delete(context.Context, string) (*Response, error) }
CertificatesService is an interface for managing certificates with the DigitalOcean API. See: https://developers.digitalocean.com/documentation/v2/#certificates
type CertificatesServiceOp ¶ added in v1.1.1
type CertificatesServiceOp struct {
// contains filtered or unexported fields
}
CertificatesServiceOp handles communication with certificates methods of the DigitalOcean API.
func (*CertificatesServiceOp) Create ¶ added in v1.1.1
func (c *CertificatesServiceOp) Create(ctx context.Context, cr *CertificateRequest) (*Certificate, *Response, error)
Create a new certificate with provided configuration.
func (*CertificatesServiceOp) Get ¶ added in v1.1.1
func (c *CertificatesServiceOp) Get(ctx context.Context, cID string) (*Certificate, *Response, error)
Get an existing certificate by its identifier.
func (*CertificatesServiceOp) List ¶ added in v1.1.1
func (c *CertificatesServiceOp) List(ctx context.Context, opt *ListOptions) ([]Certificate, *Response, error)
List all certificates.
type Client ¶ added in v0.3.1
type Client struct { // Base URL for API requests. BaseURL *url.URL // User agent for client UserAgent string // Rate contains the current rate limit for the client as determined by the most recent // API call. Rate Rate // Services used for communicating with the API Account AccountService Actions ActionsService CDNs CDNService Domains DomainsService Droplets DropletsService DropletActions DropletActionsService Images ImagesService ImageActions ImageActionsService Keys KeysService Regions RegionsService Sizes SizesService FloatingIPs FloatingIPsService FloatingIPActions FloatingIPActionsService Snapshots SnapshotsService Storage StorageService StorageActions StorageActionsService Tags TagsService LoadBalancers LoadBalancersService Certificates CertificatesService Firewalls FirewallsService // contains filtered or unexported fields }
Client manages communication with DigitalOcean V2 API.
func (*Client) Do ¶ added in v0.3.1
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.
func (*Client) NewRequest ¶ added in v0.3.1
func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body.
func (*Client) OnRequestCompleted ¶ added in v0.9.0
func (c *Client) OnRequestCompleted(rc RequestCompletionCallback)
OnRequestCompleted sets the DO API request completion callback
type ClientOpt ¶ added in v1.1.1
ClientOpt are options for New.
func SetBaseURL ¶ added in v1.1.1
SetBaseURL is a client option for setting the base URL.
func SetUserAgent ¶ added in v1.1.1
SetUserAgent is a client option for setting the user agent.
type Destinations ¶ added in v1.1.1
type Destinations struct { Addresses []string `json:"addresses,omitempty"` Tags []string `json:"tags,omitempty"` DropletIDs []int `json:"droplet_ids,omitempty"` LoadBalancerUIDs []string `json:"load_balancer_uids,omitempty"` }
Destinations represents a DigitalOcean Firewall OutboundRule destinations.
type Domain ¶ added in v0.3.1
type Domain struct { Name string `json:"name"` TTL int `json:"ttl"` ZoneFile string `json:"zone_file"` }
Domain represents a DigitalOcean domain
type DomainCreateRequest ¶ added in v0.3.1
type DomainCreateRequest struct { Name string `json:"name"` IPAddress string `json:"ip_address,omitempty"` }
DomainCreateRequest respresents a request to create a domain.
type DomainRecord ¶ added in v0.3.1
type DomainRecord struct { ID int `json:"id,float64,omitempty"` Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Data string `json:"data,omitempty"` Priority int `json:"priority"` Port int `json:"port,omitempty"` TTL int `json:"ttl,omitempty"` Weight int `json:"weight,omitempty"` Flags int `json:"flags"` Tag string `json:"tag,omitempty"` }
DomainRecord represents a DigitalOcean DomainRecord
func (DomainRecord) String ¶ added in v0.3.1
func (d DomainRecord) String() string
Converts a DomainRecord to a string.
type DomainRecordEditRequest ¶ added in v0.3.1
type DomainRecordEditRequest struct { Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Data string `json:"data,omitempty"` Priority int `json:"priority"` Port int `json:"port,omitempty"` TTL int `json:"ttl,omitempty"` Weight int `json:"weight,omitempty"` Flags int `json:"flags"` Tag string `json:"tag,omitempty"` }
DomainRecordEditRequest represents a request to update a domain record.
func (DomainRecordEditRequest) String ¶ added in v0.3.1
func (d DomainRecordEditRequest) String() string
Converts a DomainRecordEditRequest to a string.
type DomainsService ¶ added in v0.3.1
type DomainsService interface { List(context.Context, *ListOptions) ([]Domain, *Response, error) Get(context.Context, string) (*Domain, *Response, error) Create(context.Context, *DomainCreateRequest) (*Domain, *Response, error) Delete(context.Context, string) (*Response, error) Records(context.Context, string, *ListOptions) ([]DomainRecord, *Response, error) Record(context.Context, string, int) (*DomainRecord, *Response, error) DeleteRecord(context.Context, string, int) (*Response, error) EditRecord(context.Context, string, int, *DomainRecordEditRequest) (*DomainRecord, *Response, error) CreateRecord(context.Context, string, *DomainRecordEditRequest) (*DomainRecord, *Response, error) }
DomainsService is an interface for managing DNS with the DigitalOcean API. See: https://developers.digitalocean.com/documentation/v2#domains and https://developers.digitalocean.com/documentation/v2#domain-records
type DomainsServiceOp ¶ added in v0.3.1
type DomainsServiceOp struct {
// contains filtered or unexported fields
}
DomainsServiceOp handles communication with the domain related methods of the DigitalOcean API.
func (*DomainsServiceOp) Create ¶ added in v0.3.1
func (s *DomainsServiceOp) Create(ctx context.Context, createRequest *DomainCreateRequest) (*Domain, *Response, error)
Create a new domain
func (*DomainsServiceOp) CreateRecord ¶ added in v0.3.1
func (s *DomainsServiceOp) CreateRecord(ctx context.Context, domain string, createRequest *DomainRecordEditRequest) (*DomainRecord, *Response, error)
CreateRecord creates a record using a DomainRecordEditRequest
func (*DomainsServiceOp) DeleteRecord ¶ added in v0.3.1
func (s *DomainsServiceOp) DeleteRecord(ctx context.Context, domain string, id int) (*Response, error)
DeleteRecord deletes a record from a domain identified by id
func (*DomainsServiceOp) EditRecord ¶ added in v0.3.1
func (s *DomainsServiceOp) EditRecord(ctx context.Context, domain string, id int, editRequest *DomainRecordEditRequest, ) (*DomainRecord, *Response, error)
EditRecord edits a record using a DomainRecordEditRequest
func (*DomainsServiceOp) Get ¶ added in v0.3.1
Get individual domain. It requires a non-empty domain name.
func (DomainsServiceOp) List ¶ added in v0.3.1
func (s DomainsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Domain, *Response, error)
List all domains.
func (*DomainsServiceOp) Record ¶ added in v0.3.1
func (s *DomainsServiceOp) Record(ctx context.Context, domain string, id int) (*DomainRecord, *Response, error)
Record returns the record id from a domain
func (*DomainsServiceOp) Records ¶ added in v0.3.1
func (s *DomainsServiceOp) Records(ctx context.Context, domain string, opt *ListOptions) ([]DomainRecord, *Response, error)
Records returns a slice of DomainRecords for a domain
type Droplet ¶ added in v0.3.1
type Droplet struct { ID int `json:"id,float64,omitempty"` Name string `json:"name,omitempty"` Memory int `json:"memory,omitempty"` Vcpus int `json:"vcpus,omitempty"` Disk int `json:"disk,omitempty"` Region *Region `json:"region,omitempty"` Image *Image `json:"image,omitempty"` Size *Size `json:"size,omitempty"` SizeSlug string `json:"size_slug,omitempty"` BackupIDs []int `json:"backup_ids,omitempty"` NextBackupWindow *BackupWindow `json:"next_backup_window,omitempty"` SnapshotIDs []int `json:"snapshot_ids,omitempty"` Features []string `json:"features,omitempty"` Locked bool `json:"locked,bool,omitempty"` Status string `json:"status,omitempty"` Networks *Networks `json:"networks,omitempty"` Created string `json:"created_at,omitempty"` Kernel *Kernel `json:"kernel,omitempty"` Tags []string `json:"tags,omitempty"` VolumeIDs []string `json:"volume_ids"` }
Droplet represents a DigitalOcean Droplet
func (*Droplet) PrivateIPv4 ¶ added in v1.1.1
PrivateIPv4 returns the private IPv4 address for the Droplet.
func (*Droplet) PublicIPv4 ¶ added in v1.1.1
PublicIPv4 returns the public IPv4 address for the Droplet.
func (*Droplet) PublicIPv6 ¶ added in v1.1.1
PublicIPv6 returns the public IPv6 address for the Droplet.
type DropletActionsService ¶ added in v0.3.1
type DropletActionsService interface { Shutdown(context.Context, int) (*Action, *Response, error) ShutdownByTag(context.Context, string) ([]Action, *Response, error) PowerOff(context.Context, int) (*Action, *Response, error) PowerOffByTag(context.Context, string) ([]Action, *Response, error) PowerOn(context.Context, int) (*Action, *Response, error) PowerOnByTag(context.Context, string) ([]Action, *Response, error) PowerCycle(context.Context, int) (*Action, *Response, error) PowerCycleByTag(context.Context, string) ([]Action, *Response, error) Reboot(context.Context, int) (*Action, *Response, error) Restore(context.Context, int, int) (*Action, *Response, error) Resize(context.Context, int, string, bool) (*Action, *Response, error) Rename(context.Context, int, string) (*Action, *Response, error) Snapshot(context.Context, int, string) (*Action, *Response, error) SnapshotByTag(context.Context, string, string) ([]Action, *Response, error) EnableBackups(context.Context, int) (*Action, *Response, error) EnableBackupsByTag(context.Context, string) ([]Action, *Response, error) DisableBackups(context.Context, int) (*Action, *Response, error) DisableBackupsByTag(context.Context, string) ([]Action, *Response, error) PasswordReset(context.Context, int) (*Action, *Response, error) RebuildByImageID(context.Context, int, int) (*Action, *Response, error) RebuildByImageSlug(context.Context, int, string) (*Action, *Response, error) ChangeKernel(context.Context, int, int) (*Action, *Response, error) EnableIPv6(context.Context, int) (*Action, *Response, error) EnableIPv6ByTag(context.Context, string) ([]Action, *Response, error) EnablePrivateNetworking(context.Context, int) (*Action, *Response, error) EnablePrivateNetworkingByTag(context.Context, string) ([]Action, *Response, error) Get(context.Context, int, int) (*Action, *Response, error) GetByURI(context.Context, string) (*Action, *Response, error) }
DropletActionsService is an interface for interfacing with the Droplet actions endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#droplet-actions
type DropletActionsServiceOp ¶ added in v0.3.1
type DropletActionsServiceOp struct {
// contains filtered or unexported fields
}
DropletActionsServiceOp handles communication with the Droplet action related methods of the DigitalOcean API.
func (*DropletActionsServiceOp) ChangeKernel ¶ added in v0.9.0
func (s *DropletActionsServiceOp) ChangeKernel(ctx context.Context, id, kernelID int) (*Action, *Response, error)
ChangeKernel changes the kernel for a Droplet.
func (*DropletActionsServiceOp) DisableBackups ¶ added in v0.9.0
func (s *DropletActionsServiceOp) DisableBackups(ctx context.Context, id int) (*Action, *Response, error)
DisableBackups disables backups for a Droplet.
func (*DropletActionsServiceOp) DisableBackupsByTag ¶ added in v1.1.1
func (s *DropletActionsServiceOp) DisableBackupsByTag(ctx context.Context, tag string) ([]Action, *Response, error)
DisableBackupsByTag disables backups for Droplet matched by a Tag.
func (*DropletActionsServiceOp) EnableBackups ¶ added in v1.1.1
func (s *DropletActionsServiceOp) EnableBackups(ctx context.Context, id int) (*Action, *Response, error)
EnableBackups enables backups for a Droplet.
func (*DropletActionsServiceOp) EnableBackupsByTag ¶ added in v1.1.1
func (s *DropletActionsServiceOp) EnableBackupsByTag(ctx context.Context, tag string) ([]Action, *Response, error)
EnableBackupsByTag enables backups for Droplets matched by a Tag.
func (*DropletActionsServiceOp) EnableIPv6 ¶ added in v0.9.0
func (s *DropletActionsServiceOp) EnableIPv6(ctx context.Context, id int) (*Action, *Response, error)
EnableIPv6 enables IPv6 for a Droplet.
func (*DropletActionsServiceOp) EnableIPv6ByTag ¶ added in v1.1.1
func (s *DropletActionsServiceOp) EnableIPv6ByTag(ctx context.Context, tag string) ([]Action, *Response, error)
EnableIPv6ByTag enables IPv6 for Droplets matched by a Tag.
func (*DropletActionsServiceOp) EnablePrivateNetworking ¶ added in v0.9.0
func (s *DropletActionsServiceOp) EnablePrivateNetworking(ctx context.Context, id int) (*Action, *Response, error)
EnablePrivateNetworking enables private networking for a Droplet.
func (*DropletActionsServiceOp) EnablePrivateNetworkingByTag ¶ added in v1.1.1
func (s *DropletActionsServiceOp) EnablePrivateNetworkingByTag(ctx context.Context, tag string) ([]Action, *Response, error)
EnablePrivateNetworkingByTag enables private networking for Droplets matched by a Tag.
func (*DropletActionsServiceOp) Get ¶ added in v0.3.1
func (s *DropletActionsServiceOp) Get(ctx context.Context, dropletID, actionID int) (*Action, *Response, error)
Get an action for a particular Droplet by id.
func (*DropletActionsServiceOp) GetByURI ¶ added in v0.3.1
func (s *DropletActionsServiceOp) GetByURI(ctx context.Context, rawurl string) (*Action, *Response, error)
GetByURI gets an action for a particular Droplet by id.
func (*DropletActionsServiceOp) PasswordReset ¶ added in v0.9.0
func (s *DropletActionsServiceOp) PasswordReset(ctx context.Context, id int) (*Action, *Response, error)
PasswordReset resets the password for a Droplet.
func (*DropletActionsServiceOp) PowerCycle ¶ added in v0.3.1
func (s *DropletActionsServiceOp) PowerCycle(ctx context.Context, id int) (*Action, *Response, error)
PowerCycle a Droplet
func (*DropletActionsServiceOp) PowerCycleByTag ¶ added in v1.1.1
func (s *DropletActionsServiceOp) PowerCycleByTag(ctx context.Context, tag string) ([]Action, *Response, error)
PowerCycleByTag power cycles Droplets matched by a Tag.
func (*DropletActionsServiceOp) PowerOffByTag ¶ added in v1.1.1
func (s *DropletActionsServiceOp) PowerOffByTag(ctx context.Context, tag string) ([]Action, *Response, error)
PowerOffByTag powers off Droplets matched by a Tag.
func (*DropletActionsServiceOp) PowerOnByTag ¶ added in v1.1.1
func (s *DropletActionsServiceOp) PowerOnByTag(ctx context.Context, tag string) ([]Action, *Response, error)
PowerOnByTag powers on Droplets matched by a Tag.
func (*DropletActionsServiceOp) RebuildByImageID ¶ added in v0.9.0
func (s *DropletActionsServiceOp) RebuildByImageID(ctx context.Context, id, imageID int) (*Action, *Response, error)
RebuildByImageID rebuilds a Droplet from an image with a given id.
func (*DropletActionsServiceOp) RebuildByImageSlug ¶ added in v0.9.0
func (s *DropletActionsServiceOp) RebuildByImageSlug(ctx context.Context, id int, slug string) (*Action, *Response, error)
RebuildByImageSlug rebuilds a Droplet from an Image matched by a given Slug.
func (*DropletActionsServiceOp) Rename ¶ added in v0.3.1
func (s *DropletActionsServiceOp) Rename(ctx context.Context, id int, name string) (*Action, *Response, error)
Rename a Droplet
func (*DropletActionsServiceOp) Resize ¶ added in v0.3.1
func (s *DropletActionsServiceOp) Resize(ctx context.Context, id int, sizeSlug string, resizeDisk bool) (*Action, *Response, error)
Resize a Droplet
func (*DropletActionsServiceOp) Restore ¶ added in v0.3.1
func (s *DropletActionsServiceOp) Restore(ctx context.Context, id, imageID int) (*Action, *Response, error)
Restore an image to a Droplet
func (*DropletActionsServiceOp) ShutdownByTag ¶ added in v1.1.1
func (s *DropletActionsServiceOp) ShutdownByTag(ctx context.Context, tag string) ([]Action, *Response, error)
ShutdownByTag shuts down Droplets matched by a Tag.
func (*DropletActionsServiceOp) Snapshot ¶ added in v0.7.0
func (s *DropletActionsServiceOp) Snapshot(ctx context.Context, id int, name string) (*Action, *Response, error)
Snapshot a Droplet.
func (*DropletActionsServiceOp) SnapshotByTag ¶ added in v1.1.1
func (s *DropletActionsServiceOp) SnapshotByTag(ctx context.Context, tag string, name string) ([]Action, *Response, error)
SnapshotByTag snapshots Droplets matched by a Tag.
type DropletCreateImage ¶ added in v0.9.0
DropletCreateImage identifies an image for the create request. It prefers slug over ID.
func (DropletCreateImage) MarshalJSON ¶ added in v0.9.0
func (d DropletCreateImage) MarshalJSON() ([]byte, error)
MarshalJSON returns either the slug or id of the image. It returns the id if the slug is empty.
type DropletCreateRequest ¶ added in v0.3.1
type DropletCreateRequest struct { Name string `json:"name"` Region string `json:"region"` Size string `json:"size"` Image DropletCreateImage `json:"image"` SSHKeys []DropletCreateSSHKey `json:"ssh_keys"` Backups bool `json:"backups"` IPv6 bool `json:"ipv6"` PrivateNetworking bool `json:"private_networking"` Monitoring bool `json:"monitoring"` UserData string `json:"user_data,omitempty"` Volumes []DropletCreateVolume `json:"volumes,omitempty"` Tags []string `json:"tags"` }
DropletCreateRequest represents a request to create a Droplet.
func (DropletCreateRequest) String ¶ added in v0.3.1
func (d DropletCreateRequest) String() string
type DropletCreateSSHKey ¶ added in v0.9.0
DropletCreateSSHKey identifies a SSH Key for the create request. It prefers fingerprint over ID.
func (DropletCreateSSHKey) MarshalJSON ¶ added in v0.9.0
func (d DropletCreateSSHKey) MarshalJSON() ([]byte, error)
MarshalJSON returns either the fingerprint or id of the ssh key. It returns the id if the fingerprint is empty.
type DropletCreateVolume ¶ added in v1.1.1
DropletCreateVolume identifies a volume to attach for the create request. It prefers Name over ID,
func (DropletCreateVolume) MarshalJSON ¶ added in v1.1.1
func (d DropletCreateVolume) MarshalJSON() ([]byte, error)
MarshalJSON returns an object with either the name or id of the volume. It returns the id if the name is empty.
type DropletMultiCreateRequest ¶ added in v1.1.1
type DropletMultiCreateRequest struct { Names []string `json:"names"` Region string `json:"region"` Size string `json:"size"` Image DropletCreateImage `json:"image"` SSHKeys []DropletCreateSSHKey `json:"ssh_keys"` Backups bool `json:"backups"` IPv6 bool `json:"ipv6"` PrivateNetworking bool `json:"private_networking"` Monitoring bool `json:"monitoring"` UserData string `json:"user_data,omitempty"` Tags []string `json:"tags"` }
DropletMultiCreateRequest is a request to create multiple Droplets.
func (DropletMultiCreateRequest) String ¶ added in v1.1.1
func (d DropletMultiCreateRequest) String() string
type DropletsService ¶ added in v0.3.1
type DropletsService interface { List(context.Context, *ListOptions) ([]Droplet, *Response, error) ListByTag(context.Context, string, *ListOptions) ([]Droplet, *Response, error) Get(context.Context, int) (*Droplet, *Response, error) Create(context.Context, *DropletCreateRequest) (*Droplet, *Response, error) CreateMultiple(context.Context, *DropletMultiCreateRequest) ([]Droplet, *Response, error) Delete(context.Context, int) (*Response, error) DeleteByTag(context.Context, string) (*Response, error) Kernels(context.Context, int, *ListOptions) ([]Kernel, *Response, error) Snapshots(context.Context, int, *ListOptions) ([]Image, *Response, error) Backups(context.Context, int, *ListOptions) ([]Image, *Response, error) Actions(context.Context, int, *ListOptions) ([]Action, *Response, error) Neighbors(context.Context, int) ([]Droplet, *Response, error) }
DropletsService is an interface for interfacing with the Droplet endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#droplets
type DropletsServiceOp ¶ added in v0.3.1
type DropletsServiceOp struct {
// contains filtered or unexported fields
}
DropletsServiceOp handles communication with the Droplet related methods of the DigitalOcean API.
func (*DropletsServiceOp) Actions ¶ added in v0.9.0
func (s *DropletsServiceOp) Actions(ctx context.Context, dropletID int, opt *ListOptions) ([]Action, *Response, error)
Actions lists the actions for a Droplet.
func (*DropletsServiceOp) Backups ¶ added in v0.9.0
func (s *DropletsServiceOp) Backups(ctx context.Context, dropletID int, opt *ListOptions) ([]Image, *Response, error)
Backups lists the backups for a Droplet.
func (*DropletsServiceOp) Create ¶ added in v0.3.1
func (s *DropletsServiceOp) Create(ctx context.Context, createRequest *DropletCreateRequest) (*Droplet, *Response, error)
Create Droplet
func (*DropletsServiceOp) CreateMultiple ¶ added in v1.1.1
func (s *DropletsServiceOp) CreateMultiple(ctx context.Context, createRequest *DropletMultiCreateRequest) ([]Droplet, *Response, error)
CreateMultiple creates multiple Droplets.
func (*DropletsServiceOp) DeleteByTag ¶ added in v1.1.1
DeleteByTag deletes Droplets matched by a Tag.
func (*DropletsServiceOp) Kernels ¶ added in v0.9.0
func (s *DropletsServiceOp) Kernels(ctx context.Context, dropletID int, opt *ListOptions) ([]Kernel, *Response, error)
Kernels lists kernels available for a Droplet.
func (*DropletsServiceOp) List ¶ added in v0.3.1
func (s *DropletsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Droplet, *Response, error)
List all Droplets.
func (*DropletsServiceOp) ListByTag ¶ added in v1.1.1
func (s *DropletsServiceOp) ListByTag(ctx context.Context, tag string, opt *ListOptions) ([]Droplet, *Response, error)
ListByTag lists all Droplets matched by a Tag.
func (*DropletsServiceOp) Neighbors ¶ added in v0.9.0
func (s *DropletsServiceOp) Neighbors(ctx context.Context, dropletID int) ([]Droplet, *Response, error)
Neighbors lists the neighbors for a Droplet.
func (*DropletsServiceOp) Snapshots ¶ added in v0.9.0
func (s *DropletsServiceOp) Snapshots(ctx context.Context, dropletID int, opt *ListOptions) ([]Image, *Response, error)
Snapshots lists the snapshots available for a Droplet.
type ErrorResponse ¶ added in v0.3.1
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response // Error message Message string `json:"message"` // RequestID returned from the API, useful to contact support. RequestID string `json:"request_id"` }
An ErrorResponse reports the error caused by an API request
func (*ErrorResponse) Error ¶ added in v0.3.1
func (r *ErrorResponse) Error() string
type Firewall ¶ added in v1.1.1
type Firewall struct { ID string `json:"id"` Name string `json:"name"` Status string `json:"status"` InboundRules []InboundRule `json:"inbound_rules"` OutboundRules []OutboundRule `json:"outbound_rules"` DropletIDs []int `json:"droplet_ids"` Tags []string `json:"tags"` Created string `json:"created_at"` PendingChanges []PendingChange `json:"pending_changes"` }
Firewall represents a DigitalOcean Firewall configuration.
type FirewallRequest ¶ added in v1.1.1
type FirewallRequest struct { Name string `json:"name"` InboundRules []InboundRule `json:"inbound_rules"` OutboundRules []OutboundRule `json:"outbound_rules"` DropletIDs []int `json:"droplet_ids"` Tags []string `json:"tags"` }
FirewallRequest represents the configuration to be applied to an existing or a new Firewall.
type FirewallRulesRequest ¶ added in v1.1.1
type FirewallRulesRequest struct { InboundRules []InboundRule `json:"inbound_rules"` OutboundRules []OutboundRule `json:"outbound_rules"` }
FirewallRulesRequest represents rules configuration to be applied to an existing Firewall.
type FirewallsService ¶ added in v1.1.1
type FirewallsService interface { Get(context.Context, string) (*Firewall, *Response, error) Create(context.Context, *FirewallRequest) (*Firewall, *Response, error) Update(context.Context, string, *FirewallRequest) (*Firewall, *Response, error) Delete(context.Context, string) (*Response, error) List(context.Context, *ListOptions) ([]Firewall, *Response, error) ListByDroplet(context.Context, int, *ListOptions) ([]Firewall, *Response, error) AddDroplets(context.Context, string, ...int) (*Response, error) RemoveDroplets(context.Context, string, ...int) (*Response, error) AddTags(context.Context, string, ...string) (*Response, error) RemoveTags(context.Context, string, ...string) (*Response, error) AddRules(context.Context, string, *FirewallRulesRequest) (*Response, error) RemoveRules(context.Context, string, *FirewallRulesRequest) (*Response, error) }
FirewallsService is an interface for managing Firewalls with the DigitalOcean API. See: https://developers.digitalocean.com/documentation/documentation/v2/#firewalls
type FirewallsServiceOp ¶ added in v1.1.1
type FirewallsServiceOp struct {
// contains filtered or unexported fields
}
FirewallsServiceOp handles communication with Firewalls methods of the DigitalOcean API.
func (*FirewallsServiceOp) AddDroplets ¶ added in v1.1.1
func (fw *FirewallsServiceOp) AddDroplets(ctx context.Context, fID string, dropletIDs ...int) (*Response, error)
AddDroplets to a Firewall.
func (*FirewallsServiceOp) AddRules ¶ added in v1.1.1
func (fw *FirewallsServiceOp) AddRules(ctx context.Context, fID string, rr *FirewallRulesRequest) (*Response, error)
AddRules to a Firewall.
func (*FirewallsServiceOp) AddTags ¶ added in v1.1.1
func (fw *FirewallsServiceOp) AddTags(ctx context.Context, fID string, tags ...string) (*Response, error)
AddTags to a Firewall.
func (*FirewallsServiceOp) Create ¶ added in v1.1.1
func (fw *FirewallsServiceOp) Create(ctx context.Context, fr *FirewallRequest) (*Firewall, *Response, error)
Create a new Firewall with a given configuration.
func (*FirewallsServiceOp) List ¶ added in v1.1.1
func (fw *FirewallsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Firewall, *Response, error)
List Firewalls.
func (*FirewallsServiceOp) ListByDroplet ¶ added in v1.1.1
func (fw *FirewallsServiceOp) ListByDroplet(ctx context.Context, dID int, opt *ListOptions) ([]Firewall, *Response, error)
ListByDroplet Firewalls.
func (*FirewallsServiceOp) RemoveDroplets ¶ added in v1.1.1
func (fw *FirewallsServiceOp) RemoveDroplets(ctx context.Context, fID string, dropletIDs ...int) (*Response, error)
RemoveDroplets from a Firewall.
func (*FirewallsServiceOp) RemoveRules ¶ added in v1.1.1
func (fw *FirewallsServiceOp) RemoveRules(ctx context.Context, fID string, rr *FirewallRulesRequest) (*Response, error)
RemoveRules from a Firewall.
func (*FirewallsServiceOp) RemoveTags ¶ added in v1.1.1
func (fw *FirewallsServiceOp) RemoveTags(ctx context.Context, fID string, tags ...string) (*Response, error)
RemoveTags from a Firewall.
func (*FirewallsServiceOp) Update ¶ added in v1.1.1
func (fw *FirewallsServiceOp) Update(ctx context.Context, fID string, fr *FirewallRequest) (*Firewall, *Response, error)
Update an existing Firewall with new configuration.
type FloatingIP ¶ added in v1.1.1
type FloatingIP struct { Region *Region `json:"region"` Droplet *Droplet `json:"droplet"` IP string `json:"ip"` }
FloatingIP represents a Digital Ocean floating IP.
func (FloatingIP) String ¶ added in v1.1.1
func (f FloatingIP) String() string
type FloatingIPActionsService ¶ added in v1.1.1
type FloatingIPActionsService interface { Assign(ctx context.Context, ip string, dropletID int) (*Action, *Response, error) Unassign(ctx context.Context, ip string) (*Action, *Response, error) Get(ctx context.Context, ip string, actionID int) (*Action, *Response, error) List(ctx context.Context, ip string, opt *ListOptions) ([]Action, *Response, error) }
FloatingIPActionsService is an interface for interfacing with the floating IPs actions endpoints of the Digital Ocean API. See: https://developers.digitalocean.com/documentation/v2#floating-ips-action
type FloatingIPActionsServiceOp ¶ added in v1.1.1
type FloatingIPActionsServiceOp struct {
// contains filtered or unexported fields
}
FloatingIPActionsServiceOp handles communication with the floating IPs action related methods of the DigitalOcean API.
func (*FloatingIPActionsServiceOp) Assign ¶ added in v1.1.1
func (s *FloatingIPActionsServiceOp) Assign(ctx context.Context, ip string, dropletID int) (*Action, *Response, error)
Assign a floating IP to a droplet.
func (*FloatingIPActionsServiceOp) Get ¶ added in v1.1.1
func (s *FloatingIPActionsServiceOp) Get(ctx context.Context, ip string, actionID int) (*Action, *Response, error)
Get an action for a particular floating IP by id.
func (*FloatingIPActionsServiceOp) List ¶ added in v1.1.1
func (s *FloatingIPActionsServiceOp) List(ctx context.Context, ip string, opt *ListOptions) ([]Action, *Response, error)
List the actions for a particular floating IP.
type FloatingIPCreateRequest ¶ added in v1.1.1
type FloatingIPCreateRequest struct { Region string `json:"region"` DropletID int `json:"droplet_id,omitempty"` }
FloatingIPCreateRequest represents a request to create a floating IP. If DropletID is not empty, the floating IP will be assigned to the droplet.
type FloatingIPsService ¶ added in v1.1.1
type FloatingIPsService interface { List(context.Context, *ListOptions) ([]FloatingIP, *Response, error) Get(context.Context, string) (*FloatingIP, *Response, error) Create(context.Context, *FloatingIPCreateRequest) (*FloatingIP, *Response, error) Delete(context.Context, string) (*Response, error) }
FloatingIPsService is an interface for interfacing with the floating IPs endpoints of the Digital Ocean API. See: https://developers.digitalocean.com/documentation/v2#floating-ips
type FloatingIPsServiceOp ¶ added in v1.1.1
type FloatingIPsServiceOp struct {
// contains filtered or unexported fields
}
FloatingIPsServiceOp handles communication with the floating IPs related methods of the DigitalOcean API.
func (*FloatingIPsServiceOp) Create ¶ added in v1.1.1
func (f *FloatingIPsServiceOp) Create(ctx context.Context, createRequest *FloatingIPCreateRequest) (*FloatingIP, *Response, error)
Create a floating IP. If the DropletID field of the request is not empty, the floating IP will also be assigned to the droplet.
func (*FloatingIPsServiceOp) Get ¶ added in v1.1.1
func (f *FloatingIPsServiceOp) Get(ctx context.Context, ip string) (*FloatingIP, *Response, error)
Get an individual floating IP.
func (*FloatingIPsServiceOp) List ¶ added in v1.1.1
func (f *FloatingIPsServiceOp) List(ctx context.Context, opt *ListOptions) ([]FloatingIP, *Response, error)
List all floating IPs.
type ForwardingRule ¶ added in v1.1.1
type ForwardingRule struct { EntryProtocol string `json:"entry_protocol,omitempty"` EntryPort int `json:"entry_port,omitempty"` TargetProtocol string `json:"target_protocol,omitempty"` TargetPort int `json:"target_port,omitempty"` CertificateID string `json:"certificate_id,omitempty"` TlsPassthrough bool `json:"tls_passthrough,omitempty"` }
ForwardingRule represents load balancer forwarding rules.
func (ForwardingRule) String ¶ added in v1.1.1
func (f ForwardingRule) String() string
String creates a human-readable description of a ForwardingRule.
type HealthCheck ¶ added in v1.1.1
type HealthCheck struct { Protocol string `json:"protocol,omitempty"` Port int `json:"port,omitempty"` Path string `json:"path,omitempty"` CheckIntervalSeconds int `json:"check_interval_seconds,omitempty"` ResponseTimeoutSeconds int `json:"response_timeout_seconds,omitempty"` HealthyThreshold int `json:"healthy_threshold,omitempty"` UnhealthyThreshold int `json:"unhealthy_threshold,omitempty"` }
HealthCheck represents optional load balancer health check rules.
func (HealthCheck) String ¶ added in v1.1.1
func (h HealthCheck) String() string
String creates a human-readable description of a HealthCheck.
type Image ¶ added in v0.3.1
type Image struct { ID int `json:"id,float64,omitempty"` Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Distribution string `json:"distribution,omitempty"` Slug string `json:"slug,omitempty"` Public bool `json:"public,omitempty"` Regions []string `json:"regions,omitempty"` MinDiskSize int `json:"min_disk_size,omitempty"` Created string `json:"created_at,omitempty"` }
Image represents a DigitalOcean Image
type ImageActionsService ¶ added in v0.3.1
type ImageActionsService interface { Get(context.Context, int, int) (*Action, *Response, error) Transfer(context.Context, int, *ActionRequest) (*Action, *Response, error) Convert(context.Context, int) (*Action, *Response, error) }
ImageActionsService is an interface for interfacing with the image actions endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#image-actions
type ImageActionsServiceOp ¶ added in v0.3.1
type ImageActionsServiceOp struct {
// contains filtered or unexported fields
}
ImageActionsServiceOp handles communition with the image action related methods of the DigitalOcean API.
func (*ImageActionsServiceOp) Convert ¶ added in v1.1.1
func (i *ImageActionsServiceOp) Convert(ctx context.Context, imageID int) (*Action, *Response, error)
Convert an image to a snapshot
func (*ImageActionsServiceOp) Get ¶ added in v0.3.1
func (i *ImageActionsServiceOp) Get(ctx context.Context, imageID, actionID int) (*Action, *Response, error)
Get an action for a particular image by id.
func (*ImageActionsServiceOp) Transfer ¶ added in v0.3.1
func (i *ImageActionsServiceOp) Transfer(ctx context.Context, imageID int, transferRequest *ActionRequest) (*Action, *Response, error)
Transfer an image
type ImageUpdateRequest ¶ added in v0.9.0
type ImageUpdateRequest struct {
Name string `json:"name"`
}
ImageUpdateRequest represents a request to update an image.
type ImagesService ¶ added in v0.3.1
type ImagesService interface { List(context.Context, *ListOptions) ([]Image, *Response, error) ListDistribution(ctx context.Context, opt *ListOptions) ([]Image, *Response, error) ListApplication(ctx context.Context, opt *ListOptions) ([]Image, *Response, error) ListUser(ctx context.Context, opt *ListOptions) ([]Image, *Response, error) GetByID(context.Context, int) (*Image, *Response, error) GetBySlug(context.Context, string) (*Image, *Response, error) Update(context.Context, int, *ImageUpdateRequest) (*Image, *Response, error) Delete(context.Context, int) (*Response, error) }
ImagesService is an interface for interfacing with the images endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#images
type ImagesServiceOp ¶ added in v0.3.1
type ImagesServiceOp struct {
// contains filtered or unexported fields
}
ImagesServiceOp handles communication with the image related methods of the DigitalOcean API.
func (*ImagesServiceOp) List ¶ added in v0.3.1
func (s *ImagesServiceOp) List(ctx context.Context, opt *ListOptions) ([]Image, *Response, error)
List lists all the images available.
func (*ImagesServiceOp) ListApplication ¶ added in v0.9.0
func (s *ImagesServiceOp) ListApplication(ctx context.Context, opt *ListOptions) ([]Image, *Response, error)
ListApplication lists all the application images.
func (*ImagesServiceOp) ListDistribution ¶ added in v0.9.0
func (s *ImagesServiceOp) ListDistribution(ctx context.Context, opt *ListOptions) ([]Image, *Response, error)
ListDistribution lists all the distribution images.
func (*ImagesServiceOp) ListUser ¶ added in v0.9.0
func (s *ImagesServiceOp) ListUser(ctx context.Context, opt *ListOptions) ([]Image, *Response, error)
ListUser lists all the user images.
func (*ImagesServiceOp) Update ¶ added in v0.9.0
func (s *ImagesServiceOp) Update(ctx context.Context, imageID int, updateRequest *ImageUpdateRequest) (*Image, *Response, error)
Update an image name.
type InboundRule ¶ added in v1.1.1
type InboundRule struct { Protocol string `json:"protocol,omitempty"` PortRange string `json:"ports,omitempty"` Sources *Sources `json:"sources"` }
InboundRule represents a DigitalOcean Firewall inbound rule.
type Kernel ¶ added in v0.9.0
type Kernel struct { ID int `json:"id,float64,omitempty"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` }
Kernel object
type Key ¶ added in v0.3.1
type Key struct { ID int `json:"id,float64,omitempty"` Name string `json:"name,omitempty"` Fingerprint string `json:"fingerprint,omitempty"` PublicKey string `json:"public_key,omitempty"` }
Key represents a DigitalOcean Key.
type KeyCreateRequest ¶ added in v0.3.1
KeyCreateRequest represents a request to create a new key.
type KeyUpdateRequest ¶ added in v0.9.0
type KeyUpdateRequest struct {
Name string `json:"name"`
}
KeyUpdateRequest represents a request to update a DigitalOcean key.
type KeysService ¶ added in v0.3.1
type KeysService interface { List(context.Context, *ListOptions) ([]Key, *Response, error) GetByID(context.Context, int) (*Key, *Response, error) GetByFingerprint(context.Context, string) (*Key, *Response, error) Create(context.Context, *KeyCreateRequest) (*Key, *Response, error) UpdateByID(context.Context, int, *KeyUpdateRequest) (*Key, *Response, error) UpdateByFingerprint(context.Context, string, *KeyUpdateRequest) (*Key, *Response, error) DeleteByID(context.Context, int) (*Response, error) DeleteByFingerprint(context.Context, string) (*Response, error) }
KeysService is an interface for interfacing with the keys endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#keys
type KeysServiceOp ¶ added in v0.3.1
type KeysServiceOp struct {
// contains filtered or unexported fields
}
KeysServiceOp handles communication with key related method of the DigitalOcean API.
func (*KeysServiceOp) Create ¶ added in v0.3.1
func (s *KeysServiceOp) Create(ctx context.Context, createRequest *KeyCreateRequest) (*Key, *Response, error)
Create a key using a KeyCreateRequest
func (*KeysServiceOp) DeleteByFingerprint ¶ added in v0.3.1
func (s *KeysServiceOp) DeleteByFingerprint(ctx context.Context, fingerprint string) (*Response, error)
DeleteByFingerprint deletes a key by its fingerprint
func (*KeysServiceOp) DeleteByID ¶ added in v0.3.1
DeleteByID deletes a key by its id
func (*KeysServiceOp) GetByFingerprint ¶ added in v0.3.1
func (s *KeysServiceOp) GetByFingerprint(ctx context.Context, fingerprint string) (*Key, *Response, error)
GetByFingerprint gets a Key by by fingerprint
func (*KeysServiceOp) List ¶ added in v0.3.1
func (s *KeysServiceOp) List(ctx context.Context, opt *ListOptions) ([]Key, *Response, error)
List all keys
func (*KeysServiceOp) UpdateByFingerprint ¶ added in v0.9.0
func (s *KeysServiceOp) UpdateByFingerprint(ctx context.Context, fingerprint string, updateRequest *KeyUpdateRequest) (*Key, *Response, error)
UpdateByFingerprint updates a key name by fingerprint.
func (*KeysServiceOp) UpdateByID ¶ added in v0.9.0
func (s *KeysServiceOp) UpdateByID(ctx context.Context, keyID int, updateRequest *KeyUpdateRequest) (*Key, *Response, error)
UpdateByID updates a key name by ID.
type LinkAction ¶ added in v0.3.1
type LinkAction struct { ID int `json:"id,omitempty"` Rel string `json:"rel,omitempty"` HREF string `json:"href,omitempty"` }
LinkAction is a pointer to an action
type Links ¶ added in v0.3.1
type Links struct { Pages *Pages `json:"pages,omitempty"` Actions []LinkAction `json:"actions,omitempty"` }
Links manages links that are returned along with a List
func (*Links) CurrentPage ¶ added in v0.3.1
CurrentPage is current page of the list
func (*Links) IsLastPage ¶ added in v0.3.1
IsLastPage returns true if the current page is the last
type ListOptions ¶ added in v0.3.1
type ListOptions struct { // For paginated result sets, page of results to retrieve. Page int `url:"page,omitempty"` // For paginated result sets, the number of results to include per page. PerPage int `url:"per_page,omitempty"` }
ListOptions specifies the optional parameters to various List methods that support pagination.
type ListVolumeParams ¶ added in v1.1.1
type ListVolumeParams struct { Region string `json:"region"` Name string `json:"name"` ListOptions *ListOptions `json:"list_options,omitempty"` }
ListVolumeParams stores the options you can set for a ListVolumeCall
type LoadBalancer ¶ added in v1.1.1
type LoadBalancer struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` IP string `json:"ip,omitempty"` Algorithm string `json:"algorithm,omitempty"` Status string `json:"status,omitempty"` Created string `json:"created_at,omitempty"` ForwardingRules []ForwardingRule `json:"forwarding_rules,omitempty"` HealthCheck *HealthCheck `json:"health_check,omitempty"` StickySessions *StickySessions `json:"sticky_sessions,omitempty"` Region *Region `json:"region,omitempty"` DropletIDs []int `json:"droplet_ids,omitempty"` Tag string `json:"tag,omitempty"` RedirectHttpToHttps bool `json:"redirect_http_to_https,omitempty"` }
LoadBalancer represents a DigitalOcean load balancer configuration.
func (LoadBalancer) AsRequest ¶ added in v1.1.1
func (l LoadBalancer) AsRequest() *LoadBalancerRequest
AsRequest creates a LoadBalancerRequest that can be submitted to Update with the current values of the LoadBalancer. Modifying the returned LoadBalancerRequest will not modify the original LoadBalancer.
func (LoadBalancer) String ¶ added in v1.1.1
func (l LoadBalancer) String() string
String creates a human-readable description of a LoadBalancer.
type LoadBalancerRequest ¶ added in v1.1.1
type LoadBalancerRequest struct { Name string `json:"name,omitempty"` Algorithm string `json:"algorithm,omitempty"` Region string `json:"region,omitempty"` ForwardingRules []ForwardingRule `json:"forwarding_rules,omitempty"` HealthCheck *HealthCheck `json:"health_check,omitempty"` StickySessions *StickySessions `json:"sticky_sessions,omitempty"` DropletIDs []int `json:"droplet_ids,omitempty"` Tag string `json:"tag,omitempty"` RedirectHttpToHttps bool `json:"redirect_http_to_https,omitempty"` }
LoadBalancerRequest represents the configuration to be applied to an existing or a new load balancer.
func (LoadBalancerRequest) String ¶ added in v1.1.1
func (l LoadBalancerRequest) String() string
String creates a human-readable description of a LoadBalancerRequest.
type LoadBalancersService ¶ added in v1.1.1
type LoadBalancersService interface { Get(context.Context, string) (*LoadBalancer, *Response, error) List(context.Context, *ListOptions) ([]LoadBalancer, *Response, error) Create(context.Context, *LoadBalancerRequest) (*LoadBalancer, *Response, error) Update(ctx context.Context, lbID string, lbr *LoadBalancerRequest) (*LoadBalancer, *Response, error) Delete(ctx context.Context, lbID string) (*Response, error) AddDroplets(ctx context.Context, lbID string, dropletIDs ...int) (*Response, error) RemoveDroplets(ctx context.Context, lbID string, dropletIDs ...int) (*Response, error) AddForwardingRules(ctx context.Context, lbID string, rules ...ForwardingRule) (*Response, error) RemoveForwardingRules(ctx context.Context, lbID string, rules ...ForwardingRule) (*Response, error) }
LoadBalancersService is an interface for managing load balancers with the DigitalOcean API. See: https://developers.digitalocean.com/documentation/v2#load-balancers
type LoadBalancersServiceOp ¶ added in v1.1.1
type LoadBalancersServiceOp struct {
// contains filtered or unexported fields
}
LoadBalancersServiceOp handles communication with load balancer-related methods of the DigitalOcean API.
func (*LoadBalancersServiceOp) AddDroplets ¶ added in v1.1.1
func (l *LoadBalancersServiceOp) AddDroplets(ctx context.Context, lbID string, dropletIDs ...int) (*Response, error)
AddDroplets adds droplets to a load balancer.
func (*LoadBalancersServiceOp) AddForwardingRules ¶ added in v1.1.1
func (l *LoadBalancersServiceOp) AddForwardingRules(ctx context.Context, lbID string, rules ...ForwardingRule) (*Response, error)
AddForwardingRules adds forwarding rules to a load balancer.
func (*LoadBalancersServiceOp) Create ¶ added in v1.1.1
func (l *LoadBalancersServiceOp) Create(ctx context.Context, lbr *LoadBalancerRequest) (*LoadBalancer, *Response, error)
Create a new load balancer with a given configuration.
func (*LoadBalancersServiceOp) Get ¶ added in v1.1.1
func (l *LoadBalancersServiceOp) Get(ctx context.Context, lbID string) (*LoadBalancer, *Response, error)
Get an existing load balancer by its identifier.
func (*LoadBalancersServiceOp) List ¶ added in v1.1.1
func (l *LoadBalancersServiceOp) List(ctx context.Context, opt *ListOptions) ([]LoadBalancer, *Response, error)
List load balancers, with optional pagination.
func (*LoadBalancersServiceOp) RemoveDroplets ¶ added in v1.1.1
func (l *LoadBalancersServiceOp) RemoveDroplets(ctx context.Context, lbID string, dropletIDs ...int) (*Response, error)
RemoveDroplets removes droplets from a load balancer.
func (*LoadBalancersServiceOp) RemoveForwardingRules ¶ added in v1.1.1
func (l *LoadBalancersServiceOp) RemoveForwardingRules(ctx context.Context, lbID string, rules ...ForwardingRule) (*Response, error)
RemoveForwardingRules removes forwarding rules from a load balancer.
func (*LoadBalancersServiceOp) Update ¶ added in v1.1.1
func (l *LoadBalancersServiceOp) Update(ctx context.Context, lbID string, lbr *LoadBalancerRequest) (*LoadBalancer, *Response, error)
Update an existing load balancer with new configuration.
type NetworkV4 ¶ added in v0.7.0
type NetworkV4 struct { IPAddress string `json:"ip_address,omitempty"` Netmask string `json:"netmask,omitempty"` Gateway string `json:"gateway,omitempty"` Type string `json:"type,omitempty"` }
NetworkV4 represents a DigitalOcean IPv4 Network.
type NetworkV6 ¶ added in v0.7.0
type NetworkV6 struct { IPAddress string `json:"ip_address,omitempty"` Netmask int `json:"netmask,omitempty"` Gateway string `json:"gateway,omitempty"` Type string `json:"type,omitempty"` }
NetworkV6 represents a DigitalOcean IPv6 network.
type OutboundRule ¶ added in v1.1.1
type OutboundRule struct { Protocol string `json:"protocol,omitempty"` PortRange string `json:"ports,omitempty"` Destinations *Destinations `json:"destinations"` }
OutboundRule represents a DigitalOcean Firewall outbound rule.
type Pages ¶ added in v0.3.1
type Pages struct { First string `json:"first,omitempty"` Prev string `json:"prev,omitempty"` Last string `json:"last,omitempty"` Next string `json:"next,omitempty"` }
Pages are pages specified in Links
type PendingChange ¶ added in v1.1.1
type PendingChange struct { DropletID int `json:"droplet_id,omitempty"` Removing bool `json:"removing,omitempty"` Status string `json:"status,omitempty"` }
PendingChange represents a DigitalOcean Firewall status details.
type Rate ¶ added in v0.3.1
type Rate struct { // The number of request per hour the client is currently limited to. Limit int `json:"limit"` // The number of remaining requests the client can make this hour. Remaining int `json:"remaining"` // The time at which the current rate limit will reset. Reset Timestamp `json:"reset"` }
Rate contains the rate limit for the current client.
type Region ¶ added in v0.3.1
type Region struct { Slug string `json:"slug,omitempty"` Name string `json:"name,omitempty"` Sizes []string `json:"sizes,omitempty"` Available bool `json:"available,omitempty"` Features []string `json:"features,omitempty"` }
Region represents a DigitalOcean Region
type RegionsService ¶ added in v0.3.1
RegionsService is an interface for interfacing with the regions endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#regions
type RegionsServiceOp ¶ added in v0.3.1
type RegionsServiceOp struct {
// contains filtered or unexported fields
}
RegionsServiceOp handles communication with the region related methods of the DigitalOcean API.
func (*RegionsServiceOp) List ¶ added in v0.3.1
func (s *RegionsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Region, *Response, error)
List all regions
type RequestCompletionCallback ¶ added in v0.9.0
RequestCompletionCallback defines the type of the request callback function
type Resource ¶ added in v1.1.1
type Resource struct { ID string `json:"resource_id,omit_empty"` Type ResourceType `json:"resource_type,omit_empty"` }
Resource represent a single resource for associating/disassociating with tags
type ResourceType ¶ added in v1.1.1
type ResourceType string
ResourceType represents a class of resource, currently only droplet are supported
const ( //DropletResourceType holds the string representing our ResourceType of Droplet. DropletResourceType ResourceType = "droplet" )
type Response ¶ added in v0.3.1
type Response struct { *http.Response // Links that were returned with the response. These are parsed from // request body and not the header. Links *Links // Monitoring URI Monitor string Rate }
Response is a DigitalOcean response. This wraps the standard http.Response returned from DigitalOcean.
type Size ¶ added in v0.3.1
type Size struct { Slug string `json:"slug,omitempty"` Memory int `json:"memory,omitempty"` Vcpus int `json:"vcpus,omitempty"` Disk int `json:"disk,omitempty"` PriceMonthly float64 `json:"price_monthly,omitempty"` PriceHourly float64 `json:"price_hourly,omitempty"` Regions []string `json:"regions,omitempty"` Available bool `json:"available,omitempty"` Transfer float64 `json:"transfer,omitempty"` }
Size represents a DigitalOcean Size
type SizesService ¶ added in v0.3.1
SizesService is an interface for interfacing with the size endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#sizes
type SizesServiceOp ¶ added in v0.3.1
type SizesServiceOp struct {
// contains filtered or unexported fields
}
SizesServiceOp handles communication with the size related methods of the DigitalOcean API.
func (*SizesServiceOp) List ¶ added in v0.3.1
func (s *SizesServiceOp) List(ctx context.Context, opt *ListOptions) ([]Size, *Response, error)
List all images
type Snapshot ¶ added in v1.1.1
type Snapshot struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` ResourceID string `json:"resource_id,omitempty"` ResourceType string `json:"resource_type,omitempty"` Regions []string `json:"regions,omitempty"` MinDiskSize int `json:"min_disk_size,omitempty"` SizeGigaBytes float64 `json:"size_gigabytes,omitempty"` Created string `json:"created_at,omitempty"` }
Snapshot represents a DigitalOcean Snapshot
type SnapshotCreateRequest ¶ added in v1.1.1
type SnapshotCreateRequest struct { VolumeID string `json:"volume_id"` Name string `json:"name"` Description string `json:"description"` }
SnapshotCreateRequest represents a request to create a block store volume.
type SnapshotsService ¶ added in v1.1.1
type SnapshotsService interface { List(context.Context, *ListOptions) ([]Snapshot, *Response, error) ListVolume(context.Context, *ListOptions) ([]Snapshot, *Response, error) ListDroplet(context.Context, *ListOptions) ([]Snapshot, *Response, error) Get(context.Context, string) (*Snapshot, *Response, error) Delete(context.Context, string) (*Response, error) }
SnapshotsService is an interface for interfacing with the snapshots endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#snapshots
type SnapshotsServiceOp ¶ added in v1.1.1
type SnapshotsServiceOp struct {
// contains filtered or unexported fields
}
SnapshotsServiceOp handles communication with the snapshot related methods of the DigitalOcean API.
func (*SnapshotsServiceOp) Get ¶ added in v1.1.1
func (s *SnapshotsServiceOp) Get(ctx context.Context, snapshotID string) (*Snapshot, *Response, error)
Get retrieves an snapshot by id.
func (*SnapshotsServiceOp) List ¶ added in v1.1.1
func (s *SnapshotsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Snapshot, *Response, error)
List lists all the snapshots available.
func (*SnapshotsServiceOp) ListDroplet ¶ added in v1.1.1
func (s *SnapshotsServiceOp) ListDroplet(ctx context.Context, opt *ListOptions) ([]Snapshot, *Response, error)
ListDroplet lists all the Droplet snapshots.
func (*SnapshotsServiceOp) ListVolume ¶ added in v1.1.1
func (s *SnapshotsServiceOp) ListVolume(ctx context.Context, opt *ListOptions) ([]Snapshot, *Response, error)
ListVolume lists all the volume snapshots.
type Sources ¶ added in v1.1.1
type Sources struct { Addresses []string `json:"addresses,omitempty"` Tags []string `json:"tags,omitempty"` DropletIDs []int `json:"droplet_ids,omitempty"` LoadBalancerUIDs []string `json:"load_balancer_uids,omitempty"` }
Sources represents a DigitalOcean Firewall InboundRule sources.
type StickySessions ¶ added in v1.1.1
type StickySessions struct { Type string `json:"type,omitempty"` CookieName string `json:"cookie_name,omitempty"` CookieTtlSeconds int `json:"cookie_ttl_seconds,omitempty"` }
StickySessions represents optional load balancer session affinity rules.
func (StickySessions) String ¶ added in v1.1.1
func (s StickySessions) String() string
String creates a human-readable description of a StickySessions instance.
type StorageActionsService ¶ added in v1.1.1
type StorageActionsService interface { Attach(ctx context.Context, volumeID string, dropletID int) (*Action, *Response, error) DetachByDropletID(ctx context.Context, volumeID string, dropletID int) (*Action, *Response, error) Get(ctx context.Context, volumeID string, actionID int) (*Action, *Response, error) List(ctx context.Context, volumeID string, opt *ListOptions) ([]Action, *Response, error) Resize(ctx context.Context, volumeID string, sizeGigabytes int, regionSlug string) (*Action, *Response, error) }
StorageActionsService is an interface for interfacing with the storage actions endpoints of the Digital Ocean API. See: https://developers.digitalocean.com/documentation/v2#storage-actions
type StorageActionsServiceOp ¶ added in v1.1.1
type StorageActionsServiceOp struct {
// contains filtered or unexported fields
}
StorageActionsServiceOp handles communication with the storage volumes action related methods of the DigitalOcean API.
func (*StorageActionsServiceOp) Attach ¶ added in v1.1.1
func (s *StorageActionsServiceOp) Attach(ctx context.Context, volumeID string, dropletID int) (*Action, *Response, error)
Attach a storage volume to a Droplet.
func (*StorageActionsServiceOp) DetachByDropletID ¶ added in v1.1.1
func (s *StorageActionsServiceOp) DetachByDropletID(ctx context.Context, volumeID string, dropletID int) (*Action, *Response, error)
DetachByDropletID a storage volume from a Droplet by Droplet ID.
func (*StorageActionsServiceOp) Get ¶ added in v1.1.1
func (s *StorageActionsServiceOp) Get(ctx context.Context, volumeID string, actionID int) (*Action, *Response, error)
Get an action for a particular storage volume by id.
func (*StorageActionsServiceOp) List ¶ added in v1.1.1
func (s *StorageActionsServiceOp) List(ctx context.Context, volumeID string, opt *ListOptions) ([]Action, *Response, error)
List the actions for a particular storage volume.
type StorageAttachment ¶ added in v1.1.1
type StorageAttachment struct {
DropletID int `json:"droplet_id"`
}
StorageAttachment represents the attachement of a block storage volume to a specific Droplet under the device name.
type StorageService ¶ added in v1.1.1
type StorageService interface { ListVolumes(context.Context, *ListVolumeParams) ([]Volume, *Response, error) GetVolume(context.Context, string) (*Volume, *Response, error) CreateVolume(context.Context, *VolumeCreateRequest) (*Volume, *Response, error) DeleteVolume(context.Context, string) (*Response, error) ListSnapshots(ctx context.Context, volumeID string, opts *ListOptions) ([]Snapshot, *Response, error) GetSnapshot(context.Context, string) (*Snapshot, *Response, error) CreateSnapshot(context.Context, *SnapshotCreateRequest) (*Snapshot, *Response, error) DeleteSnapshot(context.Context, string) (*Response, error) }
StorageService is an interface for interfacing with the storage endpoints of the Digital Ocean API. See: https://developers.digitalocean.com/documentation/v2#storage
type StorageServiceOp ¶ added in v1.1.1
type StorageServiceOp struct {
// contains filtered or unexported fields
}
StorageServiceOp handles communication with the storage volumes related methods of the DigitalOcean API.
func (*StorageServiceOp) CreateSnapshot ¶ added in v1.1.1
func (svc *StorageServiceOp) CreateSnapshot(ctx context.Context, createRequest *SnapshotCreateRequest) (*Snapshot, *Response, error)
CreateSnapshot creates a snapshot of a storage volume.
func (*StorageServiceOp) CreateVolume ¶ added in v1.1.1
func (svc *StorageServiceOp) CreateVolume(ctx context.Context, createRequest *VolumeCreateRequest) (*Volume, *Response, error)
CreateVolume creates a storage volume. The name must be unique.
func (*StorageServiceOp) DeleteSnapshot ¶ added in v1.1.1
DeleteSnapshot deletes a snapshot.
func (*StorageServiceOp) DeleteVolume ¶ added in v1.1.1
DeleteVolume deletes a storage volume.
func (*StorageServiceOp) GetSnapshot ¶ added in v1.1.1
func (svc *StorageServiceOp) GetSnapshot(ctx context.Context, id string) (*Snapshot, *Response, error)
GetSnapshot retrieves an individual snapshot.
func (*StorageServiceOp) GetVolume ¶ added in v1.1.1
GetVolume retrieves an individual storage volume.
func (*StorageServiceOp) ListSnapshots ¶ added in v1.1.1
func (svc *StorageServiceOp) ListSnapshots(ctx context.Context, volumeID string, opt *ListOptions) ([]Snapshot, *Response, error)
ListSnapshots lists all snapshots related to a storage volume.
func (*StorageServiceOp) ListVolumes ¶ added in v1.1.1
func (svc *StorageServiceOp) ListVolumes(ctx context.Context, params *ListVolumeParams) ([]Volume, *Response, error)
ListVolumes lists all storage volumes.
type Tag ¶ added in v1.1.1
type Tag struct { Name string `json:"name,omitempty"` Resources *TaggedResources `json:"resources,omitempty"` }
Tag represent DigitalOcean tag
type TagCreateRequest ¶ added in v1.1.1
type TagCreateRequest struct {
Name string `json:"name"`
}
TagCreateRequest represents the JSON structure of a request of that type.
type TagResourcesRequest ¶ added in v1.1.1
type TagResourcesRequest struct {
Resources []Resource `json:"resources"`
}
TagResourcesRequest represents the JSON structure of a request of that type.
type TaggedDropletsResources ¶ added in v1.1.1
type TaggedDropletsResources struct { Count int `json:"count,float64,omitempty"` LastTagged *Droplet `json:"last_tagged,omitempty"` }
TaggedDropletsResources represent the droplet resources a tag is attached to
type TaggedResources ¶ added in v1.1.1
type TaggedResources struct {
Droplets *TaggedDropletsResources `json:"droplets,omitempty"`
}
TaggedResources represent the set of resources a tag is attached to
type TagsService ¶ added in v1.1.1
type TagsService interface { List(context.Context, *ListOptions) ([]Tag, *Response, error) Get(context.Context, string) (*Tag, *Response, error) Create(context.Context, *TagCreateRequest) (*Tag, *Response, error) Delete(context.Context, string) (*Response, error) TagResources(context.Context, string, *TagResourcesRequest) (*Response, error) UntagResources(context.Context, string, *UntagResourcesRequest) (*Response, error) }
TagsService is an interface for interfacing with the tags endpoints of the DigitalOcean API See: https://developers.digitalocean.com/documentation/v2#tags
type TagsServiceOp ¶ added in v1.1.1
type TagsServiceOp struct {
// contains filtered or unexported fields
}
TagsServiceOp handles communication with tag related method of the DigitalOcean API.
func (*TagsServiceOp) Create ¶ added in v1.1.1
func (s *TagsServiceOp) Create(ctx context.Context, createRequest *TagCreateRequest) (*Tag, *Response, error)
Create a new tag
func (*TagsServiceOp) List ¶ added in v1.1.1
func (s *TagsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Tag, *Response, error)
List all tags
func (*TagsServiceOp) TagResources ¶ added in v1.1.1
func (s *TagsServiceOp) TagResources(ctx context.Context, name string, tagRequest *TagResourcesRequest) (*Response, error)
TagResources associates resources with a given Tag.
func (*TagsServiceOp) UntagResources ¶ added in v1.1.1
func (s *TagsServiceOp) UntagResources(ctx context.Context, name string, untagRequest *UntagResourcesRequest) (*Response, error)
UntagResources dissociates resources with a given Tag.
type Timestamp ¶ added in v0.3.1
Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. All exported methods of time.Time can be called on Timestamp.
func (Timestamp) Equal ¶ added in v0.3.1
Equal reports whether t and u are equal based on time.Equal
func (*Timestamp) UnmarshalJSON ¶ added in v0.3.1
UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.
type UntagResourcesRequest ¶ added in v1.1.1
type UntagResourcesRequest struct {
Resources []Resource `json:"resources"`
}
UntagResourcesRequest represents the JSON structure of a request of that type.
type Volume ¶ added in v1.1.1
type Volume struct { ID string `json:"id"` Region *Region `json:"region"` Name string `json:"name"` SizeGigaBytes int64 `json:"size_gigabytes"` Description string `json:"description"` DropletIDs []int `json:"droplet_ids"` CreatedAt time.Time `json:"created_at"` FilesystemType string `json:"filesystem_type"` FilesystemLabel string `json:"filesystem_label"` }
Volume represents a Digital Ocean block store volume.
type VolumeCreateRequest ¶ added in v1.1.1
type VolumeCreateRequest struct { Region string `json:"region"` Name string `json:"name"` Description string `json:"description"` SizeGigaBytes int64 `json:"size_gigabytes"` SnapshotID string `json:"snapshot_id"` FilesystemType string `json:"filesystem_type"` FilesystemLabel string `json:"filesystem_label"` }
VolumeCreateRequest represents a request to create a block store volume.
Source Files ¶
- account.go
- action.go
- cdn.go
- certificates.go
- doc.go
- domains.go
- droplet_actions.go
- droplets.go
- errors.go
- firewalls.go
- floating_ips.go
- floating_ips_actions.go
- godo.go
- image_actions.go
- images.go
- keys.go
- links.go
- load_balancers.go
- regions.go
- sizes.go
- snapshots.go
- storage.go
- storage_actions.go
- strings.go
- tags.go
- timestamp.go