ibm.FunctionPackage
Explore with Pulumi AI
Create, update, or delete an IBM Cloud functions package. You can use the packages to bundle together a set of related actions, and share with other resources. To create actions, use the function_action
resource.
Example Usage
The sample example provides the usage of package and to bind the package by using ibm.FunctionPackage
resource.
Create a package
The following example creates the mypackage
package.
import * as pulumi from "@pulumi/pulumi";
import * as ibm from "@pulumi/ibm";
const _package = new ibm.FunctionPackage("package", {userDefinedAnnotations: ` [
{
"key":"description",
"value":"Count words in a string"
},
{
"key":"sampleOutput",
"value": {
"count": 3
}
},
{
"key":"final",
"value": [
{
"description": "A string",
"name": "payload",
"required": true
}
]
}
]
`});
import pulumi
import pulumi_ibm as ibm
package = ibm.FunctionPackage("package", user_defined_annotations=""" [
{
"key":"description",
"value":"Count words in a string"
},
{
"key":"sampleOutput",
"value": {
"count": 3
}
},
{
"key":"final",
"value": [
{
"description": "A string",
"name": "payload",
"required": true
}
]
}
]
""")
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.NewFunctionPackage(ctx, "package", &ibm.FunctionPackageArgs{
UserDefinedAnnotations: pulumi.String(` [
{
"key":"description",
"value":"Count words in a string"
},
{
"key":"sampleOutput",
"value": {
"count": 3
}
},
{
"key":"final",
"value": [
{
"description": "A string",
"name": "payload",
"required": true
}
]
}
]
`),
})
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 package = new Ibm.FunctionPackage("package", new()
{
UserDefinedAnnotations = @" [
{
""key"":""description"",
""value"":""Count words in a string""
},
{
""key"":""sampleOutput"",
""value"": {
""count"": 3
}
},
{
""key"":""final"",
""value"": [
{
""description"": ""A string"",
""name"": ""payload"",
""required"": true
}
]
}
]
",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ibm.FunctionPackage;
import com.pulumi.ibm.FunctionPackageArgs;
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 package_ = new FunctionPackage("package", FunctionPackageArgs.builder()
.userDefinedAnnotations("""
[
{
"key":"description",
"value":"Count words in a string"
},
{
"key":"sampleOutput",
"value": {
"count": 3
}
},
{
"key":"final",
"value": [
{
"description": "A string",
"name": "payload",
"required": true
}
]
}
]
""")
.build());
}
}
resources:
package:
type: ibm:FunctionPackage
properties:
userDefinedAnnotations: |2+
[
{
"key":"description",
"value":"Count words in a string"
},
{
"key":"sampleOutput",
"value": {
"count": 3
}
},
{
"key":"final",
"value": [
{
"description": "A string",
"name": "payload",
"required": true
}
]
}
]
Create a package by using a binding
import * as pulumi from "@pulumi/pulumi";
import * as ibm from "@pulumi/ibm";
const bindpackage = new ibm.FunctionPackage("bindpackage", {
bindPackageName: "/whisk.system/alarms/alarm",
userDefinedParameters: ` [
{
"key":"cron",
"value":"0 0 1 0 *"
},
{
"key":"trigger_payload ",
"value":"{'message':'bye old Year!'}"
},
{
"key":"maxTriggers",
"value":1
},
{
"key":"userdefined",
"value":"test"
}
]
`,
});
import pulumi
import pulumi_ibm as ibm
bindpackage = ibm.FunctionPackage("bindpackage",
bind_package_name="/whisk.system/alarms/alarm",
user_defined_parameters=""" [
{
"key":"cron",
"value":"0 0 1 0 *"
},
{
"key":"trigger_payload ",
"value":"{'message':'bye old Year!'}"
},
{
"key":"maxTriggers",
"value":1
},
{
"key":"userdefined",
"value":"test"
}
]
""")
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.NewFunctionPackage(ctx, "bindpackage", &ibm.FunctionPackageArgs{
BindPackageName: pulumi.String("/whisk.system/alarms/alarm"),
UserDefinedParameters: pulumi.String(` [
{
"key":"cron",
"value":"0 0 1 0 *"
},
{
"key":"trigger_payload ",
"value":"{'message':'bye old Year!'}"
},
{
"key":"maxTriggers",
"value":1
},
{
"key":"userdefined",
"value":"test"
}
]
`),
})
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 bindpackage = new Ibm.FunctionPackage("bindpackage", new()
{
BindPackageName = "/whisk.system/alarms/alarm",
UserDefinedParameters = @" [
{
""key"":""cron"",
""value"":""0 0 1 0 *""
},
{
""key"":""trigger_payload "",
""value"":""{'message':'bye old Year!'}""
},
{
""key"":""maxTriggers"",
""value"":1
},
{
""key"":""userdefined"",
""value"":""test""
}
]
",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ibm.FunctionPackage;
import com.pulumi.ibm.FunctionPackageArgs;
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 bindpackage = new FunctionPackage("bindpackage", FunctionPackageArgs.builder()
.bindPackageName("/whisk.system/alarms/alarm")
.userDefinedParameters("""
[
{
"key":"cron",
"value":"0 0 1 0 *"
},
{
"key":"trigger_payload ",
"value":"{'message':'bye old Year!'}"
},
{
"key":"maxTriggers",
"value":1
},
{
"key":"userdefined",
"value":"test"
}
]
""")
.build());
}
}
resources:
bindpackage:
type: ibm:FunctionPackage
properties:
bindPackageName: /whisk.system/alarms/alarm
userDefinedParameters: |2+
[
{
"key":"cron",
"value":"0 0 1 0 *"
},
{
"key":"trigger_payload ",
"value":"{'message':'bye old Year!'}"
},
{
"key":"maxTriggers",
"value":1
},
{
"key":"userdefined",
"value":"test"
}
]
Create FunctionPackage Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new FunctionPackage(name: string, args: FunctionPackageArgs, opts?: CustomResourceOptions);
@overload
def FunctionPackage(resource_name: str,
args: FunctionPackageArgs,
opts: Optional[ResourceOptions] = None)
@overload
def FunctionPackage(resource_name: str,
opts: Optional[ResourceOptions] = None,
namespace: Optional[str] = None,
bind_package_name: Optional[str] = None,
function_package_id: Optional[str] = None,
name: Optional[str] = None,
publish: Optional[bool] = None,
user_defined_annotations: Optional[str] = None,
user_defined_parameters: Optional[str] = None)
func NewFunctionPackage(ctx *Context, name string, args FunctionPackageArgs, opts ...ResourceOption) (*FunctionPackage, error)
public FunctionPackage(string name, FunctionPackageArgs args, CustomResourceOptions? opts = null)
public FunctionPackage(String name, FunctionPackageArgs args)
public FunctionPackage(String name, FunctionPackageArgs args, CustomResourceOptions options)
type: ibm:FunctionPackage
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 FunctionPackageArgs
- 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 FunctionPackageArgs
- 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 FunctionPackageArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FunctionPackageArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args FunctionPackageArgs
- 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 functionPackageResource = new Ibm.FunctionPackage("functionPackageResource", new()
{
Namespace = "string",
BindPackageName = "string",
FunctionPackageId = "string",
Name = "string",
Publish = false,
UserDefinedAnnotations = "string",
UserDefinedParameters = "string",
});
example, err := ibm.NewFunctionPackage(ctx, "functionPackageResource", &ibm.FunctionPackageArgs{
Namespace: pulumi.String("string"),
BindPackageName: pulumi.String("string"),
FunctionPackageId: pulumi.String("string"),
Name: pulumi.String("string"),
Publish: pulumi.Bool(false),
UserDefinedAnnotations: pulumi.String("string"),
UserDefinedParameters: pulumi.String("string"),
})
var functionPackageResource = new FunctionPackage("functionPackageResource", FunctionPackageArgs.builder()
.namespace("string")
.bindPackageName("string")
.functionPackageId("string")
.name("string")
.publish(false)
.userDefinedAnnotations("string")
.userDefinedParameters("string")
.build());
function_package_resource = ibm.FunctionPackage("functionPackageResource",
namespace="string",
bind_package_name="string",
function_package_id="string",
name="string",
publish=False,
user_defined_annotations="string",
user_defined_parameters="string")
const functionPackageResource = new ibm.FunctionPackage("functionPackageResource", {
namespace: "string",
bindPackageName: "string",
functionPackageId: "string",
name: "string",
publish: false,
userDefinedAnnotations: "string",
userDefinedParameters: "string",
});
type: ibm:FunctionPackage
properties:
bindPackageName: string
functionPackageId: string
name: string
namespace: string
publish: false
userDefinedAnnotations: string
userDefinedParameters: string
FunctionPackage 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 FunctionPackage resource accepts the following input properties:
- Namespace string
- The name of the function namespace.
- Bind
Package stringName - Name of package to be bound.
- Function
Package stringId - (String) The ID of the new package. The ID is a combination of namespace and package ID delimited by
:
. - Name string
- The name of the package.
- Publish bool
- Package visibility.
- User
Defined stringAnnotations - Annotations defined in key value format.
- User
Defined stringParameters - Parameters defined in key value format. Parameter bindings included in the context passed to the package.
- Namespace string
- The name of the function namespace.
- Bind
Package stringName - Name of package to be bound.
- Function
Package stringId - (String) The ID of the new package. The ID is a combination of namespace and package ID delimited by
:
. - Name string
- The name of the package.
- Publish bool
- Package visibility.
- User
Defined stringAnnotations - Annotations defined in key value format.
- User
Defined stringParameters - Parameters defined in key value format. Parameter bindings included in the context passed to the package.
- namespace String
- The name of the function namespace.
- bind
Package StringName - Name of package to be bound.
- function
Package StringId - (String) The ID of the new package. The ID is a combination of namespace and package ID delimited by
:
. - name String
- The name of the package.
- publish Boolean
- Package visibility.
- user
Defined StringAnnotations - Annotations defined in key value format.
- user
Defined StringParameters - Parameters defined in key value format. Parameter bindings included in the context passed to the package.
- namespace string
- The name of the function namespace.
- bind
Package stringName - Name of package to be bound.
- function
Package stringId - (String) The ID of the new package. The ID is a combination of namespace and package ID delimited by
:
. - name string
- The name of the package.
- publish boolean
- Package visibility.
- user
Defined stringAnnotations - Annotations defined in key value format.
- user
Defined stringParameters - Parameters defined in key value format. Parameter bindings included in the context passed to the package.
- namespace str
- The name of the function namespace.
- bind_
package_ strname - Name of package to be bound.
- function_
package_ strid - (String) The ID of the new package. The ID is a combination of namespace and package ID delimited by
:
. - name str
- The name of the package.
- publish bool
- Package visibility.
- user_
defined_ strannotations - Annotations defined in key value format.
- user_
defined_ strparameters - Parameters defined in key value format. Parameter bindings included in the context passed to the package.
- namespace String
- The name of the function namespace.
- bind
Package StringName - Name of package to be bound.
- function
Package StringId - (String) The ID of the new package. The ID is a combination of namespace and package ID delimited by
:
. - name String
- The name of the package.
- publish Boolean
- Package visibility.
- user
Defined StringAnnotations - Annotations defined in key value format.
- user
Defined StringParameters - Parameters defined in key value format. Parameter bindings included in the context passed to the package.
Outputs
All input properties are implicitly available as output properties. Additionally, the FunctionPackage resource produces the following output properties:
- Annotations string
- (String) All annotations to describe the package, including those you set or by IBM Cloud Functions.
- Id string
- The provider-assigned unique ID for this managed resource.
- Package
Id string - (String) The package ID.
- Parameters string
- (String) All parameters passed to the package, including those you set or by IBM Cloud Functions.
- Version string
- (String) Semantic version of the item.
- Annotations string
- (String) All annotations to describe the package, including those you set or by IBM Cloud Functions.
- Id string
- The provider-assigned unique ID for this managed resource.
- Package
Id string - (String) The package ID.
- Parameters string
- (String) All parameters passed to the package, including those you set or by IBM Cloud Functions.
- Version string
- (String) Semantic version of the item.
- annotations String
- (String) All annotations to describe the package, including those you set or by IBM Cloud Functions.
- id String
- The provider-assigned unique ID for this managed resource.
- package
Id String - (String) The package ID.
- parameters String
- (String) All parameters passed to the package, including those you set or by IBM Cloud Functions.
- version String
- (String) Semantic version of the item.
- annotations string
- (String) All annotations to describe the package, including those you set or by IBM Cloud Functions.
- id string
- The provider-assigned unique ID for this managed resource.
- package
Id string - (String) The package ID.
- parameters string
- (String) All parameters passed to the package, including those you set or by IBM Cloud Functions.
- version string
- (String) Semantic version of the item.
- annotations str
- (String) All annotations to describe the package, including those you set or by IBM Cloud Functions.
- id str
- The provider-assigned unique ID for this managed resource.
- package_
id str - (String) The package ID.
- parameters str
- (String) All parameters passed to the package, including those you set or by IBM Cloud Functions.
- version str
- (String) Semantic version of the item.
- annotations String
- (String) All annotations to describe the package, including those you set or by IBM Cloud Functions.
- id String
- The provider-assigned unique ID for this managed resource.
- package
Id String - (String) The package ID.
- parameters String
- (String) All parameters passed to the package, including those you set or by IBM Cloud Functions.
- version String
- (String) Semantic version of the item.
Look up Existing FunctionPackage Resource
Get an existing FunctionPackage 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?: FunctionPackageState, opts?: CustomResourceOptions): FunctionPackage
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
annotations: Optional[str] = None,
bind_package_name: Optional[str] = None,
function_package_id: Optional[str] = None,
name: Optional[str] = None,
namespace: Optional[str] = None,
package_id: Optional[str] = None,
parameters: Optional[str] = None,
publish: Optional[bool] = None,
user_defined_annotations: Optional[str] = None,
user_defined_parameters: Optional[str] = None,
version: Optional[str] = None) -> FunctionPackage
func GetFunctionPackage(ctx *Context, name string, id IDInput, state *FunctionPackageState, opts ...ResourceOption) (*FunctionPackage, error)
public static FunctionPackage Get(string name, Input<string> id, FunctionPackageState? state, CustomResourceOptions? opts = null)
public static FunctionPackage get(String name, Output<String> id, FunctionPackageState state, CustomResourceOptions options)
resources: _: type: ibm:FunctionPackage 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 package, including those you set or by IBM Cloud Functions.
- Bind
Package stringName - Name of package to be bound.
- Function
Package stringId - (String) The ID of the new package. The ID is a combination of namespace and package ID delimited by
:
. - Name string
- The name of the package.
- Namespace string
- The name of the function namespace.
- Package
Id string - (String) The package ID.
- Parameters string
- (String) All parameters passed to the package, including those you set or by IBM Cloud Functions.
- Publish bool
- Package visibility.
- User
Defined stringAnnotations - Annotations defined in key value format.
- User
Defined stringParameters - Parameters defined in key value format. Parameter bindings included in the context passed to the package.
- Version string
- (String) Semantic version of the item.
- Annotations string
- (String) All annotations to describe the package, including those you set or by IBM Cloud Functions.
- Bind
Package stringName - Name of package to be bound.
- Function
Package stringId - (String) The ID of the new package. The ID is a combination of namespace and package ID delimited by
:
. - Name string
- The name of the package.
- Namespace string
- The name of the function namespace.
- Package
Id string - (String) The package ID.
- Parameters string
- (String) All parameters passed to the package, including those you set or by IBM Cloud Functions.
- Publish bool
- Package visibility.
- User
Defined stringAnnotations - Annotations defined in key value format.
- User
Defined stringParameters - Parameters defined in key value format. Parameter bindings included in the context passed to the package.
- Version string
- (String) Semantic version of the item.
- annotations String
- (String) All annotations to describe the package, including those you set or by IBM Cloud Functions.
- bind
Package StringName - Name of package to be bound.
- function
Package StringId - (String) The ID of the new package. The ID is a combination of namespace and package ID delimited by
:
. - name String
- The name of the package.
- namespace String
- The name of the function namespace.
- package
Id String - (String) The package ID.
- parameters String
- (String) All parameters passed to the package, including those you set or by IBM Cloud Functions.
- publish Boolean
- Package visibility.
- user
Defined StringAnnotations - Annotations defined in key value format.
- user
Defined StringParameters - Parameters defined in key value format. Parameter bindings included in the context passed to the package.
- version String
- (String) Semantic version of the item.
- annotations string
- (String) All annotations to describe the package, including those you set or by IBM Cloud Functions.
- bind
Package stringName - Name of package to be bound.
- function
Package stringId - (String) The ID of the new package. The ID is a combination of namespace and package ID delimited by
:
. - name string
- The name of the package.
- namespace string
- The name of the function namespace.
- package
Id string - (String) The package ID.
- parameters string
- (String) All parameters passed to the package, including those you set or by IBM Cloud Functions.
- publish boolean
- Package visibility.
- user
Defined stringAnnotations - Annotations defined in key value format.
- user
Defined stringParameters - Parameters defined in key value format. Parameter bindings included in the context passed to the package.
- version string
- (String) Semantic version of the item.
- annotations str
- (String) All annotations to describe the package, including those you set or by IBM Cloud Functions.
- bind_
package_ strname - Name of package to be bound.
- function_
package_ strid - (String) The ID of the new package. The ID is a combination of namespace and package ID delimited by
:
. - name str
- The name of the package.
- namespace str
- The name of the function namespace.
- package_
id str - (String) The package ID.
- parameters str
- (String) All parameters passed to the package, including those you set or by IBM Cloud Functions.
- publish bool
- Package visibility.
- user_
defined_ strannotations - Annotations defined in key value format.
- user_
defined_ strparameters - Parameters defined in key value format. Parameter bindings included in the context passed to the package.
- version str
- (String) Semantic version of the item.
- annotations String
- (String) All annotations to describe the package, including those you set or by IBM Cloud Functions.
- bind
Package StringName - Name of package to be bound.
- function
Package StringId - (String) The ID of the new package. The ID is a combination of namespace and package ID delimited by
:
. - name String
- The name of the package.
- namespace String
- The name of the function namespace.
- package
Id String - (String) The package ID.
- parameters String
- (String) All parameters passed to the package, including those you set or by IBM Cloud Functions.
- publish Boolean
- Package visibility.
- user
Defined StringAnnotations - Annotations defined in key value format.
- user
Defined StringParameters - Parameters defined in key value format. Parameter bindings included in the context passed to the package.
- version String
- (String) Semantic version of the item.
Import
The ibm_function_package
resource can be imported by using the namespace and packageID.
Syntax
$ pulumi import ibm:index/functionPackage:FunctionPackage sample <namespace>:<package_id>
Example
$ pulumi import ibm:index/functionPackage:FunctionPackage sample Namespace-01:util
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.