servers

package
v0.1.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2015 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package servers provides information and interaction with the server API resource for the Rackspace Cloud Servers service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeAdminPassword

func ChangeAdminPassword(client *gophercloud.ServiceClient, id, newPassword string) os.ActionResult

ChangeAdminPassword alters the administrator or root password for a specified server.

func Create

Create requests a server to be provisioned to the user in the current tenant.

func Delete

func Delete(client *gophercloud.ServiceClient, id string) os.DeleteResult

Delete requests that a server previously provisioned be removed from your account.

func ExtractServers

func ExtractServers(page pagination.Page) ([]os.Server, error)

ExtractServers interprets the results of a single page from a List() call, producing a slice of Server entities.

func Get

func Get(client *gophercloud.ServiceClient, id string) os.GetResult

Get requests details on a single server, by ID.

func List

List makes a request against the API to list servers accessible to you.

func Reboot

Reboot requests that a given server reboot. Two methods exist for rebooting a server:

os.HardReboot (aka PowerCycle) restarts the server instance by physically cutting power to the machine, or if a VM, terminating it at the hypervisor level. It's done. Caput. Full stop. Then, after a brief wait, power is restored or the VM instance restarted.

os.SoftReboot (aka OSReboot) simply tells the OS to restart under its own procedures. E.g., in Linux, asking it to enter runlevel 6, or executing "sudo shutdown -r now", or by asking Windows to restart the machine.

func Rebuild

Rebuild will reprovision the server according to the configuration options provided in the RebuildOpts struct.

func WaitForStatus

func WaitForStatus(c *gophercloud.ServiceClient, id, status string, secs int) error

WaitForStatus will continually poll a server until it successfully transitions to a specified status. It will do this for at most the number of seconds specified.

Types

type CreateOpts

type CreateOpts struct {
	// Name [required] is the name to assign to the newly launched server.
	Name string

	// ImageRef [required] is the ID or full URL to the image that contains the server's OS and initial state.
	// Optional if using the boot-from-volume extension.
	ImageRef string

	// FlavorRef [required] is the ID or full URL to the flavor that describes the server's specs.
	FlavorRef string

	// SecurityGroups [optional] lists the names of the security groups to which this server should belong.
	SecurityGroups []string

	// UserData [optional] contains configuration information or scripts to use upon launch.
	// Create will base64-encode it for you.
	UserData []byte

	// AvailabilityZone [optional] in which to launch the server.
	AvailabilityZone string

	// Networks [optional] dictates how this server will be attached to available networks.
	// By default, the server will be attached to all isolated networks for the tenant.
	Networks []os.Network

	// Metadata [optional] contains key-value pairs (up to 255 bytes each) to attach to the server.
	Metadata map[string]string

	// Personality [optional] includes the path and contents of a file to inject into the server at launch.
	// The maximum size of the file is 255 bytes (decoded).
	Personality []byte

	// ConfigDrive [optional] enables metadata injection through a configuration drive.
	ConfigDrive bool

	// AdminPass [optional] sets the root user password. If not set, a randomly-generated
	// password will be created and returned in the response.
	AdminPass string

	// KeyPair [optional] specifies the name of the SSH KeyPair to be injected into the newly launched
	// server. See the "keypairs" extension in OpenStack compute v2.
	KeyPair string

	// DiskConfig [optional] controls how the created server's disk is partitioned. See the "diskconfig"
	// extension in OpenStack compute v2.
	DiskConfig diskconfig.DiskConfig

	// BlockDevice [optional] will create the server from a volume, which is created from an image,
	// a snapshot, or an another volume.
	BlockDevice []bootfromvolume.BlockDevice
}

CreateOpts specifies all of the options that Rackspace accepts in its Create request, including the union of all extensions that Rackspace supports.

func (CreateOpts) ToServerCreateMap

func (opts CreateOpts) ToServerCreateMap() (map[string]interface{}, error)

ToServerCreateMap constructs a request body using all of the OpenStack extensions that are active on Rackspace.

type RebuildOpts

type RebuildOpts struct {
	// Required. The ID of the image you want your server to be provisioned on
	ImageID string

	// Name to set the server to
	Name string

	// Required. The server's admin password
	AdminPass string

	// AccessIPv4 [optional] provides a new IPv4 address for the instance.
	AccessIPv4 string

	// AccessIPv6 [optional] provides a new IPv6 address for the instance.
	AccessIPv6 string

	// Metadata [optional] contains key-value pairs (up to 255 bytes each) to attach to the server.
	Metadata map[string]string

	// Personality [optional] includes the path and contents of a file to inject into the server at launch.
	// The maximum size of the file is 255 bytes (decoded).
	Personality []byte

	// DiskConfig [optional] controls how the created server's disk is partitioned. See the "diskconfig"
	// extension in OpenStack compute v2.
	DiskConfig diskconfig.DiskConfig
}

RebuildOpts represents all of the configuration options used in a server rebuild operation that are supported by Rackspace.

func (RebuildOpts) ToServerRebuildMap

func (opts RebuildOpts) ToServerRebuildMap() (map[string]interface{}, error)

ToServerRebuildMap constructs a request body using all of the OpenStack extensions that are active on Rackspace.

Jump to

Keyboard shortcuts

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