1. Packages
  2. Scaleway
  3. API Docs
  4. ContainerCron
Scaleway v1.20.0 published on Monday, Nov 4, 2024 by pulumiverse

scaleway.ContainerCron

Explore with Pulumi AI

scaleway logo
Scaleway v1.20.0 published on Monday, Nov 4, 2024 by pulumiverse

    The scaleway.ContainerCron resource allows you to create and manage CRON triggers for Scaleway Serverless Containers.

    Refer to the Containers CRON triggers documentation and API documentation for more information.

    Example Usage

    The following command allows you to add a CRON trigger to a Serverless Container.

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const main = new scaleway.ContainerNamespace("main", {});
    const mainContainer = new scaleway.Container("main", {
        name: "my-container-with-cron-tf",
        namespaceId: main.id,
    });
    const mainContainerCron = new scaleway.ContainerCron("main", {
        containerId: mainContainer.id,
        name: "my-cron-name",
        schedule: "5 4 1 * *",
        args: JSON.stringify({
            address: {
                city: "Paris",
                country: "FR",
            },
            age: 23,
            firstName: "John",
            isAlive: true,
            lastName: "Smith",
        }),
    });
    
    import pulumi
    import json
    import pulumiverse_scaleway as scaleway
    
    main = scaleway.ContainerNamespace("main")
    main_container = scaleway.Container("main",
        name="my-container-with-cron-tf",
        namespace_id=main.id)
    main_container_cron = scaleway.ContainerCron("main",
        container_id=main_container.id,
        name="my-cron-name",
        schedule="5 4 1 * *",
        args=json.dumps({
            "address": {
                "city": "Paris",
                "country": "FR",
            },
            "age": 23,
            "firstName": "John",
            "isAlive": True,
            "lastName": "Smith",
        }))
    
    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.NewContainerNamespace(ctx, "main", nil)
    		if err != nil {
    			return err
    		}
    		mainContainer, err := scaleway.NewContainer(ctx, "main", &scaleway.ContainerArgs{
    			Name:        pulumi.String("my-container-with-cron-tf"),
    			NamespaceId: main.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"address": map[string]interface{}{
    				"city":    "Paris",
    				"country": "FR",
    			},
    			"age":       23,
    			"firstName": "John",
    			"isAlive":   true,
    			"lastName":  "Smith",
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = scaleway.NewContainerCron(ctx, "main", &scaleway.ContainerCronArgs{
    			ContainerId: mainContainer.ID(),
    			Name:        pulumi.String("my-cron-name"),
    			Schedule:    pulumi.String("5 4 1 * *"),
    			Args:        pulumi.String(json0),
    		})
    		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.ContainerNamespace("main");
    
        var mainContainer = new Scaleway.Container("main", new()
        {
            Name = "my-container-with-cron-tf",
            NamespaceId = main.Id,
        });
    
        var mainContainerCron = new Scaleway.ContainerCron("main", new()
        {
            ContainerId = mainContainer.Id,
            Name = "my-cron-name",
            Schedule = "5 4 1 * *",
            Args = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["address"] = new Dictionary<string, object?>
                {
                    ["city"] = "Paris",
                    ["country"] = "FR",
                },
                ["age"] = 23,
                ["firstName"] = "John",
                ["isAlive"] = true,
                ["lastName"] = "Smith",
            }),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.ContainerNamespace;
    import com.pulumi.scaleway.Container;
    import com.pulumi.scaleway.ContainerArgs;
    import com.pulumi.scaleway.ContainerCron;
    import com.pulumi.scaleway.ContainerCronArgs;
    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 ContainerNamespace("main");
    
            var mainContainer = new Container("mainContainer", ContainerArgs.builder()
                .name("my-container-with-cron-tf")
                .namespaceId(main.id())
                .build());
    
            var mainContainerCron = new ContainerCron("mainContainerCron", ContainerCronArgs.builder()
                .containerId(mainContainer.id())
                .name("my-cron-name")
                .schedule("5 4 1 * *")
                .args(serializeJson(
                    jsonObject(
                        jsonProperty("address", jsonObject(
                            jsonProperty("city", "Paris"),
                            jsonProperty("country", "FR")
                        )),
                        jsonProperty("age", 23),
                        jsonProperty("firstName", "John"),
                        jsonProperty("isAlive", true),
                        jsonProperty("lastName", "Smith")
                    )))
                .build());
    
        }
    }
    
    resources:
      main:
        type: scaleway:ContainerNamespace
      mainContainer:
        type: scaleway:Container
        name: main
        properties:
          name: my-container-with-cron-tf
          namespaceId: ${main.id}
      mainContainerCron:
        type: scaleway:ContainerCron
        name: main
        properties:
          containerId: ${mainContainer.id}
          name: my-cron-name
          schedule: 5 4 1 * *
          args:
            fn::toJSON:
              address:
                city: Paris
                country: FR
              age: 23
              firstName: John
              isAlive: true
              lastName: Smith
    

    Create ContainerCron Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ContainerCron(name: string, args: ContainerCronArgs, opts?: CustomResourceOptions);
    @overload
    def ContainerCron(resource_name: str,
                      args: ContainerCronArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def ContainerCron(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      args: Optional[str] = None,
                      container_id: Optional[str] = None,
                      schedule: Optional[str] = None,
                      name: Optional[str] = None,
                      region: Optional[str] = None)
    func NewContainerCron(ctx *Context, name string, args ContainerCronArgs, opts ...ResourceOption) (*ContainerCron, error)
    public ContainerCron(string name, ContainerCronArgs args, CustomResourceOptions? opts = null)
    public ContainerCron(String name, ContainerCronArgs args)
    public ContainerCron(String name, ContainerCronArgs args, CustomResourceOptions options)
    
    type: scaleway:ContainerCron
    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 ContainerCronArgs
    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 ContainerCronArgs
    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 ContainerCronArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ContainerCronArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ContainerCronArgs
    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 containerCronResource = new Scaleway.ContainerCron("containerCronResource", new()
    {
        Args = "string",
        ContainerId = "string",
        Schedule = "string",
        Name = "string",
        Region = "string",
    });
    
    example, err := scaleway.NewContainerCron(ctx, "containerCronResource", &scaleway.ContainerCronArgs{
    	Args:        pulumi.String("string"),
    	ContainerId: pulumi.String("string"),
    	Schedule:    pulumi.String("string"),
    	Name:        pulumi.String("string"),
    	Region:      pulumi.String("string"),
    })
    
    var containerCronResource = new ContainerCron("containerCronResource", ContainerCronArgs.builder()
        .args("string")
        .containerId("string")
        .schedule("string")
        .name("string")
        .region("string")
        .build());
    
    container_cron_resource = scaleway.ContainerCron("containerCronResource",
        args="string",
        container_id="string",
        schedule="string",
        name="string",
        region="string")
    
    const containerCronResource = new scaleway.ContainerCron("containerCronResource", {
        args: "string",
        containerId: "string",
        schedule: "string",
        name: "string",
        region: "string",
    });
    
    type: scaleway:ContainerCron
    properties:
        args: string
        containerId: string
        name: string
        region: string
        schedule: string
    

    ContainerCron 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 ContainerCron resource accepts the following input properties:

    Args string
    The key-value mapping to define arguments that will be passed to your container’s event object
    ContainerId string
    The unique identifier of the container 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 container CRON trigger. If not provided, a random name is generated.
    Region string
    (Defaults to provider region) The region in which the CRON trigger is created.
    Args string
    The key-value mapping to define arguments that will be passed to your container’s event object
    ContainerId string
    The unique identifier of the container 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 container CRON trigger. If not provided, a random name is generated.
    Region string
    (Defaults to provider region) The region in which the CRON trigger is created.
    args String
    The key-value mapping to define arguments that will be passed to your container’s event object
    containerId String
    The unique identifier of the container 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 container CRON trigger. If not provided, a random name is generated.
    region String
    (Defaults to provider region) The region in which the CRON trigger is created.
    args string
    The key-value mapping to define arguments that will be passed to your container’s event object
    containerId string
    The unique identifier of the container 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 container CRON trigger. If not provided, a random name is generated.
    region string
    (Defaults to provider region) The region in which the CRON trigger is created.
    args str
    The key-value mapping to define arguments that will be passed to your container’s event object
    container_id str
    The unique identifier of the container 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 container CRON trigger. If not provided, a random name is generated.
    region str
    (Defaults to provider region) The region in which the CRON trigger is created.
    args String
    The key-value mapping to define arguments that will be passed to your container’s event object
    containerId String
    The unique identifier of the container 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 container CRON trigger. If not provided, a random name is generated.
    region String
    (Defaults to provider region) The region in which the CRON trigger is created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ContainerCron resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The CRON status.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The CRON status.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The CRON status.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The CRON status.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The CRON status.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The CRON status.

    Look up Existing ContainerCron Resource

    Get an existing ContainerCron 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?: ContainerCronState, opts?: CustomResourceOptions): ContainerCron
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            args: Optional[str] = None,
            container_id: Optional[str] = None,
            name: Optional[str] = None,
            region: Optional[str] = None,
            schedule: Optional[str] = None,
            status: Optional[str] = None) -> ContainerCron
    func GetContainerCron(ctx *Context, name string, id IDInput, state *ContainerCronState, opts ...ResourceOption) (*ContainerCron, error)
    public static ContainerCron Get(string name, Input<string> id, ContainerCronState? state, CustomResourceOptions? opts = null)
    public static ContainerCron get(String name, Output<String> id, ContainerCronState 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.
    The following state arguments are supported:
    Args string
    The key-value mapping to define arguments that will be passed to your container’s event object
    ContainerId string
    The unique identifier of the container to link to your CRON trigger.
    Name string
    The name of the container CRON trigger. If not provided, a random name is generated.
    Region string
    (Defaults to provider region) The region in which the CRON trigger is 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 container’s event object
    ContainerId string
    The unique identifier of the container to link to your CRON trigger.
    Name string
    The name of the container CRON trigger. If not provided, a random name is generated.
    Region string
    (Defaults to provider region) The region in which the CRON trigger is 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 container’s event object
    containerId String
    The unique identifier of the container to link to your CRON trigger.
    name String
    The name of the container CRON trigger. If not provided, a random name is generated.
    region String
    (Defaults to provider region) The region in which the CRON trigger is 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 container’s event object
    containerId string
    The unique identifier of the container to link to your CRON trigger.
    name string
    The name of the container CRON trigger. If not provided, a random name is generated.
    region string
    (Defaults to provider region) The region in which the CRON trigger is 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 container’s event object
    container_id str
    The unique identifier of the container to link to your CRON trigger.
    name str
    The name of the container CRON trigger. If not provided, a random name is generated.
    region str
    (Defaults to provider region) The region in which the CRON trigger is 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 container’s event object
    containerId String
    The unique identifier of the container to link to your CRON trigger.
    name String
    The name of the container CRON trigger. If not provided, a random name is generated.
    region String
    (Defaults to provider region) The region in which the CRON trigger is created.
    schedule String
    CRON format string (refer to the CRON schedule reference for more information).
    status String
    The CRON status.

    Import

    Container Cron can be imported using {region}/{id}, as shown below:

    bash

    $ pulumi import scaleway:index/containerCron:ContainerCron 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.
    scaleway logo
    Scaleway v1.20.0 published on Monday, Nov 4, 2024 by pulumiverse