rescueunrescue

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package rescueunrescue provides the ability to place a server into rescue mode and to return it back.

Example to Rescue a server

rescueOpts := rescueunrescue.RescueOpts{
  AdminPass:      "aUPtawPzE9NU",
  RescueImageRef: "115e5c5b-72f0-4a0a-9067-60706545248c",
}
serverID := "3f54d05f-3430-4d80-aa07-63e6af9e2488"

adminPass, err := rescueunrescue.Rescue(computeClient, serverID, rescueOpts).Extract()
if err != nil {
  panic(err)
}

fmt.Printf("adminPass of the rescued server %s: %s\n", serverID, adminPass)

Example to Unrescue a server

serverID := "3f54d05f-3430-4d80-aa07-63e6af9e2488"

if err := rescueunrescue.Unrescue(computeClient, serverID).ExtractErr(); err != nil {
  panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

type RescueOptsBuilder interface {
	ToServerRescueMap() (map[string]interface{}, error)
}

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(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 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.

func Unrescue

func Unrescue(client *gophercloud.ServiceClient, id string) (r UnrescueResult)

Unrescue instructs the provider to return the server from RESCUE mode.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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