Variables¶
Create / interact with Google Cloud RuntimeConfig variables.
- google.cloud.runtimeconfig.variable.STATE_UNSPECIFIED¶
The default variable state. See https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables#VariableState
- google.cloud.runtimeconfig.variable.STATE_UPDATED¶
Indicates the variable was updated, while variables.watch was executing. See https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables#VariableState
- google.cloud.runtimeconfig.variable.STATE_DELETED¶
Indicates the variable was deleted, while variables.watch was executing. See https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables#VariableState
- class google.cloud.runtimeconfig.variable.Variable(name, config)[source]¶
Bases:
object
A variable in the Cloud RuntimeConfig service.
- Parameters
name (str) – The name of the variable. This corresponds to the unique path of the variable in the config.
config (
google.cloud.runtimeconfig.config.Config
) – The config to which this variable belongs.
- property client¶
The client bound to this variable.
- classmethod from_api_repr(resource, config)[source]¶
Factory: construct a Variable given its API representation
- Parameters
resource (dict) – change set representation returned from the API.
config (
google.cloud.runtimeconfig.config.Config
) – The config to which this variable belongs.
- Return type
- Returns
Variable parsed from
resource
.
- property full_name¶
Fully-qualified name of this variable.
Example:
projects/my-project/configs/my-config/variables/my-var
- Return type
- Returns
The full name based on config and variable names.
- Raises
ValueError
if the variable is missing a name.
- property path¶
URL path for the variable’s APIs.
- Return type
- Returns
The URL path based on config and variable names.
- reload(client=None)[source]¶
API call: reload the variable via a
GET
request.This method will reload the newest data for the variable.
- Parameters
client (
google.cloud.runtimeconfig.client.Client
) – (Optional) The client to use. If not passed, falls back to the client stored on the current config.
- property state¶
Retrieve the state of the variable.
- Return type
- Returns
If set, one of “UPDATED”, “DELETED”, or defaults to “VARIABLE_STATE_UNSPECIFIED”.
- property text¶
Text of the variable, as string.
- Return type
str or
NoneType
- Returns
The text of the variable or
None
if the property is not set locally.
- property update_time¶
Retrieve the timestamp at which the variable was updated.
- Returns
DatetimeWithNanoseconds
,datetime.datetime
orNoneType
: Datetime object parsed from RFC3339 valid timestamp, orNone
if the property is not set locally.- Raises
ValueError – if value is not a valid RFC3339 timestamp
- property value¶
Value of the variable, as bytes.
- Return type
bytes or
NoneType
- Returns
The value of the variable or
None
if the property is not set locally.