servers

package
Version: v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 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 ConfirmResize

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

ConfirmResize confirms a previous resize operation on a server. See Resize() for more details.

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 ExtractAddresses

func ExtractAddresses(page pagination.Page) (map[string][]os.Address, error)

ExtractAddresses interprets the results of a single page from a ListAddresses() call, producing a map of Address slices.

func ExtractNetworkAddresses

func ExtractNetworkAddresses(page pagination.Page) ([]os.Address, error)

ExtractNetworkAddresses interprets the results of a single page from a ListAddressesByNetwork() call, producing a map of Address slices.

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 ListAddresses

func ListAddresses(client *gophercloud.ServiceClient, id string) pagination.Pager

ListAddresses makes a request against the API to list the servers IP addresses.

func ListAddressesByNetwork

func ListAddressesByNetwork(client *gophercloud.ServiceClient, id, network string) pagination.Pager

ListAddressesByNetwork makes a request against the API to list the servers IP addresses for the given network.

func Metadata

func Metadata(client *gophercloud.ServiceClient, id string) os.GetMetadataResult

Metadata requests all the metadata for the given server ID.

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 Resize

Resize instructs the provider to change the flavor of the server. Note that this implies rebuilding it. Unfortunately, one cannot pass rebuild parameters to the resize function. When the resize completes, the server will be in RESIZE_VERIFY state. While in this state, you can explore the use of the new server's configuration. If you like it, call ConfirmResize() to commit the resize permanently. Otherwise, call RevertResize() to restore the old configuration.

func Update

Update requests an existing server to be updated with the supplied options.

func UpdateMetadata

UpdateMetadata updates (or creates) all the metadata specified by opts for the given server ID. This operation does not affect already-existing metadata that is not specified by opts.

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
t or T : Toggle theme light dark auto
y or Y : Canonical URL