apiversions

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package apiversions provides information and interaction with the different API versions for the OpenStack Block Storage service, code-named Cinder.

Example of Retrieving all API Versions

allPages, err := apiversions.List(client).AllPages()
if err != nil {
	panic("unable to get API versions: " + err.Error())
}

allVersions, err := apiversions.ExtractAPIVersions(allPages)
if err != nil {
	panic("unable to extract API versions: " + err.Error())
}

for _, version := range allVersions {
	fmt.Printf("%+v\n", version)
}

Example of Retrieving an API Version

version, err := apiversions.Get(client, "v3").Extract()
if err != nil {
	panic("unable to get API version: " + err.Error())
}

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List lists all the Cinder API versions available to end-users.

Types

type APIVersion

type APIVersion struct {
	// ID is the unique identifier of the API version.
	ID string `json:"id"`

	// MinVersion is the minimum microversion supported.
	MinVersion string `json:"min_version"`

	// Status represents the status of the API version.
	Status string `json:"status"`

	// Updated is the date the API version was updated.
	Updated time.Time `json:"updated"`

	// Version is the current version and microversion.
	Version string `json:"version"`
}

APIVersion represents an API version for Cinder.

func ExtractAPIVersion

func ExtractAPIVersion(r pagination.Page, v string) (*APIVersion, error)

ExtractAPIVersion takes a List result and extracts a single requested version, which is returned as an APIVersion

func ExtractAPIVersions

func ExtractAPIVersions(r pagination.Page) ([]APIVersion, error)

ExtractAPIVersions takes a collection page, extracts all of the elements, and returns them a slice of APIVersion structs. It is effectively a cast.

type APIVersionPage

type APIVersionPage struct {
	pagination.SinglePageBase
}

APIVersionPage is the page returned by a pager when traversing over a collection of API versions.

func (APIVersionPage) IsEmpty

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

IsEmpty checks whether an APIVersionPage struct is empty.

type ErrMultipleVersionsFound

type ErrMultipleVersionsFound struct {
	Count int
}

ErrMultipleVersionsFound is the error when a request for an API version returns multiple results.

func (ErrMultipleVersionsFound) Error

func (e ErrMultipleVersionsFound) Error() string

type ErrVersionNotFound

type ErrVersionNotFound struct{}

ErrVersionNotFound is the error when the requested API version could not be found.

func (ErrVersionNotFound) Error

func (e ErrVersionNotFound) Error() string

Directories

Path Synopsis
apiversions_v1
apiversions_v1

Jump to

Keyboard shortcuts

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