1. Packages
  2. Scaleway
  3. API Docs
  4. ContainerCron
Scaleway v1.11.0 published on Sunday, Oct 29, 2023 by lbrlabs

scaleway.ContainerCron

Explore with Pulumi AI

scaleway logo
Scaleway v1.11.0 published on Sunday, Oct 29, 2023 by lbrlabs

    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

    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Scaleway = Lbrlabs.PulumiPackage.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 main
    
    import (
    	"encoding/json"
    
    	"github.com/lbrlabs/pulumi-scaleway/sdk/go/scaleway"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    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
    	})
    }
    
    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());
    
        }
    }
    
    import pulumi
    import json
    import lbrlabs_pulumi_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",
        }))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@lbrlabs/pulumi-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",
        }),
    });
    
    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

    new ContainerCron(name: string, args: ContainerCronArgs, opts?: CustomResourceOptions);
    @overload
    def ContainerCron(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      args: Optional[str] = None,
                      container_id: Optional[str] = None,
                      region: Optional[str] = None,
                      schedule: Optional[str] = None)
    @overload
    def ContainerCron(resource_name: str,
                      args: ContainerCronArgs,
                      opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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.
    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.
    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.
    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.
    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.
    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.
    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,
            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.
    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.
    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.
    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.
    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.
    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.
    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
    

    Package Details

    Repository
    scaleway lbrlabs/pulumi-scaleway
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scaleway Terraform Provider.
    scaleway logo
    Scaleway v1.11.0 published on Sunday, Oct 29, 2023 by lbrlabs