This page explains how to create a Config resource. A Config resource is an API object that stores variables as key value pairs. You need a Config resource before you can set and get variables. After creating a Config resource, you can create arbitrary variables that you can use to store data.
To learn more about configurations, variables, and the Runtime Configurator service, see Runtime Configurator Fundamentals.
Before you begin
- If you want to use the command-line examples in this guide, install the `gcloud` command-line tool.
- If you want to use the API examples in this guide, set up API access.
- Read Runtime Configurator Fundamentals.
- Enable the Runtime Configurator API.
Creating a config
You can create a Config resource with Deployment Manager, the gcloud
command-line tool, or directly using the Runtime Configurator API.
Deployment Manager
To create a config in Deployment Manager, specify the RuntimeConfig type:
runtimeconfig.v1beta1.config
In the properties
of the resource, provide the name
and other optional
properties if desired:
resources:
- name: [CONFIG_NAME]
type: runtimeconfig.v1beta1.config
properties:
config: [CONFIG_NAME]
description: [DESCRIPTION]
where:
[CONFIG_NAME]
is the name for this config.[DESCRIPTION]
is the description of this config (optional).
gcloud
With the Google Cloud CLI, use the
gcloud beta runtime-config configs create
command:
gcloud beta runtime-config configs create [CONFIG_NAME] --description [DESCRIPTION]
where:
[CONFIG_NAME]
is the name for this config.[DESCRIPTION]
is the description of this config (optional).
gcloud
returns a response like:
Created [https://runtimeconfig.googleapis.com/v1beta1/projects/[PROJECT_ID]/configs/[CONFIG_NAME]].
For a complete reference for this gcloud
command, read the
runtime-config configs create
reference documentation.
API
In the REST API, make a POST
request to the following URI:
https://runtimeconfig.googleapis.com/v1beta1/projects/[PROJECT_ID]/configs/
where [PROJECT_ID]
is the project ID for this request. The payload for
the request looks like this:
{
"name": "projects/[PROJECT_ID]/configs/[CONFIG_NAME]",
"description": "[DESCRIPTION]"
}
where:
[PROJECT_ID]
is the project ID for this request.[CONFIG_NAME]
is the name of this RuntimeConfig.[DESCRIPTION]
is the description of this config (optional).To learn more about this method, read the
configs().create
documentation.
Deleting a RuntimeConfig resource
Deleting a RuntimeConfig resource deletes all resources contained by that resource, including all variables and waiters.
Deployment Manager
Delete a RuntimeConfig resource that is part of a deployment using one of the following methods:
- Update the deployment to omit the config and redeploy the deployment.
- Delete the deployment and the resources it contains.
gcloud
With the Google Cloud CLI, use the gcloud beta runtime-config configs delete
command:
gcloud beta runtime-config configs delete [CONFIG_NAME]
where [CONFIG_NAME]
is the name of the configuration object.
The gcloud CLI returns a response like:
Deleted [https://runtimeconfig.googleapis.com/v1beta1/projects/[PROJECT_ID]/configs/[CONFIG_NAME]].
For the full gcloud
reference, read the runtime-config configs delete
reference documentation.
API
In the REST API, make a DELETE
request to the following URI:
https://runtimeconfig.googleapis.com/v1beta1/projects/[PROJECT_ID]/configs/[CONFIG_NAME]
where:
[PROJECT_ID]
is the project ID for this request.[CONFIG_NAME]
is the name of this configuration.To learn more about this method, read the
configs().delete
documentation.
What's next
- Next, create some variables and learn how to set and get data.
- Learn how to set a Watcher on a specific variable.
- Create a Waiter that returns when a variable reaches a Cardinality condition.
- Refer to the v1beta1 reference.
- Refer to the Quotas for Runtime Configurator.
- Learn about Runtime Configurator.