@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
422 lines (421 loc) • 15.6 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import { input as inputs, output as outputs } from "../types";
/**
* Manages a trigger resource within HuaweiCloud FunctionGraph.\
* It's recommend to use `huaweicloudFgsFunctionTrigger`, which makes a great improvement of managing function triggers.
*
* ## Example Usage
* ### Create a Timing Trigger with rate schedule type
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const functionUrn = config.requireObject("functionUrn");
* const triggerName = config.requireObject("triggerName");
* const test = new huaweicloud.functiongraph.Trigger("test", {
* functionUrn: functionUrn,
* type: "TIMER",
* timer: {
* name: triggerName,
* scheduleType: "Rate",
* schedule: "1d",
* },
* });
* ```
* ### Create a Timing Trigger with cron schedule type
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const functionUrn = config.requireObject("functionUrn");
* const triggerName = config.requireObject("triggerName");
* const test = new huaweicloud.functiongraph.Trigger("test", {
* functionUrn: functionUrn,
* type: "TIMER",
* timer: {
* name: triggerName,
* scheduleType: "Cron",
* schedule: "@every 1h30m",
* },
* });
* ```
* ### Create an OBS trigger
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const functionUrn = config.requireObject("functionUrn");
* const bucketName = config.requireObject("bucketName");
* const triggerName = config.requireObject("triggerName");
* const test = new huaweicloud.functiongraph.Trigger("test", {
* functionUrn: functionUrn,
* type: "OBS",
* status: "ACTIVE",
* obs: {
* bucketName: bucketName,
* eventNotificationName: triggerName,
* suffix: ".json",
* events: ["ObjectCreated"],
* },
* });
* ```
* ### Create an SMN trigger
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const functionUrn = config.requireObject("functionUrn");
* const topicUrn = config.requireObject("topicUrn");
* const test = new huaweicloud.functiongraph.Trigger("test", {
* functionUrn: functionUrn,
* type: "SMN",
* status: "ACTIVE",
* smn: {
* topicUrn: topicUrn,
* },
* });
* ```
* ### Create a DIS trigger
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const functionUrn = config.requireObject("functionUrn");
* const streamName = config.requireObject("streamName");
* const test = new huaweicloud.functiongraph.Trigger("test", {
* functionUrn: functionUrn,
* type: "DIS",
* status: "ACTIVE",
* dis: {
* streamName: streamName,
* startingPosition: "TRIM_HORIZON",
* maxFetchBytes: 2097152,
* pullPeriod: 30000,
* serialEnable: true,
* },
* });
* ```
* ### Create a DMS Kafka trigger
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const functionUrn = config.requireObject("functionUrn");
* const kafkaInstanceId = config.requireObject("kafkaInstanceId");
* const kafkaTopicId = config.requireObject("kafkaTopicId");
* const userPassword = config.requireObject("userPassword");
* const test = new huaweicloud.functiongraph.Trigger("test", {
* functionUrn: functionUrn,
* type: "KAFKA",
* kafka: {
* instanceId: kafkaInstanceId,
* userName: "user",
* password: userPassword,
* batchSize: 100,
* topicIds: [kafkaTopicId],
* },
* });
* ```
* ### Create a Dedicated APIG trigger
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const functionUrn = config.requireObject("functionUrn");
* const instanceId = config.requireObject("instanceId");
* const groupId = config.requireObject("groupId");
* const apiName = config.requireObject("apiName");
* const test = new huaweicloud.functiongraph.Trigger("test", {
* functionUrn: functionUrn,
* type: "DEDICATEDGATEWAY",
* status: "ACTIVE",
* apig: {
* instanceId: instanceId,
* groupId: groupId,
* apiName: apiName,
* envName: "RELEASE",
* },
* });
* ```
* ### Create a Shared APIG trigger
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const functionUrn = config.requireObject("functionUrn");
* const groupId = config.requireObject("groupId");
* const apiName = config.requireObject("apiName");
* const test = new huaweicloud.functiongraph.Trigger("test", {
* functionUrn: functionUrn,
* type: "APIG",
* status: "ACTIVE",
* apig: {
* groupId: groupId,
* apiName: apiName,
* envName: "RELEASE",
* },
* });
* ```
* ### Create a LTS trigger
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const logGroupId = config.requireObject("logGroupId");
* const logTopicId = config.requireObject("logTopicId");
* const test = new huaweicloud.functiongraph.Trigger("test", {
* functionUrn: _var.function_urn,
* type: "LTS",
* status: "ACTIVE",
* lts: {
* logGroupId: logGroupId,
* logTopicId: logTopicId,
* },
* });
* ```
*/
export declare class Trigger extends pulumi.CustomResource {
/**
* Get an existing Trigger resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: TriggerState, opts?: pulumi.CustomResourceOptions): Trigger;
/**
* Returns true if the given object is an instance of Trigger. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is Trigger;
/**
* Specifies the configuration of the shared APIG and dedicated APIG trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
readonly apig: pulumi.Output<outputs.FunctionGraph.TriggerApig | undefined>;
/**
* Specifies the configuration of the DIS trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
readonly dis: pulumi.Output<outputs.FunctionGraph.TriggerDis | undefined>;
/**
* Specifies the Uniform Resource Name (URN) of the function.
* Changing this will create a new trigger resource.
*/
readonly functionUrn: pulumi.Output<string>;
/**
* Specifies the configuration of the DMS trigger for Kafka.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
readonly kafka: pulumi.Output<outputs.FunctionGraph.TriggerKafka | undefined>;
/**
* Specifies the configuration of the LTS trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
readonly lts: pulumi.Output<outputs.FunctionGraph.TriggerLts | undefined>;
/**
* Specifies the configuration of the OBS trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
readonly obs: pulumi.Output<outputs.FunctionGraph.TriggerObs | undefined>;
/**
* Specifies the region in which to create the trigger resource.
* If omitted, the provider-level region will be used.
* Changing this will create a new trigger resource.
*/
readonly region: pulumi.Output<string>;
/**
* Specifies the configuration of the SMN trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
readonly smn: pulumi.Output<outputs.FunctionGraph.TriggerSmn | undefined>;
/**
* Specifies whether trigger is enabled. The valid values are **ACTIVE** and **DISABLED**.
* About DMS kafka trigger, the default value is **ACTIVE**.
*/
readonly status: pulumi.Output<string>;
/**
* Specifies the configuration of the timing trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
readonly timer: pulumi.Output<outputs.FunctionGraph.TriggerTimer | undefined>;
/**
* Specifies the type of the function.
* The valid values currently only support **TIMER**, **OBS**, **SMN**, **DIS**, **KAFKA**, **APIG**, **LTS**, and
* **DEDICATEDGATEWAY**. Changing this will create a new trigger resource.
*/
readonly type: pulumi.Output<string>;
/**
* Create a Trigger resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: TriggerArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Trigger resources.
*/
export interface TriggerState {
/**
* Specifies the configuration of the shared APIG and dedicated APIG trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
apig?: pulumi.Input<inputs.FunctionGraph.TriggerApig>;
/**
* Specifies the configuration of the DIS trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
dis?: pulumi.Input<inputs.FunctionGraph.TriggerDis>;
/**
* Specifies the Uniform Resource Name (URN) of the function.
* Changing this will create a new trigger resource.
*/
functionUrn?: pulumi.Input<string>;
/**
* Specifies the configuration of the DMS trigger for Kafka.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
kafka?: pulumi.Input<inputs.FunctionGraph.TriggerKafka>;
/**
* Specifies the configuration of the LTS trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
lts?: pulumi.Input<inputs.FunctionGraph.TriggerLts>;
/**
* Specifies the configuration of the OBS trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
obs?: pulumi.Input<inputs.FunctionGraph.TriggerObs>;
/**
* Specifies the region in which to create the trigger resource.
* If omitted, the provider-level region will be used.
* Changing this will create a new trigger resource.
*/
region?: pulumi.Input<string>;
/**
* Specifies the configuration of the SMN trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
smn?: pulumi.Input<inputs.FunctionGraph.TriggerSmn>;
/**
* Specifies whether trigger is enabled. The valid values are **ACTIVE** and **DISABLED**.
* About DMS kafka trigger, the default value is **ACTIVE**.
*/
status?: pulumi.Input<string>;
/**
* Specifies the configuration of the timing trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
timer?: pulumi.Input<inputs.FunctionGraph.TriggerTimer>;
/**
* Specifies the type of the function.
* The valid values currently only support **TIMER**, **OBS**, **SMN**, **DIS**, **KAFKA**, **APIG**, **LTS**, and
* **DEDICATEDGATEWAY**. Changing this will create a new trigger resource.
*/
type?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a Trigger resource.
*/
export interface TriggerArgs {
/**
* Specifies the configuration of the shared APIG and dedicated APIG trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
apig?: pulumi.Input<inputs.FunctionGraph.TriggerApig>;
/**
* Specifies the configuration of the DIS trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
dis?: pulumi.Input<inputs.FunctionGraph.TriggerDis>;
/**
* Specifies the Uniform Resource Name (URN) of the function.
* Changing this will create a new trigger resource.
*/
functionUrn: pulumi.Input<string>;
/**
* Specifies the configuration of the DMS trigger for Kafka.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
kafka?: pulumi.Input<inputs.FunctionGraph.TriggerKafka>;
/**
* Specifies the configuration of the LTS trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
lts?: pulumi.Input<inputs.FunctionGraph.TriggerLts>;
/**
* Specifies the configuration of the OBS trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
obs?: pulumi.Input<inputs.FunctionGraph.TriggerObs>;
/**
* Specifies the region in which to create the trigger resource.
* If omitted, the provider-level region will be used.
* Changing this will create a new trigger resource.
*/
region?: pulumi.Input<string>;
/**
* Specifies the configuration of the SMN trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
smn?: pulumi.Input<inputs.FunctionGraph.TriggerSmn>;
/**
* Specifies whether trigger is enabled. The valid values are **ACTIVE** and **DISABLED**.
* About DMS kafka trigger, the default value is **ACTIVE**.
*/
status?: pulumi.Input<string>;
/**
* Specifies the configuration of the timing trigger.
* Changing this will create a new trigger resource.
* The object structure is documented below.
*/
timer?: pulumi.Input<inputs.FunctionGraph.TriggerTimer>;
/**
* Specifies the type of the function.
* The valid values currently only support **TIMER**, **OBS**, **SMN**, **DIS**, **KAFKA**, **APIG**, **LTS**, and
* **DEDICATEDGATEWAY**. Changing this will create a new trigger resource.
*/
type: pulumi.Input<string>;
}