gcorelabs.FaasFunction
Explore with Pulumi AI
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:
- Code
Text string - Flavor string
- Main
Method string - Main startup method name
- Max
Instances double - Autoscaling max number of instances
- Min
Instances double - Autoscaling min number of instances
- Namespace string
- Namespace of the function
- Runtime string
- Timeout double
- Description string
- Envs Dictionary<string, string>
- Faas
Function stringId - The ID of this resource.
- Name string
- Project
Id double - Project
Name string - Region
Id double - Region
Name string
- Code
Text string - Flavor string
- Main
Method string - Main startup method name
- Max
Instances float64 - Autoscaling max number of instances
- Min
Instances float64 - Autoscaling min number of instances
- Namespace string
- Namespace of the function
- Runtime string
- Timeout float64
- Description string
- Envs map[string]string
- Faas
Function stringId - The ID of this resource.
- Name string
- Project
Id float64 - Project
Name string - Region
Id float64 - Region
Name string
- code
Text String - flavor String
- main
Method String - Main startup method name
- max
Instances Double - Autoscaling max number of instances
- min
Instances Double - Autoscaling min number of instances
- namespace String
- Namespace of the function
- runtime String
- timeout Double
- description String
- envs Map<String,String>
- faas
Function StringId - The ID of this resource.
- name String
- project
Id Double - project
Name String - region
Id Double - region
Name String
- code
Text string - flavor string
- main
Method string - Main startup method name
- max
Instances number - Autoscaling max number of instances
- min
Instances number - Autoscaling min number of instances
- namespace string
- Namespace of the function
- runtime string
- timeout number
- description string
- envs {[key: string]: string}
- faas
Function stringId - The ID of this resource.
- name string
- project
Id number - project
Name string - region
Id number - region
Name 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_ strid - The ID of this resource.
- name str
- project_
id float - project_
name str - region_
id float - region_
name str
- code
Text String - flavor String
- main
Method String - Main startup method name
- max
Instances Number - Autoscaling max number of instances
- min
Instances Number - Autoscaling min number of instances
- namespace String
- Namespace of the function
- runtime String
- timeout Number
- description String
- envs Map<String>
- faas
Function StringId - The ID of this resource.
- name String
- project
Id Number - project
Name String - region
Id Number - region
Name String
Outputs
All input properties are implicitly available as output properties. Additionally, the FaasFunction resource produces the following output properties:
- Build
Message string - Build
Status string - Created
At string - Deploy
Status Dictionary<string, double> - Endpoint string
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- Build
Message string - Build
Status string - Created
At string - Deploy
Status map[string]float64 - Endpoint string
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- build
Message String - build
Status String - created
At String - deploy
Status Map<String,Double> - endpoint String
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- build
Message string - build
Status string - created
At string - deploy
Status {[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
- build
Message String - build
Status String - created
At String - deploy
Status 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.
- Build
Message string - Build
Status string - Code
Text string - Created
At string - Deploy
Status Dictionary<string, double> - Description string
- Endpoint string
- Envs Dictionary<string, string>
- Faas
Function stringId - The ID of this resource.
- Flavor string
- Main
Method string - Main startup method name
- Max
Instances double - Autoscaling max number of instances
- Min
Instances double - Autoscaling min number of instances
- Name string
- Namespace string
- Namespace of the function
- Project
Id double - Project
Name string - Region
Id double - Region
Name string - Runtime string
- Status string
- Timeout double
- Build
Message string - Build
Status string - Code
Text string - Created
At string - Deploy
Status map[string]float64 - Description string
- Endpoint string
- Envs map[string]string
- Faas
Function stringId - The ID of this resource.
- Flavor string
- Main
Method string - Main startup method name
- Max
Instances float64 - Autoscaling max number of instances
- Min
Instances float64 - Autoscaling min number of instances
- Name string
- Namespace string
- Namespace of the function
- Project
Id float64 - Project
Name string - Region
Id float64 - Region
Name string - Runtime string
- Status string
- Timeout float64
- build
Message String - build
Status String - code
Text String - created
At String - deploy
Status Map<String,Double> - description String
- endpoint String
- envs Map<String,String>
- faas
Function StringId - The ID of this resource.
- flavor String
- main
Method String - Main startup method name
- max
Instances Double - Autoscaling max number of instances
- min
Instances Double - Autoscaling min number of instances
- name String
- namespace String
- Namespace of the function
- project
Id Double - project
Name String - region
Id Double - region
Name String - runtime String
- status String
- timeout Double
- build
Message string - build
Status string - code
Text string - created
At string - deploy
Status {[key: string]: number} - description string
- endpoint string
- envs {[key: string]: string}
- faas
Function stringId - The ID of this resource.
- flavor string
- main
Method string - Main startup method name
- max
Instances number - Autoscaling max number of instances
- min
Instances number - Autoscaling min number of instances
- name string
- namespace string
- Namespace of the function
- project
Id number - project
Name string - region
Id number - region
Name 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_ strid - 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
- build
Message String - build
Status String - code
Text String - created
At String - deploy
Status Map<Number> - description String
- endpoint String
- envs Map<String>
- faas
Function StringId - The ID of this resource.
- flavor String
- main
Method String - Main startup method name
- max
Instances Number - Autoscaling max number of instances
- min
Instances Number - Autoscaling min number of instances
- name String
- namespace String
- Namespace of the function
- project
Id Number - project
Name String - region
Id Number - region
Name 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.