providers

package
v1.1.24 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package providers provides information about the supported providers at OpenStack Octavia Load Balancing service.

Example to List Providers

allPages, err := providers.List(lbClient).AllPages()
if err != nil {
	panic(err)
}

allProviders, err := providers.ExtractProviders(allPages)
if err != nil {
	panic(err)
}

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List returns a Pager which allows you to iterate over a collection of providers.

Default policy settings return only those providers that are owned by the project who submits the request, unless an admin user submits the request.

Types

type GetResult

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

GetResult represents the result of a get operation. Call its Extract method to interpret it as a Provider.

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts a provider.

type ListOpts

type ListOpts struct {
	Fields []string `q:"fields"`
}

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 Provider attributes you want to see returned.

func (ListOpts) ToProviderListQuery

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

ToProviderListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type Provider

type Provider struct {
	// Human-readable description for the Loadbalancer.
	Description string `json:"description"`

	// Human-readable name for the Provider.
	Name string `json:"name"`
}

Provider is the Octavia driver that implements the load balancing mechanism

func ExtractProviders

func ExtractProviders(r pagination.Page) ([]Provider, error)

ExtractProviders accepts a Page struct, specifically a ProviderPage struct, and extracts the elements into a slice of Provider structs. In other words, a generic collection is mapped into a relevant slice.

type ProviderPage

type ProviderPage struct {
	pagination.LinkedPageBase
}

ProviderPage is the page returned by a pager when traversing over a collection of providers.

func (ProviderPage) IsEmpty

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

IsEmpty checks whether a ProviderPage struct is empty.

func (ProviderPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of providers has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

Directories

Path Synopsis
providers unit tests
providers unit tests

Jump to

Keyboard shortcuts

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