Variable(name, config)
A variable in the Cloud RuntimeConfig service.
Parameters | |
---|---|
Name | Description |
name |
str
The name of the variable. This corresponds to the unique path of the variable in the config. |
config |
Config
The config to which this variable belongs. |
Properties
client
The client bound to this variable.
full_name
Fully-qualified name of this variable.
Example:
projects/my-project/configs/my-config/variables/my-var
Exceptions | |
---|---|
Type | Description |
`ValueError | if the variable is missing a name. |
Returns | |
---|---|
Type | Description |
str | The full name based on config and variable names. |
path
URL path for the variable's APIs.
Returns | |
---|---|
Type | Description |
str | The URL path based on config and variable names. |
state
Retrieve the state of the variable.
Returns | |
---|---|
Type | Description |
str | If set, one of "UPDATED", "DELETED", or defaults to "VARIABLE_STATE_UNSPECIFIED". |
text
Text of the variable, as string.
Returns | |
---|---|
Type | Description |
str or | The text of the variable or None if the property is not set locally. |
update_time
Retrieve the timestamp at which the variable was updated.
Exceptions | |
---|---|
Type | Description |
ValueError | if value is not a valid RFC3339 timestamp |
value
Value of the variable, as bytes.
Returns | |
---|---|
Type | Description |
bytes or | The value of the variable or None if the property is not set locally. |
Methods
create
create(client=None)
API call: create the variable via a POST request
Parameter | |
---|---|
Name | Description |
client |
Client
(Optional) The client to use. If not passed, falls back to the |
Returns | |
---|---|
Type | Description |
bool | True if the variable has been created, False on error. |
exists
exists(client=None)
API call: test for the existence of the variable via a GET request
Parameter | |
---|---|
Name | Description |
client |
Client
(Optional) The client to use. If not passed, falls back to the |
Returns | |
---|---|
Type | Description |
bool | True if the variable exists in Cloud RuntimeConfig. |
from_api_repr
from_api_repr(resource, config)
Factory: construct a Variable given its API representation
Parameters | |
---|---|
Name | Description |
resource |
dict
change set representation returned from the API. |
config |
Config
The config to which this variable belongs. |
Returns | |
---|---|
Type | Description |
Variable | Variable parsed from resource . |
reload
reload(client=None)
API call: reload the variable via a GET
request.
This method will reload the newest data for the variable.
Parameter | |
---|---|
Name | Description |
client |
Client
(Optional) The client to use. If not passed, falls back to the client stored on the current config. |
update
update(client=None)
API call: update the variable via a PUT request
Parameter | |
---|---|
Name | Description |
client |
Client
(Optional) The client to use. If not passed, falls back to the |
Returns | |
---|---|
Type | Description |
bool | True if the variable has been created, False on error. |