1. Packages
  2. Gcorelabs Provider
  3. API Docs
  4. FaasFunction
gcorelabs 0.3.63 published on Monday, Apr 14, 2025 by g-core

gcorelabs.FaasFunction

Explore with Pulumi AI

gcorelabs logo
gcorelabs 0.3.63 published on Monday, Apr 14, 2025 by g-core

    Represent FaaS function

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    const func = new gcore.index.Gcore_faas_function("func", {
        projectId: 1,
        regionId: 1,
        name: "testf",
        namespace: "ns4test",
        description: "function description",
        envs: {
            BIG: "EXAMPLE2",
        },
        runtime: "go1.16.6",
        codeText: `package kubeless
    
    import (
            "github.com/kubeless/kubeless/pkg/functions"
    )
    
    func Run(evt functions.Event, ctx functions.Context) (string, error) {
            return "Hello World!!", nil
    }
    `,
        timeout: 5,
        flavor: "80mCPU-128MB",
        mainMethod: "Run",
        minInstances: 1,
        maxInstances: 2,
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    func = gcore.index.Gcore_faas_function("func",
        project_id=1,
        region_id=1,
        name=testf,
        namespace=ns4test,
        description=function description,
        envs={
            BIG: EXAMPLE2,
        },
        runtime=go1.16.6,
        code_text=package kubeless
    
    import (
            "github.com/kubeless/kubeless/pkg/functions"
    )
    
    func Run(evt functions.Event, ctx functions.Context) (string, error) {
            return "Hello World!!", nil
    }
    ,
        timeout=5,
        flavor=80mCPU-128MB,
        main_method=Run,
        min_instances=1,
        max_instances=2)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcore/sdk/go/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := gcore.NewGcore_faas_function(ctx, "func", &gcore.Gcore_faas_functionArgs{
    			ProjectId:   1,
    			RegionId:    1,
    			Name:        "testf",
    			Namespace:   "ns4test",
    			Description: "function description",
    			Envs: map[string]interface{}{
    				"BIG": "EXAMPLE2",
    			},
    			Runtime: "go1.16.6",
    			CodeText: `package kubeless
    
    import (
            "github.com/kubeless/kubeless/pkg/functions"
    )
    
    func Run(evt functions.Event, ctx functions.Context) (string, error) {
            return "Hello World!!", nil
    }
    `,
    			Timeout:      5,
    			Flavor:       "80mCPU-128MB",
    			MainMethod:   "Run",
    			MinInstances: 1,
    			MaxInstances: 2,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        var func = new Gcore.Index.Gcore_faas_function("func", new()
        {
            ProjectId = 1,
            RegionId = 1,
            Name = "testf",
            Namespace = "ns4test",
            Description = "function description",
            Envs = 
            {
                { "BIG", "EXAMPLE2" },
            },
            Runtime = "go1.16.6",
            CodeText = @"package kubeless
    
    import (
            ""github.com/kubeless/kubeless/pkg/functions""
    )
    
    func Run(evt functions.Event, ctx functions.Context) (string, error) {
            return ""Hello World!!"", nil
    }
    ",
            Timeout = 5,
            Flavor = "80mCPU-128MB",
            MainMethod = "Run",
            MinInstances = 1,
            MaxInstances = 2,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.gcore_faas_function;
    import com.pulumi.gcore.Gcore_faas_functionArgs;
    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 func = new Gcore_faas_function("func", Gcore_faas_functionArgs.builder()
                .projectId(1)
                .regionId(1)
                .name("testf")
                .namespace("ns4test")
                .description("function description")
                .envs(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
                .runtime("go1.16.6")
                .codeText("""
    package kubeless
    
    import (
            "github.com/kubeless/kubeless/pkg/functions"
    )
    
    func Run(evt functions.Event, ctx functions.Context) (string, error) {
            return "Hello World!!", nil
    }
                """)
                .timeout(5)
                .flavor("80mCPU-128MB")
                .mainMethod("Run")
                .minInstances(1)
                .maxInstances(2)
                .build());
    
        }
    }
    
    resources:
      func:
        type: gcore:gcore_faas_function
        properties:
          projectId: 1
          regionId: 1
          name: testf
          namespace: ns4test
          description: function description
          envs:
            BIG: EXAMPLE2
          runtime: go1.16.6
          codeText: |
            package kubeless
    
            import (
                    "github.com/kubeless/kubeless/pkg/functions"
            )
    
            func Run(evt functions.Event, ctx functions.Context) (string, error) {
                    return "Hello World!!", nil
            }        
          timeout: 5
          flavor: 80mCPU-128MB
          mainMethod: Run
          minInstances: 1
          maxInstances: 2
    

    Create FaasFunction Resource

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

    Constructor syntax

    new FaasFunction(name: string, args: FaasFunctionArgs, opts?: CustomResourceOptions);
    @overload
    def FaasFunction(resource_name: str,
                     args: FaasFunctionArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def FaasFunction(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     code_text: Optional[str] = None,
                     timeout: Optional[float] = None,
                     runtime: Optional[str] = None,
                     namespace: Optional[str] = None,
                     flavor: Optional[str] = None,
                     main_method: Optional[str] = None,
                     max_instances: Optional[float] = None,
                     min_instances: Optional[float] = None,
                     name: Optional[str] = None,
                     faas_function_id: Optional[str] = None,
                     project_id: Optional[float] = None,
                     project_name: Optional[str] = None,
                     region_id: Optional[float] = None,
                     region_name: Optional[str] = None,
                     envs: Optional[Mapping[str, str]] = None,
                     description: Optional[str] = None)
    func NewFaasFunction(ctx *Context, name string, args FaasFunctionArgs, opts ...ResourceOption) (*FaasFunction, error)
    public FaasFunction(string name, FaasFunctionArgs args, CustomResourceOptions? opts = null)
    public FaasFunction(String name, FaasFunctionArgs args)
    public FaasFunction(String name, FaasFunctionArgs args, CustomResourceOptions options)
    
    type: gcorelabs:FaasFunction
    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 FaasFunctionArgs
    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 FaasFunctionArgs
    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 FaasFunctionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FaasFunctionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FaasFunctionArgs
    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 faasFunctionResource = new Gcorelabs.FaasFunction("faasFunctionResource", new()
    {
        CodeText = "string",
        Timeout = 0,
        Runtime = "string",
        Namespace = "string",
        Flavor = "string",
        MainMethod = "string",
        MaxInstances = 0,
        MinInstances = 0,
        Name = "string",
        FaasFunctionId = "string",
        ProjectId = 0,
        ProjectName = "string",
        RegionId = 0,
        RegionName = "string",
        Envs = 
        {
            { "string", "string" },
        },
        Description = "string",
    });
    
    example, err := gcorelabs.NewFaasFunction(ctx, "faasFunctionResource", &gcorelabs.FaasFunctionArgs{
    	CodeText:       pulumi.String("string"),
    	Timeout:        pulumi.Float64(0),
    	Runtime:        pulumi.String("string"),
    	Namespace:      pulumi.String("string"),
    	Flavor:         pulumi.String("string"),
    	MainMethod:     pulumi.String("string"),
    	MaxInstances:   pulumi.Float64(0),
    	MinInstances:   pulumi.Float64(0),
    	Name:           pulumi.String("string"),
    	FaasFunctionId: pulumi.String("string"),
    	ProjectId:      pulumi.Float64(0),
    	ProjectName:    pulumi.String("string"),
    	RegionId:       pulumi.Float64(0),
    	RegionName:     pulumi.String("string"),
    	Envs: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Description: pulumi.String("string"),
    })
    
    var faasFunctionResource = new FaasFunction("faasFunctionResource", FaasFunctionArgs.builder()
        .codeText("string")
        .timeout(0)
        .runtime("string")
        .namespace("string")
        .flavor("string")
        .mainMethod("string")
        .maxInstances(0)
        .minInstances(0)
        .name("string")
        .faasFunctionId("string")
        .projectId(0)
        .projectName("string")
        .regionId(0)
        .regionName("string")
        .envs(Map.of("string", "string"))
        .description("string")
        .build());
    
    faas_function_resource = gcorelabs.FaasFunction("faasFunctionResource",
        code_text="string",
        timeout=0,
        runtime="string",
        namespace="string",
        flavor="string",
        main_method="string",
        max_instances=0,
        min_instances=0,
        name="string",
        faas_function_id="string",
        project_id=0,
        project_name="string",
        region_id=0,
        region_name="string",
        envs={
            "string": "string",
        },
        description="string")
    
    const faasFunctionResource = new gcorelabs.FaasFunction("faasFunctionResource", {
        codeText: "string",
        timeout: 0,
        runtime: "string",
        namespace: "string",
        flavor: "string",
        mainMethod: "string",
        maxInstances: 0,
        minInstances: 0,
        name: "string",
        faasFunctionId: "string",
        projectId: 0,
        projectName: "string",
        regionId: 0,
        regionName: "string",
        envs: {
            string: "string",
        },
        description: "string",
    });
    
    type: gcorelabs:FaasFunction
    properties:
        codeText: string
        description: string
        envs:
            string: string
        faasFunctionId: string
        flavor: string
        mainMethod: string
        maxInstances: 0
        minInstances: 0
        name: string
        namespace: string
        projectId: 0
        projectName: string
        regionId: 0
        regionName: string
        runtime: string
        timeout: 0
    

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

    CodeText string
    Flavor string
    MainMethod string
    Main startup method name
    MaxInstances double
    Autoscaling max number of instances
    MinInstances double
    Autoscaling min number of instances
    Namespace string
    Namespace of the function
    Runtime string
    Timeout double
    Description string
    Envs Dictionary<string, string>
    FaasFunctionId string
    The ID of this resource.
    Name string
    ProjectId double
    ProjectName string
    RegionId double
    RegionName string
    CodeText string
    Flavor string
    MainMethod string
    Main startup method name
    MaxInstances float64
    Autoscaling max number of instances
    MinInstances float64
    Autoscaling min number of instances
    Namespace string
    Namespace of the function
    Runtime string
    Timeout float64
    Description string
    Envs map[string]string
    FaasFunctionId string
    The ID of this resource.
    Name string
    ProjectId float64
    ProjectName string
    RegionId float64
    RegionName string
    codeText String
    flavor String
    mainMethod String
    Main startup method name
    maxInstances Double
    Autoscaling max number of instances
    minInstances Double
    Autoscaling min number of instances
    namespace String
    Namespace of the function
    runtime String
    timeout Double
    description String
    envs Map<String,String>
    faasFunctionId String
    The ID of this resource.
    name String
    projectId Double
    projectName String
    regionId Double
    regionName String
    codeText string
    flavor string
    mainMethod string
    Main startup method name
    maxInstances number
    Autoscaling max number of instances
    minInstances number
    Autoscaling min number of instances
    namespace string
    Namespace of the function
    runtime string
    timeout number
    description string
    envs {[key: string]: string}
    faasFunctionId string
    The ID of this resource.
    name string
    projectId number
    projectName string
    regionId number
    regionName string
    code_text str
    flavor str
    main_method str
    Main startup method name
    max_instances float
    Autoscaling max number of instances
    min_instances float
    Autoscaling min number of instances
    namespace str
    Namespace of the function
    runtime str
    timeout float
    description str
    envs Mapping[str, str]
    faas_function_id str
    The ID of this resource.
    name str
    project_id float
    project_name str
    region_id float
    region_name str
    codeText String
    flavor String
    mainMethod String
    Main startup method name
    maxInstances Number
    Autoscaling max number of instances
    minInstances Number
    Autoscaling min number of instances
    namespace String
    Namespace of the function
    runtime String
    timeout Number
    description String
    envs Map<String>
    faasFunctionId String
    The ID of this resource.
    name String
    projectId Number
    projectName String
    regionId Number
    regionName String

    Outputs

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

    BuildMessage string
    BuildStatus string
    CreatedAt string
    DeployStatus Dictionary<string, double>
    Endpoint string
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    BuildMessage string
    BuildStatus string
    CreatedAt string
    DeployStatus map[string]float64
    Endpoint string
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    buildMessage String
    buildStatus String
    createdAt String
    deployStatus Map<String,Double>
    endpoint String
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    buildMessage string
    buildStatus string
    createdAt string
    deployStatus {[key: string]: number}
    endpoint string
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    build_message str
    build_status str
    created_at str
    deploy_status Mapping[str, float]
    endpoint str
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    buildMessage String
    buildStatus String
    createdAt String
    deployStatus Map<Number>
    endpoint String
    id String
    The provider-assigned unique ID for this managed resource.
    status String

    Look up Existing FaasFunction Resource

    Get an existing FaasFunction 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?: FaasFunctionState, opts?: CustomResourceOptions): FaasFunction
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            build_message: Optional[str] = None,
            build_status: Optional[str] = None,
            code_text: Optional[str] = None,
            created_at: Optional[str] = None,
            deploy_status: Optional[Mapping[str, float]] = None,
            description: Optional[str] = None,
            endpoint: Optional[str] = None,
            envs: Optional[Mapping[str, str]] = None,
            faas_function_id: Optional[str] = None,
            flavor: Optional[str] = None,
            main_method: Optional[str] = None,
            max_instances: Optional[float] = None,
            min_instances: Optional[float] = None,
            name: Optional[str] = None,
            namespace: Optional[str] = None,
            project_id: Optional[float] = None,
            project_name: Optional[str] = None,
            region_id: Optional[float] = None,
            region_name: Optional[str] = None,
            runtime: Optional[str] = None,
            status: Optional[str] = None,
            timeout: Optional[float] = None) -> FaasFunction
    func GetFaasFunction(ctx *Context, name string, id IDInput, state *FaasFunctionState, opts ...ResourceOption) (*FaasFunction, error)
    public static FaasFunction Get(string name, Input<string> id, FaasFunctionState? state, CustomResourceOptions? opts = null)
    public static FaasFunction get(String name, Output<String> id, FaasFunctionState state, CustomResourceOptions options)
    resources:  _:    type: gcorelabs:FaasFunction    get:      id: ${id}
    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:
    BuildMessage string
    BuildStatus string
    CodeText string
    CreatedAt string
    DeployStatus Dictionary<string, double>
    Description string
    Endpoint string
    Envs Dictionary<string, string>
    FaasFunctionId string
    The ID of this resource.
    Flavor string
    MainMethod string
    Main startup method name
    MaxInstances double
    Autoscaling max number of instances
    MinInstances double
    Autoscaling min number of instances
    Name string
    Namespace string
    Namespace of the function
    ProjectId double
    ProjectName string
    RegionId double
    RegionName string
    Runtime string
    Status string
    Timeout double
    BuildMessage string
    BuildStatus string
    CodeText string
    CreatedAt string
    DeployStatus map[string]float64
    Description string
    Endpoint string
    Envs map[string]string
    FaasFunctionId string
    The ID of this resource.
    Flavor string
    MainMethod string
    Main startup method name
    MaxInstances float64
    Autoscaling max number of instances
    MinInstances float64
    Autoscaling min number of instances
    Name string
    Namespace string
    Namespace of the function
    ProjectId float64
    ProjectName string
    RegionId float64
    RegionName string
    Runtime string
    Status string
    Timeout float64
    buildMessage String
    buildStatus String
    codeText String
    createdAt String
    deployStatus Map<String,Double>
    description String
    endpoint String
    envs Map<String,String>
    faasFunctionId String
    The ID of this resource.
    flavor String
    mainMethod String
    Main startup method name
    maxInstances Double
    Autoscaling max number of instances
    minInstances Double
    Autoscaling min number of instances
    name String
    namespace String
    Namespace of the function
    projectId Double
    projectName String
    regionId Double
    regionName String
    runtime String
    status String
    timeout Double
    buildMessage string
    buildStatus string
    codeText string
    createdAt string
    deployStatus {[key: string]: number}
    description string
    endpoint string
    envs {[key: string]: string}
    faasFunctionId string
    The ID of this resource.
    flavor string
    mainMethod string
    Main startup method name
    maxInstances number
    Autoscaling max number of instances
    minInstances number
    Autoscaling min number of instances
    name string
    namespace string
    Namespace of the function
    projectId number
    projectName string
    regionId number
    regionName string
    runtime string
    status string
    timeout number
    build_message str
    build_status str
    code_text str
    created_at str
    deploy_status Mapping[str, float]
    description str
    endpoint str
    envs Mapping[str, str]
    faas_function_id str
    The ID of this resource.
    flavor str
    main_method str
    Main startup method name
    max_instances float
    Autoscaling max number of instances
    min_instances float
    Autoscaling min number of instances
    name str
    namespace str
    Namespace of the function
    project_id float
    project_name str
    region_id float
    region_name str
    runtime str
    status str
    timeout float
    buildMessage String
    buildStatus String
    codeText String
    createdAt String
    deployStatus Map<Number>
    description String
    endpoint String
    envs Map<String>
    faasFunctionId String
    The ID of this resource.
    flavor String
    mainMethod String
    Main startup method name
    maxInstances Number
    Autoscaling max number of instances
    minInstances Number
    Autoscaling min number of instances
    name String
    namespace String
    Namespace of the function
    projectId Number
    projectName String
    regionId Number
    regionName String
    runtime String
    status String
    timeout Number

    Import

    import using <project_id>:<region_id>:<namespace_name><function_name> format

    $ pulumi import gcorelabs:index/faasFunction:FaasFunction test 1:6:ns:test_func
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    gcorelabs g-core/terraform-provider-gcorelabs
    License
    Notes
    This Pulumi package is based on the gcorelabs Terraform Provider.
    gcorelabs logo
    gcorelabs 0.3.63 published on Monday, Apr 14, 2025 by g-core