extendedserverattributes

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 0 Imported by: 3

Documentation

Overview

Package extendedserverattributes provides the ability to extend a server result with the extended usage information.

Example to Get basic extended information:

type serverAttributesExt struct {
  servers.Server
  extendedserverattributes.ServerAttributesExt
}
var serverWithAttributesExt serverAttributesExt

err := servers.Get(computeClient, "d650a0ce-17c3-497d-961a-43c4af80998a").ExtractInto(&serverWithAttributesExt)
if err != nil {
  panic(err)
}

fmt.Printf("%+v\n", serverWithAttributesExt)

Example to get additional fields with microversion 2.3 or later

computeClient.Microversion = "2.3"
result := servers.Get(computeClient, "d650a0ce-17c3-497d-961a-43c4af80998a")

reservationID, err := extendedserverattributes.ExtractReservationID(result.Result)
if err != nil {
  panic(err)
}
fmt.Printf("%s\n", reservationID)

launchIndex, err := extendedserverattributes.ExtractLaunchIndex(result.Result)
if err != nil {
  panic(err)
}
fmt.Printf("%d\n", launchIndex)

ramdiskID, err := extendedserverattributes.ExtractRamdiskID(result.Result)
if err != nil {
  panic(err)
}
fmt.Printf("%s\n", ramdiskID)

kernelID, err := extendedserverattributes.ExtractKernelID(result.Result)
if err != nil {
  panic(err)
}
fmt.Printf("%s\n", kernelID)

hostname, err := extendedserverattributes.ExtractHostname(result.Result)
if err != nil {
  panic(err)
}
fmt.Printf("%s\n", hostname)

rootDeviceName, err := extendedserverattributes.ExtractRootDeviceName(result.Result)
if err != nil {
  panic(err)
}
fmt.Printf("%s\n", rootDeviceName)

userData, err := extendedserverattributes.ExtractUserData(result.Result)
if err != nil {
  panic(err)
}
fmt.Printf("%s\n", userData)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServerAttributesExt

type ServerAttributesExt struct {
	// 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"`
}

ServerAttributesExt represents basic OS-EXT-SRV-ATTR server response fields. You should use extract methods from microversions.go to retrieve additional fields.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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