server

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2016 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ListTimeout = 200
)
View Source
var (
	TemplateTimeout = 200
)

Functions

func GetNames

func GetNames(cn base.Connection, dataCenter string) ([]string, error)

func IDByName

func IDByName(cn base.Connection, name string) (string, error)

func LoadTemplates

func LoadTemplates(cn base.Connection) ([]string, error)

Types

type AddDiskRequest

type AddDiskRequest struct {
	Path   string
	SizeGB int64
	Type   string
}

type AddIPAddressReq

type AddIPAddressReq struct {
	Server `json:"-" argument:"composed" URIParam:"ServerId"`

	InternalIpAddress  string                     `json:",omitempty"`
	Ports              []models.PortRestriction   `json:",omitempty"`
	SourceRestrictions []models.SourceRestriction `json:",omitempty"`
}

func (*AddIPAddressReq) Validate

func (ar *AddIPAddressReq) Validate() error

type AddNetwork

type AddNetwork struct {
	ServerId    string `json:"-" URIParam:"yes"`
	ServerName  string `json:"-"`
	NetworkId   string
	NetworkName string `json:"-"`
	IpAddress   string
}

func (*AddNetwork) GetNames

func (a *AddNetwork) GetNames(cn base.Connection, property string) ([]string, error)

func (*AddNetwork) InferID

func (a *AddNetwork) InferID(cn base.Connection) error

func (*AddNetwork) Validate

func (a *AddNetwork) Validate() error

type AvailableImport

type AvailableImport struct {
	Id            string
	Name          string
	StorageSizeGB int64
	CpuCount      int64
	MemorySizeMB  int64
}

type CreateReq

type CreateReq struct {
	Name                   string `valid:"required"`
	Description            string `json:",omitempty"`
	GroupId                string
	GroupName              string `json:",omitempty"`
	SourceServerId         string
	SourceServerName       string `json:"-"`
	TemplateName           string `json:"-"`
	IsManagedOs            bool   `json:"IsManagedOS"`
	IsManagedBackup        bool
	PrimaryDns             string             `json:",omitempty"`
	SecondaryDns           string             `json:",omitempty"`
	NetworkId              string             `json:",omitempty"`
	NetworkName            string             `json:",omitempty"`
	IpAddress              string             `json:",omitempty"`
	RootPassword           string             `json:"Password,omitempty"`
	SourceServerPassword   string             `json:",omitempty"`
	Cpu                    int64              `json:",omitempty`
	CpuAutoscalePolicyId   string             `json:",omitempty"`
	MemoryGb               int64              `json:",omitempty`
	Type                   string             `valid:"required" oneOf:"standard,hyperscale,bareMetal"`
	AntiAffinityPolicyId   string             `json:",omitempty"`
	AntiAffinityPolicyName string             `json:",omitempty"`
	CustomFields           []customfields.Def `json:",omitempty"`
	AdditionalDisks        []AddDiskRequest   `json:",omitempty"`
	Ttl                    time.Time          `json:"-"`
	TtlString              string             `json:"Ttl,omitempty" argument:"ignore"`
	Packages               []PackageDef       `json:",omitempty"`
	ConfigurationId        string             `json:",omitempty"`
	OsType                 string             `json:",omitempty"`
}

func (*CreateReq) ApplyDefaultBehaviour

func (c *CreateReq) ApplyDefaultBehaviour() error

func (*CreateReq) GetNames

func (c *CreateReq) GetNames(cn base.Connection, property string) ([]string, error)

func (*CreateReq) InferID

func (c *CreateReq) InferID(cn base.Connection) error

func (*CreateReq) Validate

func (c *CreateReq) Validate() error

type CreateSnapshotReq

type CreateSnapshotReq struct {
	SnapshotExpirationDays int64 `valid:"required"`
	ServerIds              []string
}

func (*CreateSnapshotReq) Validate

func (cr *CreateSnapshotReq) Validate() error

type DeleteReq

type DeleteReq struct {
	Server `argument:"composed" URIParam:"ServerId"  json:"-"`
}

type DeleteSnapshotReq

type DeleteSnapshotReq struct {
	Server     `argument:"composed" URIParam:"ServerId" json:"-"`
	SnapshotId string `valid:"required" URIParam:"yes" json:"-"`
}

type Details

type Details struct {
	IpAddresses          []IPAddresses
	SecondaryIPAddresses []IPAddresses
	AlertPolicies        []alert.AlertPolicy
	Cpu                  int64
	DiskCount            int64
	HostName             string
	InMaintenanceMode    bool
	MemoryMB             int64
	PowerState           string
	StorageGB            int64
	Disks                []Disk
	Partitions           []Partition
	Snapshots            []Snapshot
	CustomFields         []customfields.FullDef
	ProcessorDescription string `json:",omitempty"`
	StorageDescription   string `json:",omitempty"`
	IsManagedBackup      bool   `json:",omitempty"`
}

type Disk

type Disk struct {
	Id             string
	SizeGB         float64
	PartitionPaths []string
}

type ExecutePackage

type ExecutePackage struct {
	ServerIds []string   `json:"servers"`
	Package   PackageDef `valid:"required"`
}

func (*ExecutePackage) Validate

func (e *ExecutePackage) Validate() error

type GetCredentialsReq

type GetCredentialsReq struct {
	Server `argument:"composed" URIParam:"ServerId"`
}

type GetCredentialsRes

type GetCredentialsRes struct {
	UserName string
	Password string
}

type GetIPAddressReq

type GetIPAddressReq struct {
	Server   `argument:"composed" URIParam:"ServerId"`
	PublicIp string `valid:"required" URIParam:"yes"`
}

type GetIPAddressRes

type GetIPAddressRes struct {
	InternalIPAddress  string
	Ports              []models.PortRestriction
	SourceRestrictions []models.SourceRestriction
}

type GetImportsReq

type GetImportsReq struct {
	DataCenter string `valid:"required" URIParam:"yes"`
}

type GetImportsRes

type GetImportsRes []AvailableImport

type GetReq

type GetReq struct {
	Server `argument:"composed" URIParam:"ServerId"`
}

type GetRes

type GetRes struct {
	Id          string
	Name        string
	DisplayName string
	Description string
	GroupId     string
	IsTemplate  bool
	LocationId  string
	OsType      string
	IsManagedOS bool
	Os          string
	Status      string
	Details     Details
	Type        string
	ChangeInfo  models.ChangeInfo
	Links       []models.LinkEntity
}

func Load

func Load(cn base.Connection, dataCenter string) ([]GetRes, error)

type IPAddresses

type IPAddresses struct {
	Public   string `json:",omitempty"`
	Internal string
}

type Import

type Import struct {
	Name         string `valid:"required"`
	Description  string `json:",omitempty"`
	GroupId      string
	GroupName    string             `json:"-"`
	PrimaryDns   string             `json:",omitempty"`
	SecondaryDns string             `json:",omitempty"`
	NetworkId    string             `json:",omitempty"`
	NetworkName  string             `json:"-"`
	RootPassword string             `json:"Password" valid:"required"`
	Cpu          int64              `valid:"required"`
	MemoryGb     int64              `valid:"required"`
	Type         string             `valid:"required" oneOf:"standard,hyperscale"`
	CustomFields []customfields.Def `json:",omitempty"`
	OvfId        string             `valid:"required"`
	OvfOsType    string             `valid:"required"`
}

func (*Import) GetNames

func (i *Import) GetNames(cn base.Connection, property string) ([]string, error)

func (*Import) InferID

func (i *Import) InferID(cn base.Connection) error

func (*Import) Validate

func (i *Import) Validate() error

type KeepDiskRequest

type KeepDiskRequest struct {
	DiskId string
	SizeGB int64
}

type List

type List struct {
	DataCenter string
	All        base.NilField
}

func (*List) Validate

func (l *List) Validate() error

type MaintenanceRequest

type MaintenanceRequest struct {
	ServerIds []string
}

func (*MaintenanceRequest) ApplyDefaultBehaviour

func (s *MaintenanceRequest) ApplyDefaultBehaviour() error

This method replaces all of the ids with their upper case versions because the API call only accepts ids written in upper case.

func (*MaintenanceRequest) MarshalJSON

func (s *MaintenanceRequest) MarshalJSON() ([]byte, error)

func (*MaintenanceRequest) Validate

func (s *MaintenanceRequest) Validate() error

type PackageDef

type PackageDef struct {
	PackageId  string
	Parameters map[string]string
}

type Partition

type Partition struct {
	SizeGB float64
	Path   string
}

type PowerReq

type PowerReq struct {
	ServerIds []string
}

func (*PowerReq) MarshalJSON

func (pr *PowerReq) MarshalJSON() ([]byte, error)

func (*PowerReq) Validate

func (pr *PowerReq) Validate() error

type RemoveIPAddressReq

type RemoveIPAddressReq struct {
	Server   `argument:"composed" URIParam:"ServerId" json:"-"`
	PublicIp string `valid:"required" URIParam:"yes" json:"-"`
}

type RemoveNetwork

type RemoveNetwork struct {
	ServerId    string `URIParam:"yes" json:"-"`
	ServerName  string `json:"-"`
	NetworkId   string `URIParam:"yes" json:"-"`
	NetworkName string `json:"-"`
}

func (*RemoveNetwork) GetNames

func (r *RemoveNetwork) GetNames(cn base.Connection, property string) ([]string, error)

func (*RemoveNetwork) InferID

func (r *RemoveNetwork) InferID(cn base.Connection) error

func (*RemoveNetwork) Validate

func (r *RemoveNetwork) Validate() error

type RestoreReq

type RestoreReq struct {
	ServerId string `json:"-" valid:"required" URIParam:"yes"`

	TargetGroupId string `valid:"required"`
}

type RevertToSnapshotReq

type RevertToSnapshotReq struct {
	Server     `json:"-" argument:"composed" URIParam:"ServerId"`
	SnapshotId string `json:"-" valid:"required" URIParam:"yes"`
}

type Server

type Server struct {
	ServerId   string
	ServerName string
}

func (*Server) GetNames

func (s *Server) GetNames(cn base.Connection, property string) ([]string, error)

func (*Server) InferID

func (s *Server) InferID(cn base.Connection) error

func (*Server) Validate

func (s *Server) Validate() error

type ServerPatchOperation

type ServerPatchOperation struct {
	Op     string
	Member string
	Value  interface{}
}

type ServerRes

type ServerRes struct {
	Server       string
	IsQueued     bool
	ErrorMessage string
	Links        []models.LinkEntity
}

type Snapshot

type Snapshot struct {
	Name  string
	Id    string
	Links []models.LinkEntity
}

func (*Snapshot) UnmarshalJSON

func (s *Snapshot) UnmarshalJSON(data []byte) error

type UpdateDisksDescription

type UpdateDisksDescription struct {
	Add  []AddDiskRequest
	Keep []KeepDiskRequest
}

func (*UpdateDisksDescription) Flatten

func (udd *UpdateDisksDescription) Flatten() []interface{}

type UpdateIPAddressReq

type UpdateIPAddressReq struct {
	Server   `json:"-" argument:"composed" URIParam:"ServerId"`
	PublicIp string `json:"-" valid:"required" URIParam:"yes"`

	Ports              []models.PortRestriction
	SourceRestrictions []models.SourceRestriction
}

func (*UpdateIPAddressReq) Validate

func (ur *UpdateIPAddressReq) Validate() error

type UpdateReq

type UpdateReq struct {
	Server         `argument:"composed" URIParam:"ServerId"`
	PatchOperation []ServerPatchOperation `argument:"ignore"`

	Cpu          int64
	MemoryGb     int64
	RootPassword []string
	CustomFields []customfields.Def
	Description  string
	GroupId      string
	GroupName    string
	Disks        UpdateDisksDescription
}

func (*UpdateReq) ApplyDefaultBehaviour

func (ur *UpdateReq) ApplyDefaultBehaviour() error

func (*UpdateReq) GetNames

func (u *UpdateReq) GetNames(cn base.Connection, property string) ([]string, error)

func (*UpdateReq) InferID

func (u *UpdateReq) InferID(cn base.Connection) error

func (*UpdateReq) MarshalJSON

func (ur *UpdateReq) MarshalJSON() ([]byte, error)

func (*UpdateReq) Validate

func (ur *UpdateReq) Validate() error

Jump to

Keyboard shortcuts

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