server

package
Version: v0.0.0-...-f62483c Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2016 License: Apache-2.0 Imports: 5 Imported by: 94

Documentation

Index

Constants

View Source
const (
	On = iota
	Off
	Pause
	Reboot
	Reset
	ShutDown
	StartMaintenance
	StopMaintenance
)

Variables

View Source
var (
	ErrInvalidServer = fmt.Errorf("server: server missing required field(s). (Name, CPU, MemoryGB, GroupID, SourceServerID, Type)")
)

Functions

func UpdateAdditionaldisks

func UpdateAdditionaldisks(disks []Disk) api.Update

func UpdateCPU

func UpdateCPU(num int) api.Update

func UpdateCredentials

func UpdateCredentials(current, updated string) api.Update

func UpdateCustomfields

func UpdateCustomfields(fields []api.Customfields) api.Update

func UpdateDescription

func UpdateDescription(desc string) api.Update

func UpdateGroup

func UpdateGroup(group string) api.Update

func UpdateMemory

func UpdateMemory(num int) api.Update

Types

type Credentials

type Credentials struct {
	Username string `json:"userName"`
	Password string `json:"password"`
}

type Disk

type Disk struct {
	DiskID string `json:"diskId,omitempty"`
	Path   string `json:"path,omitempty"`
	SizeGB int    `json:"sizeGB,omitempty"`
	Type   string `json:"type,omitempty"`
}

type Package

type Package struct {
	ID     string            `json:"packageId"`
	Params map[string]string `json:"parameters"`
}

type Port

type Port struct {
	Protocol string `json:"protocol"`
	Port     int    `json:"port"`
	PortTo   int    `json:"portTo,omitempty"`
}

type PowerState

type PowerState int

func (PowerState) String

func (p PowerState) String() string

type PublicIP

type PublicIP struct {
	InternalIP         string              `json:"internalIPAddress,omitempty"`
	Ports              []Port              `json:"ports,omitempty"`
	SourceRestrictions []SourceRestriction `json:"sourceRestrictions,omitempty"`
}

type Response

type Response struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	GroupID     string `json:"groupId"`
	IsTemplate  bool   `json:"isTemplate"`
	LocationID  string `json:"locationId"`
	OStype      string `json:"osType"`
	OS          string `json:"os"`
	Status      string `json:"status"`
	Details     struct {
		IPaddresses []struct {
			Internal string `json:"internal"`
			Public   string `json:"public"`
		} `json:"ipAddresses"`
		AlertPolicies []struct {
			ID    string    `json:"id"`
			Name  string    `json:"name"`
			Links api.Links `json:"links"`
		} `json:"alertPolicies"`
		CPU               int    `json:"cpu"`
		Diskcount         int    `json:"diskCount"`
		Hostname          string `json:"hostName"`
		InMaintenanceMode bool   `json:"inMaintenanceMode"`
		MemoryMB          int    `json:"memoryMB"`
		Powerstate        string `json:"powerState"`
		Storagegb         int    `json:"storageGB"`
		Disks             []struct {
			ID             string        `json:"id"`
			SizeGB         int           `json:"sizeGB"`
			PartitionPaths []interface{} `json:"partitionPaths"`
		} `json:"disks"`
		Partitions []struct {
			SizeGB float64 `json:"sizeGB"`
			Path   string  `json:"path"`
		} `json:"partitions"`
		Snapshots []struct {
			Name  string    `json:"name"`
			Links api.Links `json:"links"`
		} `json:"snapshots"`
		Customfields []api.Customfields `json:"customFields,omitempty"`
	} `json:"details"`
	Type        string `json:"type"`
	Storagetype string `json:"storageType"`
	ChangeInfo  struct {
		CreatedDate  string `json:"createdDate"`
		CreatedBy    string `json:"createdBy"`
		ModifiedDate string `json:"modifiedDate"`
		ModifiedBy   string `json:"modifiedBy"`
	} `json:"changeInfo"`
	Links api.Links `json:"links"`
}

type SecondaryNetwork

type SecondaryNetwork struct {
	NetworkID string `json:"networkId,omitempty"`
	IPAddress string `json:"ipAddress,omitempty"`
}

type Server

type Server struct {
	Name                 string             `json:"name"`
	Description          string             `json:"description,omitempty"`
	GroupID              string             `json:"groupId"`
	SourceServerID       string             `json:"sourceServerId"`
	IsManagedOS          bool               `json:"isManagedOS,omitempty"`
	IsManagedBackup      bool               `json:"isManagedBackup,omitempty"`
	PrimaryDNS           string             `json:"primaryDns,omitempty"`
	SecondaryDNS         string             `json:"secondaryDns,omitempty"`
	NetworkID            string             `json:"networkId,omitempty"`
	IPaddress            string             `json:"ipAddress,omitempty"`
	Password             string             `json:"password,omitempty"`
	SourceServerPassword string             `json:"sourceServerPassword,omitempty"`
	CPU                  int                `json:"cpu"`
	CPUAutoscalePolicyID string             `json:"cpuAutoscalePolicyId,omitempty"`
	MemoryGB             int                `json:"memoryGB"`
	Type                 string             `json:"type"`
	Storagetype          string             `json:"storageType,omitempty"`
	AntiAffinityPolicyID string             `json:"antiAffinityPolicyId,omitempty"`
	Customfields         []api.Customfields `json:"customFields,omitempty"`
	Additionaldisks      []Disk             `json:"additionalDisks,omitempty"`
	TTL                  *time.Time         `json:"ttl,omitempty"`
	Packages             []Package          `json:"packages,omitempty"`
	ConfigurationID      string             `json:"configurationId,omitempty"`
	OSType               string             `json:"osType,omitempty"`
}

func (*Server) Valid

func (s *Server) Valid() bool

type Service

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

func New

func New(client api.HTTP) *Service

func (*Service) AddPublicIP

func (s *Service) AddPublicIP(name string, ip PublicIP) (*status.Status, error)

func (*Service) AddSecondaryNetwork

func (s *Service) AddSecondaryNetwork(name, networkId, ip string) (*status.Status, error)

func (*Service) Archive

func (s *Service) Archive(servers ...string) ([]*status.QueuedResponse, error)

func (*Service) Create

func (s *Service) Create(server Server) (*status.QueuedResponse, error)

func (*Service) CreateSnapshot

func (s *Service) CreateSnapshot(expiration int, servers ...string) ([]*status.QueuedResponse, error)

func (*Service) Delete

func (s *Service) Delete(name string) (*status.QueuedResponse, error)

func (*Service) DeletePublicIP

func (s *Service) DeletePublicIP(name, ip string) (*status.Status, error)

func (*Service) DeleteSnapshot

func (s *Service) DeleteSnapshot(server, id string) (*status.Status, error)

func (*Service) Edit

func (s *Service) Edit(name string, updates ...api.Update) error

func (*Service) ExecutePackage

func (s *Service) ExecutePackage(pkg Package, servers ...string) ([]*status.QueuedResponse, error)

func (*Service) Get

func (s *Service) Get(name string) (*Response, error)

func (*Service) GetCredentials

func (s *Service) GetCredentials(name string) (Credentials, error)

func (*Service) GetPublicIP

func (s *Service) GetPublicIP(name string, ip string) (*PublicIP, error)

func (*Service) PowerState

func (s *Service) PowerState(state PowerState, servers ...string) ([]*status.QueuedResponse, error)

func (*Service) Restore

func (s *Service) Restore(name, group string) (*status.Status, error)

func (*Service) RevertSnapshot

func (s *Service) RevertSnapshot(server, id string) (*status.Status, error)

func (*Service) Update

func (s *Service) Update(name string, updates ...api.Update) (*status.Status, error)

func (*Service) UpdatePublicIP

func (s *Service) UpdatePublicIP(name string, public string, ip PublicIP) (*status.Status, error)

type Snapshot

type Snapshot struct {
	Expiration int      `json:"snapshotExpirationDays"`
	Servers    []string `json:"serverIds"`
}

type SourceRestriction

type SourceRestriction struct {
	CIDR string `json:"cidr"`
}

Source Files

Jump to

Keyboard shortcuts

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