compute

package
v0.0.0-...-52b58a3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0, MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CNSTagDisable    = "triton.cns.disable"
	CNSTagReversePTR = "triton.cns.reverse_ptr"
	CNSTagServices   = "triton.cns.services"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddNICInput

type AddNICInput struct {
	InstanceID    string
	Network       string
	NetworkObject NetworkObject
}

type AddTagsInput

type AddTagsInput struct {
	ID   string
	Tags map[string]string
}

type CloudAPI

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

type ComputeClient

type ComputeClient struct {
	Client *client.Client
}

func NewClient

func NewClient(config *triton.ClientConfig) (*ComputeClient, error)

NewClient returns a new client for working with Compute endpoints and resources within CloudAPI

func (*ComputeClient) Datacenters

func (c *ComputeClient) Datacenters() *DataCentersClient

Datacenters returns a Compute client used for accessing functions pertaining to DataCenter functionality in the Triton API.

func (*ComputeClient) Images

func (c *ComputeClient) Images() *ImagesClient

Images returns a Compute client used for accessing functions pertaining to Images functionality in the Triton API.

func (*ComputeClient) Instances

func (c *ComputeClient) Instances() *InstancesClient

Machine returns a Compute client used for accessing functions pertaining to machine functionality in the Triton API.

func (*ComputeClient) Packages

func (c *ComputeClient) Packages() *PackagesClient

Packages returns a Compute client used for accessing functions pertaining to Packages functionality in the Triton API.

func (*ComputeClient) Ping

func (c *ComputeClient) Ping(ctx context.Context) (*PingOutput, error)

Ping sends a request to the '/--ping' endpoint and returns a `pong` as well as a list of API version numbers your instance of CloudAPI is presenting.

func (*ComputeClient) Services

func (c *ComputeClient) Services() *ServicesClient

Services returns a Compute client used for accessing functions pertaining to Services functionality in the Triton API.

func (*ComputeClient) SetHeader

func (c *ComputeClient) SetHeader(header *http.Header)

SetHeaders allows a consumer of the current client to set custom headers for the next backend HTTP request sent to CloudAPI

func (*ComputeClient) Snapshots

func (c *ComputeClient) Snapshots() *SnapshotsClient

Snapshots returns a Compute client used for accessing functions pertaining to Snapshots functionality in the Triton API.

func (*ComputeClient) Volumes

func (c *ComputeClient) Volumes() *VolumesClient

Snapshots returns a Compute client used for accessing functions pertaining to Snapshots functionality in the Triton API.

type CreateImageFromMachineInput

type CreateImageFromMachineInput struct {
	MachineID   string            `json:"machine"`
	Name        string            `json:"name"`
	Version     string            `json:"version,omitempty"`
	Description string            `json:"description,omitempty"`
	HomePage    string            `json:"homepage,omitempty"`
	EULA        string            `json:"eula,omitempty"`
	ACL         []string          `json:"acl,omitempty"`
	Tags        map[string]string `json:"tags,omitempty"`
}

type CreateInstanceInput

type CreateInstanceInput struct {
	Name            string
	NamePrefix      string
	Package         string
	Image           string
	Networks        []string
	NetworkObjects  []NetworkObject
	Affinity        []string
	LocalityStrict  bool
	LocalityNear    []string
	LocalityFar     []string
	Metadata        map[string]string
	Tags            map[string]string //
	FirewallEnabled bool              //
	CNS             InstanceCNS
	Volumes         []InstanceVolume
}

type CreateSnapshotInput

type CreateSnapshotInput struct {
	MachineID string
	Name      string
}

type CreateVolumeInput

type CreateVolumeInput struct {
	Name     string
	Size     int64
	Networks []string
	Type     string
}

type DataCenter

type DataCenter struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type DataCentersClient

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

func (*DataCentersClient) Get

func (*DataCentersClient) List

type DeleteAllMetadataInput

type DeleteAllMetadataInput struct {
	ID string
}

type DeleteImageInput

type DeleteImageInput struct {
	ImageID string
}

type DeleteInstanceInput

type DeleteInstanceInput struct {
	ID string
}

type DeleteMetadataInput

type DeleteMetadataInput struct {
	ID  string
	Key string
}

type DeleteSnapshotInput

type DeleteSnapshotInput struct {
	MachineID string
	Name      string
}

type DeleteTagInput

type DeleteTagInput struct {
	ID  string
	Key string
}

type DeleteTagsInput

type DeleteTagsInput struct {
	ID string
}

type DeleteVolumeInput

type DeleteVolumeInput struct {
	ID string
}

type DisableDeletionProtectionInput

type DisableDeletionProtectionInput struct {
	InstanceID string
}

type DisableFirewallInput

type DisableFirewallInput struct {
	ID string
}

type EnableDeletionProtectionInput

type EnableDeletionProtectionInput struct {
	InstanceID string
}

type EnableFirewallInput

type EnableFirewallInput struct {
	ID string
}

type ExportImageInput

type ExportImageInput struct {
	ImageID   string
	MantaPath string
}

type GetDataCenterInput

type GetDataCenterInput struct {
	Name string
}

type GetImageInput

type GetImageInput struct {
	ImageID string
}

type GetInstanceInput

type GetInstanceInput struct {
	ID string
}

func (*GetInstanceInput) Validate

func (gmi *GetInstanceInput) Validate() error

type GetMetadataInput

type GetMetadataInput struct {
	ID  string
	Key string
}

type GetNICInput

type GetNICInput struct {
	InstanceID string
	MAC        string
}

type GetPackageInput

type GetPackageInput struct {
	ID string
}

type GetSnapshotInput

type GetSnapshotInput struct {
	MachineID string
	Name      string
}

type GetTagInput

type GetTagInput struct {
	ID  string
	Key string
}

type GetVolumeInput

type GetVolumeInput struct {
	ID string
}

type Image

type Image struct {
	ID           string                 `json:"id"`
	Name         string                 `json:"name"`
	OS           string                 `json:"os"`
	Description  string                 `json:"description"`
	Version      string                 `json:"version"`
	Type         string                 `json:"type"`
	Requirements map[string]interface{} `json:"requirements"`
	Homepage     string                 `json:"homepage"`
	Files        []*ImageFile           `json:"files"`
	PublishedAt  time.Time              `json:"published_at"`
	Owner        string                 `json:"owner"`
	Public       bool                   `json:"public"`
	State        string                 `json:"state"`
	Tags         map[string]string      `json:"tags"`
	EULA         string                 `json:"eula"`
	ACL          []string               `json:"acl"`
}

type ImageFile

type ImageFile struct {
	Compression string `json:"compression"`
	SHA1        string `json:"sha1"`
	Size        int64  `json:"size"`
}

type ImagesClient

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

func (*ImagesClient) CreateFromMachine

func (c *ImagesClient) CreateFromMachine(ctx context.Context, input *CreateImageFromMachineInput) (*Image, error)

func (*ImagesClient) Delete

func (c *ImagesClient) Delete(ctx context.Context, input *DeleteImageInput) error

func (*ImagesClient) Export

func (c *ImagesClient) Export(ctx context.Context, input *ExportImageInput) (*MantaLocation, error)

func (*ImagesClient) Get

func (c *ImagesClient) Get(ctx context.Context, input *GetImageInput) (*Image, error)

func (*ImagesClient) List

func (c *ImagesClient) List(ctx context.Context, input *ListImagesInput) ([]*Image, error)

func (*ImagesClient) Update

func (c *ImagesClient) Update(ctx context.Context, input *UpdateImageInput) (*Image, error)

type Instance

type Instance struct {
	ID                 string                 `json:"id"`
	Name               string                 `json:"name"`
	Type               string                 `json:"type"`
	Brand              string                 `json:"brand"`
	State              string                 `json:"state"`
	Image              string                 `json:"image"`
	Memory             int                    `json:"memory"`
	Disk               int                    `json:"disk"`
	Metadata           map[string]string      `json:"metadata"`
	Tags               map[string]interface{} `json:"tags"`
	Created            time.Time              `json:"created"`
	Updated            time.Time              `json:"updated"`
	Docker             bool                   `json:"docker"`
	IPs                []string               `json:"ips"`
	Networks           []string               `json:"networks"`
	PrimaryIP          string                 `json:"primaryIp"`
	FirewallEnabled    bool                   `json:"firewall_enabled"`
	ComputeNode        string                 `json:"compute_node"`
	Package            string                 `json:"package"`
	DomainNames        []string               `json:"dns_names"`
	DeletionProtection bool                   `json:"deletion_protection"`
	CNS                InstanceCNS
}

type InstanceCNS

type InstanceCNS struct {
	Disable    bool
	ReversePTR string
	Services   []string
}

InstanceCNS is a container for the CNS-specific attributes. In the API these values are embedded within a Instance's Tags attribute, however they are exposed to the caller as their native types.

func TagsExtractMeta

func TagsExtractMeta(tags map[string]interface{}) (InstanceCNS, map[string]interface{})

TagsExtractMeta extracts all of the misc parameters from Tags and returns a clean CNS and Tags struct.

type InstanceVolume

type InstanceVolume struct {
	Name       string `json:"name,omitempty"`
	Type       string `json:"type,omitempty"`
	Mode       string `json:"mode,omitempty"`
	Mountpoint string `json:"mountpoint,omitempty"`
}

type InstancesClient

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

func (*InstancesClient) AddNIC

func (c *InstancesClient) AddNIC(ctx context.Context, input *AddNICInput) (*NIC, error)

AddNIC asynchronously adds a NIC to a given instance. If a NIC for a given network already exists, a ResourceFound error will be returned. The status of the addition of a NIC can be polled by calling GetNIC()'s and testing NIC until its state is set to "running". Only one NIC per network may exist. Warning: this operation causes the instance to restart.

func (*InstancesClient) AddTags

func (c *InstancesClient) AddTags(ctx context.Context, input *AddTagsInput) error

func (*InstancesClient) Count

func (c *InstancesClient) Count(ctx context.Context, input *ListInstancesInput) (int, error)

func (*InstancesClient) Create

func (c *InstancesClient) Create(ctx context.Context, input *CreateInstanceInput) (*Instance, error)

func (*InstancesClient) Delete

func (c *InstancesClient) Delete(ctx context.Context, input *DeleteInstanceInput) error

func (*InstancesClient) DeleteAllMetadata

func (c *InstancesClient) DeleteAllMetadata(ctx context.Context, input *DeleteAllMetadataInput) error

DeleteAllMetadata deletes all metadata keys from this instance

func (*InstancesClient) DeleteMetadata

func (c *InstancesClient) DeleteMetadata(ctx context.Context, input *DeleteMetadataInput) error

DeleteMetadata deletes a single metadata key from an instance

func (*InstancesClient) DeleteTag

func (c *InstancesClient) DeleteTag(ctx context.Context, input *DeleteTagInput) error

func (*InstancesClient) DeleteTags

func (c *InstancesClient) DeleteTags(ctx context.Context, input *DeleteTagsInput) error

func (*InstancesClient) DisableDeletionProtection

func (c *InstancesClient) DisableDeletionProtection(ctx context.Context, input *DisableDeletionProtectionInput) error

func (*InstancesClient) DisableFirewall

func (c *InstancesClient) DisableFirewall(ctx context.Context, input *DisableFirewallInput) error

func (*InstancesClient) EnableDeletionProtection

func (c *InstancesClient) EnableDeletionProtection(ctx context.Context, input *EnableDeletionProtectionInput) error

func (*InstancesClient) EnableFirewall

func (c *InstancesClient) EnableFirewall(ctx context.Context, input *EnableFirewallInput) error

func (*InstancesClient) Get

func (*InstancesClient) GetMetadata

func (c *InstancesClient) GetMetadata(ctx context.Context, input *GetMetadataInput) (string, error)

GetMetadata returns a single metadata entry associated with an instance.

func (*InstancesClient) GetNIC

func (c *InstancesClient) GetNIC(ctx context.Context, input *GetNICInput) (*NIC, error)

func (*InstancesClient) GetTag

func (c *InstancesClient) GetTag(ctx context.Context, input *GetTagInput) (string, error)

func (*InstancesClient) List

func (c *InstancesClient) List(ctx context.Context, input *ListInstancesInput) ([]*Instance, error)

func (*InstancesClient) ListMetadata

func (c *InstancesClient) ListMetadata(ctx context.Context, input *ListMetadataInput) (map[string]string, error)

func (*InstancesClient) ListNICs

func (c *InstancesClient) ListNICs(ctx context.Context, input *ListNICsInput) ([]*NIC, error)

func (*InstancesClient) ListTags

func (c *InstancesClient) ListTags(ctx context.Context, input *ListTagsInput) (map[string]interface{}, error)

func (*InstancesClient) Reboot

func (c *InstancesClient) Reboot(ctx context.Context, input *RebootInstanceInput) error

func (*InstancesClient) RemoveNIC

func (c *InstancesClient) RemoveNIC(ctx context.Context, input *RemoveNICInput) error

RemoveNIC removes a given NIC from a machine asynchronously. The status of the removal can be polled via GetNIC(). When GetNIC() returns a 404, the NIC has been removed from the instance. Warning: this operation causes the machine to restart.

func (*InstancesClient) Rename

func (c *InstancesClient) Rename(ctx context.Context, input *RenameInstanceInput) error

func (*InstancesClient) ReplaceTags

func (c *InstancesClient) ReplaceTags(ctx context.Context, input *ReplaceTagsInput) error

func (*InstancesClient) Resize

func (c *InstancesClient) Resize(ctx context.Context, input *ResizeInstanceInput) error

func (*InstancesClient) Start

func (c *InstancesClient) Start(ctx context.Context, input *StartInstanceInput) error

func (*InstancesClient) Stop

func (c *InstancesClient) Stop(ctx context.Context, input *StopInstanceInput) error

func (*InstancesClient) UpdateMetadata

func (c *InstancesClient) UpdateMetadata(ctx context.Context, input *UpdateMetadataInput) (map[string]string, error)

type ListDataCentersInput

type ListDataCentersInput struct{}

type ListImagesInput

type ListImagesInput struct {
	Name    string
	OS      string
	Version string
	Public  bool
	State   string
	Owner   string
	Type    string
}

type ListInstancesInput

type ListInstancesInput struct {
	Brand       string
	Alias       string
	Name        string
	Image       string
	State       string
	Memory      uint16
	Limit       uint16
	Offset      uint16
	Tags        map[string]interface{} // query by arbitrary tags prefixed with "tag."
	Tombstone   bool
	Docker      bool
	Credentials bool
}

type ListMetadataInput

type ListMetadataInput struct {
	ID          string
	Credentials bool
}

type ListNICsInput

type ListNICsInput struct {
	InstanceID string
}

type ListPackagesInput

type ListPackagesInput struct {
	Name    string `json:"name"`
	Memory  int64  `json:"memory"`
	Disk    int64  `json:"disk"`
	Swap    int64  `json:"swap"`
	LWPs    int64  `json:"lwps"`
	VCPUs   int64  `json:"vcpus"`
	Version string `json:"version"`
	Group   string `json:"group"`
}

type ListServicesInput

type ListServicesInput struct{}

type ListSnapshotsInput

type ListSnapshotsInput struct {
	MachineID string
}

type ListTagsInput

type ListTagsInput struct {
	ID string
}

type ListVolumesInput

type ListVolumesInput struct {
	Name  string
	Size  string
	State string
	Type  string
}

type MantaLocation

type MantaLocation struct {
	MantaURL     string `json:"manta_url"`
	ImagePath    string `json:"image_path"`
	ManifestPath string `json:"manifest_path"`
}

type NIC

type NIC struct {
	IP      string `json:"ip"`
	MAC     string `json:"mac"`
	Primary bool   `json:"primary"`
	Netmask string `json:"netmask"`
	Gateway string `json:"gateway"`
	State   string `json:"state"`
	Network string `json:"network"`
}

type NetworkObject

type NetworkObject struct {
	IPv4UUID string   `json:"ipv4_uuid"`
	IPv4IPs  []string `json:"ipv4_ips,omitempty"`
}

type Package

type Package struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Memory      int64  `json:"memory"`
	Disk        int64  `json:"disk"`
	Swap        int64  `json:"swap"`
	LWPs        int64  `json:"lwps"`
	VCPUs       int64  `json:"vcpus"`
	Version     string `json:"version"`
	Group       string `json:"group"`
	Description string `json:"description"`
	Default     bool   `json:"default"`
}

type PackagesClient

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

func (*PackagesClient) Get

func (c *PackagesClient) Get(ctx context.Context, input *GetPackageInput) (*Package, error)

func (*PackagesClient) List

func (c *PackagesClient) List(ctx context.Context, input *ListPackagesInput) ([]*Package, error)

type PingOutput

type PingOutput struct {
	Ping     string   `json:"ping"`
	CloudAPI CloudAPI `json:"cloudapi"`
}

type RebootInstanceInput

type RebootInstanceInput struct {
	InstanceID string
}

type RemoveNICInput

type RemoveNICInput struct {
	InstanceID string
	MAC        string
}

type RenameInstanceInput

type RenameInstanceInput struct {
	ID   string
	Name string
}

type ReplaceTagsInput

type ReplaceTagsInput struct {
	ID   string
	Tags map[string]string
	CNS  InstanceCNS
}

type ResizeInstanceInput

type ResizeInstanceInput struct {
	ID      string
	Package string
}

type Service

type Service struct {
	Name     string
	Endpoint string
}

type ServicesClient

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

func (*ServicesClient) List

type Snapshot

type Snapshot struct {
	Name    string
	State   string
	Created time.Time
	Updated time.Time
}

type SnapshotsClient

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

func (*SnapshotsClient) Create

func (c *SnapshotsClient) Create(ctx context.Context, input *CreateSnapshotInput) (*Snapshot, error)

func (*SnapshotsClient) Delete

func (c *SnapshotsClient) Delete(ctx context.Context, input *DeleteSnapshotInput) error

func (*SnapshotsClient) Get

func (*SnapshotsClient) List

func (c *SnapshotsClient) List(ctx context.Context, input *ListSnapshotsInput) ([]*Snapshot, error)

func (*SnapshotsClient) StartMachine

func (c *SnapshotsClient) StartMachine(ctx context.Context, input *StartMachineFromSnapshotInput) error

type StartInstanceInput

type StartInstanceInput struct {
	InstanceID string
}

type StartMachineFromSnapshotInput

type StartMachineFromSnapshotInput struct {
	MachineID string
	Name      string
}

type StopInstanceInput

type StopInstanceInput struct {
	InstanceID string
}

type UpdateImageInput

type UpdateImageInput struct {
	ImageID     string            `json:"-"`
	Name        string            `json:"name,omitempty"`
	Version     string            `json:"version,omitempty"`
	Description string            `json:"description,omitempty"`
	HomePage    string            `json:"homepage,omitempty"`
	EULA        string            `json:"eula,omitempty"`
	ACL         []string          `json:"acl,omitempty"`
	Tags        map[string]string `json:"tags,omitempty"`
}

type UpdateMetadataInput

type UpdateMetadataInput struct {
	ID       string
	Metadata map[string]string
}

type UpdateVolumeInput

type UpdateVolumeInput struct {
	ID   string `json:"-"`
	Name string `json:"name"`
}

type Volume

type Volume struct {
	ID             string   `json:"id"`
	Name           string   `json:"name"`
	Owner          string   `json:"owner_uuid"`
	Type           string   `json:"type"`
	FileSystemPath string   `json:"filesystem_path"`
	Size           int64    `json:"size"`
	State          string   `json:"state"`
	Networks       []string `json:"networks"`
	Refs           []string `json:"refs"`
}

type VolumesClient

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

func (*VolumesClient) Create

func (c *VolumesClient) Create(ctx context.Context, input *CreateVolumeInput) (*Volume, error)

func (*VolumesClient) Delete

func (c *VolumesClient) Delete(ctx context.Context, input *DeleteVolumeInput) error

func (*VolumesClient) Get

func (c *VolumesClient) Get(ctx context.Context, input *GetVolumeInput) (*Volume, error)

func (*VolumesClient) List

func (c *VolumesClient) List(ctx context.Context, input *ListVolumesInput) ([]*Volume, error)

func (*VolumesClient) Update

func (c *VolumesClient) Update(ctx context.Context, input *UpdateVolumeInput) error

Jump to

Keyboard shortcuts

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