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

scaleway.FunctionToken

Explore with Pulumi AI

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

    The scaleway.FunctionToken resource allows you to create and manage authentication tokens for Scaleway Serverless Functions.

    Refer to the Functions tokens documentation and API documentation for more information.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const main = new scaleway.FunctionNamespace("main", {name: "test-function-token-ns"});
    const mainFunction = new scaleway.Function("main", {
        namespaceId: main.id,
        runtime: "go118",
        handler: "Handle",
        privacy: "private",
    });
    // Namespace Token
    const namespace = new scaleway.FunctionToken("namespace", {
        namespaceId: main.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 = scaleway.FunctionNamespace("main", name="test-function-token-ns")
    main_function = scaleway.Function("main",
        namespace_id=main.id,
        runtime="go118",
        handler="Handle",
        privacy="private")
    # Namespace Token
    namespace = scaleway.FunctionToken("namespace",
        namespace_id=main.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 {
    		main, err := scaleway.NewFunctionNamespace(ctx, "main", &scaleway.FunctionNamespaceArgs{
    			Name: pulumi.String("test-function-token-ns"),
    		})
    		if err != nil {
    			return err
    		}
    		mainFunction, err := scaleway.NewFunction(ctx, "main", &scaleway.FunctionArgs{
    			NamespaceId: main.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: main.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 main = new Scaleway.FunctionNamespace("main", new()
        {
            Name = "test-function-token-ns",
        });
    
        var mainFunction = new Scaleway.Function("main", new()
        {
            NamespaceId = main.Id,
            Runtime = "go118",
            Handler = "Handle",
            Privacy = "private",
        });
    
        // Namespace Token
        var @namespace = new Scaleway.FunctionToken("namespace", new()
        {
            NamespaceId = main.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.FunctionNamespaceArgs;
    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 main = new FunctionNamespace("main", FunctionNamespaceArgs.builder()
                .name("test-function-token-ns")
                .build());
    
            var mainFunction = new Function("mainFunction", FunctionArgs.builder()
                .namespaceId(main.id())
                .runtime("go118")
                .handler("Handle")
                .privacy("private")
                .build());
    
            // Namespace Token
            var namespace = new FunctionToken("namespace", FunctionTokenArgs.builder()
                .namespaceId(main.id())
                .expiresAt("2022-10-18T11:35:15+02:00")
                .build());
    
            // Function Token
            var function = new FunctionToken("function", FunctionTokenArgs.builder()
                .functionId(mainFunction.id())
                .build());
    
        }
    }
    
    resources:
      main:
        type: scaleway:FunctionNamespace
        properties:
          name: test-function-token-ns
      mainFunction:
        type: scaleway:Function
        name: main
        properties:
          namespaceId: ${main.id}
          runtime: go118
          handler: Handle
          privacy: private
      # Namespace Token
      namespace:
        type: scaleway:FunctionToken
        properties:
          namespaceId: ${main.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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    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 unique identifier of the function.

    Only one of namespace_id or function_id must be set.

    NamespaceId string
    The unique identifier of the Functions namespace.
    Region string

    region). The region in which the namespace is created.

    Important Updating any of the arguments above will recreate the token.

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

    The unique identifier of the function.

    Only one of namespace_id or function_id must be set.

    NamespaceId string
    The unique identifier of the Functions namespace.
    Region string

    region). The region in which the namespace is created.

    Important Updating any of the arguments above will recreate the token.

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

    The unique identifier of the function.

    Only one of namespace_id or function_id must be set.

    namespaceId String
    The unique identifier of the Functions namespace.
    region String

    region). The region in which the namespace is created.

    Important Updating any of the arguments above will recreate the token.

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

    The unique identifier of the function.

    Only one of namespace_id or function_id must be set.

    namespaceId string
    The unique identifier of the Functions namespace.
    region string

    region). The region in which the namespace is created.

    Important Updating any of the arguments above will recreate the token.

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

    The unique identifier of the function.

    Only one of namespace_id or function_id must be set.

    namespace_id str
    The unique identifier of the Functions namespace.
    region str

    region). The region in which the namespace is created.

    Important Updating any of the arguments above will recreate the token.

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

    The unique identifier of the function.

    Only one of namespace_id or function_id must be set.

    namespaceId String
    The unique identifier of the Functions namespace.
    region String

    region). The region in which the namespace is created.

    Important Updating any of the arguments above 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 unique identifier of the function.

    Only one of namespace_id or function_id must be set.

    NamespaceId string
    The unique identifier of the Functions namespace.
    Region string

    region). The region in which the namespace is created.

    Important Updating any of the arguments above 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 unique identifier of the function.

    Only one of namespace_id or function_id must be set.

    NamespaceId string
    The unique identifier of the Functions namespace.
    Region string

    region). The region in which the namespace is created.

    Important Updating any of the arguments above 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 unique identifier of the function.

    Only one of namespace_id or function_id must be set.

    namespaceId String
    The unique identifier of the Functions namespace.
    region String

    region). The region in which the namespace is created.

    Important Updating any of the arguments above 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 unique identifier of the function.

    Only one of namespace_id or function_id must be set.

    namespaceId string
    The unique identifier of the Functions namespace.
    region string

    region). The region in which the namespace is created.

    Important Updating any of the arguments above 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 unique identifier of the function.

    Only one of namespace_id or function_id must be set.

    namespace_id str
    The unique identifier of the Functions namespace.
    region str

    region). The region in which the namespace is created.

    Important Updating any of the arguments above 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 unique identifier of the function.

    Only one of namespace_id or function_id must be set.

    namespaceId String
    The unique identifier of the Functions namespace.
    region String

    region). The region in which the namespace is created.

    Important Updating any of the arguments above will recreate the token.

    token String
    The token.

    Import

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

    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.20.0 published on Monday, Nov 4, 2024 by pulumiverse