Type conversion and validation classes for configuration options.
Use these classes as values for the type argument to
oslo_config.cfg.Opt
and its subclasses.
New in version 1.3.
oslo_config.types.
Boolean
(type_name='boolean value')¶Boolean type.
Values are case insensitive and can be set using 1/0, yes/no, true/false or on/off.
Parameters: | type_name – Type name to be used in the sample config file. |
---|
Changed in version 2.7: Added type_name parameter.
oslo_config.types.
Dict
(value_type=None, bounds=False, type_name='dict value')¶Dictionary type.
Dictionary type values are key:value pairs separated by commas. The resulting value is a dictionary of these key/value pairs. Type of dictionary key is always string, but dictionary value type can be customized.
Parameters: |
|
---|
Changed in version 2.7: Added type_name parameter.
oslo_config.types.
Float
(min=None, max=None, type_name='floating point value')¶Float type.
Parameters: |
|
---|
Changed in version 2.7: Added type_name parameter.
Changed in version 3.14: Added min and max parameters. If choices are also supplied, they must be within the range.
oslo_config.types.
HostAddress
(version=None, type_name='host address value')¶Host Address type.
Represents both valid IP addresses and valid host domain names including fully qualified domain names. Performs strict checks for both IP addresses and valid hostnames, matching the opt values to the respective types as per RFC1912.
Parameters: |
|
---|
oslo_config.types.
Hostname
(type_name='hostname value')¶Host domain name type.
A hostname refers to a valid DNS or hostname. It must not be longer than 253 characters, have a segment greater than 63 characters, nor start or end with a hyphen.
Parameters: | type_name – Type name to be used in the sample config file. |
---|
oslo_config.types.
IPAddress
(version=None, type_name='IP address value')¶IP address type
Represents either ipv4 or ipv6. Without specifying version parameter both versions are checked
Parameters: |
|
---|
Changed in version 2.7: Added type_name parameter.
oslo_config.types.
Integer
(min=None, max=None, type_name='integer value', choices=None)¶Integer type.
Converts value to an integer optionally doing range checking. If value is whitespace or empty string will return None.
Parameters: |
|
---|
Changed in version 2.4: The class now honors zero for min and max parameters.
Changed in version 2.7: Added type_name parameter.
Changed in version 3.2: Added choices parameter.
Changed in version 3.16: choices is no longer mutually exclusive with min/max. If those are supplied, all choices are verified to be within the range.
oslo_config.types.
List
(item_type=None, bounds=False, type_name='list value')¶List type.
Represent values of other (item) type, separated by commas. The resulting value is a list containing those values.
List doesn’t know if item type can also contain commas. To workaround this it tries the following: if the next part fails item validation, it appends comma and next item until validation succeeds or there is no parts left. In the later case it will signal validation error.
Parameters: |
|
---|
Changed in version 2.7: Added type_name parameter.
oslo_config.types.
MultiString
(type_name='multi valued')¶Multi-valued string.
format_defaults
(default, sample_default=None)¶Return a list of formatted default values.
oslo_config.types.
Number
(num_type, type_name, min=None, max=None, choices=None)¶Number class, base for Integer and Float.
Parameters: |
|
---|
New in version 3.14.
oslo_config.types.
Port
(min=None, max=None, type_name='port', choices=None)¶Port type
Represents a L4 Port.
Parameters: |
|
---|
New in version 3.16.
oslo_config.types.
Range
(min=None, max=None, inclusive=True, type_name='range value')¶Range type.
Represents a range of integers. A range is identified by an integer both sides of a ‘-‘ character. Negatives are allowed. A single number is also a valid range.
Parameters: |
|
---|
New in version 3.18.
oslo_config.types.
String
(choices=None, quotes=False, regex=None, ignore_case=False, max_length=None, type_name='string value')¶String type.
String values do not get transformed and are returned as str objects.
Parameters: |
|
---|
Changed in version 2.1: Added regex parameter.
Changed in version 2.5: Added ignore_case parameter.
Changed in version 2.7: Added max_length parameter. Added type_name parameter.
oslo_config.types.
URI
(max_length=None, schemes=None, type_name='uri value')¶URI type
Represents URI. Value will be validated as RFC 3986.
Parameters: |
|
---|
Changed in version 3.14: Added max_length parameter.
Changed in version 3.18: Added schemes parameter.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.