conductors

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package conductors provides information and interaction with the conductors API resource in the OpenStack Bare Metal service.

Example to List Conductors with Detail

conductors.List(client, conductors.ListOpts{Detail: true}).EachPage(func(page pagination.Page) (bool, error) {
	conductorList, err := conductors.ExtractConductors(page)
	if err != nil {
		return false, err
	}

	for _, n := range conductorList {
		// Do something
	}

	return true, nil
})

Example to List Conductors

listOpts := conductors.ListOpts{
	Fields:         []string{"hostname"},
}

conductors.List(client, listOpts).EachPage(func(page pagination.Page) (bool, error) {
	conductorList, err := conductors.ExtractConductors(page)
	if err != nil {
		return false, err
	}

	for _, n := range conductorList {
		// Do something
	}

	return true, nil
})

Example to Get Conductor

showConductor, err := conductors.Get(client, "compute2.localdomain").Extract()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractConductorInto

func ExtractConductorInto(r pagination.Page, v interface{}) error

func List

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

Types

type Conductor

type Conductor struct {
	// Whether or not this Conductor is alive or not
	Alive bool `json:"alive"`

	// Hostname of this conductor
	Hostname string `json:"hostname"`

	// Array of drivers for this conductor.
	Drivers []string `json:"drivers"`

	// Conductor group for a conductor. Case-insensitive string up to 255 characters, containing a-z, 0-9, _, -, and ..
	ConductorGroup string `json:"conductor_group"`

	// The UTC date and time when the resource was created, ISO 8601 format.
	CreatedAt time.Time `json:"created_at"`

	// The UTC date and time when the resource was updated, ISO 8601 format. May be “null”.
	UpdatedAt time.Time `json:"updated_at"`
}

Conductor represents a conductor in the OpenStack Bare Metal API.

func ExtractConductors

func ExtractConductors(r pagination.Page) ([]Conductor, error)

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

type ConductorPage

type ConductorPage struct {
	pagination.LinkedPageBase
}

ConductorPage 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 ExtractConductor call.

func (ConductorPage) IsEmpty

func (r ConductorPage) IsEmpty() (bool, error)

IsEmpty returns true if a page contains no conductor results.

func (ConductorPage) NextPageURL

func (r ConductorPage) NextPageURL() (string, error)

NextPageURL uses the response's embedded link reference to navigate to the next page of results.

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

func Get

func Get(client *gophercloud.ServiceClient, name string) (r GetResult)

Get requests details on a single conductor by hostname

func (GetResult) Extract

func (r GetResult) Extract() (*Conductor, error)

Extract interprets any conductorResult as a Conductor, if possible.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type ListOpts

type ListOpts struct {
	// One or more fields to be returned in the response.
	Fields []string `q:"fields"`

	// Requests a page size of items.
	Limit int `q:"limit"`

	// The ID of the last-seen item.
	Marker string `q:"marker"`

	// Sorts the response by the requested sort direction.
	SortDir string `q:"sort_dir"`

	// Sorts the response by the this attribute value.
	SortKey string `q:"sort_key"`

	// Provide additional information for the BIOS Settings
	Detail bool `q:"detail"`
}

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 conductor attributes you want to see returned. Marker and Limit are used for pagination.

func (ListOpts) ToConductorListQuery

func (opts ListOpts) ToConductorListQuery() (string, error)

ToConductorListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToConductorListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

Directories

Path Synopsis
conductors unit tests
conductors unit tests

Jump to

Keyboard shortcuts

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