apiversions

package
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package apiversions provides information and interaction with the different API versions for the OpenStack Neutron service. This functionality is not restricted to this particular version.

Example to List API Versions

allPages, err := apiversions.ListVersions(networkingClient).AllPages()
if err != nil {
	panic(err)
}

allVersions, err := apiversions.ExtractAPIVersions(allPages)
if err != nil {
	panic(err)
}

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListVersionResources

func ListVersionResources(c *gophercloud.ServiceClient, v string) pagination.Pager

ListVersionResources lists all of the different API resources for a particular API versions. Typical resources for Neutron might be: networks, subnets, etc.

func ListVersions

func ListVersions(c *gophercloud.ServiceClient) pagination.Pager

ListVersions lists all the Neutron API versions available to end-users.

Types

type APIVersion

type APIVersion struct {
	Status string `son:"status"`
	ID     string `json:"id"`
}

APIVersion represents an API version for Neutron. It contains the status of the API, and its unique ID.

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 APIVersionResource

type APIVersionResource struct {
	Name       string `json:"name"`
	Collection string `json:"collection"`
}

APIVersionResource represents a generic API resource. It contains the name of the resource and its plural collection name.

func ExtractVersionResources

func ExtractVersionResources(r pagination.Page) ([]APIVersionResource, error)

ExtractVersionResources accepts a Page struct, specifically a APIVersionResourcePage struct, and extracts the elements into a slice of APIVersionResource structs. In other words, the collection is mapped into a relevant slice.

type APIVersionResourcePage

type APIVersionResourcePage struct {
	pagination.SinglePageBase
}

APIVersionResourcePage is a concrete type which embeds the common SinglePageBase struct, and is used when traversing API versions collections.

func (APIVersionResourcePage) IsEmpty

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

IsEmpty is a concrete function which indicates whether an APIVersionResourcePage is empty or not.

Directories

Path Synopsis
apiversions unit tests
apiversions unit tests

Jump to

Keyboard shortcuts

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