Documentation ¶
Overview ¶
Package servers provides information and interaction with the server API resource in the OpenStack Compute service.
A server is a virtual machine instance in the compute system. In order for one to be provisioned, a valid flavor and image are required.
Example to List Servers
listOpts := servers.ListOpts{ AllTenants: true, } allPages, err := servers.ListSimple(computeClient, listOpts).AllPages(context.TODO()) if err != nil { panic(err) } allServers, err := servers.ExtractServers(allPages) if err != nil { panic(err) } for _, server := range allServers { fmt.Printf("%+v\n", server) }
Example to List Detail Servers
listOpts := servers.ListOpts{ AllTenants: true, } allPages, err := servers.List(computeClient, listOpts).AllPages(context.TODO()) if err != nil { panic(err) } allServers, err := servers.ExtractServers(allPages) if err != nil { panic(err) } for _, server := range allServers { fmt.Printf("%+v\n", server) }
Example to Create a Server
createOpts := servers.CreateOpts{ Name: "server_name", ImageRef: "image-uuid", FlavorRef: "flavor-uuid", } server, err := servers.Create(context.TODO(), computeClient, createOpts).Extract() if err != nil { panic(err) }
Example to Add a Server to a Server Group
createOpts := servers.CreateOpts{ Name: "server_name", ImageRef: "image-uuid", FlavorRef: "flavor-uuid", SchedulerHints: servers.SchedulerHints{ Group: "servergroup-uuid", }, } server, err := servers.Create(context.TODO(), computeClient, createOpts).Extract() if err != nil { panic(err) }
Example to Place Server B on a Different Host than Server A
createOpts := servers.CreateOpts{ Name: "server_name", ImageRef: "image-uuid", FlavorRef: "flavor-uuid", SchedulerHints: servers.SchedulerHints{ DifferentHost: []string{ "server-a-uuid", } }, } server, err := servers.Create(context.TODO(), computeClient, createOpts).Extract() if err != nil { panic(err) }
Example to Place Server B on the Same Host as Server A
createOpts := servers.CreateOpts{ Name: "server_name", ImageRef: "image-uuid", FlavorRef: "flavor-uuid", SchedulerHints: servers.SchedulerHints{ SameHost: []string{ "server-a-uuid", } }, } server, err := servers.Create(context.TODO(), computeClient, createOpts).Extract() if err != nil { panic(err) }
Example to Create a Server From an Image ¶
This example will boot a server from an image and use a standard ephemeral disk as the server's root disk. This is virtually no different than creating a server without using block device mappings.
blockDevices := []servers.BlockDevice{ servers.BlockDevice{ BootIndex: 0, DeleteOnTermination: true, DestinationType: servers.DestinationLocal, SourceType: servers.SourceImage, UUID: "image-uuid", }, } createOpts := servers.CreateOpts{ Name: "server_name", FlavorRef: "flavor-uuid", ImageRef: "image-uuid", BlockDevice: blockDevices, } server, err := servers.Create(context.TODO(), client, createOpts).Extract() if err != nil { panic(err) }
Example to Create a Server From a New Volume ¶
This example will create a block storage volume based on the given Image. The server will use this volume as its root disk.
blockDevices := []servers.BlockDevice{ servers.BlockDevice{ DeleteOnTermination: true, DestinationType: servers.DestinationVolume, SourceType: servers.SourceImage, UUID: "image-uuid", VolumeSize: 2, }, } createOpts := servers.CreateOpts{ Name: "server_name", FlavorRef: "flavor-uuid", BlockDevice: blockDevices, } server, err := servers.Create(context.TODO(), client, createOpts).Extract() if err != nil { panic(err) }
Example to Create a Server From an Existing Volume ¶
This example will create a server with an existing volume as its root disk.
blockDevices := []servers.BlockDevice{ servers.BlockDevice{ DeleteOnTermination: true, DestinationType: servers.DestinationVolume, SourceType: servers.SourceVolume, UUID: "volume-uuid", }, } createOpts := servers.CreateOpts{ Name: "server_name", FlavorRef: "flavor-uuid", BlockDevice: blockDevices, } server, err := servers.Create(context.TODO(), client, createOpts).Extract() if err != nil { panic(err) }
Example to Create a Server with Multiple Ephemeral Disks ¶
This example will create a server with multiple ephemeral disks. The first block device will be based off of an existing Image. Each additional ephemeral disks must have an index of -1.
blockDevices := []servers.BlockDevice{ servers.BlockDevice{ BootIndex: 0, DestinationType: servers.DestinationLocal, DeleteOnTermination: true, SourceType: servers.SourceImage, UUID: "image-uuid", VolumeSize: 5, }, servers.BlockDevice{ BootIndex: -1, DestinationType: servers.DestinationLocal, DeleteOnTermination: true, GuestFormat: "ext4", SourceType: servers.SourceBlank, VolumeSize: 1, }, servers.BlockDevice{ BootIndex: -1, DestinationType: servers.DestinationLocal, DeleteOnTermination: true, GuestFormat: "ext4", SourceType: servers.SourceBlank, VolumeSize: 1, }, } CreateOpts := servers.CreateOpts{ Name: "server_name", FlavorRef: "flavor-uuid", ImageRef: "image-uuid", BlockDevice: blockDevices, } server, err := servers.Create(context.TODO(), client, createOpts).Extract() if err != nil { panic(err) }
Example to Delete a Server
serverID := "d9072956-1560-487c-97f2-18bdf65ec749" err := servers.Delete(context.TODO(), computeClient, serverID).ExtractErr() if err != nil { panic(err) }
Example to Force Delete a Server
serverID := "d9072956-1560-487c-97f2-18bdf65ec749" err := servers.ForceDelete(context.TODO(), computeClient, serverID).ExtractErr() if err != nil { panic(err) }
Example to Reboot a Server
rebootOpts := servers.RebootOpts{ Type: servers.SoftReboot, } serverID := "d9072956-1560-487c-97f2-18bdf65ec749" err := servers.Reboot(context.TODO(), computeClient, serverID, rebootOpts).ExtractErr() if err != nil { panic(err) }
Example to Rebuild a Server
rebuildOpts := servers.RebuildOpts{ Name: "new_name", ImageID: "image-uuid", } serverID := "d9072956-1560-487c-97f2-18bdf65ec749" server, err := servers.Rebuilt(computeClient, serverID, rebuildOpts).Extract() if err != nil { panic(err) }
Example to Resize a Server
resizeOpts := servers.ResizeOpts{ FlavorRef: "flavor-uuid", } serverID := "d9072956-1560-487c-97f2-18bdf65ec749" err := servers.Resize(context.TODO(), computeClient, serverID, resizeOpts).ExtractErr() if err != nil { panic(err) } err = servers.ConfirmResize(context.TODO(), computeClient, serverID).ExtractErr() if err != nil { panic(err) }
Example to Snapshot a Server
snapshotOpts := servers.CreateImageOpts{ Name: "snapshot_name", } serverID := "d9072956-1560-487c-97f2-18bdf65ec749" image, err := servers.CreateImage(context.TODO(), computeClient, serverID, snapshotOpts).ExtractImageID() if err != nil { panic(err) }
Index ¶
- Constants
- func ExtractAddresses(r pagination.Page) (map[string][]Address, error)
- func ExtractServersInto(r pagination.Page, v interface{}) error
- func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- func ListAddresses(client *gophercloud.ServiceClient, id string) pagination.Pager
- func ListAddressesByNetwork(client *gophercloud.ServiceClient, id, network string) pagination.Pager
- func ListSimple(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- func WaitForStatus(ctx context.Context, c *gophercloud.ServiceClient, id, status string) error
- type ActionResult
- func ChangeAdminPassword(ctx context.Context, client *gophercloud.ServiceClient, id, newPassword string) (r ActionResult)
- func ConfirmResize(ctx context.Context, client *gophercloud.ServiceClient, id string) (r ActionResult)
- func ForceDelete(ctx context.Context, client *gophercloud.ServiceClient, id string) (r ActionResult)
- func Reboot(ctx context.Context, client *gophercloud.ServiceClient, id string, ...) (r ActionResult)
- func Resize(ctx context.Context, client *gophercloud.ServiceClient, id string, ...) (r ActionResult)
- func RevertResize(ctx context.Context, client *gophercloud.ServiceClient, id string) (r ActionResult)
- type Address
- type AddressPage
- type AttachedVolume
- type BlockDevice
- type CreateImageOpts
- type CreateImageOptsBuilder
- type CreateImageResult
- type CreateMetadatumResult
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteMetadatumResult
- type DeleteResult
- type DestinationType
- type DiskConfig
- type ErrInvalidHowParameterProvided
- type ErrNeitherFlavorIDNorFlavorNameProvided
- type ErrNeitherImageIDNorImageNameProvided
- type ErrNoAdminPassProvided
- type ErrNoClientProvidedForIDByName
- type ErrNoIDProvided
- type ErrNoImageIDProvided
- type ErrServer
- type ErrServerNotFound
- type EvacuateOpts
- type EvacuateOptsBuilder
- type EvacuateResult
- type Fault
- type File
- type GetMetadataResult
- type GetMetadatumResult
- type GetPasswordResult
- type GetResult
- type InjectNetworkResult
- type ListOpts
- type ListOptsBuilder
- type LiveMigrateOpts
- type LiveMigrateOptsBuilder
- type LockResult
- type MetadataOpts
- type MetadataResult
- type MetadatumOpts
- type MetadatumOptsBuilder
- type MetadatumResult
- type MigrateResult
- type Network
- type NetworkAddressPage
- type PauseResult
- type Personality
- type PowerState
- type RebootMethod
- type RebootOpts
- type RebootOptsBuilder
- type RebuildOpts
- type RebuildOptsBuilder
- type RebuildResult
- type RescueOpts
- type RescueOptsBuilder
- type RescueResult
- type ResetMetadataOptsBuilder
- type ResetMetadataResult
- type ResetNetworkResult
- type ResetStateResult
- type ResizeOpts
- type ResizeOptsBuilder
- type ResumeResult
- type SchedulerHints
- type SchedulerHintsCreateOptsBuilder
- type Server
- type ServerExtendedStatusExt
- type ServerPage
- type ServerState
- type ShelveOffloadResult
- type ShelveResult
- type ShowConsoleOutputOpts
- type ShowConsoleOutputOptsBuilder
- type ShowConsoleOutputResult
- type SourceType
- type StartResult
- type StopResult
- type SuspendResult
- type UnlockResult
- type UnpauseResult
- type UnrescueResult
- type UnshelveOpts
- type UnshelveOptsBuilder
- type UnshelveResult
- type UpdateMetadataOptsBuilder
- type UpdateMetadataResult
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
const ( // DestinationLocal DestinationType is for using an ephemeral disk as the // destination. DestinationLocal DestinationType = "local" // DestinationVolume DestinationType is for using a volume as the destination. DestinationVolume DestinationType = "volume" // SourceBlank SourceType is for a "blank" or empty source. SourceBlank SourceType = "blank" // SourceImage SourceType is for using images as the source of a block device. SourceImage SourceType = "image" // SourceSnapshot SourceType is for using a volume snapshot as the source of // a block device. SourceSnapshot SourceType = "snapshot" // SourceVolume SourceType is for using a volume as the source of block // device. SourceVolume SourceType = "volume" )
const ( SoftReboot RebootMethod = "SOFT" HardReboot RebootMethod = "HARD" OSReboot = SoftReboot PowerCycle = HardReboot )
These constants determine how a server should be rebooted. See the Reboot() function for further details.
const ( NOSTATE = iota RUNNING PAUSED SHUTDOWN CRASHED SUSPENDED )
Variables ¶
This section is empty.
Functions ¶
func ExtractAddresses ¶
func ExtractAddresses(r pagination.Page) (map[string][]Address, error)
ExtractAddresses interprets the results of a single page from a ListAddresses() call, producing a map of addresses.
func ExtractServersInto ¶
func ExtractServersInto(r pagination.Page, v interface{}) error
func List ¶
func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List makes a request against the API to list servers details 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 ListSimple ¶
func ListSimple(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
ListSimple makes a request against the API to list servers accessible to you.
Types ¶
type ActionResult ¶
type ActionResult struct {
gophercloud.ErrResult
}
ActionResult represents the result of server action operations, like reboot. Call its ExtractErr method to determine if the action succeeded or failed.
func ChangeAdminPassword ¶
func ChangeAdminPassword(ctx context.Context, client *gophercloud.ServiceClient, id, newPassword string) (r ActionResult)
ChangeAdminPassword alters the administrator or root password for a specified server.
func ConfirmResize ¶
func ConfirmResize(ctx context.Context, client *gophercloud.ServiceClient, id string) (r ActionResult)
ConfirmResize confirms a previous resize operation on a server. See Resize() for more details.
func ForceDelete ¶
func ForceDelete(ctx context.Context, client *gophercloud.ServiceClient, id string) (r ActionResult)
ForceDelete forces the deletion of a server.
func Reboot ¶
func Reboot(ctx context.Context, client *gophercloud.ServiceClient, id string, opts RebootOptsBuilder) (r ActionResult)
Reboot requests that a given server reboot.
Two methods exist for rebooting a server:
HardReboot (aka PowerCycle) starts 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 while, power is restored or the VM instance restarted.
SoftReboot (aka OSReboot) simply tells the OS to restart under its own procedure. E.g., in Linux, asking it to enter runlevel 6, or executing "sudo shutdown -r now", or by asking Windows to rtart the machine.
func Resize ¶
func Resize(ctx context.Context, client *gophercloud.ServiceClient, id string, opts ResizeOptsBuilder) (r ActionResult)
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 VERIFY_RESIZE 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 RevertResize ¶
func RevertResize(ctx context.Context, client *gophercloud.ServiceClient, id string) (r ActionResult)
RevertResize cancels a previous resize operation on a server. See Resize() for more details.
type Address ¶
Address represents an IP address.
func ExtractNetworkAddresses ¶
func ExtractNetworkAddresses(r pagination.Page) ([]Address, error)
ExtractNetworkAddresses interprets the results of a single page from a ListAddressesByNetwork() call, producing a slice of addresses.
type AddressPage ¶
type AddressPage struct {
pagination.SinglePageBase
}
AddressPage abstracts the raw results of making a ListAddresses() request against the API. As OpenStack extensions may freely alter the response bodies of structures returned to the client, you may only safely access the data provided through the ExtractAddresses call.
func (AddressPage) IsEmpty ¶
func (r AddressPage) IsEmpty() (bool, error)
IsEmpty returns true if an AddressPage contains no networks.
type AttachedVolume ¶
type AttachedVolume struct {
ID string `json:"id"`
}
type BlockDevice ¶
type BlockDevice struct { // SourceType must be one of: "volume", "snapshot", "image", or "blank". SourceType SourceType `json:"source_type" required:"true"` // UUID is the unique identifier for the existing volume, snapshot, or // image (see above). UUID string `json:"uuid,omitempty"` // BootIndex is the boot index. It defaults to 0. BootIndex int `json:"boot_index"` // DeleteOnTermination specifies whether or not to delete the attached volume // when the server is deleted. Defaults to `false`. DeleteOnTermination bool `json:"delete_on_termination"` // DestinationType is the type that gets created. Possible values are "volume" // and "local". DestinationType DestinationType `json:"destination_type,omitempty"` // GuestFormat specifies the format of the block device. // Not specifying this will cause the device to be formatted to the default in Nova // which is currently vfat. // https://opendev.org/openstack/nova/src/commit/d0b459423dd81644e8d9382b6c87fabaa4f03ad4/nova/privsep/fs.py#L257 GuestFormat string `json:"guest_format,omitempty"` // VolumeSize is the size of the volume to create (in gigabytes). This can be // omitted for existing volumes. VolumeSize int `json:"volume_size,omitempty"` // DeviceType specifies the device type of the block devices. // Examples of this are disk, cdrom, floppy, lun, etc. DeviceType string `json:"device_type,omitempty"` // DiskBus is the bus type of the block devices. // Examples of this are ide, usb, virtio, scsi, etc. DiskBus string `json:"disk_bus,omitempty"` // VolumeType is the volume type of the block device. // This requires Compute API microversion 2.67 or later. VolumeType string `json:"volume_type,omitempty"` // Tag is an arbitrary string that can be applied to a block device. // Information about the device tags can be obtained from the metadata API // and the config drive, allowing devices to be easily identified. // This requires Compute API microversion 2.42 or later. Tag string `json:"tag,omitempty"` }
BlockDevice is a structure with options for creating block devices in a server. The block device may be created from an image, snapshot, new volume, or existing volume. The destination may be a new volume, existing volume which will be attached to the instance, ephemeral disk, or boot device.
type CreateImageOpts ¶
type CreateImageOpts struct { // Name of the image/snapshot. Name string `json:"name" required:"true"` // Metadata contains key-value pairs (up to 255 bytes each) to attach to // the created image. Metadata map[string]string `json:"metadata,omitempty"` }
CreateImageOpts provides options to pass to the CreateImage request.
func (CreateImageOpts) ToServerCreateImageMap ¶
func (opts CreateImageOpts) ToServerCreateImageMap() (map[string]interface{}, error)
ToServerCreateImageMap formats a CreateImageOpts structure into a request body.
type CreateImageOptsBuilder ¶
CreateImageOptsBuilder allows extensions to add additional parameters to the CreateImage request.
type CreateImageResult ¶
type CreateImageResult struct {
gophercloud.Result
}
CreateImageResult is the response from a CreateImage operation. Call its ExtractImageID method to retrieve the ID of the newly created image.
func CreateImage ¶
func CreateImage(ctx context.Context, client *gophercloud.ServiceClient, id string, opts CreateImageOptsBuilder) (r CreateImageResult)
CreateImage makes a request against the nova API to schedule an image to be created of the server
func (CreateImageResult) ExtractImageID ¶
func (r CreateImageResult) ExtractImageID() (string, error)
ExtractImageID gets the ID of the newly created server image from the header.
type CreateMetadatumResult ¶
type CreateMetadatumResult struct {
MetadatumResult
}
CreateMetadatumResult contains the result of a Create operation. Call its Extract method to interpret it as a map[string]interface.
func CreateMetadatum ¶
func CreateMetadatum(ctx context.Context, client *gophercloud.ServiceClient, id string, opts MetadatumOptsBuilder) (r CreateMetadatumResult)
CreateMetadatum will create or update the key-value pair with the given key for the given server ID.
type CreateOpts ¶
type CreateOpts struct { // Name is the name to assign to the newly launched server. Name string `json:"name" required:"true"` // ImageRef is the ID or full URL to the image that contains the // server's OS and initial state. // Also optional if using the boot-from-volume extension. ImageRef string `json:"imageRef"` // FlavorRef is the ID or full URL to the flavor that describes the server's specs. FlavorRef string `json:"flavorRef"` // SecurityGroups lists the names of the security groups to which this server // should belong. SecurityGroups []string `json:"-"` // UserData contains configuration information or scripts to use upon launch. // Create will base64-encode it for you, if it isn't already. UserData []byte `json:"-"` // AvailabilityZone in which to launch the server. AvailabilityZone string `json:"availability_zone,omitempty"` // Networks dictates how this server will be attached to available networks. // By default, the server will be attached to all isolated networks for the // tenant. // Starting with microversion 2.37 networks can also be an "auto" or "none" // string. Networks interface{} `json:"-"` // Metadata contains key-value pairs (up to 255 bytes each) to attach to the // server. Metadata map[string]string `json:"metadata,omitempty"` // Personality includes files to inject into the server at launch. // Create will base64-encode file contents for you. Personality Personality `json:"personality,omitempty"` // ConfigDrive enables metadata injection through a configuration drive. ConfigDrive *bool `json:"config_drive,omitempty"` // AdminPass sets the root user password. If not set, a randomly-generated // password will be created and returned in the response. AdminPass string `json:"adminPass,omitempty"` // AccessIPv4 specifies an IPv4 address for the instance. AccessIPv4 string `json:"accessIPv4,omitempty"` // AccessIPv6 specifies an IPv6 address for the instance. AccessIPv6 string `json:"accessIPv6,omitempty"` // Min specifies Minimum number of servers to launch. Min int `json:"min_count,omitempty"` // Max specifies Maximum number of servers to launch. Max int `json:"max_count,omitempty"` // Tags allows a server to be tagged with single-word metadata. // Requires microversion 2.52 or later. Tags []string `json:"tags,omitempty"` // (Available from 2.90) Hostname specifies the hostname to configure for the // instance in the metadata service. Starting with microversion 2.94, this can // be a Fully Qualified Domain Name (FQDN) of up to 255 characters in length. // If not set, OpenStack will derive the server's hostname from the Name field. Hostname string `json:"hostname,omitempty"` // BlockDevice describes the mapping of various block devices. BlockDevice []BlockDevice `json:"block_device_mapping_v2,omitempty"` // DiskConfig [optional] controls how the created server's disk is partitioned. DiskConfig DiskConfig `json:"OS-DCF:diskConfig,omitempty"` // SchedulerHints provides a set of hints to the scheduler. SchedulerHints SchedulerHintsCreateOptsBuilder }
CreateOpts specifies server creation parameters.
func (CreateOpts) ToServerCreateMap ¶
func (opts CreateOpts) ToServerCreateMap() (map[string]interface{}, error)
ToServerCreateMap assembles a request body based on the contents of a CreateOpts.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult is the response from a Create operation. Call its Extract method to interpret it as a Server.
func Create ¶
func Create(ctx context.Context, client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create requests a server to be provisioned to the user in the current tenant.
func (CreateResult) ExtractInto ¶
func (r CreateResult) ExtractInto(v interface{}) error
type DeleteMetadatumResult ¶
type DeleteMetadatumResult struct {
gophercloud.ErrResult
}
DeleteMetadatumResult contains the result of a Delete operation. Call its ExtractErr method to determine if the call succeeded or failed.
func DeleteMetadatum ¶
func DeleteMetadatum(ctx context.Context, client *gophercloud.ServiceClient, id, key string) (r DeleteMetadatumResult)
DeleteMetadatum will delete the key-value pair with the given key for the given server ID.
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
DeleteResult is the response from a Delete operation. Call its ExtractErr method to determine if the call succeeded or failed.
type DestinationType ¶
type DestinationType string
DestinationType represents the type of medium being used as the destination of the bootable device.
type DiskConfig ¶
type DiskConfig string
DiskConfig represents one of the two possible settings for the DiskConfig option when creating, rebuilding, or resizing servers: Auto or Manual.
const ( // Auto builds a server with a single partition the size of the target flavor // disk and automatically adjusts the filesystem to fit the entire partition. // Auto may only be used with images and servers that use a single EXT3 // partition. Auto DiskConfig = "AUTO" // Manual builds a server using whatever partition scheme and filesystem are // present in the source image. If the target flavor disk is larger, the // remaining space is left unpartitioned. This enables images to have non-EXT3 // filesystems, multiple partitions, and so on, and enables you to manage the // disk configuration. It also results in slightly shorter boot times. Manual DiskConfig = "MANUAL" )
type ErrInvalidHowParameterProvided ¶
type ErrInvalidHowParameterProvided struct{ gophercloud.ErrInvalidInput }
ErrInvalidHowParameterProvided is the error when an unknown value is given for the `how` argument
type ErrNeitherFlavorIDNorFlavorNameProvided ¶
type ErrNeitherFlavorIDNorFlavorNameProvided struct{ gophercloud.ErrMissingInput }
ErrNeitherFlavorIDNorFlavorNameProvided is the error when neither the flavor ID nor the flavor name is provided for a server operation
func (ErrNeitherFlavorIDNorFlavorNameProvided) Error ¶
func (e ErrNeitherFlavorIDNorFlavorNameProvided) Error() string
type ErrNeitherImageIDNorImageNameProvided ¶
type ErrNeitherImageIDNorImageNameProvided struct{ gophercloud.ErrMissingInput }
ErrNeitherImageIDNorImageNameProvided is the error when neither the image ID nor the image name is provided for a server operation
func (ErrNeitherImageIDNorImageNameProvided) Error ¶
func (e ErrNeitherImageIDNorImageNameProvided) Error() string
type ErrNoAdminPassProvided ¶
type ErrNoAdminPassProvided struct{ gophercloud.ErrMissingInput }
ErrNoAdminPassProvided is the error when an administrative password isn't provided for a server operation
type ErrNoClientProvidedForIDByName ¶
type ErrNoClientProvidedForIDByName struct{ gophercloud.ErrMissingInput }
func (ErrNoClientProvidedForIDByName) Error ¶
func (e ErrNoClientProvidedForIDByName) Error() string
type ErrNoIDProvided ¶
type ErrNoIDProvided struct{ gophercloud.ErrMissingInput }
ErrNoIDProvided is the error when a server ID isn't provided for a server operation
type ErrNoImageIDProvided ¶
type ErrNoImageIDProvided struct{ gophercloud.ErrMissingInput }
ErrNoImageIDProvided is the error when an image ID isn't provided for a server operation
type ErrServer ¶
type ErrServer struct { gophercloud.ErrUnexpectedResponseCode ID string }
ErrServer is a generic error type for servers HTTP operations.
type ErrServerNotFound ¶
type ErrServerNotFound struct {
ErrServer
}
ErrServerNotFound is the error when a 404 is received during server HTTP operations.
func (ErrServerNotFound) Error ¶
func (e ErrServerNotFound) Error() string
type EvacuateOpts ¶
type EvacuateOpts struct { // The name of the host to which the server is evacuated Host string `json:"host,omitempty"` OnSharedStorage bool `json:"onSharedStorage"` // An administrative password to access the evacuated server AdminPass string `json:"adminPass,omitempty"` }
EvacuateOpts specifies Evacuate action parameters.
func (EvacuateOpts) ToEvacuateMap ¶
func (opts EvacuateOpts) ToEvacuateMap() (map[string]interface{}, error)
ToServerGroupCreateMap constructs a request body from CreateOpts.
type EvacuateOptsBuilder ¶
EvacuateOptsBuilder allows extensions to add additional parameters to the the Evacuate request.
type EvacuateResult ¶
type EvacuateResult struct {
gophercloud.Result
}
EvacuateResult is the response from an Evacuate operation. Call its ExtractAdminPass method to retrieve the admin password of the instance. The admin password will be an empty string if the cloud is not configured to inject admin passwords..
func Evacuate ¶
func Evacuate(ctx context.Context, client *gophercloud.ServiceClient, id string, opts EvacuateOptsBuilder) (r EvacuateResult)
Evacuate will Evacuate a failed instance to another host.
func (EvacuateResult) ExtractAdminPass ¶
func (r EvacuateResult) ExtractAdminPass() (string, error)
type File ¶
type File struct { // Path of the file. Path string // Contents of the file. Maximum content size is 255 bytes. Contents []byte }
File is used within CreateOpts and RebuildOpts to inject a file into the server at launch. File implements the json.Marshaler interface, so when a Create or Rebuild operation is requested, json.Marshal will call File's MarshalJSON method.
func (*File) MarshalJSON ¶
MarshalJSON marshals the escaped file, base64 encoding the contents.
type GetMetadataResult ¶
type GetMetadataResult struct {
MetadataResult
}
GetMetadataResult contains the result of a Get operation. Call its Extract method to interpret it as a map[string]interface.
type GetMetadatumResult ¶
type GetMetadatumResult struct {
MetadatumResult
}
GetMetadatumResult contains the result of a Get operation. Call its Extract method to interpret it as a map[string]interface.
type GetPasswordResult ¶
type GetPasswordResult struct {
gophercloud.Result
}
GetPasswordResult represent the result of a get os-server-password operation. Call its ExtractPassword method to retrieve the password.
func GetPassword ¶
func GetPassword(ctx context.Context, client *gophercloud.ServiceClient, serverId string) (r GetPasswordResult)
GetPassword makes a request against the nova API to get the encrypted administrative password.
func (GetPasswordResult) ExtractPassword ¶
func (r GetPasswordResult) ExtractPassword(privateKey *rsa.PrivateKey) (string, error)
ExtractPassword gets the encrypted password. If privateKey != nil the password is decrypted with the private key. If privateKey == nil the encrypted password is returned and can be decrypted with:
echo '<pwd>' | base64 -D | openssl rsautl -decrypt -inkey <private_key>
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult is the response from a Get operation. Call its Extract method to interpret it as a Server.
func (GetResult) ExtractInto ¶
func (r GetResult) ExtractInto(v interface{}) error
type InjectNetworkResult ¶
type InjectNetworkResult struct {
gophercloud.ErrResult
}
InjectNetworkResult is the response of a InjectNetworkInfo operation. Call its ExtractErr method to determine if the request suceeded or failed.
func InjectNetworkInfo ¶
func InjectNetworkInfo(ctx context.Context, client *gophercloud.ServiceClient, id string) (r InjectNetworkResult)
InjectNetworkInfo will inject the network info into a server
type ListOpts ¶
type ListOpts struct { // ChangesSince is a time/date stamp for when the server last changed status. ChangesSince string `q:"changes-since"` // Image is the name of the image in URL format. Image string `q:"image"` // Flavor is the name of the flavor in URL format. Flavor string `q:"flavor"` // IP is a regular expression to match the IPv4 address of the server. IP string `q:"ip"` // This requires the client to be set to microversion 2.5 or later, unless // the user is an admin. // IP is a regular expression to match the IPv6 address of the server. IP6 string `q:"ip6"` // Name of the server as a string; can be queried with regular expressions. // Realize that ?name=bob returns both bob and bobb. If you need to match bob // only, you can use a regular expression matching the syntax of the // underlying database server implemented for Compute. Name string `q:"name"` // Status is the value of the status of the server so that you can filter on // "ACTIVE" for example. Status string `q:"status"` // Host is the name of the host as a string. Host string `q:"host"` // Marker is a UUID of the server at which you want to set a marker. Marker string `q:"marker"` // Limit is an integer value for the limit of values to return. Limit int `q:"limit"` // AllTenants is a bool to show all tenants. AllTenants bool `q:"all_tenants"` // TenantID lists servers for a particular tenant. // Setting "AllTenants = true" is required. TenantID string `q:"tenant_id"` // This requires the client to be set to microversion 2.83 or later, unless // the user is an admin. // UserID lists servers for a particular user. UserID string `q:"user_id"` // This requires the client to be set to microversion 2.26 or later. // Tags filters on specific server tags. All tags must be present for the server. Tags string `q:"tags"` // This requires the client to be set to microversion 2.26 or later. // TagsAny filters on specific server tags. At least one of the tags must be present for the server. TagsAny string `q:"tags-any"` // This requires the client to be set to microversion 2.26 or later. // NotTags filters on specific server tags. All tags must be absent for the server. NotTags string `q:"not-tags"` // This requires the client to be set to microversion 2.26 or later. // NotTagsAny filters on specific server tags. At least one of the tags must be absent for the server. NotTagsAny string `q:"not-tags-any"` // Display servers based on their availability zone (Admin only until microversion 2.82). AvailabilityZone string `q:"availability_zone"` }
ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the server attributes you want to see returned. Marker and Limit are used for pagination.
func (ListOpts) ToServerListQuery ¶
ToServerListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type LiveMigrateOpts ¶
type LiveMigrateOpts struct { // The host to which to migrate the server. // If this parameter is None, the scheduler chooses a host. Host *string `json:"host"` // Set to True to migrate local disks by using block migration. // If the source or destination host uses shared storage and you set // this value to True, the live migration fails. BlockMigration *bool `json:"block_migration,omitempty"` // Set to True to enable over commit when the destination host is checked // for available disk space. Set to False to disable over commit. This setting // affects only the libvirt virt driver. DiskOverCommit *bool `json:"disk_over_commit,omitempty"` }
LiveMigrateOpts specifies parameters of live migrate action.
func (LiveMigrateOpts) ToLiveMigrateMap ¶
func (opts LiveMigrateOpts) ToLiveMigrateMap() (map[string]interface{}, error)
ToLiveMigrateMap constructs a request body from LiveMigrateOpts.
type LiveMigrateOptsBuilder ¶
LiveMigrateOptsBuilder allows extensions to add additional parameters to the LiveMigrate request.
type LockResult ¶
type LockResult struct {
gophercloud.ErrResult
}
LockResult and UnlockResult are the responses from a Lock and Unlock operations respectively. Call their ExtractErr methods to determine if the requests suceeded or failed.
type MetadataOpts ¶
MetadataOpts is a map that contains key-value pairs.
func (MetadataOpts) ToMetadataResetMap ¶
func (opts MetadataOpts) ToMetadataResetMap() (map[string]interface{}, error)
ToMetadataResetMap assembles a body for a Reset request based on the contents of a MetadataOpts.
func (MetadataOpts) ToMetadataUpdateMap ¶
func (opts MetadataOpts) ToMetadataUpdateMap() (map[string]interface{}, error)
ToMetadataUpdateMap assembles a body for an Update request based on the contents of a MetadataOpts.
type MetadataResult ¶
type MetadataResult struct {
gophercloud.Result
}
MetadataResult contains the result of a call for (potentially) multiple key-value pairs. Call its Extract method to interpret it as a map[string]interface.
type MetadatumOpts ¶
MetadatumOpts is a map of length one that contains a key-value pair.
func (MetadatumOpts) ToMetadatumCreateMap ¶
func (opts MetadatumOpts) ToMetadatumCreateMap() (map[string]interface{}, string, error)
ToMetadatumCreateMap assembles a body for a Create request based on the contents of a MetadataumOpts.
type MetadatumOptsBuilder ¶
type MetadatumOptsBuilder interface {
ToMetadatumCreateMap() (map[string]interface{}, string, error)
}
MetadatumOptsBuilder allows extensions to add additional parameters to the Create request.
type MetadatumResult ¶
type MetadatumResult struct {
gophercloud.Result
}
MetadatumResult contains the result of a call for individual a single key-value pair.
type MigrateResult ¶
type MigrateResult struct {
gophercloud.ErrResult
}
MigrateResult is the response from a Migrate operation. Call its ExtractErr method to determine if the request suceeded or failed.
func LiveMigrate ¶
func LiveMigrate(ctx context.Context, client *gophercloud.ServiceClient, id string, opts LiveMigrateOptsBuilder) (r MigrateResult)
LiveMigrate will initiate a live-migration (without rebooting) of the instance to another host.
type Network ¶
type Network struct { // UUID of a network to attach to the newly provisioned server. // Required unless Port is provided. UUID string // Port of a neutron network to attach to the newly provisioned server. // Required unless UUID is provided. Port string // FixedIP specifies a fixed IPv4 address to be used on this network. FixedIP string // Tag may contain an optional device role tag for the server's virtual // network interface. This can be used to identify network interfaces when // multiple networks are connected to one server. // // Requires microversion 2.32 through 2.36 or 2.42 or later. Tag string }
Network is used within CreateOpts to control a new server's network attachments.
type NetworkAddressPage ¶
type NetworkAddressPage struct {
pagination.SinglePageBase
}
NetworkAddressPage abstracts the raw results of making a ListAddressesByNetwork() request against the API. As OpenStack extensions may freely alter the response bodies of structures returned to the client, you may only safely access the data provided through the ExtractAddresses call.
func (NetworkAddressPage) IsEmpty ¶
func (r NetworkAddressPage) IsEmpty() (bool, error)
IsEmpty returns true if a NetworkAddressPage contains no addresses.
type PauseResult ¶
type PauseResult struct {
gophercloud.ErrResult
}
PauseResult is the response from a Pause operation. Call its ExtractErr method to determine if the request succeeded or failed.
type Personality ¶
type Personality []*File
Personality is an array of files that are injected into the server at launch.
type PowerState ¶
type PowerState int
func (PowerState) String ¶
func (r PowerState) String() string
type RebootMethod ¶
type RebootMethod string
RebootMethod describes the mechanisms by which a server reboot can be requested.
type RebootOpts ¶
type RebootOpts struct { // Type is the type of reboot to perform on the server. Type RebootMethod `json:"type" required:"true"` }
RebootOpts provides options to the reboot request.
func (RebootOpts) ToServerRebootMap ¶
func (opts RebootOpts) ToServerRebootMap() (map[string]interface{}, error)
ToServerRebootMap builds a body for the reboot request.
type RebootOptsBuilder ¶
RebootOptsBuilder allows extensions to add additional parameters to the reboot request.
type RebuildOpts ¶
type RebuildOpts struct { // AdminPass is the server's admin password AdminPass string `json:"adminPass,omitempty"` // ImageRef is the ID of the image you want your server to be provisioned on. ImageRef string `json:"imageRef"` // Name to set the server to Name string `json:"name,omitempty"` // AccessIPv4 [optional] provides a new IPv4 address for the instance. AccessIPv4 string `json:"accessIPv4,omitempty"` // AccessIPv6 [optional] provides a new IPv6 address for the instance. AccessIPv6 string `json:"accessIPv6,omitempty"` // Metadata [optional] contains key-value pairs (up to 255 bytes each) // to attach to the server. Metadata map[string]string `json:"metadata,omitempty"` // Personality [optional] includes files to inject into the server at launch. // Rebuild will base64-encode file contents for you. Personality Personality `json:"personality,omitempty"` // DiskConfig controls how the rebuilt server's disk is partitioned. DiskConfig DiskConfig `json:"OS-DCF:diskConfig,omitempty"` }
RebuildOpts represents the configuration options used in a server rebuild operation.
func (RebuildOpts) ToServerRebuildMap ¶
func (opts RebuildOpts) ToServerRebuildMap() (map[string]interface{}, error)
ToServerRebuildMap formats a RebuildOpts struct into a map for use in JSON
type RebuildOptsBuilder ¶
RebuildOptsBuilder allows extensions to provide additional parameters to the rebuild request.
type RebuildResult ¶
type RebuildResult struct {
// contains filtered or unexported fields
}
RebuildResult is the response from a Rebuild operation. Call its Extract method to interpret it as a Server.
func Rebuild ¶
func Rebuild(ctx context.Context, client *gophercloud.ServiceClient, id string, opts RebuildOptsBuilder) (r RebuildResult)
Rebuild will reprovision the server according to the configuration options provided in the RebuildOpts struct.
func (RebuildResult) ExtractInto ¶
func (r RebuildResult) ExtractInto(v interface{}) error
type RescueOpts ¶
type RescueOpts struct { // AdminPass is the desired administrative password for the instance in // RESCUE mode. // If it's left blank, the server will generate a password. AdminPass string `json:"adminPass,omitempty"` // RescueImageRef contains reference on an image that needs to be used as // rescue image. // If it's left blank, the server will be rescued with the default image. RescueImageRef string `json:"rescue_image_ref,omitempty"` }
RescueOpts represents the configuration options used to control a Rescue option.
func (RescueOpts) ToServerRescueMap ¶
func (opts RescueOpts) ToServerRescueMap() (map[string]interface{}, error)
ToServerRescueMap formats a RescueOpts as a map that can be used as a JSON request body for the Rescue request.
type RescueOptsBuilder ¶
RescueOptsBuilder is an interface that allows extensions to override the default structure of a Rescue request.
type RescueResult ¶
type RescueResult struct {
// contains filtered or unexported fields
}
RescueResult is the response from a Rescue operation. Call its Extract method to retrieve adminPass for a rescued server.
func Rescue ¶
func Rescue(ctx context.Context, client *gophercloud.ServiceClient, id string, opts RescueOptsBuilder) (r RescueResult)
Rescue instructs the provider to place the server into RESCUE mode.
func (RescueResult) Extract ¶
func (r RescueResult) Extract() (string, error)
Extract interprets any RescueResult as an AdminPass, if possible.
type ResetMetadataOptsBuilder ¶
ResetMetadataOptsBuilder allows extensions to add additional parameters to the Reset request.
type ResetMetadataResult ¶
type ResetMetadataResult struct {
MetadataResult
}
ResetMetadataResult contains the result of a Reset operation. Call its Extract method to interpret it as a map[string]interface.
func ResetMetadata ¶
func ResetMetadata(ctx context.Context, client *gophercloud.ServiceClient, id string, opts ResetMetadataOptsBuilder) (r ResetMetadataResult)
ResetMetadata will create multiple new key-value pairs for the given server ID. Note: Using this operation will erase any already-existing metadata and create the new metadata provided. To keep any already-existing metadata, use the UpdateMetadatas or UpdateMetadata function.
type ResetNetworkResult ¶
type ResetNetworkResult struct {
gophercloud.ErrResult
}
ResetResult is the response of a ResetNetwork operation. Call its ExtractErr method to determine if the request suceeded or failed.
func ResetNetwork ¶
func ResetNetwork(ctx context.Context, client *gophercloud.ServiceClient, id string) (r ResetNetworkResult)
ResetNetwork will reset the network of a server
type ResetStateResult ¶
type ResetStateResult struct {
gophercloud.ErrResult
}
ResetResult is the response of a ResetState operation. Call its ExtractErr method to determine if the request suceeded or failed.
func ResetState ¶
func ResetState(ctx context.Context, client *gophercloud.ServiceClient, id string, state ServerState) (r ResetStateResult)
ResetState will reset the state of a server
type ResizeOpts ¶
type ResizeOpts struct { // FlavorRef is the ID of the flavor you wish your server to become. FlavorRef string `json:"flavorRef" required:"true"` // DiskConfig [optional] controls how the resized server's disk is partitioned. DiskConfig DiskConfig `json:"OS-DCF:diskConfig,omitempty"` }
ResizeOpts represents the configuration options used to control a Resize operation.
func (ResizeOpts) ToServerResizeMap ¶
func (opts ResizeOpts) ToServerResizeMap() (map[string]interface{}, error)
ToServerResizeMap formats a ResizeOpts as a map that can be used as a JSON request body for the Resize request.
type ResizeOptsBuilder ¶
ResizeOptsBuilder allows extensions to add additional parameters to the resize request.
type ResumeResult ¶
type ResumeResult struct {
gophercloud.ErrResult
}
ResumeResult is the response from an Unsuspend operation. Call its ExtractErr method to determine if the request succeeded or failed.
type SchedulerHints ¶
type SchedulerHints struct { // Group specifies a Server Group to place the instance in. Group string // DifferentHost will place the instance on a compute node that does not // host the given instances. DifferentHost []string // SameHost will place the instance on a compute node that hosts the given // instances. SameHost []string // Query is a conditional statement that results in compute nodes able to // host the instance. Query []interface{} // TargetCell specifies a cell name where the instance will be placed. TargetCell string `json:"target_cell,omitempty"` // DifferentCell specifies cells names where an instance should not be placed. DifferentCell []string `json:"different_cell,omitempty"` // BuildNearHostIP specifies a subnet of compute nodes to host the instance. BuildNearHostIP string // AdditionalProperies are arbitrary key/values that are not validated by nova. AdditionalProperties map[string]interface{} }
SchedulerHints represents a set of scheduling hints that are passed to the OpenStack scheduler.
func (SchedulerHints) ToServerSchedulerHintsCreateMap ¶
func (opts SchedulerHints) ToServerSchedulerHintsCreateMap() (map[string]interface{}, error)
ToServerSchedulerHintsMap builds the scheduler hints into a serializable format.
type SchedulerHintsCreateOptsBuilder ¶
type SchedulerHintsCreateOptsBuilder interface {
ToServerSchedulerHintsCreateMap() (map[string]interface{}, error)
}
SchedulerHintsCreateOptsBuilder builds the scheduler hints into a serializable format.
type Server ¶
type Server struct { // ID uniquely identifies this server amongst all other servers, // including those not accessible to the current tenant. ID string `json:"id"` // TenantID identifies the tenant owning this server resource. TenantID string `json:"tenant_id"` // UserID uniquely identifies the user account owning the tenant. UserID string `json:"user_id"` // Name contains the human-readable name for the server. Name string `json:"name"` // Updated and Created contain ISO-8601 timestamps of when the state of the // server last changed, and when it was created. Updated time.Time `json:"updated"` Created time.Time `json:"created"` // HostID is the host where the server is located in the cloud. HostID string `json:"hostid"` // Status contains the current operational status of the server, // such as IN_PROGRESS or ACTIVE. Status string `json:"status"` // Progress ranges from 0..100. // A request made against the server completes only once Progress reaches 100. Progress int `json:"progress"` // AccessIPv4 and AccessIPv6 contain the IP addresses of the server, // suitable for remote access for administration. AccessIPv4 string `json:"accessIPv4"` AccessIPv6 string `json:"accessIPv6"` // Image refers to a JSON object, which itself indicates the OS image used to // deploy the server. Image map[string]interface{} `json:"-"` // Flavor refers to a JSON object, which itself indicates the hardware // configuration of the deployed server. Flavor map[string]interface{} `json:"flavor"` // Addresses includes a list of all IP addresses assigned to the server, // keyed by pool. Addresses map[string]interface{} `json:"addresses"` // Metadata includes a list of all user-specified key-value pairs attached // to the server. Metadata map[string]string `json:"metadata"` // Links includes HTTP references to the itself, useful for passing along to // other APIs that might want a server reference. Links []interface{} `json:"links"` // KeyName indicates which public key was injected into the server on launch. KeyName string `json:"key_name"` // AdminPass will generally be empty (""). However, it will contain the // administrative password chosen when provisioning a new server without a // set AdminPass setting in the first place. // Note that this is the ONLY time this field will be valid. AdminPass string `json:"adminPass"` // SecurityGroups includes the security groups that this instance has applied // to it. SecurityGroups []map[string]interface{} `json:"security_groups"` // AttachedVolumes includes the volume attachments of this instance AttachedVolumes []AttachedVolume `json:"os-extended-volumes:volumes_attached"` // Fault contains failure information about a server. Fault Fault `json:"fault"` // Tags is a slice/list of string tags in a server. // The requires microversion 2.26 or later. Tags *[]string `json:"tags"` // ServerGroups is a slice of strings containing the UUIDs of the // server groups to which the server belongs. Currently this can // contain at most one entry. // New in microversion 2.71 ServerGroups *[]string `json:"server_groups"` // Host is the host/hypervisor that the instance is hosted on. Host string `json:"OS-EXT-SRV-ATTR:host"` // InstanceName is the name of the instance. InstanceName string `json:"OS-EXT-SRV-ATTR:instance_name"` // HypervisorHostname is the hostname of the host/hypervisor that the // instance is hosted on. HypervisorHostname string `json:"OS-EXT-SRV-ATTR:hypervisor_hostname"` // ReservationID is the reservation ID of the instance. // This requires microversion 2.3 or later. ReservationID *string `json:"OS-EXT-SRV-ATTR:reservation_id"` // LaunchIndex is the launch index of the instance. // This requires microversion 2.3 or later. LaunchIndex *int `json:"OS-EXT-SRV-ATTR:launch_index"` // RAMDiskID is the ID of the RAM disk image of the instance. // This requires microversion 2.3 or later. RAMDiskID *string `json:"OS-EXT-SRV-ATTR:ramdisk_id"` // KernelID is the ID of the kernel image of the instance. // This requires microversion 2.3 or later. KernelID *string `json:"OS-EXT-SRV-ATTR:kernel_id"` // Hostname is the hostname of the instance. // This requires microversion 2.3 or later. Hostname *string `json:"OS-EXT-SRV-ATTR:hostname"` // RootDeviceName is the name of the root device of the instance. // This requires microversion 2.3 or later. RootDeviceName *string `json:"OS-EXT-SRV-ATTR:root_device_name"` // Userdata is the userdata of the instance. // This requires microversion 2.3 or later. Userdata *string `json:"OS-EXT-SRV-ATTR:user_data"` TaskState string `json:"OS-EXT-STS:task_state"` VmState string `json:"OS-EXT-STS:vm_state"` PowerState PowerState `json:"OS-EXT-STS:power_state"` LaunchedAt time.Time `json:"-"` TerminatedAt time.Time `json:"-"` // DiskConfig is the disk configuration of the server. DiskConfig DiskConfig `json:"OS-DCF:diskConfig"` // AvailabilityZone is the availabilty zone the server is in. AvailabilityZone string `json:"OS-EXT-AZ:availability_zone"` }
Server represents a server/instance in the OpenStack cloud.
func ExtractServers ¶
func ExtractServers(r pagination.Page) ([]Server, error)
ExtractServers interprets the results of a single page from a List() call, producing a slice of Server entities.
func (*Server) UnmarshalJSON ¶
type ServerExtendedStatusExt ¶
type ServerExtendedStatusExt struct { TaskState string `json:"OS-EXT-STS:task_state"` VmState string `json:"OS-EXT-STS:vm_state"` PowerState PowerState `json:"OS-EXT-STS:power_state"` }
type ServerPage ¶
type ServerPage struct {
pagination.LinkedPageBase
}
ServerPage abstracts the raw results of making a List() request against the API. As OpenStack extensions may freely alter the response bodies of structures returned to the client, you may only safely access the data provided through the ExtractServers call.
func (ServerPage) IsEmpty ¶
func (r ServerPage) IsEmpty() (bool, error)
IsEmpty returns true if a page contains no Server results.
func (ServerPage) NextPageURL ¶
func (r ServerPage) NextPageURL() (string, error)
NextPageURL uses the response's embedded link reference to navigate to the next page of results.
type ServerState ¶
type ServerState string
ServerState refers to the states usable in ResetState Action
const ( // StateActive returns the state of the server as active StateActive ServerState = "active" // StateError returns the state of the server as error StateError ServerState = "error" )
type ShelveOffloadResult ¶
type ShelveOffloadResult struct {
gophercloud.ErrResult
}
ShelveOffloadResult is the response from a Shelve operation. Call its ExtractErr method to determine if the request succeeded or failed.
func ShelveOffload ¶
func ShelveOffload(ctx context.Context, client *gophercloud.ServiceClient, id string) (r ShelveOffloadResult)
ShelveOffload is the operation responsible for Shelve-Offload a Compute server.
type ShelveResult ¶
type ShelveResult struct {
gophercloud.ErrResult
}
ShelveResult is the response from a Shelve operation. Call its ExtractErr method to determine if the request succeeded or failed.
type ShowConsoleOutputOpts ¶
type ShowConsoleOutputOpts struct { // The number of lines to fetch from the end of console log. // All lines will be returned if this is not specified. Length int `json:"length,omitempty"` }
ShowConsoleOutputOpts satisfies the ShowConsoleOutputOptsBuilder
func (ShowConsoleOutputOpts) ToServerShowConsoleOutputMap ¶
func (opts ShowConsoleOutputOpts) ToServerShowConsoleOutputMap() (map[string]interface{}, error)
ToServerShowConsoleOutputMap formats a ShowConsoleOutputOpts structure into a request body.
type ShowConsoleOutputOptsBuilder ¶
type ShowConsoleOutputOptsBuilder interface {
ToServerShowConsoleOutputMap() (map[string]interface{}, error)
}
ShowConsoleOutputOptsBuilder is the interface types must satisfy in order to be used as ShowConsoleOutput options
type ShowConsoleOutputResult ¶
type ShowConsoleOutputResult struct {
gophercloud.Result
}
ShowConsoleOutputResult represents the result of console output from a server
func ShowConsoleOutput ¶
func ShowConsoleOutput(ctx context.Context, client *gophercloud.ServiceClient, id string, opts ShowConsoleOutputOptsBuilder) (r ShowConsoleOutputResult)
ShowConsoleOutput makes a request against the nova API to get console log from the server
func (ShowConsoleOutputResult) Extract ¶
func (r ShowConsoleOutputResult) Extract() (string, error)
Extract will return the console output from a ShowConsoleOutput request.
type SourceType ¶
type SourceType string
SourceType represents the type of medium being used as the source of the bootable device.
type StartResult ¶
type StartResult struct {
gophercloud.ErrResult
}
StartResult is the response from a Start operation. Call its ExtractErr method to determine if the request succeeded or failed.
type StopResult ¶
type StopResult struct {
gophercloud.ErrResult
}
StopResult is the response from Stop operation. Call its ExtractErr method to determine if the request succeeded or failed.
type SuspendResult ¶
type SuspendResult struct {
gophercloud.ErrResult
}
SuspendResult is the response from a Suspend operation. Call its ExtractErr method to determine if the request succeeded or failed.
type UnlockResult ¶
type UnlockResult struct {
gophercloud.ErrResult
}
type UnpauseResult ¶
type UnpauseResult struct {
gophercloud.ErrResult
}
UnpauseResult is the response from an Unpause operation. Call its ExtractErr method to determine if the request succeeded or failed.
type UnrescueResult ¶
type UnrescueResult struct {
gophercloud.ErrResult
}
UnrescueResult is the response from an UnRescue operation. Call its ExtractErr method to determine if the call succeeded or failed.
type UnshelveOpts ¶
type UnshelveOpts struct { // Sets the availability zone to unshelve a server // Available only after nova 2.77 AvailabilityZone string `json:"availability_zone,omitempty"` }
UnshelveOpts specifies parameters of shelve-offload action.
func (UnshelveOpts) ToUnshelveMap ¶
func (opts UnshelveOpts) ToUnshelveMap() (map[string]interface{}, error)
type UnshelveOptsBuilder ¶
UnshelveOptsBuilder allows extensions to add additional parameters to the Unshelve request.
type UnshelveResult ¶
type UnshelveResult struct {
gophercloud.ErrResult
}
UnshelveResult is the response from Stop operation. Call its ExtractErr method to determine if the request succeeded or failed.
func Unshelve ¶
func Unshelve(ctx context.Context, client *gophercloud.ServiceClient, id string, opts UnshelveOptsBuilder) (r UnshelveResult)
Unshelve is the operation responsible for unshelve a Compute server.
type UpdateMetadataOptsBuilder ¶
UpdateMetadataOptsBuilder allows extensions to add additional parameters to the Create request.
type UpdateMetadataResult ¶
type UpdateMetadataResult struct {
MetadataResult
}
UpdateMetadataResult contains the result of an Update operation. Call its Extract method to interpret it as a map[string]interface.
func UpdateMetadata ¶
func UpdateMetadata(ctx context.Context, client *gophercloud.ServiceClient, id string, opts UpdateMetadataOptsBuilder) (r UpdateMetadataResult)
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.
type UpdateOpts ¶
type UpdateOpts struct { // Name changes the displayed name of the server. // The server host name will *not* change. // Server names are not constrained to be unique, even within the same tenant. Name string `json:"name,omitempty"` // AccessIPv4 provides a new IPv4 address for the instance. AccessIPv4 string `json:"accessIPv4,omitempty"` // AccessIPv6 provides a new IPv6 address for the instance. AccessIPv6 string `json:"accessIPv6,omitempty"` }
UpdateOpts specifies the base attributes that may be updated on an existing server.
func (UpdateOpts) ToServerUpdateMap ¶
func (opts UpdateOpts) ToServerUpdateMap() (map[string]interface{}, error)
ToServerUpdateMap formats an UpdateOpts structure into a request body.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional attributes to the Update request.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult is the response from an Update operation. Call its Extract method to interpret it as a Server.
func Update ¶
func Update(ctx context.Context, client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)
Update requests that various attributes of the indicated server be changed.
func (UpdateResult) ExtractInto ¶
func (r UpdateResult) ExtractInto(v interface{}) error