Optional
actionsOptional
dryOnly applies a dry run of the templates passed in the request.
Optional
envAn object with key-value pairs that map to environment references in templates.
Environment references in templates are envRef
objects with an envRef.key
property.
To substitute a custom environment reference value when applying templates,
pass envRefs
with the envRef.key
and the value.
When you apply a template, InfluxDB replaces envRef
objects in the template
with the values that you provide in the envRefs
parameter.
For more examples, see how to define environment references.
The following template fields may use environment references:
metadata.name
spec.endpointName
spec.associations.name
For more information about including environment references in template fields, see how to include user-definable resource names.
Optional
orgIDOrganization ID. InfluxDB applies templates to this organization. The organization owns all resources created by the template.
To find your organization, see how to view organizations.
Optional
remotesA list of URLs for template files.
To apply a template manifest file located at a URL, pass remotes
with an array that contains the URL.
Optional
secretsAn object with key-value pairs that map to secrets in queries.
Queries may reference secrets stored in InfluxDB--for example,
the following Flux script retrieves POSTGRES_USERNAME
and POSTGRES_PASSWORD
secrets and then uses them to connect to a PostgreSQL database:
import "sql"
import "influxdata/influxdb/secrets"
username = secrets.get(key: "POSTGRES_USERNAME")
password = secrets.get(key: "POSTGRES_PASSWORD")
sql.from(
driverName: "postgres",
dataSourceName: "postgresql://${username}:${password}@localhost:5432",
query: "SELECT * FROM example_table",
)
To define secret values in your /api/v2/templates/apply
request,
pass the secrets
parameter with key-value pairs--for example:
{
...
"secrets": {
"POSTGRES_USERNAME": "pguser",
"POSTGRES_PASSWORD": "foo"
}
...
}
InfluxDB stores the key-value pairs as secrets that you can access with secrets.get()
.
Once stored, you can't view secret values in InfluxDB.
Optional
stackIDID of the stack to update.
To apply templates to an existing stack in the organization, use the stackID
parameter.
If you apply templates without providing a stack ID,
InfluxDB initializes a new stack with all new resources.
To find a stack ID, use the InfluxDB /api/v2/stacks
API endpoint to list stacks.
Optional
templateA template object to apply.
A template object has a contents
property
with an array of InfluxDB resource configurations.
Pass template
to apply only one template object.
If you use template
, you can't use the templates
parameter.
If you want to apply multiple template objects, use templates
instead.
Optional
templatesA list of template objects to apply.
A template object has a contents
property
with an array of InfluxDB resource configurations.
Use the templates
parameter to apply multiple template objects.
If you use templates
, you can't use the template
parameter.
A list of
action
objects. Actions let you customize how InfluxDB applies templates in the request.You can use the following actions to prevent creating or updating resources:
skipKind
action skips template resources of a specifiedkind
.skipResource
action skips template resources with a specifiedmetadata.name
andkind
.