scaleway.FunctionCron
Explore with Pulumi AI
The scaleway.FunctionCron
resource allows you to create and manage CRON triggers for Scaleway Serverless Functions.
Refer to the Functions CRON triggers documentation and API documentation for more information.
Example Usage
The following command allows you to add a CRON trigger to a Serverless Function.
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";
const main = new scaleway.FunctionNamespace("main", {name: "test-cron"});
const mainFunction = new scaleway.Function("main", {
name: "test-cron",
namespaceId: main.id,
runtime: "node14",
privacy: "private",
handler: "handler.handle",
});
const mainFunctionCron = new scaleway.FunctionCron("main", {
name: "test-cron",
functionId: mainFunction.id,
schedule: "0 0 * * *",
args: JSON.stringify({
test: "scw",
}),
});
const func = new scaleway.FunctionCron("func", {
functionId: mainFunction.id,
schedule: "0 1 * * *",
args: JSON.stringify({
my_var: "terraform",
}),
});
import pulumi
import json
import pulumiverse_scaleway as scaleway
main = scaleway.FunctionNamespace("main", name="test-cron")
main_function = scaleway.Function("main",
name="test-cron",
namespace_id=main.id,
runtime="node14",
privacy="private",
handler="handler.handle")
main_function_cron = scaleway.FunctionCron("main",
name="test-cron",
function_id=main_function.id,
schedule="0 0 * * *",
args=json.dumps({
"test": "scw",
}))
func = scaleway.FunctionCron("func",
function_id=main_function.id,
schedule="0 1 * * *",
args=json.dumps({
"my_var": "terraform",
}))
package main
import (
"encoding/json"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
main, err := scaleway.NewFunctionNamespace(ctx, "main", &scaleway.FunctionNamespaceArgs{
Name: pulumi.String("test-cron"),
})
if err != nil {
return err
}
mainFunction, err := scaleway.NewFunction(ctx, "main", &scaleway.FunctionArgs{
Name: pulumi.String("test-cron"),
NamespaceId: main.ID(),
Runtime: pulumi.String("node14"),
Privacy: pulumi.String("private"),
Handler: pulumi.String("handler.handle"),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"test": "scw",
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = scaleway.NewFunctionCron(ctx, "main", &scaleway.FunctionCronArgs{
Name: pulumi.String("test-cron"),
FunctionId: mainFunction.ID(),
Schedule: pulumi.String("0 0 * * *"),
Args: pulumi.String(json0),
})
if err != nil {
return err
}
tmpJSON1, err := json.Marshal(map[string]interface{}{
"my_var": "terraform",
})
if err != nil {
return err
}
json1 := string(tmpJSON1)
_, err = scaleway.NewFunctionCron(ctx, "func", &scaleway.FunctionCronArgs{
FunctionId: mainFunction.ID(),
Schedule: pulumi.String("0 1 * * *"),
Args: pulumi.String(json1),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Scaleway = Pulumiverse.Scaleway;
return await Deployment.RunAsync(() =>
{
var main = new Scaleway.FunctionNamespace("main", new()
{
Name = "test-cron",
});
var mainFunction = new Scaleway.Function("main", new()
{
Name = "test-cron",
NamespaceId = main.Id,
Runtime = "node14",
Privacy = "private",
Handler = "handler.handle",
});
var mainFunctionCron = new Scaleway.FunctionCron("main", new()
{
Name = "test-cron",
FunctionId = mainFunction.Id,
Schedule = "0 0 * * *",
Args = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["test"] = "scw",
}),
});
var func = new Scaleway.FunctionCron("func", new()
{
FunctionId = mainFunction.Id,
Schedule = "0 1 * * *",
Args = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["my_var"] = "terraform",
}),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.FunctionNamespace;
import com.pulumi.scaleway.FunctionNamespaceArgs;
import com.pulumi.scaleway.Function;
import com.pulumi.scaleway.FunctionArgs;
import com.pulumi.scaleway.FunctionCron;
import com.pulumi.scaleway.FunctionCronArgs;
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 main = new FunctionNamespace("main", FunctionNamespaceArgs.builder()
.name("test-cron")
.build());
var mainFunction = new Function("mainFunction", FunctionArgs.builder()
.name("test-cron")
.namespaceId(main.id())
.runtime("node14")
.privacy("private")
.handler("handler.handle")
.build());
var mainFunctionCron = new FunctionCron("mainFunctionCron", FunctionCronArgs.builder()
.name("test-cron")
.functionId(mainFunction.id())
.schedule("0 0 * * *")
.args(serializeJson(
jsonObject(
jsonProperty("test", "scw")
)))
.build());
var func = new FunctionCron("func", FunctionCronArgs.builder()
.functionId(mainFunction.id())
.schedule("0 1 * * *")
.args(serializeJson(
jsonObject(
jsonProperty("my_var", "terraform")
)))
.build());
}
}
resources:
main:
type: scaleway:FunctionNamespace
properties:
name: test-cron
mainFunction:
type: scaleway:Function
name: main
properties:
name: test-cron
namespaceId: ${main.id}
runtime: node14
privacy: private
handler: handler.handle
mainFunctionCron:
type: scaleway:FunctionCron
name: main
properties:
name: test-cron
functionId: ${mainFunction.id}
schedule: 0 0 * * *
args:
fn::toJSON:
test: scw
func:
type: scaleway:FunctionCron
properties:
functionId: ${mainFunction.id}
schedule: 0 1 * * *
args:
fn::toJSON:
my_var: terraform
Create FunctionCron Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new FunctionCron(name: string, args: FunctionCronArgs, opts?: CustomResourceOptions);
@overload
def FunctionCron(resource_name: str,
args: FunctionCronArgs,
opts: Optional[ResourceOptions] = None)
@overload
def FunctionCron(resource_name: str,
opts: Optional[ResourceOptions] = None,
args: Optional[str] = None,
function_id: Optional[str] = None,
schedule: Optional[str] = None,
name: Optional[str] = None,
region: Optional[str] = None)
func NewFunctionCron(ctx *Context, name string, args FunctionCronArgs, opts ...ResourceOption) (*FunctionCron, error)
public FunctionCron(string name, FunctionCronArgs args, CustomResourceOptions? opts = null)
public FunctionCron(String name, FunctionCronArgs args)
public FunctionCron(String name, FunctionCronArgs args, CustomResourceOptions options)
type: scaleway:FunctionCron
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 FunctionCronArgs
- 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 FunctionCronArgs
- 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 FunctionCronArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FunctionCronArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args FunctionCronArgs
- 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 functionCronResource = new Scaleway.FunctionCron("functionCronResource", new()
{
Args = "string",
FunctionId = "string",
Schedule = "string",
Name = "string",
Region = "string",
});
example, err := scaleway.NewFunctionCron(ctx, "functionCronResource", &scaleway.FunctionCronArgs{
Args: pulumi.String("string"),
FunctionId: pulumi.String("string"),
Schedule: pulumi.String("string"),
Name: pulumi.String("string"),
Region: pulumi.String("string"),
})
var functionCronResource = new FunctionCron("functionCronResource", FunctionCronArgs.builder()
.args("string")
.functionId("string")
.schedule("string")
.name("string")
.region("string")
.build());
function_cron_resource = scaleway.FunctionCron("functionCronResource",
args="string",
function_id="string",
schedule="string",
name="string",
region="string")
const functionCronResource = new scaleway.FunctionCron("functionCronResource", {
args: "string",
functionId: "string",
schedule: "string",
name: "string",
region: "string",
});
type: scaleway:FunctionCron
properties:
args: string
functionId: string
name: string
region: string
schedule: string
FunctionCron 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 FunctionCron resource accepts the following input properties:
- Args string
- The key-value mapping to define arguments that will be passed to your function’s event object
- Function
Id string - The unique identifier of the function to link to your CRON trigger.
- Schedule string
- CRON format string (refer to the CRON schedule reference for more information).
- Name string
- The name of the function CRON trigger. If not provided, a random name is generated.
- Region string
region
) The region in which the function was created.
- Args string
- The key-value mapping to define arguments that will be passed to your function’s event object
- Function
Id string - The unique identifier of the function to link to your CRON trigger.
- Schedule string
- CRON format string (refer to the CRON schedule reference for more information).
- Name string
- The name of the function CRON trigger. If not provided, a random name is generated.
- Region string
region
) The region in which the function was created.
- args String
- The key-value mapping to define arguments that will be passed to your function’s event object
- function
Id String - The unique identifier of the function to link to your CRON trigger.
- schedule String
- CRON format string (refer to the CRON schedule reference for more information).
- name String
- The name of the function CRON trigger. If not provided, a random name is generated.
- region String
region
) The region in which the function was created.
- args string
- The key-value mapping to define arguments that will be passed to your function’s event object
- function
Id string - The unique identifier of the function to link to your CRON trigger.
- schedule string
- CRON format string (refer to the CRON schedule reference for more information).
- name string
- The name of the function CRON trigger. If not provided, a random name is generated.
- region string
region
) The region in which the function was created.
- args str
- The key-value mapping to define arguments that will be passed to your function’s event object
- function_
id str - The unique identifier of the function to link to your CRON trigger.
- schedule str
- CRON format string (refer to the CRON schedule reference for more information).
- name str
- The name of the function CRON trigger. If not provided, a random name is generated.
- region str
region
) The region in which the function was created.
- args String
- The key-value mapping to define arguments that will be passed to your function’s event object
- function
Id String - The unique identifier of the function to link to your CRON trigger.
- schedule String
- CRON format string (refer to the CRON schedule reference for more information).
- name String
- The name of the function CRON trigger. If not provided, a random name is generated.
- region String
region
) The region in which the function was created.
Outputs
All input properties are implicitly available as output properties. Additionally, the FunctionCron resource produces the following output properties:
Look up Existing FunctionCron Resource
Get an existing FunctionCron 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?: FunctionCronState, opts?: CustomResourceOptions): FunctionCron
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
args: Optional[str] = None,
function_id: Optional[str] = None,
name: Optional[str] = None,
region: Optional[str] = None,
schedule: Optional[str] = None,
status: Optional[str] = None) -> FunctionCron
func GetFunctionCron(ctx *Context, name string, id IDInput, state *FunctionCronState, opts ...ResourceOption) (*FunctionCron, error)
public static FunctionCron Get(string name, Input<string> id, FunctionCronState? state, CustomResourceOptions? opts = null)
public static FunctionCron get(String name, Output<String> id, FunctionCronState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Args string
- The key-value mapping to define arguments that will be passed to your function’s event object
- Function
Id string - The unique identifier of the function to link to your CRON trigger.
- Name string
- The name of the function CRON trigger. If not provided, a random name is generated.
- Region string
region
) The region in which the function was created.- Schedule string
- CRON format string (refer to the CRON schedule reference for more information).
- Status string
- The CRON status.
- Args string
- The key-value mapping to define arguments that will be passed to your function’s event object
- Function
Id string - The unique identifier of the function to link to your CRON trigger.
- Name string
- The name of the function CRON trigger. If not provided, a random name is generated.
- Region string
region
) The region in which the function was created.- Schedule string
- CRON format string (refer to the CRON schedule reference for more information).
- Status string
- The CRON status.
- args String
- The key-value mapping to define arguments that will be passed to your function’s event object
- function
Id String - The unique identifier of the function to link to your CRON trigger.
- name String
- The name of the function CRON trigger. If not provided, a random name is generated.
- region String
region
) The region in which the function was created.- schedule String
- CRON format string (refer to the CRON schedule reference for more information).
- status String
- The CRON status.
- args string
- The key-value mapping to define arguments that will be passed to your function’s event object
- function
Id string - The unique identifier of the function to link to your CRON trigger.
- name string
- The name of the function CRON trigger. If not provided, a random name is generated.
- region string
region
) The region in which the function was created.- schedule string
- CRON format string (refer to the CRON schedule reference for more information).
- status string
- The CRON status.
- args str
- The key-value mapping to define arguments that will be passed to your function’s event object
- function_
id str - The unique identifier of the function to link to your CRON trigger.
- name str
- The name of the function CRON trigger. If not provided, a random name is generated.
- region str
region
) The region in which the function was created.- schedule str
- CRON format string (refer to the CRON schedule reference for more information).
- status str
- The CRON status.
- args String
- The key-value mapping to define arguments that will be passed to your function’s event object
- function
Id String - The unique identifier of the function to link to your CRON trigger.
- name String
- The name of the function CRON trigger. If not provided, a random name is generated.
- region String
region
) The region in which the function was created.- schedule String
- CRON format string (refer to the CRON schedule reference for more information).
- status String
- The CRON status.
Import
Function Cron can be imported using {region}/{id}
, as shown below:
bash
$ pulumi import scaleway:index/functionCron:FunctionCron main fr-par/11111111-1111-1111-1111-111111111111
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- scaleway pulumiverse/pulumi-scaleway
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
scaleway
Terraform Provider.