novaclient.api_versions module

novaclient.api_versions module

class novaclient.api_versions.APIVersion(version_str=None)

Bases: object

This class represents an API Version Request.

This class provides convenience methods for manipulation and comparison of version numbers that we need to do to implement microversions.

Create an API version object.

Parameters:version_str – String representation of APIVersionRequest. Correct format is ‘X.Y’, where ‘X’ and ‘Y’ are int values. None value should be used to create Null APIVersionRequest, which is equal to 0.0
get_string()

Version string representation.

Converts object to string representation which if used to create an APIVersion object results in the same version.

is_latest()
is_null()
matches(min_version, max_version)

Matches the version object.

Returns whether the version object represents a version greater than or equal to the minimum version and less than or equal to the maximum version.

Parameters:
  • min_version – Minimum acceptable version.
  • max_version – Maximum acceptable version.
Returns:

boolean

If min_version is null then there is no minimum limit. If max_version is null then there is no maximum limit. If self is null then raise ValueError

class novaclient.api_versions.VersionedMethod(name, start_version, end_version, func)

Bases: object

Versioning information for a single method

Parameters:
  • name – Name of the method
  • start_version – Minimum acceptable version
  • end_version – Maximum acceptable_version
  • func – Method to call

Minimum and maximums are inclusive

novaclient.api_versions.check_headers(response, api_version)

Checks that microversion header is in response.

novaclient.api_versions.check_major_version(api_version)

Checks major part of APIVersion obj is supported.

Raises:novaclient.exceptions.UnsupportedVersion – if major part is not supported
novaclient.api_versions.deprecated_after(version)
novaclient.api_versions.discover_version(client, requested_version)

Discover most recent version supported by API and client.

Checks requested_version and returns the most recent version supported by both the API and the client.

Parameters:
  • client – client object
  • requested_version – requested version represented by APIVersion obj
Returns:

APIVersion

novaclient.api_versions.get_api_version(version_string)

Returns checked APIVersion object

novaclient.api_versions.get_available_major_versions()
novaclient.api_versions.get_substitutions(func_name, api_version=None)
novaclient.api_versions.update_headers(headers, api_version)

Set microversion headers if api_version is not null

novaclient.api_versions.wraps(start_version, end_version=None)
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.