1. Packages
  2. Scaleway
  3. API Docs
  4. ContainerCron
Scaleway v1.14.0 published on Thursday, Jun 6, 2024 by pulumiverse

scaleway.ContainerCron

Explore with Pulumi AI

scaleway logo
Scaleway v1.14.0 published on Thursday, Jun 6, 2024 by pulumiverse

    Creates and manages Scaleway Container Triggers. For the moment, the feature is limited to CRON Schedule (time-based).

    For more information consult the documentation .

    For more details about the limitation check containers-limitations .

    You can check also our containers cron api documentation.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const mainContainerNamespace = new scaleway.ContainerNamespace("mainContainerNamespace", {});
    const mainContainer = new scaleway.Container("mainContainer", {namespaceId: mainContainerNamespace.id});
    const mainContainerCron = new scaleway.ContainerCron("mainContainerCron", {
        containerId: mainContainer.id,
        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_container_namespace = scaleway.ContainerNamespace("mainContainerNamespace")
    main_container = scaleway.Container("mainContainer", namespace_id=main_container_namespace.id)
    main_container_cron = scaleway.ContainerCron("mainContainerCron",
        container_id=main_container.id,
        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 {
    		mainContainerNamespace, err := scaleway.NewContainerNamespace(ctx, "mainContainerNamespace", nil)
    		if err != nil {
    			return err
    		}
    		mainContainer, err := scaleway.NewContainer(ctx, "mainContainer", &scaleway.ContainerArgs{
    			NamespaceId: mainContainerNamespace.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, "mainContainerCron", &scaleway.ContainerCronArgs{
    			ContainerId: mainContainer.ID(),
    			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 mainContainerNamespace = new Scaleway.ContainerNamespace("mainContainerNamespace");
    
        var mainContainer = new Scaleway.Container("mainContainer", new()
        {
            NamespaceId = mainContainerNamespace.Id,
        });
    
        var mainContainerCron = new Scaleway.ContainerCron("mainContainerCron", new()
        {
            ContainerId = mainContainer.Id,
            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 mainContainerNamespace = new ContainerNamespace("mainContainerNamespace");
    
            var mainContainer = new Container("mainContainer", ContainerArgs.builder()        
                .namespaceId(mainContainerNamespace.id())
                .build());
    
            var mainContainerCron = new ContainerCron("mainContainerCron", ContainerCronArgs.builder()        
                .containerId(mainContainer.id())
                .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:
      mainContainerNamespace:
        type: scaleway:ContainerNamespace
      mainContainer:
        type: scaleway:Container
        properties:
          namespaceId: ${mainContainerNamespace.id}
      mainContainerCron:
        type: scaleway:ContainerCron
        properties:
          containerId: ${mainContainer.id}
          schedule: 5 4 1 * *
          #cron at 04:05 on day-of-month 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

    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 during
    ContainerId string
    The container ID to link with your cron.
    Schedule string
    Cron format string, e.g. @hourly, as schedule time of its jobs to be created and executed.
    Name string
    The name of the container cron. If not provided, the name is generated. during
    Region string
    (Defaults to provider region) The region in where the job was created.
    Args string
    The key-value mapping to define arguments that will be passed to your container’s event object during
    ContainerId string
    The container ID to link with your cron.
    Schedule string
    Cron format string, e.g. @hourly, as schedule time of its jobs to be created and executed.
    Name string
    The name of the container cron. If not provided, the name is generated. during
    Region string
    (Defaults to provider region) The region in where the job was created.
    args String
    The key-value mapping to define arguments that will be passed to your container’s event object during
    containerId String
    The container ID to link with your cron.
    schedule String
    Cron format string, e.g. @hourly, as schedule time of its jobs to be created and executed.
    name String
    The name of the container cron. If not provided, the name is generated. during
    region String
    (Defaults to provider region) The region in where the job was created.
    args string
    The key-value mapping to define arguments that will be passed to your container’s event object during
    containerId string
    The container ID to link with your cron.
    schedule string
    Cron format string, e.g. @hourly, as schedule time of its jobs to be created and executed.
    name string
    The name of the container cron. If not provided, the name is generated. during
    region string
    (Defaults to provider region) The region in where the job was created.
    args str
    The key-value mapping to define arguments that will be passed to your container’s event object during
    container_id str
    The container ID to link with your cron.
    schedule str
    Cron format string, e.g. @hourly, as schedule time of its jobs to be created and executed.
    name str
    The name of the container cron. If not provided, the name is generated. during
    region str
    (Defaults to provider region) The region in where the job was created.
    args String
    The key-value mapping to define arguments that will be passed to your container’s event object during
    containerId String
    The container ID to link with your cron.
    schedule String
    Cron format string, e.g. @hourly, as schedule time of its jobs to be created and executed.
    name String
    The name of the container cron. If not provided, the name is generated. during
    region String
    (Defaults to provider region) The region in where the job was 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 during
    ContainerId string
    The container ID to link with your cron.
    Name string
    The name of the container cron. If not provided, the name is generated. during
    Region string
    (Defaults to provider region) The region in where the job was created.
    Schedule string
    Cron format string, e.g. @hourly, as schedule time of its jobs to be created and executed.
    Status string
    The cron status.
    Args string
    The key-value mapping to define arguments that will be passed to your container’s event object during
    ContainerId string
    The container ID to link with your cron.
    Name string
    The name of the container cron. If not provided, the name is generated. during
    Region string
    (Defaults to provider region) The region in where the job was created.
    Schedule string
    Cron format string, e.g. @hourly, as schedule time of its jobs to be created and executed.
    Status string
    The cron status.
    args String
    The key-value mapping to define arguments that will be passed to your container’s event object during
    containerId String
    The container ID to link with your cron.
    name String
    The name of the container cron. If not provided, the name is generated. during
    region String
    (Defaults to provider region) The region in where the job was created.
    schedule String
    Cron format string, e.g. @hourly, as schedule time of its jobs to be created and executed.
    status String
    The cron status.
    args string
    The key-value mapping to define arguments that will be passed to your container’s event object during
    containerId string
    The container ID to link with your cron.
    name string
    The name of the container cron. If not provided, the name is generated. during
    region string
    (Defaults to provider region) The region in where the job was created.
    schedule string
    Cron format string, e.g. @hourly, as schedule time of its jobs to be created and executed.
    status string
    The cron status.
    args str
    The key-value mapping to define arguments that will be passed to your container’s event object during
    container_id str
    The container ID to link with your cron.
    name str
    The name of the container cron. If not provided, the name is generated. during
    region str
    (Defaults to provider region) The region in where the job was created.
    schedule str
    Cron format string, e.g. @hourly, as schedule time of its jobs to be created and executed.
    status str
    The cron status.
    args String
    The key-value mapping to define arguments that will be passed to your container’s event object during
    containerId String
    The container ID to link with your cron.
    name String
    The name of the container cron. If not provided, the name is generated. during
    region String
    (Defaults to provider region) The region in where the job was created.
    schedule String
    Cron format string, e.g. @hourly, as schedule time of its jobs to be created and executed.
    status String
    The cron status.

    Import

    Container Cron can be imported using the {region}/{id}, e.g.

    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.14.0 published on Thursday, Jun 6, 2024 by pulumiverse