ibm.FunctionTrigger
Explore with Pulumi AI
Create, update, or delete an IBM Cloud Functions trigger. Events from external and internal event sources are channeled through a trigger, and rules allow your actions to react to these events. To set rules, use the function_rule
resource.
Example Usage
Creating triggers
The following example creates the mytrigger
trigger.
import * as pulumi from "@pulumi/pulumi";
import * as ibm from "@pulumi/ibm";
const trigger = new ibm.FunctionTrigger("trigger", {userDefinedParameters: ` [
{
"key":"place",
"value":"India"
}
]
EOF user_defined_annotations = <<EOF
[
{
"key":"Description",
"value":"Example usage to display hello"
}
]
`});
import pulumi
import pulumi_ibm as ibm
trigger = ibm.FunctionTrigger("trigger", user_defined_parameters=""" [
{
"key":"place",
"value":"India"
}
]
EOF user_defined_annotations = <<EOF
[
{
"key":"Description",
"value":"Example usage to display hello"
}
]
""")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ibm.NewFunctionTrigger(ctx, "trigger", &ibm.FunctionTriggerArgs{
UserDefinedParameters: pulumi.String(` [
{
"key":"place",
"value":"India"
}
]
EOF user_defined_annotations = <<EOF
[
{
"key":"Description",
"value":"Example usage to display hello"
}
]
`),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ibm = Pulumi.Ibm;
return await Deployment.RunAsync(() =>
{
var trigger = new Ibm.FunctionTrigger("trigger", new()
{
UserDefinedParameters = @" [
{
""key"":""place"",
""value"":""India""
}
]
EOF user_defined_annotations = <<EOF
[
{
""key"":""Description"",
""value"":""Example usage to display hello""
}
]
",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ibm.FunctionTrigger;
import com.pulumi.ibm.FunctionTriggerArgs;
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 trigger = new FunctionTrigger("trigger", FunctionTriggerArgs.builder()
.userDefinedParameters("""
[
{
"key":"place",
"value":"India"
}
]
EOF user_defined_annotations = <<EOF
[
{
"key":"Description",
"value":"Example usage to display hello"
}
]
""")
.build());
}
}
resources:
trigger:
type: ibm:FunctionTrigger
properties:
userDefinedParameters: " [\n {\n \"key\":\"place\",\n \"value\":\"India\"\n }\n ]\n EOF user_defined_annotations = <<EOF\n [\n {\n \"key\":\"Description\",\n \"value\":\"Example usage to display hello\"\n }\n ]\n \n"
Creating a trigger feed
The following example creates a feed for the alarmFeed
trigger.
import * as pulumi from "@pulumi/pulumi";
import * as ibm from "@pulumi/ibm";
const feedtrigger = new ibm.FunctionTrigger("feedtrigger", {
feed: {
name: "/whisk.system/alarms/alarm",
parameters: ` [
{
"key":"cron",
"value":"0 */2 * * *"
}
]
`,
},
userDefinedAnnotations: ` [
{
"key":"sample trigger",
"value":"Trigger for hello action"
}
]
`,
});
import pulumi
import pulumi_ibm as ibm
feedtrigger = ibm.FunctionTrigger("feedtrigger",
feed={
"name": "/whisk.system/alarms/alarm",
"parameters": """ [
{
"key":"cron",
"value":"0 */2 * * *"
}
]
""",
},
user_defined_annotations=""" [
{
"key":"sample trigger",
"value":"Trigger for hello action"
}
]
""")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ibm.NewFunctionTrigger(ctx, "feedtrigger", &ibm.FunctionTriggerArgs{
Feed: &ibm.FunctionTriggerFeedArgs{
Name: pulumi.String("/whisk.system/alarms/alarm"),
Parameters: pulumi.String(` [
{
"key":"cron",
"value":"0 */2 * * *"
}
]
`),
},
UserDefinedAnnotations: pulumi.String(` [
{
"key":"sample trigger",
"value":"Trigger for hello action"
}
]
`),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ibm = Pulumi.Ibm;
return await Deployment.RunAsync(() =>
{
var feedtrigger = new Ibm.FunctionTrigger("feedtrigger", new()
{
Feed = new Ibm.Inputs.FunctionTriggerFeedArgs
{
Name = "/whisk.system/alarms/alarm",
Parameters = @" [
{
""key"":""cron"",
""value"":""0 */2 * * *""
}
]
",
},
UserDefinedAnnotations = @" [
{
""key"":""sample trigger"",
""value"":""Trigger for hello action""
}
]
",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ibm.FunctionTrigger;
import com.pulumi.ibm.FunctionTriggerArgs;
import com.pulumi.ibm.inputs.FunctionTriggerFeedArgs;
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 feedtrigger = new FunctionTrigger("feedtrigger", FunctionTriggerArgs.builder()
.feed(FunctionTriggerFeedArgs.builder()
.name("/whisk.system/alarms/alarm")
.parameters("""
[
{
"key":"cron",
"value":"0 */2 * * *"
}
]
""")
.build())
.userDefinedAnnotations("""
[
{
"key":"sample trigger",
"value":"Trigger for hello action"
}
]
""")
.build());
}
}
resources:
feedtrigger:
type: ibm:FunctionTrigger
properties:
feed:
name: /whisk.system/alarms/alarm
parameters: " [\n {\n \"key\":\"cron\",\n \"value\":\"0 */2 * * *\"\n }\n ]\n \n"
userDefinedAnnotations: " [\n {\n \"key\":\"sample trigger\",\n \"value\":\"Trigger for hello action\"\n }\n ]\n \n"
Create FunctionTrigger Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new FunctionTrigger(name: string, args: FunctionTriggerArgs, opts?: CustomResourceOptions);
@overload
def FunctionTrigger(resource_name: str,
args: FunctionTriggerArgs,
opts: Optional[ResourceOptions] = None)
@overload
def FunctionTrigger(resource_name: str,
opts: Optional[ResourceOptions] = None,
namespace: Optional[str] = None,
feed: Optional[FunctionTriggerFeedArgs] = None,
function_trigger_id: Optional[str] = None,
name: Optional[str] = None,
user_defined_annotations: Optional[str] = None,
user_defined_parameters: Optional[str] = None)
func NewFunctionTrigger(ctx *Context, name string, args FunctionTriggerArgs, opts ...ResourceOption) (*FunctionTrigger, error)
public FunctionTrigger(string name, FunctionTriggerArgs args, CustomResourceOptions? opts = null)
public FunctionTrigger(String name, FunctionTriggerArgs args)
public FunctionTrigger(String name, FunctionTriggerArgs args, CustomResourceOptions options)
type: ibm:FunctionTrigger
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 FunctionTriggerArgs
- 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 FunctionTriggerArgs
- 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 FunctionTriggerArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FunctionTriggerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args FunctionTriggerArgs
- 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 functionTriggerResource = new Ibm.FunctionTrigger("functionTriggerResource", new()
{
Namespace = "string",
Feed = new Ibm.Inputs.FunctionTriggerFeedArgs
{
Name = "string",
Parameters = "string",
},
FunctionTriggerId = "string",
Name = "string",
UserDefinedAnnotations = "string",
UserDefinedParameters = "string",
});
example, err := ibm.NewFunctionTrigger(ctx, "functionTriggerResource", &ibm.FunctionTriggerArgs{
Namespace: pulumi.String("string"),
Feed: &ibm.FunctionTriggerFeedArgs{
Name: pulumi.String("string"),
Parameters: pulumi.String("string"),
},
FunctionTriggerId: pulumi.String("string"),
Name: pulumi.String("string"),
UserDefinedAnnotations: pulumi.String("string"),
UserDefinedParameters: pulumi.String("string"),
})
var functionTriggerResource = new FunctionTrigger("functionTriggerResource", FunctionTriggerArgs.builder()
.namespace("string")
.feed(FunctionTriggerFeedArgs.builder()
.name("string")
.parameters("string")
.build())
.functionTriggerId("string")
.name("string")
.userDefinedAnnotations("string")
.userDefinedParameters("string")
.build());
function_trigger_resource = ibm.FunctionTrigger("functionTriggerResource",
namespace="string",
feed={
"name": "string",
"parameters": "string",
},
function_trigger_id="string",
name="string",
user_defined_annotations="string",
user_defined_parameters="string")
const functionTriggerResource = new ibm.FunctionTrigger("functionTriggerResource", {
namespace: "string",
feed: {
name: "string",
parameters: "string",
},
functionTriggerId: "string",
name: "string",
userDefinedAnnotations: "string",
userDefinedParameters: "string",
});
type: ibm:FunctionTrigger
properties:
feed:
name: string
parameters: string
functionTriggerId: string
name: string
namespace: string
userDefinedAnnotations: string
userDefinedParameters: string
FunctionTrigger 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 FunctionTrigger resource accepts the following input properties:
- Namespace string
- The name of the function namespace.
- Feed
Function
Trigger Feed A nested block to describe the feed.
Nested scheme for
feed
:- Function
Trigger stringId - (String) The ID of the new trigger.
- Name string
- The name of the trigger.
- User
Defined stringAnnotations - Annotation definitions in key value format.
- User
Defined stringParameters - Parameters definitions in key value format. Parameter bindings are included in the context and passed to the trigger.
- Namespace string
- The name of the function namespace.
- Feed
Function
Trigger Feed Args A nested block to describe the feed.
Nested scheme for
feed
:- Function
Trigger stringId - (String) The ID of the new trigger.
- Name string
- The name of the trigger.
- User
Defined stringAnnotations - Annotation definitions in key value format.
- User
Defined stringParameters - Parameters definitions in key value format. Parameter bindings are included in the context and passed to the trigger.
- namespace String
- The name of the function namespace.
- feed
Function
Trigger Feed A nested block to describe the feed.
Nested scheme for
feed
:- function
Trigger StringId - (String) The ID of the new trigger.
- name String
- The name of the trigger.
- user
Defined StringAnnotations - Annotation definitions in key value format.
- user
Defined StringParameters - Parameters definitions in key value format. Parameter bindings are included in the context and passed to the trigger.
- namespace string
- The name of the function namespace.
- feed
Function
Trigger Feed A nested block to describe the feed.
Nested scheme for
feed
:- function
Trigger stringId - (String) The ID of the new trigger.
- name string
- The name of the trigger.
- user
Defined stringAnnotations - Annotation definitions in key value format.
- user
Defined stringParameters - Parameters definitions in key value format. Parameter bindings are included in the context and passed to the trigger.
- namespace str
- The name of the function namespace.
- feed
Function
Trigger Feed Args A nested block to describe the feed.
Nested scheme for
feed
:- function_
trigger_ strid - (String) The ID of the new trigger.
- name str
- The name of the trigger.
- user_
defined_ strannotations - Annotation definitions in key value format.
- user_
defined_ strparameters - Parameters definitions in key value format. Parameter bindings are included in the context and passed to the trigger.
- namespace String
- The name of the function namespace.
- feed Property Map
A nested block to describe the feed.
Nested scheme for
feed
:- function
Trigger StringId - (String) The ID of the new trigger.
- name String
- The name of the trigger.
- user
Defined StringAnnotations - Annotation definitions in key value format.
- user
Defined StringParameters - Parameters definitions in key value format. Parameter bindings are included in the context and passed to the trigger.
Outputs
All input properties are implicitly available as output properties. Additionally, the FunctionTrigger resource produces the following output properties:
- Annotations string
- (String) All annotations to describe the trigger, including those set by you or by IBM Cloud Functions.
- Id string
- The provider-assigned unique ID for this managed resource.
- Parameters string
- (String) All parameters passed to the trigger, including those set by you or by IBM Cloud Functions.
- Publish bool
- (Bool) Trigger visibility.
- Trigger
Id string - (String) The trigger ID.
- Version string
- (String) Semantic version of the item.
- Annotations string
- (String) All annotations to describe the trigger, including those set by you or by IBM Cloud Functions.
- Id string
- The provider-assigned unique ID for this managed resource.
- Parameters string
- (String) All parameters passed to the trigger, including those set by you or by IBM Cloud Functions.
- Publish bool
- (Bool) Trigger visibility.
- Trigger
Id string - (String) The trigger ID.
- Version string
- (String) Semantic version of the item.
- annotations String
- (String) All annotations to describe the trigger, including those set by you or by IBM Cloud Functions.
- id String
- The provider-assigned unique ID for this managed resource.
- parameters String
- (String) All parameters passed to the trigger, including those set by you or by IBM Cloud Functions.
- publish Boolean
- (Bool) Trigger visibility.
- trigger
Id String - (String) The trigger ID.
- version String
- (String) Semantic version of the item.
- annotations string
- (String) All annotations to describe the trigger, including those set by you or by IBM Cloud Functions.
- id string
- The provider-assigned unique ID for this managed resource.
- parameters string
- (String) All parameters passed to the trigger, including those set by you or by IBM Cloud Functions.
- publish boolean
- (Bool) Trigger visibility.
- trigger
Id string - (String) The trigger ID.
- version string
- (String) Semantic version of the item.
- annotations str
- (String) All annotations to describe the trigger, including those set by you or by IBM Cloud Functions.
- id str
- The provider-assigned unique ID for this managed resource.
- parameters str
- (String) All parameters passed to the trigger, including those set by you or by IBM Cloud Functions.
- publish bool
- (Bool) Trigger visibility.
- trigger_
id str - (String) The trigger ID.
- version str
- (String) Semantic version of the item.
- annotations String
- (String) All annotations to describe the trigger, including those set by you or by IBM Cloud Functions.
- id String
- The provider-assigned unique ID for this managed resource.
- parameters String
- (String) All parameters passed to the trigger, including those set by you or by IBM Cloud Functions.
- publish Boolean
- (Bool) Trigger visibility.
- trigger
Id String - (String) The trigger ID.
- version String
- (String) Semantic version of the item.
Look up Existing FunctionTrigger Resource
Get an existing FunctionTrigger 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?: FunctionTriggerState, opts?: CustomResourceOptions): FunctionTrigger
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
annotations: Optional[str] = None,
feed: Optional[FunctionTriggerFeedArgs] = None,
function_trigger_id: Optional[str] = None,
name: Optional[str] = None,
namespace: Optional[str] = None,
parameters: Optional[str] = None,
publish: Optional[bool] = None,
trigger_id: Optional[str] = None,
user_defined_annotations: Optional[str] = None,
user_defined_parameters: Optional[str] = None,
version: Optional[str] = None) -> FunctionTrigger
func GetFunctionTrigger(ctx *Context, name string, id IDInput, state *FunctionTriggerState, opts ...ResourceOption) (*FunctionTrigger, error)
public static FunctionTrigger Get(string name, Input<string> id, FunctionTriggerState? state, CustomResourceOptions? opts = null)
public static FunctionTrigger get(String name, Output<String> id, FunctionTriggerState state, CustomResourceOptions options)
resources: _: type: ibm:FunctionTrigger 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.
- Annotations string
- (String) All annotations to describe the trigger, including those set by you or by IBM Cloud Functions.
- Feed
Function
Trigger Feed A nested block to describe the feed.
Nested scheme for
feed
:- Function
Trigger stringId - (String) The ID of the new trigger.
- Name string
- The name of the trigger.
- Namespace string
- The name of the function namespace.
- Parameters string
- (String) All parameters passed to the trigger, including those set by you or by IBM Cloud Functions.
- Publish bool
- (Bool) Trigger visibility.
- Trigger
Id string - (String) The trigger ID.
- User
Defined stringAnnotations - Annotation definitions in key value format.
- User
Defined stringParameters - Parameters definitions in key value format. Parameter bindings are included in the context and passed to the trigger.
- Version string
- (String) Semantic version of the item.
- Annotations string
- (String) All annotations to describe the trigger, including those set by you or by IBM Cloud Functions.
- Feed
Function
Trigger Feed Args A nested block to describe the feed.
Nested scheme for
feed
:- Function
Trigger stringId - (String) The ID of the new trigger.
- Name string
- The name of the trigger.
- Namespace string
- The name of the function namespace.
- Parameters string
- (String) All parameters passed to the trigger, including those set by you or by IBM Cloud Functions.
- Publish bool
- (Bool) Trigger visibility.
- Trigger
Id string - (String) The trigger ID.
- User
Defined stringAnnotations - Annotation definitions in key value format.
- User
Defined stringParameters - Parameters definitions in key value format. Parameter bindings are included in the context and passed to the trigger.
- Version string
- (String) Semantic version of the item.
- annotations String
- (String) All annotations to describe the trigger, including those set by you or by IBM Cloud Functions.
- feed
Function
Trigger Feed A nested block to describe the feed.
Nested scheme for
feed
:- function
Trigger StringId - (String) The ID of the new trigger.
- name String
- The name of the trigger.
- namespace String
- The name of the function namespace.
- parameters String
- (String) All parameters passed to the trigger, including those set by you or by IBM Cloud Functions.
- publish Boolean
- (Bool) Trigger visibility.
- trigger
Id String - (String) The trigger ID.
- user
Defined StringAnnotations - Annotation definitions in key value format.
- user
Defined StringParameters - Parameters definitions in key value format. Parameter bindings are included in the context and passed to the trigger.
- version String
- (String) Semantic version of the item.
- annotations string
- (String) All annotations to describe the trigger, including those set by you or by IBM Cloud Functions.
- feed
Function
Trigger Feed A nested block to describe the feed.
Nested scheme for
feed
:- function
Trigger stringId - (String) The ID of the new trigger.
- name string
- The name of the trigger.
- namespace string
- The name of the function namespace.
- parameters string
- (String) All parameters passed to the trigger, including those set by you or by IBM Cloud Functions.
- publish boolean
- (Bool) Trigger visibility.
- trigger
Id string - (String) The trigger ID.
- user
Defined stringAnnotations - Annotation definitions in key value format.
- user
Defined stringParameters - Parameters definitions in key value format. Parameter bindings are included in the context and passed to the trigger.
- version string
- (String) Semantic version of the item.
- annotations str
- (String) All annotations to describe the trigger, including those set by you or by IBM Cloud Functions.
- feed
Function
Trigger Feed Args A nested block to describe the feed.
Nested scheme for
feed
:- function_
trigger_ strid - (String) The ID of the new trigger.
- name str
- The name of the trigger.
- namespace str
- The name of the function namespace.
- parameters str
- (String) All parameters passed to the trigger, including those set by you or by IBM Cloud Functions.
- publish bool
- (Bool) Trigger visibility.
- trigger_
id str - (String) The trigger ID.
- user_
defined_ strannotations - Annotation definitions in key value format.
- user_
defined_ strparameters - Parameters definitions in key value format. Parameter bindings are included in the context and passed to the trigger.
- version str
- (String) Semantic version of the item.
- annotations String
- (String) All annotations to describe the trigger, including those set by you or by IBM Cloud Functions.
- feed Property Map
A nested block to describe the feed.
Nested scheme for
feed
:- function
Trigger StringId - (String) The ID of the new trigger.
- name String
- The name of the trigger.
- namespace String
- The name of the function namespace.
- parameters String
- (String) All parameters passed to the trigger, including those set by you or by IBM Cloud Functions.
- publish Boolean
- (Bool) Trigger visibility.
- trigger
Id String - (String) The trigger ID.
- user
Defined StringAnnotations - Annotation definitions in key value format.
- user
Defined StringParameters - Parameters definitions in key value format. Parameter bindings are included in the context and passed to the trigger.
- version String
- (String) Semantic version of the item.
Supporting Types
FunctionTriggerFeed, FunctionTriggerFeedArgs
- Name string
- Trigger feed
ACTION_NAME
. - Parameters string
- Parameters definitions in key value format. Parameter bindings are included in the context and passed when the action is invoked.
- Name string
- Trigger feed
ACTION_NAME
. - Parameters string
- Parameters definitions in key value format. Parameter bindings are included in the context and passed when the action is invoked.
- name String
- Trigger feed
ACTION_NAME
. - parameters String
- Parameters definitions in key value format. Parameter bindings are included in the context and passed when the action is invoked.
- name string
- Trigger feed
ACTION_NAME
. - parameters string
- Parameters definitions in key value format. Parameter bindings are included in the context and passed when the action is invoked.
- name str
- Trigger feed
ACTION_NAME
. - parameters str
- Parameters definitions in key value format. Parameter bindings are included in the context and passed when the action is invoked.
- name String
- Trigger feed
ACTION_NAME
. - parameters String
- Parameters definitions in key value format. Parameter bindings are included in the context and passed when the action is invoked.
Import
The ibm_function_trigger
resource can be imported by using the namespace
and trigger ID
.
Syntax
$ pulumi import ibm:index/functionTrigger:FunctionTrigger trigger <namespace>:<trigger_id>
Example
$ pulumi import ibm:index/functionTrigger:FunctionTrigger trigger Namespace01:alarmtrigger
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- ibm ibm-cloud/terraform-provider-ibm
- License
- Notes
- This Pulumi package is based on the
ibm
Terraform Provider.