elasticstack.ElasticsearchWatch
Explore with Pulumi AI
Adds and manages a Watch. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api.html
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as elasticstack from "@pulumi/elasticstack";
const example = new elasticstack.ElasticsearchWatch("example", {
watchId: "test_watch",
active: true,
trigger: JSON.stringify({
schedule: {
cron: "0 0/1 * * * ?",
},
}),
input: JSON.stringify({
none: {},
}),
condition: JSON.stringify({
always: {},
}),
actions: JSON.stringify({}),
metadata: JSON.stringify({
example_key: "example_value",
}),
transform: JSON.stringify({
script: "return [ 'time' : ctx.trigger.scheduled_time ]",
}),
throttlePeriodInMillis: 10000,
});
export const watch = example.watchId;
import pulumi
import json
import pulumi_elasticstack as elasticstack
example = elasticstack.ElasticsearchWatch("example",
watch_id="test_watch",
active=True,
trigger=json.dumps({
"schedule": {
"cron": "0 0/1 * * * ?",
},
}),
input=json.dumps({
"none": {},
}),
condition=json.dumps({
"always": {},
}),
actions=json.dumps({}),
metadata=json.dumps({
"example_key": "example_value",
}),
transform=json.dumps({
"script": "return [ 'time' : ctx.trigger.scheduled_time ]",
}),
throttle_period_in_millis=10000)
pulumi.export("watch", example.watch_id)
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-terraform-provider/sdks/go/elasticstack/elasticstack"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"schedule": map[string]interface{}{
"cron": "0 0/1 * * * ?",
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
tmpJSON1, err := json.Marshal(map[string]interface{}{
"none": map[string]interface{}{},
})
if err != nil {
return err
}
json1 := string(tmpJSON1)
tmpJSON2, err := json.Marshal(map[string]interface{}{
"always": map[string]interface{}{},
})
if err != nil {
return err
}
json2 := string(tmpJSON2)
tmpJSON3, err := json.Marshal(map[string]interface{}{})
if err != nil {
return err
}
json3 := string(tmpJSON3)
tmpJSON4, err := json.Marshal(map[string]interface{}{
"example_key": "example_value",
})
if err != nil {
return err
}
json4 := string(tmpJSON4)
tmpJSON5, err := json.Marshal(map[string]interface{}{
"script": "return [ 'time' : ctx.trigger.scheduled_time ]",
})
if err != nil {
return err
}
json5 := string(tmpJSON5)
example, err := elasticstack.NewElasticsearchWatch(ctx, "example", &elasticstack.ElasticsearchWatchArgs{
WatchId: pulumi.String("test_watch"),
Active: pulumi.Bool(true),
Trigger: pulumi.String(json0),
Input: pulumi.String(json1),
Condition: pulumi.String(json2),
Actions: pulumi.String(json3),
Metadata: pulumi.String(json4),
Transform: pulumi.String(json5),
ThrottlePeriodInMillis: pulumi.Float64(10000),
})
if err != nil {
return err
}
ctx.Export("watch", example.WatchId)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Elasticstack = Pulumi.Elasticstack;
return await Deployment.RunAsync(() =>
{
var example = new Elasticstack.ElasticsearchWatch("example", new()
{
WatchId = "test_watch",
Active = true,
Trigger = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["schedule"] = new Dictionary<string, object?>
{
["cron"] = "0 0/1 * * * ?",
},
}),
Input = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["none"] = new Dictionary<string, object?>
{
},
}),
Condition = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["always"] = new Dictionary<string, object?>
{
},
}),
Actions = JsonSerializer.Serialize(new Dictionary<string, object?>
{
}),
Metadata = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["example_key"] = "example_value",
}),
Transform = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["script"] = "return [ 'time' : ctx.trigger.scheduled_time ]",
}),
ThrottlePeriodInMillis = 10000,
});
return new Dictionary<string, object?>
{
["watch"] = example.WatchId,
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.elasticstack.ElasticsearchWatch;
import com.pulumi.elasticstack.ElasticsearchWatchArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ElasticsearchWatch("example", ElasticsearchWatchArgs.builder()
.watchId("test_watch")
.active(true)
.trigger(serializeJson(
jsonObject(
jsonProperty("schedule", jsonObject(
jsonProperty("cron", "0 0/1 * * * ?")
))
)))
.input(serializeJson(
jsonObject(
jsonProperty("none", jsonObject(
))
)))
.condition(serializeJson(
jsonObject(
jsonProperty("always", jsonObject(
))
)))
.actions(serializeJson(
jsonObject(
)))
.metadata(serializeJson(
jsonObject(
jsonProperty("example_key", "example_value")
)))
.transform(serializeJson(
jsonObject(
jsonProperty("script", "return [ 'time' : ctx.trigger.scheduled_time ]")
)))
.throttlePeriodInMillis(10000)
.build());
ctx.export("watch", example.watchId());
}
}
resources:
example:
type: elasticstack:ElasticsearchWatch
properties:
watchId: test_watch
active: true
trigger:
fn::toJSON:
schedule:
cron: 0 0/1 * * * ?
input:
fn::toJSON:
none: {}
condition:
fn::toJSON:
always: {}
actions:
fn::toJSON: {}
metadata:
fn::toJSON:
example_key: example_value
transform:
fn::toJSON:
script: 'return [ ''time'' : ctx.trigger.scheduled_time ]'
throttlePeriodInMillis: 10000
outputs:
watch: ${example.watchId}
Create ElasticsearchWatch Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ElasticsearchWatch(name: string, args: ElasticsearchWatchArgs, opts?: CustomResourceOptions);
@overload
def ElasticsearchWatch(resource_name: str,
args: ElasticsearchWatchArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ElasticsearchWatch(resource_name: str,
opts: Optional[ResourceOptions] = None,
trigger: Optional[str] = None,
watch_id: Optional[str] = None,
actions: Optional[str] = None,
active: Optional[bool] = None,
condition: Optional[str] = None,
input: Optional[str] = None,
metadata: Optional[str] = None,
throttle_period_in_millis: Optional[float] = None,
transform: Optional[str] = None)
func NewElasticsearchWatch(ctx *Context, name string, args ElasticsearchWatchArgs, opts ...ResourceOption) (*ElasticsearchWatch, error)
public ElasticsearchWatch(string name, ElasticsearchWatchArgs args, CustomResourceOptions? opts = null)
public ElasticsearchWatch(String name, ElasticsearchWatchArgs args)
public ElasticsearchWatch(String name, ElasticsearchWatchArgs args, CustomResourceOptions options)
type: elasticstack:ElasticsearchWatch
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ElasticsearchWatchArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ElasticsearchWatchArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ElasticsearchWatchArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ElasticsearchWatchArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ElasticsearchWatchArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var elasticsearchWatchResource = new Elasticstack.ElasticsearchWatch("elasticsearchWatchResource", new()
{
Trigger = "string",
WatchId = "string",
Actions = "string",
Active = false,
Condition = "string",
Input = "string",
Metadata = "string",
ThrottlePeriodInMillis = 0,
Transform = "string",
});
example, err := elasticstack.NewElasticsearchWatch(ctx, "elasticsearchWatchResource", &elasticstack.ElasticsearchWatchArgs{
Trigger: pulumi.String("string"),
WatchId: pulumi.String("string"),
Actions: pulumi.String("string"),
Active: pulumi.Bool(false),
Condition: pulumi.String("string"),
Input: pulumi.String("string"),
Metadata: pulumi.String("string"),
ThrottlePeriodInMillis: pulumi.Float64(0),
Transform: pulumi.String("string"),
})
var elasticsearchWatchResource = new ElasticsearchWatch("elasticsearchWatchResource", ElasticsearchWatchArgs.builder()
.trigger("string")
.watchId("string")
.actions("string")
.active(false)
.condition("string")
.input("string")
.metadata("string")
.throttlePeriodInMillis(0)
.transform("string")
.build());
elasticsearch_watch_resource = elasticstack.ElasticsearchWatch("elasticsearchWatchResource",
trigger="string",
watch_id="string",
actions="string",
active=False,
condition="string",
input="string",
metadata="string",
throttle_period_in_millis=0,
transform="string")
const elasticsearchWatchResource = new elasticstack.ElasticsearchWatch("elasticsearchWatchResource", {
trigger: "string",
watchId: "string",
actions: "string",
active: false,
condition: "string",
input: "string",
metadata: "string",
throttlePeriodInMillis: 0,
transform: "string",
});
type: elasticstack:ElasticsearchWatch
properties:
actions: string
active: false
condition: string
input: string
metadata: string
throttlePeriodInMillis: 0
transform: string
trigger: string
watchId: string
ElasticsearchWatch Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ElasticsearchWatch resource accepts the following input properties:
- Trigger string
- The trigger that defines when the watch should run.
- Watch
Id string - Identifier for the watch.
- Actions string
- The list of actions that will be run if the condition matches.
- Active bool
- Defines whether the watch is active or inactive by default. The default value is true, which means the watch is active by default.
- Condition string
- The condition that defines if the actions should be run.
- Input string
- The input that defines the input that loads the data for the watch.
- Metadata string
- Metadata json that will be copied into the history entries.
- Throttle
Period doubleIn Millis - Minimum time in milliseconds between actions being run. Defaults to 5000.
- Transform string
- Processes the watch payload to prepare it for the watch actions.
- Trigger string
- The trigger that defines when the watch should run.
- Watch
Id string - Identifier for the watch.
- Actions string
- The list of actions that will be run if the condition matches.
- Active bool
- Defines whether the watch is active or inactive by default. The default value is true, which means the watch is active by default.
- Condition string
- The condition that defines if the actions should be run.
- Input string
- The input that defines the input that loads the data for the watch.
- Metadata string
- Metadata json that will be copied into the history entries.
- Throttle
Period float64In Millis - Minimum time in milliseconds between actions being run. Defaults to 5000.
- Transform string
- Processes the watch payload to prepare it for the watch actions.
- trigger String
- The trigger that defines when the watch should run.
- watch
Id String - Identifier for the watch.
- actions String
- The list of actions that will be run if the condition matches.
- active Boolean
- Defines whether the watch is active or inactive by default. The default value is true, which means the watch is active by default.
- condition String
- The condition that defines if the actions should be run.
- input String
- The input that defines the input that loads the data for the watch.
- metadata String
- Metadata json that will be copied into the history entries.
- throttle
Period DoubleIn Millis - Minimum time in milliseconds between actions being run. Defaults to 5000.
- transform String
- Processes the watch payload to prepare it for the watch actions.
- trigger string
- The trigger that defines when the watch should run.
- watch
Id string - Identifier for the watch.
- actions string
- The list of actions that will be run if the condition matches.
- active boolean
- Defines whether the watch is active or inactive by default. The default value is true, which means the watch is active by default.
- condition string
- The condition that defines if the actions should be run.
- input string
- The input that defines the input that loads the data for the watch.
- metadata string
- Metadata json that will be copied into the history entries.
- throttle
Period numberIn Millis - Minimum time in milliseconds between actions being run. Defaults to 5000.
- transform string
- Processes the watch payload to prepare it for the watch actions.
- trigger str
- The trigger that defines when the watch should run.
- watch_
id str - Identifier for the watch.
- actions str
- The list of actions that will be run if the condition matches.
- active bool
- Defines whether the watch is active or inactive by default. The default value is true, which means the watch is active by default.
- condition str
- The condition that defines if the actions should be run.
- input str
- The input that defines the input that loads the data for the watch.
- metadata str
- Metadata json that will be copied into the history entries.
- throttle_
period_ floatin_ millis - Minimum time in milliseconds between actions being run. Defaults to 5000.
- transform str
- Processes the watch payload to prepare it for the watch actions.
- trigger String
- The trigger that defines when the watch should run.
- watch
Id String - Identifier for the watch.
- actions String
- The list of actions that will be run if the condition matches.
- active Boolean
- Defines whether the watch is active or inactive by default. The default value is true, which means the watch is active by default.
- condition String
- The condition that defines if the actions should be run.
- input String
- The input that defines the input that loads the data for the watch.
- metadata String
- Metadata json that will be copied into the history entries.
- throttle
Period NumberIn Millis - Minimum time in milliseconds between actions being run. Defaults to 5000.
- transform String
- Processes the watch payload to prepare it for the watch actions.
Outputs
All input properties are implicitly available as output properties. Additionally, the ElasticsearchWatch resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing ElasticsearchWatch Resource
Get an existing ElasticsearchWatch resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ElasticsearchWatchState, opts?: CustomResourceOptions): ElasticsearchWatch
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
actions: Optional[str] = None,
active: Optional[bool] = None,
condition: Optional[str] = None,
input: Optional[str] = None,
metadata: Optional[str] = None,
throttle_period_in_millis: Optional[float] = None,
transform: Optional[str] = None,
trigger: Optional[str] = None,
watch_id: Optional[str] = None) -> ElasticsearchWatch
func GetElasticsearchWatch(ctx *Context, name string, id IDInput, state *ElasticsearchWatchState, opts ...ResourceOption) (*ElasticsearchWatch, error)
public static ElasticsearchWatch Get(string name, Input<string> id, ElasticsearchWatchState? state, CustomResourceOptions? opts = null)
public static ElasticsearchWatch get(String name, Output<String> id, ElasticsearchWatchState state, CustomResourceOptions options)
resources: _: type: elasticstack:ElasticsearchWatch get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Actions string
- The list of actions that will be run if the condition matches.
- Active bool
- Defines whether the watch is active or inactive by default. The default value is true, which means the watch is active by default.
- Condition string
- The condition that defines if the actions should be run.
- Input string
- The input that defines the input that loads the data for the watch.
- Metadata string
- Metadata json that will be copied into the history entries.
- Throttle
Period doubleIn Millis - Minimum time in milliseconds between actions being run. Defaults to 5000.
- Transform string
- Processes the watch payload to prepare it for the watch actions.
- Trigger string
- The trigger that defines when the watch should run.
- Watch
Id string - Identifier for the watch.
- Actions string
- The list of actions that will be run if the condition matches.
- Active bool
- Defines whether the watch is active or inactive by default. The default value is true, which means the watch is active by default.
- Condition string
- The condition that defines if the actions should be run.
- Input string
- The input that defines the input that loads the data for the watch.
- Metadata string
- Metadata json that will be copied into the history entries.
- Throttle
Period float64In Millis - Minimum time in milliseconds between actions being run. Defaults to 5000.
- Transform string
- Processes the watch payload to prepare it for the watch actions.
- Trigger string
- The trigger that defines when the watch should run.
- Watch
Id string - Identifier for the watch.
- actions String
- The list of actions that will be run if the condition matches.
- active Boolean
- Defines whether the watch is active or inactive by default. The default value is true, which means the watch is active by default.
- condition String
- The condition that defines if the actions should be run.
- input String
- The input that defines the input that loads the data for the watch.
- metadata String
- Metadata json that will be copied into the history entries.
- throttle
Period DoubleIn Millis - Minimum time in milliseconds between actions being run. Defaults to 5000.
- transform String
- Processes the watch payload to prepare it for the watch actions.
- trigger String
- The trigger that defines when the watch should run.
- watch
Id String - Identifier for the watch.
- actions string
- The list of actions that will be run if the condition matches.
- active boolean
- Defines whether the watch is active or inactive by default. The default value is true, which means the watch is active by default.
- condition string
- The condition that defines if the actions should be run.
- input string
- The input that defines the input that loads the data for the watch.
- metadata string
- Metadata json that will be copied into the history entries.
- throttle
Period numberIn Millis - Minimum time in milliseconds between actions being run. Defaults to 5000.
- transform string
- Processes the watch payload to prepare it for the watch actions.
- trigger string
- The trigger that defines when the watch should run.
- watch
Id string - Identifier for the watch.
- actions str
- The list of actions that will be run if the condition matches.
- active bool
- Defines whether the watch is active or inactive by default. The default value is true, which means the watch is active by default.
- condition str
- The condition that defines if the actions should be run.
- input str
- The input that defines the input that loads the data for the watch.
- metadata str
- Metadata json that will be copied into the history entries.
- throttle_
period_ floatin_ millis - Minimum time in milliseconds between actions being run. Defaults to 5000.
- transform str
- Processes the watch payload to prepare it for the watch actions.
- trigger str
- The trigger that defines when the watch should run.
- watch_
id str - Identifier for the watch.
- actions String
- The list of actions that will be run if the condition matches.
- active Boolean
- Defines whether the watch is active or inactive by default. The default value is true, which means the watch is active by default.
- condition String
- The condition that defines if the actions should be run.
- input String
- The input that defines the input that loads the data for the watch.
- metadata String
- Metadata json that will be copied into the history entries.
- throttle
Period NumberIn Millis - Minimum time in milliseconds between actions being run. Defaults to 5000.
- transform String
- Processes the watch payload to prepare it for the watch actions.
- trigger String
- The trigger that defines when the watch should run.
- watch
Id String - Identifier for the watch.
Import
$ pulumi import elasticstack:index/elasticsearchWatch:ElasticsearchWatch watch_id <cluster_uuid>/<watch ID>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- elasticstack elastic/terraform-provider-elasticstack
- License
- Notes
- This Pulumi package is based on the
elasticstack
Terraform Provider.