utils

package
v2.0.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseEndpoint

func BaseEndpoint(endpoint string) (string, error)

BaseEndpoint will return a URL without the /vX.Y portion of the URL.

func ParseMicroversion

func ParseMicroversion(version string) (major int, minor int, err error)

ParseMicroversion parses the version major.minor into separate integers major and minor. For example, "2.53" becomes 2 and 53.

func RequireMicroversion

func RequireMicroversion(ctx context.Context, client gophercloud.ServiceClient, required string) (gophercloud.ServiceClient, error)

RequireMicroversion checks that the required microversion is supported and returns a ServiceClient with the microversion set.

Types

type SupportedMicroversions

type SupportedMicroversions struct {
	MaxMajor int
	MaxMinor int
	MinMajor int
	MinMinor int
}

func GetSupportedMicroversions

func GetSupportedMicroversions(ctx context.Context, client *gophercloud.ServiceClient) (SupportedMicroversions, error)

GetSupportedMicroversions returns the minimum and maximum microversion that is supported by the ServiceClient Endpoint.

func (SupportedMicroversions) IsSupported

func (supported SupportedMicroversions) IsSupported(version string) (bool, error)

IsSupported checks if a microversion falls in the supported interval. It returns true if the version is within the interval and false otherwise.

type Version

type Version struct {
	ID       string
	Suffix   string
	Priority int
}

Version is a supported API version, corresponding to a vN package within the appropriate service.

func ChooseVersion

func ChooseVersion(ctx context.Context, client *gophercloud.ProviderClient, recognized []*Version) (*Version, string, error)

ChooseVersion queries the base endpoint of an API to choose the identity service version. It will pick a version among the recognized, taking into account the priority and avoiding experimental alternatives from the published versions. However, if the client specifies a full endpoint that is among the recognized versions, it will be used regardless of priority. It returns the highest-Priority Version, OR exact match with client endpoint, among the alternatives that are provided, as well as its corresponding endpoint.

Directories

Path Synopsis
utils
utils

Jump to

Keyboard shortcuts

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