Config(client, name)
A Config resource in the Cloud RuntimeConfig service.
This consists of metadata and a hierarchy of variables.
Parameters | |
---|---|
Name | Description |
client |
Client
A client which holds credentials and project configuration for the config (which requires a project). |
name |
str
The name of the config. |
Properties
client
The client bound to this config.
description
Description of the config object.
Returns | |
---|---|
Type | Description |
str, or | the description (None until set from the server). |
full_name
Fully-qualified name of this variable.
Example:
projects/my-project/configs/my-config
Exceptions | |
---|---|
Type | Description |
`ValueError | if the config is missing a name. |
Returns | |
---|---|
Type | Description |
str | The full name based on project and config names. |
path
URL path for the config's APIs.
Returns | |
---|---|
Type | Description |
str | The URL path based on project and config names. |
project
Project bound to the config.
Returns | |
---|---|
Type | Description |
str | the project (derived from the client). |
Methods
exists
exists(client=None)
Determines whether or not this config exists.
Parameter | |
---|---|
Name | Description |
client |
Client
(Optional) The client to use. If not passed, falls back to the |
Returns | |
---|---|
Type | Description |
bool | True if the config exists in Cloud Runtime Configurator. |
get_variable
get_variable(variable_name, client=None)
API call: get a variable via a GET
request.
This will return None if the variable doesn't exist::
from google.cloud import runtimeconfig client = runtimeconfig.Client() config = client.config('my-config') print(config.get_variable('variable-name')) <Variable: my-config, variable-name> print(config.get_variable('does-not-exist')) None
Parameters | |
---|---|
Name | Description |
variable_name |
str
The name of the variable to retrieve. |
client |
Client
(Optional) The client to use. If not passed, falls back to the |
Returns | |
---|---|
Type | Description |
Variable or None | The variable object if it exists, otherwise None. |
list_variables
list_variables(page_size=None, page_token=None, client=None)
API call: list variables for this config.
This only lists variable names, not the values.
Parameters | |
---|---|
Name | Description |
page_size |
int
Optional. The maximum number of variables in each page of results from this request. Non-positive values are ignored. Defaults to a sensible value set by the API. |
page_token |
str
Optional. If present, return the next batch of variables, using the value, which must correspond to the |
client |
Client
(Optional) The client to use. If not passed, falls back to the |
Returns | |
---|---|
Type | Description |
| Iterator of Variable belonging to this project. |
reload
reload(client=None)
API call: reload the config via a GET
request.
This method will reload the newest data for the config.
Parameter | |
---|---|
Name | Description |
client |
Client
(Optional) The client to use. If not passed, falls back to the client stored on the current config. |
variable
variable(variable_name)
Factory constructor for variable object.
Parameter | |
---|---|
Name | Description |
variable_name |
str
The name of the variable to be instantiated. |
Returns | |
---|---|
Type | Description |
Variable | The variable object created. |