drivers

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package drivers contains the functionality for Listing drivers, driver details, driver properties and driver logical disk properties

API reference: https://developer.openstack.org/api-ref/baremetal/#drivers-drivers

Example to List Drivers

drivers.ListDrivers(client.ServiceClient(), drivers.ListDriversOpts{}).EachPage(context.TODO(), func(_ context.Context, page pagination.Page) (bool, error) {
	driversList, err := drivers.ExtractDrivers(page)
	if err != nil {
		return false, err
	}

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

	return true, nil
})

Example to Get single Driver Details

showDriverDetails, err := drivers.GetDriverDetails(context.TODO(), client, "ipmi").Extract()
if err != nil {
	panic(err)
}

Example to Get single Driver Properties

showDriverProperties, err := drivers.GetDriverProperties(context.TODO(), client, "ipmi").Extract()
if err != nil {
	panic(err)
}

Example to Get single Driver Logical Disk Properties

showDriverDiskProperties, err := drivers.GetDriverDiskProperties(context.TODO(), client, "ipmi").Extract()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractDriversInto

func ExtractDriversInto(r pagination.Page, v any) error

func ListDrivers

func ListDrivers(client *gophercloud.ServiceClient, opts ListDriversOptsBuilder) pagination.Pager

ListDrivers makes a request against the API to list all drivers

Types

type DiskProperties

type DiskProperties map[string]any

DiskProperties represents driver disk properties in the OpenStack Bare Metal API.

type Driver

type Driver struct {
	// Name and Identifier of the driver
	Name string `json:"name"`

	// A list of active hosts that support this driver
	Hosts []string `json:"hosts"`

	// Type of this driver (“classic” or “dynamic”)
	Type string `json:"type"`

	// The default bios interface used for a node with a dynamic driver,
	// if no bios interface is specified for the node.
	DefaultBiosInterface string `json:"default_bios_interface"`

	// The default boot interface used for a node with a dynamic driver,
	// if no boot interface is specified for the node.
	DefaultBootInterface string `json:"default_boot_interface"`

	// The default console interface used for a node with a dynamic driver,
	// if no console interface is specified for the node.
	DefaultConsoleInterface string `json:"default_console_interface"`

	// The default deploy interface used for a node with a dynamic driver,
	// if no deploy interface is specified for the node.
	DefaultDeployInterface string `json:"default_deploy_interface"`

	// The default firmware interface used for a node with a dynamic driver,
	// if no firmware interface is specified for the node.
	DefaultFirmwareInterface string `json:"default_firmware_interface"`

	// The default inspection interface used for a node with a dynamic driver,
	// if no inspection interface is specified for the node.
	DefaultInspectInterface string `json:"default_inspect_interface"`

	// The default management interface used for a node with a dynamic driver,
	// if no management interface is specified for the node.
	DefaultManagementInterface string `json:"default_management_interface"`

	// The default network interface used for a node with a dynamic driver,
	// if no network interface is specified for the node.
	DefaultNetworkInterface string `json:"default_network_interface"`

	// The default power interface used for a node with a dynamic driver,
	// if no power interface is specified for the node.
	DefaultPowerInterface string `json:"default_power_interface"`

	// The default RAID interface used for a node with a dynamic driver,
	// if no RAID interface is specified for the node.
	DefaultRaidInterface string `json:"default_raid_interface"`

	// The default rescue interface used for a node with a dynamic driver,
	// if no rescue interface is specified for the node.
	DefaultRescueInterface string `json:"default_rescue_interface"`

	// The default storage interface used for a node with a dynamic driver,
	// if no storage interface is specified for the node.
	DefaultStorageInterface string `json:"default_storage_interface"`

	// The default vendor interface used for a node with a dynamic driver,
	// if no vendor interface is specified for the node.
	DefaultVendorInterface string `json:"default_vendor_interface"`

	// The enabled bios interfaces for this driver.
	EnabledBiosInterfaces []string `json:"enabled_bios_interfaces"`

	// The enabled boot interfaces for this driver.
	EnabledBootInterfaces []string `json:"enabled_boot_interfaces"`

	// The enabled console interfaces for this driver.
	EnabledConsoleInterface []string `json:"enabled_console_interfaces"`

	// The enabled deploy interfaces for this driver.
	EnabledDeployInterfaces []string `json:"enabled_deploy_interfaces"`

	// The enabled firmware interfaces for this driver.
	EnabledFirmwareInterfaces []string `json:"enabled_firmware_interfaces"`

	// The enabled inspection interfaces for this driver.
	EnabledInspectInterfaces []string `json:"enabled_inspect_interfaces"`

	// The enabled management interfaces for this driver.
	EnabledManagementInterfaces []string `json:"enabled_management_interfaces"`

	// The enabled network interfaces for this driver.
	EnabledNetworkInterfaces []string `json:"enabled_network_interfaces"`

	// The enabled power interfaces for this driver.
	EnabledPowerInterfaces []string `json:"enabled_power_interfaces"`

	// The enabled rescue interfaces for this driver.
	EnabledRescueInterfaces []string `json:"enabled_rescue_interfaces"`

	// The enabled RAID interfaces for this driver.
	EnabledRaidInterfaces []string `json:"enabled_raid_interfaces"`

	// The enabled storage interfaces for this driver.
	EnabledStorageInterfaces []string `json:"enabled_storage_interfaces"`

	// The enabled vendor interfaces for this driver.
	EnabledVendorInterfaces []string `json:"enabled_vendor_interfaces"`

	//A list of relative links. Includes the self and bookmark links.
	Links []any `json:"links"`

	// A list of links to driver properties.
	Properties []any `json:"properties"`
}

Driver represents a driver in the OpenStack Bare Metal API.

func ExtractDrivers

func ExtractDrivers(r pagination.Page) ([]Driver, error)

ExtractDrivers interprets the results of a single page from ListDrivers() call, producing a slice of Driver entities.

type DriverPage

type DriverPage struct {
	pagination.LinkedPageBase
}

DriverPage abstracts the raw results of making a ListDrivers() request against the API.

func (DriverPage) IsEmpty

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

IsEmpty returns true if a page contains no Driver results.

func (DriverPage) NextPageURL

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

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

type DriverProperties

type DriverProperties map[string]any

DriverProperties represents driver properties in the OpenStack Bare Metal API.

type GetDiskPropertiesResult

type GetDiskPropertiesResult struct {
	gophercloud.Result
}

GetDiskPropertiesResult is the response from a GetDriverDiskProperties operation. Call its Extract method to interpret it as DiskProperties.

func GetDriverDiskProperties

func GetDriverDiskProperties(ctx context.Context, client *gophercloud.ServiceClient, driverName string) (r GetDiskPropertiesResult)

GetDriverDiskProperties Show the required and optional parameters that driverName expects to be supplied in the node’s raid_config field, if a RAID configuration change is requested.

func (GetDiskPropertiesResult) Extract

Extract interprets any GetDiskPropertiesResult as DiskProperties, if possible.

type GetDriverResult

type GetDriverResult struct {
	// contains filtered or unexported fields
}

GetDriverResult is the response from a Get operation. Call its Extract method to interpret it as a Driver.

func GetDriverDetails

func GetDriverDetails(ctx context.Context, client *gophercloud.ServiceClient, driverName string) (r GetDriverResult)

GetDriverDetails Shows details for a driver

func (GetDriverResult) Extract

func (r GetDriverResult) Extract() (*Driver, error)

Extract interprets any driverResult as a Driver, if possible.

func (GetDriverResult) ExtractInto

func (r GetDriverResult) ExtractInto(v any) error

type GetPropertiesResult

type GetPropertiesResult struct {
	gophercloud.Result
}

GetPropertiesResult is the response from a GetDriverProperties operation. Call its Extract method to interpret it as DriverProperties.

func GetDriverProperties

func GetDriverProperties(ctx context.Context, client *gophercloud.ServiceClient, driverName string) (r GetPropertiesResult)

GetDriverProperties Shows the required and optional parameters that driverName expects to be supplied in the driver_info field for every Node it manages

func (GetPropertiesResult) Extract

func (r GetPropertiesResult) Extract() (*DriverProperties, error)

Extract interprets any GetPropertiesResult as DriverProperties, if possible.

type ListDriversOpts

type ListDriversOpts struct {
	// Provide detailed information about the drivers
	Detail bool `q:"detail"`

	// Filter the list by the type of the driver
	Type string `q:"type"`
}

ListDriversOpts defines query options that can be passed to ListDrivers

func (ListDriversOpts) ToListDriversOptsQuery

func (opts ListDriversOpts) ToListDriversOptsQuery() (string, error)

ToListDriversOptsQuery formats a ListOpts into a query string

type ListDriversOptsBuilder

type ListDriversOptsBuilder interface {
	ToListDriversOptsQuery() (string, error)
}

ListDriversOptsBuilder allows extensions to add additional parameters to the ListDrivers request.

Directories

Path Synopsis
Package testing contains drivers unit tests
Package testing contains drivers unit tests

Jump to

Keyboard shortcuts

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