OptionalactionsOptionaldryOnly applies a dry run of the templates passed in the request.
OptionalenvAn 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.namespec.endpointNamespec.associations.nameFor more information about including environment references in template fields, see how to include user-definable resource names.
OptionalorgIDOrganization 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.
OptionalremotesA 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.
OptionalsecretsAn 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.
OptionalstackIDID 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.
OptionaltemplateA 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.
OptionaltemplatesA 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
actionobjects. Actions let you customize how InfluxDB applies templates in the request.You can use the following actions to prevent creating or updating resources:
skipKindaction skips template resources of a specifiedkind.skipResourceaction skips template resources with a specifiedmetadata.nameandkind.