request

package
v0.0.0-...-278d4fc Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PasswordDeliveryNone  = "none"
	PasswordDeliveryEmail = "email"
	PasswordDeliverySMS   = "sms"

	ServerStopTypeSoft = "soft"
	ServerStopTypeHard = "hard"

	RestartTimeoutActionDestroy = "destroy"
	RestartTimeoutActionIgnore  = "ignore"
)

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type AssignIPAddressRequest

type AssignIPAddressRequest struct {
	XMLName xml.Name `xml:"ip_address"`

	Access     string `xml:"access"`
	Family     string `xml:"family,omitempty"`
	ServerUUID string `xml:"server"`
}

AssignIPAddressRequest represents a request to assign a new IP address to a server

func (*AssignIPAddressRequest) RequestURL

func (r *AssignIPAddressRequest) RequestURL() string

RequestURL implements the Request interface

type AttachStorageRequest

type AttachStorageRequest struct {
	XMLName    xml.Name `xml:"storage_device"`
	ServerUUID string   `xml:"-"`

	Type        string `xml:"type,omitempty"`
	Address     string `xml:"address,omitempty"`
	StorageUUID string `xml:"storage,omitempty"`
}

AttachStorageRequest represents a request to attach a storage device to a server

func (*AttachStorageRequest) RequestURL

func (r *AttachStorageRequest) RequestURL() string

RequestURL implements the Request interface

type CloneStorageRequest

type CloneStorageRequest struct {
	XMLName xml.Name `xml:"storage"`
	UUID    string   `xml:"-"`

	Zone  string `xml:"zone"`
	Tier  string `xml:"tier,omitempty"`
	Title string `xml:"title"`
}

CloneStorageRequest represents a requests to clone a storage device

func (*CloneStorageRequest) RequestURL

func (r *CloneStorageRequest) RequestURL() string

RequestURL implements the Request interface

type CreateBackupRequest

type CreateBackupRequest struct {
	XMLName xml.Name `xml:"storage"`
	UUID    string   `xml:"-"`

	Title string `xml:"title"`
}

CreateBackupRequest represents a request to create a backup of a storage device

func (*CreateBackupRequest) RequestURL

func (r *CreateBackupRequest) RequestURL() string

RequestURL implements the Request interface

type CreateFirewallRuleRequest

type CreateFirewallRuleRequest struct {
	upcloud.FirewallRule

	XMLName    xml.Name `xml:"firewall_rule"`
	ServerUUID string   `xml:"-"`
}

CreateFirewallRuleRequest represents a request to create a new firewall rule for a specific server

func (*CreateFirewallRuleRequest) RequestURL

func (r *CreateFirewallRuleRequest) RequestURL() string

RequestURL implements the Request interface

type CreateServerIPAddress

type CreateServerIPAddress struct {
	Access string `xml:"access"`
	Family string `xml:"family"`
}

CreateServerIPAddress represents an IP address for a CreateServerRequest

type CreateServerRequest

type CreateServerRequest struct {
	XMLName xml.Name `xml:"server"`

	AvoidHost  string `xml:"avoid_host,omitempty"`
	BootOrder  string `xml:"boot_order,omitempty"`
	CoreNumber int    `xml:"core_number,omitempty"`
	// TODO: Convert to boolean
	Firewall         string                              `xml:"firewall,omitempty"`
	Hostname         string                              `xml:"hostname"`
	IPAddresses      []CreateServerIPAddress             `xml:"ip_addresses>ip_address"`
	LoginUser        *LoginUser                          `xml:"login_user,omitempty"`
	MemoryAmount     int                                 `xml:"memory_amount,omitempty"`
	PasswordDelivery string                              `xml:"password_delivery,omitempty"`
	Plan             string                              `xml:"plan,omitempty"`
	StorageDevices   []upcloud.CreateServerStorageDevice `xml:"storage_devices>storage_device"`
	TimeZone         string                              `xml:"timezone,omitempty"`
	Title            string                              `xml:"title"`
	UserData         string                              `xml:"user_data,omitempty"`
	VideoModel       string                              `xml:"video_model,omitempty"`
	// TODO: Convert to boolean
	VNC         string `xml:"vnc,omitempty"`
	VNCPassword string `xml:"vnc_password,omitempty"`
	Zone        string `xml:"zone"`
}

CreateServerRequest represents a request for creating a new server

func (*CreateServerRequest) RequestURL

func (r *CreateServerRequest) RequestURL() string

RequestURL implements the Request interface

type CreateStorageRequest

type CreateStorageRequest struct {
	XMLName xml.Name `xml:"storage"`

	Size       int                 `xml:"size"`
	Tier       string              `xml:"tier,omitempty"`
	Title      string              `xml:"title"`
	Zone       string              `xml:"zone"`
	BackupRule *upcloud.BackupRule `xml:"backup_rule,omitempty"`
}

CreateStorageRequest represents a request to create a storage device

func (*CreateStorageRequest) RequestURL

func (r *CreateStorageRequest) RequestURL() string

RequestURL implements the Request interface

type CreateTagRequest

type CreateTagRequest struct {
	upcloud.Tag

	XMLName xml.Name `xml:"tag"`
}

CreateTagRequest represents a request to create a tag and assign it to zero or more servers

func (*CreateTagRequest) RequestURL

func (r *CreateTagRequest) RequestURL() string

RequestURL implements the Request interface

type DeleteFirewallRuleRequest

type DeleteFirewallRuleRequest struct {
	ServerUUID string
	Position   int
}

DeleteFirewallRuleRequest represents a request to remove a firewall rule

func (*DeleteFirewallRuleRequest) RequestURL

func (r *DeleteFirewallRuleRequest) RequestURL() string

RequestURL implements the Request interface

type DeleteServerAndStoragesRequest

type DeleteServerAndStoragesRequest struct {
	UUID string
}

DeleteServerAndStoragesRequest represents a request to delete a server and all attached storages

func (*DeleteServerAndStoragesRequest) RequestURL

func (r *DeleteServerAndStoragesRequest) RequestURL() string

RequestURL implements the Request interface

type DeleteServerRequest

type DeleteServerRequest struct {
	UUID string
}

DeleteServerRequest represents a request to delete a server

func (*DeleteServerRequest) RequestURL

func (r *DeleteServerRequest) RequestURL() string

RequestURL implements the Request interface

type DeleteStorageRequest

type DeleteStorageRequest struct {
	UUID string
}

DeleteStorageRequest represents a request to delete a storage device

func (*DeleteStorageRequest) RequestURL

func (r *DeleteStorageRequest) RequestURL() string

RequestURL implements the Request interface

type DeleteTagRequest

type DeleteTagRequest struct {
	Name string
}

DeleteTagRequest represents a request to delete a tag

func (*DeleteTagRequest) RequestURL

func (r *DeleteTagRequest) RequestURL() string

RequestURL implements the Request interface

type DetachStorageRequest

type DetachStorageRequest struct {
	XMLName    xml.Name `xml:"storage_device"`
	ServerUUID string   `xml:"-"`

	Address string `xml:"address"`
}

DetachStorageRequest represents a request to detach a storage device from a server

func (*DetachStorageRequest) RequestURL

func (r *DetachStorageRequest) RequestURL() string

RequestURL implements the Request interface

type EjectCDROMRequest

type EjectCDROMRequest struct {
	ServerUUID string
}

EjectCDROMRequest represents a request to load a storage as a CD-ROM in the CD-ROM device of a server

func (*EjectCDROMRequest) RequestURL

func (r *EjectCDROMRequest) RequestURL() string

RequestURL implements the Request interface

type GetFirewallRuleDetailsRequest

type GetFirewallRuleDetailsRequest struct {
	ServerUUID string
	Position   int
}

GetFirewallRuleDetailsRequest represents a request to get details about a specific firewall rule

func (*GetFirewallRuleDetailsRequest) RequestURL

func (r *GetFirewallRuleDetailsRequest) RequestURL() string

RequestURL implements the Request interface

type GetFirewallRulesRequest

type GetFirewallRulesRequest struct {
	ServerUUID string
}

GetFirewallRulesRequest represents a request for retrieving the firewall rules for a specific server

func (*GetFirewallRulesRequest) RequestURL

func (r *GetFirewallRulesRequest) RequestURL() string

RequestURL implements the Request interface

type GetIPAddressDetailsRequest

type GetIPAddressDetailsRequest struct {
	Address string
}

GetIPAddressDetailsRequest represents a request to retrieve details about a specific IP address

func (*GetIPAddressDetailsRequest) RequestURL

func (r *GetIPAddressDetailsRequest) RequestURL() string

RequestURL implements the Request interface

type GetServerDetailsRequest

type GetServerDetailsRequest struct {
	UUID string
}

GetServerDetailsRequest represents a request for retrieving details about a server

func (*GetServerDetailsRequest) RequestURL

func (r *GetServerDetailsRequest) RequestURL() string

RequestURL implements the Request interface

type GetStorageDetailsRequest

type GetStorageDetailsRequest struct {
	UUID string
}

GetStorageDetailsRequest represents a request for retrieving details about a piece of storage

func (*GetStorageDetailsRequest) RequestURL

func (r *GetStorageDetailsRequest) RequestURL() string

RequestURL implements the Request interface

type GetStoragesRequest

type GetStoragesRequest struct {
	// If specified, only storages with this access type will be retrieved
	Access string
	// If specified, only storages with this type will be retrieved
	Type string
	// If specified, only storages marked as favorite will be retrieved
	Favorite bool
}

GetStoragesRequest represents a request for retrieving all or some storages

func (*GetStoragesRequest) RequestURL

func (r *GetStoragesRequest) RequestURL() string

RequestURL implements the Request interface

type LoadCDROMRequest

type LoadCDROMRequest struct {
	XMLName    xml.Name `xml:"storage_device"`
	ServerUUID string   `xml:"-"`

	StorageUUID string `xml:"storage"`
}

LoadCDROMRequest represents a request to load a storage as a CD-ROM in the CD-ROM device of a server

func (*LoadCDROMRequest) RequestURL

func (r *LoadCDROMRequest) RequestURL() string

RequestURL implements the Request interface

type LoginUser

type LoginUser struct {
	CreatePassword string   `xml:"create_password,omitempty"`
	Username       string   `xml:"username,omitempty"`
	SSHKeys        []string `xml:"ssh_keys>ssh_key,omitempty"`
}

LoginUser represents the login_user block when creating a new server

type ModifyIPAddressRequest

type ModifyIPAddressRequest struct {
	XMLName   xml.Name `xml:"ip_address"`
	IPAddress string   `xml:"-"`

	PTRRecord string `xml:"ptr_record"`
}

ModifyIPAddressRequest represents a request to modify the PTR DNS record of a specific IP address

func (*ModifyIPAddressRequest) RequestURL

func (r *ModifyIPAddressRequest) RequestURL() string

RequestURL implements the Request interface

type ModifyServerRequest

type ModifyServerRequest struct {
	XMLName xml.Name `xml:"server"`

	UUID string `xml:"-"`

	AvoidHost string `xml:"avoid_host,omitempty"`
	BootOrder string `xml:"boot_order,omitempty"`
	// TODO: Investigate correct type and format
	CoreNumber string `xml:"core_number,omitempty"`
	// TODO: Convert to boolean
	Firewall string `xml:"firewall,omitempty"`
	Hostname string `xml:"hostname,omitempty"`
	// TODO: Investigate correct type and format
	MemoryAmount string `xml:"memory_amount,omitempty"`
	Plan         string `xml:"plan,omitempty"`
	TimeZone     string `xml:"timezone,omitempty"`
	Title        string `xml:"title,omitempty"`
	VideoModel   string `xml:"video_model,omitempty"`
	// TODO: Convert to boolean
	VNC         string `xml:"vnc,omitempty"`
	VNCPassword string `xml:"vnc_password,omitempty"`
}

ModifyServerRequest represents a request to modify a server

func (*ModifyServerRequest) RequestURL

func (r *ModifyServerRequest) RequestURL() string

RequestURL implements the Request interface

type ModifyStorageRequest

type ModifyStorageRequest struct {
	XMLName xml.Name `xml:"storage"`
	UUID    string   `xml:"-"`

	Title      string              `xml:"title,omitempty"`
	Size       int                 `xml:"size,omitempty"`
	BackupRule *upcloud.BackupRule `xml:"backup_rule,omitempty"`
}

ModifyStorageRequest represents a request to modify a storage device

func (*ModifyStorageRequest) RequestURL

func (r *ModifyStorageRequest) RequestURL() string

RequestURL implements the Request interface

type ModifyTagRequest

type ModifyTagRequest struct {
	upcloud.Tag

	XMLName xml.Name `xml:"tag"`
	Name    string   `xml:"-"`
}

ModifyTagRequest represents a request to modify an existing tag. The Name is the name of the current tag, the Tag is the new values for the tag.

func (*ModifyTagRequest) RequestURL

func (r *ModifyTagRequest) RequestURL() string

RequestURL implements the Request interface

type ReleaseIPAddressRequest

type ReleaseIPAddressRequest struct {
	IPAddress string
}

ReleaseIPAddressRequest represents a request to remove a specific IP address from server

func (*ReleaseIPAddressRequest) RequestURL

func (r *ReleaseIPAddressRequest) RequestURL() string

RequestURL implements the Request interface

type Request

type Request interface {
	// RequestURL returns the relative API URL for the request, excluding the API version.
	RequestURL() string
}

Request is the interface for request objects

type RestartServerRequest

type RestartServerRequest struct {
	XMLName xml.Name `xml:"restart_server"`

	UUID string `xml:"-"`

	StopType      string        `xml:"stop_type,omitempty"`
	Timeout       time.Duration `xml:"timeout,omitempty"`
	TimeoutAction string        `xml:"timeout_action,omitempty"`
}

RestartServerRequest represents a request to restart a server

func (*RestartServerRequest) MarshalXML

func (r *RestartServerRequest) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements a custom marshaller for RestartServerRequest which converts the timeout to seconds

func (*RestartServerRequest) RequestURL

func (r *RestartServerRequest) RequestURL() string

RequestURL implements the Request interface

type RestoreBackupRequest

type RestoreBackupRequest struct {
	UUID string
}

RestoreBackupRequest represents a request to restore a storage from the specified backup

func (*RestoreBackupRequest) RequestURL

func (r *RestoreBackupRequest) RequestURL() string

RequestURL implements the Request interface

type StartServerRequest

type StartServerRequest struct {
	UUID string

	// TODO: Start server requests have no timeout in the API
	Timeout time.Duration
}

StartServerRequest represents a request to start a server

func (*StartServerRequest) RequestURL

func (r *StartServerRequest) RequestURL() string

RequestURL implements the Request interface

type StopServerRequest

type StopServerRequest struct {
	XMLName xml.Name `xml:"stop_server"`

	UUID string `xml:"-"`

	StopType string        `xml:"stop_type,omitempty"`
	Timeout  time.Duration `xml:"timeout,omitempty"`
}

StopServerRequest represents a request to stop a server

func (*StopServerRequest) MarshalXML

func (r *StopServerRequest) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements a custom marshaller for StopServerRequest which converts the timeout to seconds

func (*StopServerRequest) RequestURL

func (r *StopServerRequest) RequestURL() string

RequestURL implements the Request interface

type TagServerRequest

type TagServerRequest struct {
	UUID string
	Tags []string
}

TagServerRequest represents a request to tag a server with one or more tags

func (*TagServerRequest) RequestURL

func (r *TagServerRequest) RequestURL() string

RequestURL implements the Request interface

type TemplatizeStorageRequest

type TemplatizeStorageRequest struct {
	XMLName xml.Name `xml:"storage"`
	UUID    string   `xml:"-"`

	Title string `xml:"title"`
}

TemplatizeStorageRequest represents a request to templatize a storage device

func (*TemplatizeStorageRequest) RequestURL

func (r *TemplatizeStorageRequest) RequestURL() string

RequestURL implements the Request interface

type UntagServerRequest

type UntagServerRequest struct {
	UUID string
	Tags []string
}

UntagServerRequest represents a request to remove one or more tags from a server

func (*UntagServerRequest) RequestURL

func (r *UntagServerRequest) RequestURL() string

RequestURL implements the Request interface

type WaitForServerStateRequest

type WaitForServerStateRequest struct {
	UUID           string
	DesiredState   string
	UndesiredState string
	Timeout        time.Duration
}

WaitForServerStateRequest represents a request to wait for a server to enter or exit a specific state

type WaitForStorageStateRequest

type WaitForStorageStateRequest struct {
	UUID         string
	DesiredState string
	Timeout      time.Duration
}

WaitForStorageStateRequest represents a request to wait for a storage to enter a specific state

Jump to

Keyboard shortcuts

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