1. Packages
  2. Scaleway
  3. API Docs
  4. FunctionToken
Scaleway v1.15.0 published on Tuesday, Jul 30, 2024 by pulumiverse

scaleway.FunctionToken

Explore with Pulumi AI

scaleway logo
Scaleway v1.15.0 published on Tuesday, Jul 30, 2024 by pulumiverse

    Creates and manages Scaleway Function Token. For more information see the documentation.

    Example Usage

    Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const mainFunctionNamespace = new scaleway.FunctionNamespace("mainFunctionNamespace", {});
    const mainFunction = new scaleway.Function("mainFunction", {
        namespaceId: mainFunctionNamespace.id,
        runtime: "go118",
        handler: "Handle",
        privacy: "private",
    });
    // Namespace Token
    const namespace = new scaleway.FunctionToken("namespace", {
        namespaceId: mainFunctionNamespace.id,
        expiresAt: "2022-10-18T11:35:15+02:00",
    });
    // Function Token
    const _function = new scaleway.FunctionToken("function", {functionId: mainFunction.id});
    
    import pulumi
    import pulumiverse_scaleway as scaleway
    
    main_function_namespace = scaleway.FunctionNamespace("mainFunctionNamespace")
    main_function = scaleway.Function("mainFunction",
        namespace_id=main_function_namespace.id,
        runtime="go118",
        handler="Handle",
        privacy="private")
    # Namespace Token
    namespace = scaleway.FunctionToken("namespace",
        namespace_id=main_function_namespace.id,
        expires_at="2022-10-18T11:35:15+02:00")
    # Function Token
    function = scaleway.FunctionToken("function", function_id=main_function.id)
    
    package main
    
    import (
    	"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 {
    		mainFunctionNamespace, err := scaleway.NewFunctionNamespace(ctx, "mainFunctionNamespace", nil)
    		if err != nil {
    			return err
    		}
    		mainFunction, err := scaleway.NewFunction(ctx, "mainFunction", &scaleway.FunctionArgs{
    			NamespaceId: mainFunctionNamespace.ID(),
    			Runtime:     pulumi.String("go118"),
    			Handler:     pulumi.String("Handle"),
    			Privacy:     pulumi.String("private"),
    		})
    		if err != nil {
    			return err
    		}
    		// Namespace Token
    		_, err = scaleway.NewFunctionToken(ctx, "namespace", &scaleway.FunctionTokenArgs{
    			NamespaceId: mainFunctionNamespace.ID(),
    			ExpiresAt:   pulumi.String("2022-10-18T11:35:15+02:00"),
    		})
    		if err != nil {
    			return err
    		}
    		// Function Token
    		_, err = scaleway.NewFunctionToken(ctx, "function", &scaleway.FunctionTokenArgs{
    			FunctionId: mainFunction.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumiverse.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        var mainFunctionNamespace = new Scaleway.FunctionNamespace("mainFunctionNamespace");
    
        var mainFunction = new Scaleway.Function("mainFunction", new()
        {
            NamespaceId = mainFunctionNamespace.Id,
            Runtime = "go118",
            Handler = "Handle",
            Privacy = "private",
        });
    
        // Namespace Token
        var @namespace = new Scaleway.FunctionToken("namespace", new()
        {
            NamespaceId = mainFunctionNamespace.Id,
            ExpiresAt = "2022-10-18T11:35:15+02:00",
        });
    
        // Function Token
        var function = new Scaleway.FunctionToken("function", new()
        {
            FunctionId = mainFunction.Id,
        });
    
    });
    
    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.Function;
    import com.pulumi.scaleway.FunctionArgs;
    import com.pulumi.scaleway.FunctionToken;
    import com.pulumi.scaleway.FunctionTokenArgs;
    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 mainFunctionNamespace = new FunctionNamespace("mainFunctionNamespace");
    
            var mainFunction = new Function("mainFunction", FunctionArgs.builder()
                .namespaceId(mainFunctionNamespace.id())
                .runtime("go118")
                .handler("Handle")
                .privacy("private")
                .build());
    
            // Namespace Token
            var namespace = new FunctionToken("namespace", FunctionTokenArgs.builder()
                .namespaceId(mainFunctionNamespace.id())
                .expiresAt("2022-10-18T11:35:15+02:00")
                .build());
    
            // Function Token
            var function = new FunctionToken("function", FunctionTokenArgs.builder()
                .functionId(mainFunction.id())
                .build());
    
        }
    }
    
    resources:
      mainFunctionNamespace:
        type: scaleway:FunctionNamespace
      mainFunction:
        type: scaleway:Function
        properties:
          namespaceId: ${mainFunctionNamespace.id}
          runtime: go118
          handler: Handle
          privacy: private
      # Namespace Token
      namespace:
        type: scaleway:FunctionToken
        properties:
          namespaceId: ${mainFunctionNamespace.id}
          expiresAt: 2022-10-18T11:35:15+02:00
      # Function Token
      function:
        type: scaleway:FunctionToken
        properties:
          functionId: ${mainFunction.id}
    

    Create FunctionToken Resource

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

    Constructor syntax

    new FunctionToken(name: string, args?: FunctionTokenArgs, opts?: CustomResourceOptions);
    @overload
    def FunctionToken(resource_name: str,
                      args: Optional[FunctionTokenArgs] = None,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def FunctionToken(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      description: Optional[str] = None,
                      expires_at: Optional[str] = None,
                      function_id: Optional[str] = None,
                      namespace_id: Optional[str] = None,
                      region: Optional[str] = None)
    func NewFunctionToken(ctx *Context, name string, args *FunctionTokenArgs, opts ...ResourceOption) (*FunctionToken, error)
    public FunctionToken(string name, FunctionTokenArgs? args = null, CustomResourceOptions? opts = null)
    public FunctionToken(String name, FunctionTokenArgs args)
    public FunctionToken(String name, FunctionTokenArgs args, CustomResourceOptions options)
    
    type: scaleway:FunctionToken
    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 FunctionTokenArgs
    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 FunctionTokenArgs
    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 FunctionTokenArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FunctionTokenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FunctionTokenArgs
    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 functionTokenResource = new Scaleway.FunctionToken("functionTokenResource", new()
    {
        Description = "string",
        ExpiresAt = "string",
        FunctionId = "string",
        NamespaceId = "string",
        Region = "string",
    });
    
    example, err := scaleway.NewFunctionToken(ctx, "functionTokenResource", &scaleway.FunctionTokenArgs{
    	Description: pulumi.String("string"),
    	ExpiresAt:   pulumi.String("string"),
    	FunctionId:  pulumi.String("string"),
    	NamespaceId: pulumi.String("string"),
    	Region:      pulumi.String("string"),
    })
    
    var functionTokenResource = new FunctionToken("functionTokenResource", FunctionTokenArgs.builder()
        .description("string")
        .expiresAt("string")
        .functionId("string")
        .namespaceId("string")
        .region("string")
        .build());
    
    function_token_resource = scaleway.FunctionToken("functionTokenResource",
        description="string",
        expires_at="string",
        function_id="string",
        namespace_id="string",
        region="string")
    
    const functionTokenResource = new scaleway.FunctionToken("functionTokenResource", {
        description: "string",
        expiresAt: "string",
        functionId: "string",
        namespaceId: "string",
        region: "string",
    });
    
    type: scaleway:FunctionToken
    properties:
        description: string
        expiresAt: string
        functionId: string
        namespaceId: string
        region: string
    

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

    Description string
    The description of the token.
    ExpiresAt string
    The expiration date of the token.
    FunctionId string

    The ID of the function.

    Only one of namespace_id or function_id must be set.

    NamespaceId string
    The ID of the function namespace.
    Region string

    region). The region in which the namespace should be created.

    Important Updates to any fields will recreate the token.

    Description string
    The description of the token.
    ExpiresAt string
    The expiration date of the token.
    FunctionId string

    The ID of the function.

    Only one of namespace_id or function_id must be set.

    NamespaceId string
    The ID of the function namespace.
    Region string

    region). The region in which the namespace should be created.

    Important Updates to any fields will recreate the token.

    description String
    The description of the token.
    expiresAt String
    The expiration date of the token.
    functionId String

    The ID of the function.

    Only one of namespace_id or function_id must be set.

    namespaceId String
    The ID of the function namespace.
    region String

    region). The region in which the namespace should be created.

    Important Updates to any fields will recreate the token.

    description string
    The description of the token.
    expiresAt string
    The expiration date of the token.
    functionId string

    The ID of the function.

    Only one of namespace_id or function_id must be set.

    namespaceId string
    The ID of the function namespace.
    region string

    region). The region in which the namespace should be created.

    Important Updates to any fields will recreate the token.

    description str
    The description of the token.
    expires_at str
    The expiration date of the token.
    function_id str

    The ID of the function.

    Only one of namespace_id or function_id must be set.

    namespace_id str
    The ID of the function namespace.
    region str

    region). The region in which the namespace should be created.

    Important Updates to any fields will recreate the token.

    description String
    The description of the token.
    expiresAt String
    The expiration date of the token.
    functionId String

    The ID of the function.

    Only one of namespace_id or function_id must be set.

    namespaceId String
    The ID of the function namespace.
    region String

    region). The region in which the namespace should be created.

    Important Updates to any fields will recreate the token.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Token string
    The token.
    Id string
    The provider-assigned unique ID for this managed resource.
    Token string
    The token.
    id String
    The provider-assigned unique ID for this managed resource.
    token String
    The token.
    id string
    The provider-assigned unique ID for this managed resource.
    token string
    The token.
    id str
    The provider-assigned unique ID for this managed resource.
    token str
    The token.
    id String
    The provider-assigned unique ID for this managed resource.
    token String
    The token.

    Look up Existing FunctionToken Resource

    Get an existing FunctionToken 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?: FunctionTokenState, opts?: CustomResourceOptions): FunctionToken
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            expires_at: Optional[str] = None,
            function_id: Optional[str] = None,
            namespace_id: Optional[str] = None,
            region: Optional[str] = None,
            token: Optional[str] = None) -> FunctionToken
    func GetFunctionToken(ctx *Context, name string, id IDInput, state *FunctionTokenState, opts ...ResourceOption) (*FunctionToken, error)
    public static FunctionToken Get(string name, Input<string> id, FunctionTokenState? state, CustomResourceOptions? opts = null)
    public static FunctionToken get(String name, Output<String> id, FunctionTokenState 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:
    Description string
    The description of the token.
    ExpiresAt string
    The expiration date of the token.
    FunctionId string

    The ID of the function.

    Only one of namespace_id or function_id must be set.

    NamespaceId string
    The ID of the function namespace.
    Region string

    region). The region in which the namespace should be created.

    Important Updates to any fields will recreate the token.

    Token string
    The token.
    Description string
    The description of the token.
    ExpiresAt string
    The expiration date of the token.
    FunctionId string

    The ID of the function.

    Only one of namespace_id or function_id must be set.

    NamespaceId string
    The ID of the function namespace.
    Region string

    region). The region in which the namespace should be created.

    Important Updates to any fields will recreate the token.

    Token string
    The token.
    description String
    The description of the token.
    expiresAt String
    The expiration date of the token.
    functionId String

    The ID of the function.

    Only one of namespace_id or function_id must be set.

    namespaceId String
    The ID of the function namespace.
    region String

    region). The region in which the namespace should be created.

    Important Updates to any fields will recreate the token.

    token String
    The token.
    description string
    The description of the token.
    expiresAt string
    The expiration date of the token.
    functionId string

    The ID of the function.

    Only one of namespace_id or function_id must be set.

    namespaceId string
    The ID of the function namespace.
    region string

    region). The region in which the namespace should be created.

    Important Updates to any fields will recreate the token.

    token string
    The token.
    description str
    The description of the token.
    expires_at str
    The expiration date of the token.
    function_id str

    The ID of the function.

    Only one of namespace_id or function_id must be set.

    namespace_id str
    The ID of the function namespace.
    region str

    region). The region in which the namespace should be created.

    Important Updates to any fields will recreate the token.

    token str
    The token.
    description String
    The description of the token.
    expiresAt String
    The expiration date of the token.
    functionId String

    The ID of the function.

    Only one of namespace_id or function_id must be set.

    namespaceId String
    The ID of the function namespace.
    region String

    region). The region in which the namespace should be created.

    Important Updates to any fields will recreate the token.

    token String
    The token.

    Import

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

    bash

    $ pulumi import scaleway:index/functionToken:FunctionToken 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.15.0 published on Tuesday, Jul 30, 2024 by pulumiverse