The watcherclient.common.api_versioning Module

class watcherclient.common.api_versioning.APIVersion(version_str=None)[source]

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.

get_string()[source]

Version string representation.

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

is_latest()[source]
is_null()[source]
matches(min_version, max_version)[source]

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

watcherclient.common.api_versioning.check_major_version(api_version)[source]

Checks major part of APIVersion obj is supported.

Raises:watcherclient.exceptions.UnsupportedVersion – if major part is not supported
watcherclient.common.api_versioning.get_api_version(version_string)[source]

Returns checked APIVersion object

watcherclient.common.api_versioning.get_available_major_versions()[source]