Skip to content

Function

This class encapsulates and extends the ROS resource type ALIYUN::FC3::Function, which is used to create a Function Compute 3.0 function.

Initializers

import com.aliyun.ros.cdk.fc3.Function;
Function.Builder.create(Construct scope, java.lang.String id, java.lang.Boolean enableResourcePropertyConstraint)
    .functionName(java.lang.String)
    .functionName(IResolvable)
    .handler(java.lang.String)
    .handler(IResolvable)
    .runtime(java.lang.String)
    .runtime(IResolvable)
//  .code(IResolvable)
//  .code(CodeProperty)
//  .cpu(java.lang.Number)
//  .cpu(IResolvable)
//  .customContainerConfig(IResolvable)
//  .customContainerConfig(CustomContainerConfigProperty)
//  .customDns(IResolvable)
//  .customDns(CustomDnsProperty)
//  .customRuntimeConfig(IResolvable)
//  .customRuntimeConfig(CustomRuntimeConfigProperty)
//  .description(java.lang.String)
//  .description(IResolvable)
//  .disableOndemand(java.lang.Boolean)
//  .disableOndemand(IResolvable)
//  .diskSize(java.lang.Number)
//  .diskSize(IResolvable)
//  .environmentVariables(IResolvable)
//  .environmentVariables(java.util.Map<java.lang.String, java.lang.Object>)
//  .gpuConfig(IResolvable)
//  .gpuConfig(GpuConfigProperty)
//  .instanceConcurrency(java.lang.Number)
//  .instanceConcurrency(IResolvable)
//  .instanceIsolationMode(java.lang.String)
//  .instanceIsolationMode(IResolvable)
//  .instanceLifecycleConfig(IResolvable)
//  .instanceLifecycleConfig(InstanceLifecycleConfigProperty)
//  .internetAccess(java.lang.Boolean)
//  .internetAccess(IResolvable)
//  .layers(IResolvable)
//  .layers(java.util.List<java.lang.String)
//  .layers(IResolvable>)
//  .logConfig(IResolvable)
//  .logConfig(LogConfigProperty)
//  .memorySize(java.lang.Number)
//  .memorySize(IResolvable)
//  .nasConfig(IResolvable)
//  .nasConfig(NasConfigProperty)
//  .ossMountConfig(IResolvable)
//  .ossMountConfig(OssMountConfigProperty)
//  .role(java.lang.String)
//  .role(IResolvable)
//  .sessionAffinity(java.lang.String)
//  .sessionAffinity(IResolvable)
//  .sessionAffinityConfig(IResolvable)
//  .sessionAffinityConfig(java.util.Map<java.lang.String, java.lang.Object>)
//  .tags(java.util.List<TagsProperty>)
//  .timeout(java.lang.Number)
//  .timeout(IResolvable)
//  .tracingConfig(IResolvable)
//  .tracingConfig(TracingConfigProperty)
//  .vpcConfig(IResolvable)
//  .vpcConfig(VpcConfigProperty)
    .build();
Name Type Description
scope com.aliyun.ros.cdk.core.Construct No description.
id java.lang.String No description.
enableResourcePropertyConstraint java.lang.Boolean No description.
functionName java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property functionName: The name of the function.
handler java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property handler: The handler of the function.
runtime java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property runtime: The programming language of the function.
code com.aliyun.ros.cdk.core.IResolvable OR CodeProperty Property code: Function code ZIP package.
cpu java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property cpu: The CPU size of the function in vCPU as a multiple of 0.05 vCPU. The minimum value is 0.05 and the maximum value is 16. At the same time, the ratio of cpu to memorySize (in GB) should be between 1:1 and 1:4.
customContainerConfig com.aliyun.ros.cdk.core.IResolvable OR CustomContainerConfigProperty Property customContainerConfig: Custom container configuration.
customDns com.aliyun.ros.cdk.core.IResolvable OR CustomDnsProperty Property customDns: Custom DNS configuration.
customRuntimeConfig com.aliyun.ros.cdk.core.IResolvable OR CustomRuntimeConfigProperty Property customRuntimeConfig: Custom runtime configuration.
description java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property description: Function description.
disableOndemand java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable Property disableOndemand: Whether to disable the creation of on-demand instances.
diskSize java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property diskSize: The disk size of the function, in MB.
environmentVariables com.aliyun.ros.cdk.core.IResolvable OR java.util.Map Property environmentVariables: The environment variables of the function.
gpuConfig com.aliyun.ros.cdk.core.IResolvable OR GpuConfigProperty Property gpuConfig: The GPU configuration of the function.
instanceConcurrency java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property instanceConcurrency: The maximum number of concurrent instances of the function.
instanceIsolationMode java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property instanceIsolationMode: Instance isolation mode.
instanceLifecycleConfig com.aliyun.ros.cdk.core.IResolvable OR InstanceLifecycleConfigProperty Property instanceLifecycleConfig: The instance lifecycle configuration of the function.
internetAccess java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable Property internetAccess: Whether the function can access the Internet.
layers com.aliyun.ros.cdk.core.IResolvable OR java.util.List Property layers: The layers of the function.
logConfig com.aliyun.ros.cdk.core.IResolvable OR LogConfigProperty Property logConfig: The log configuration of the function.
memorySize java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property memorySize: The memory size of the function, in MB.
nasConfig com.aliyun.ros.cdk.core.IResolvable OR NasConfigProperty Property nasConfig: The NAS configuration of the function.
ossMountConfig com.aliyun.ros.cdk.core.IResolvable OR OssMountConfigProperty Property ossMountConfig: The OSS mount configuration of the function.
role java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property role: The user is authorized to the RAM role of Function Compute.
sessionAffinity java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property sessionAffinity: The session affinity policy for Function Compute requests.
sessionAffinityConfig com.aliyun.ros.cdk.core.IResolvable OR java.util.Map Property sessionAffinityConfig: Session affinity configuration.
tags java.util.List<TagsProperty> Property tags: Tags to attach to function.
timeout java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property timeout: The timeout of the function.
tracingConfig com.aliyun.ros.cdk.core.IResolvable OR TracingConfigProperty Property tracingConfig: The tracing configuration of the function.
vpcConfig com.aliyun.ros.cdk.core.IResolvable OR VpcConfigProperty Property vpcConfig: The VPC configuration of the function.

scopeRequired

  • Type: com.aliyun.ros.cdk.core.Construct

idRequired

  • Type: java.lang.String

enableResourcePropertyConstraintOptional

  • Type: java.lang.Boolean

functionNameRequired

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property functionName: The name of the function.


handlerRequired

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property handler: The handler of the function.


runtimeRequired

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property runtime: The programming language of the function.


codeOptional

Property code: Function code ZIP package.

Choose one of Code and CustomContainerConfig.


cpuOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property cpu: The CPU size of the function in vCPU as a multiple of 0.05 vCPU. The minimum value is 0.05 and the maximum value is 16. At the same time, the ratio of cpu to memorySize (in GB) should be between 1:1 and 1:4.


customContainerConfigOptional

Property customContainerConfig: Custom container configuration.

Choose one of Code and CustomContainerConfig.


customDnsOptional

Property customDns: Custom DNS configuration.


customRuntimeConfigOptional

Property customRuntimeConfig: Custom runtime configuration.


descriptionOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property description: Function description.


disableOndemandOptional

  • Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable

Property disableOndemand: Whether to disable the creation of on-demand instances.

When enabled, on-demand instances will not be created, and only reserved instances can be used.


diskSizeOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property diskSize: The disk size of the function, in MB.


environmentVariablesOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.Map

Property environmentVariables: The environment variables of the function.


gpuConfigOptional

Property gpuConfig: The GPU configuration of the function.


instanceConcurrencyOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property instanceConcurrency: The maximum number of concurrent instances of the function.


instanceIsolationModeOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property instanceIsolationMode: Instance isolation mode.


instanceLifecycleConfigOptional

Property instanceLifecycleConfig: The instance lifecycle configuration of the function.


internetAccessOptional

  • Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable

Property internetAccess: Whether the function can access the Internet.


layersOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List

Property layers: The layers of the function.


logConfigOptional

Property logConfig: The log configuration of the function.


memorySizeOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property memorySize: The memory size of the function, in MB.


nasConfigOptional

Property nasConfig: The NAS configuration of the function.


ossMountConfigOptional

Property ossMountConfig: The OSS mount configuration of the function.


roleOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property role: The user is authorized to the RAM role of Function Compute.

After setting, Function Compute will assume the role and generate temporary access credentials. The temporary access credentials of this role can be used in functions to access specified Alibaba Cloud services, such as OSS and OTS.


sessionAffinityOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property sessionAffinity: The session affinity policy for Function Compute requests.

Set to MCP_SSE to implement MCP SSE protocol request affinity. Set to GENERATED_COOKIE for cookie-based affinity. Set to HEADER_FIELD for header-based affinity. If not set or set to NONE, there is no affinity effect, and requests are routed according to the default scheduling policy of Function Compute.


sessionAffinityConfigOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.Map

Property sessionAffinityConfig: Session affinity configuration.


tagsOptional

Property tags: Tags to attach to function.

Max support 20 tags to add during create function. Each tag with two properties Key and Value, and Key is required.


timeoutOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property timeout: The timeout of the function.


tracingConfigOptional

Property tracingConfig: The tracing configuration of the function.


vpcConfigOptional

Property vpcConfig: The VPC configuration of the function.


Methods

Name Description
toString Returns a string representation of this construct.
synthesize Allows this construct to emit artifacts into the cloud assembly during synthesis.
addCondition No description.
addCount No description.
addDependency No description.
addResourceDesc No description.
applyRemovalPolicy No description.
fetchCondition No description.
fetchDependency No description.
fetchResourceDesc No description.
getAtt No description.
setMetadata No description.

toString

public java.lang.String toString()

Returns a string representation of this construct.

synthesize

public void synthesize(ISynthesisSession session)

Allows this construct to emit artifacts into the cloud assembly during synthesis.

This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

sessionRequired

  • Type: com.aliyun.ros.cdk.core.ISynthesisSession

The synthesis session.


addCondition

public void addCondition(RosCondition condition)

conditionRequired

  • Type: com.aliyun.ros.cdk.core.RosCondition

addCount

public void addCount(java.lang.Number OR IResolvable count)

countRequired

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

addDependency

public void addDependency(Resource resource)

resourceRequired

  • Type: com.aliyun.ros.cdk.core.Resource

addResourceDesc

public void addResourceDesc(java.lang.String desc)

descRequired

  • Type: java.lang.String

applyRemovalPolicy

public void applyRemovalPolicy(RemovalPolicy policy)

policyRequired

  • Type: com.aliyun.ros.cdk.core.RemovalPolicy

fetchCondition

public RosCondition fetchCondition()

fetchDependency

public java.util.List<java.lang.String> fetchDependency()

fetchResourceDesc

public java.lang.String fetchResourceDesc()

getAtt

public IResolvable getAtt(java.lang.String name)

nameRequired

  • Type: java.lang.String

setMetadata

public void setMetadata(java.lang.String key, java.lang.Object value)

keyRequired

  • Type: java.lang.String

valueRequired

  • Type: java.lang.Object

Static Functions

Name Description
isConstruct Return whether the given object is a Construct.

isConstruct

import com.aliyun.ros.cdk.fc3.Function;
Function.isConstruct(java.lang.Object x)

Return whether the given object is a Construct.

xRequired

  • Type: java.lang.Object

Properties

Name Type Description
node com.aliyun.ros.cdk.core.ConstructNode The construct tree node associated with this construct.
env com.aliyun.ros.cdk.core.IResourceEnvironment The environment this resource belongs to.
ref java.lang.String No description.
stack com.aliyun.ros.cdk.core.Stack The stack in which this resource is defined.
resource com.aliyun.ros.cdk.core.RosResource No description.
attrArn java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Attribute ARN: The ARN for ALIYUN::ROS::CustomResource.
attrFunctionId java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Attribute FunctionId: The function ID.
attrFunctionName java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Attribute FunctionName: The function name.
props FunctionProps No description.

nodeRequired

public ConstructNode getNode();
  • Type: com.aliyun.ros.cdk.core.ConstructNode

The construct tree node associated with this construct.


envRequired

public IResourceEnvironment getEnv();
  • Type: com.aliyun.ros.cdk.core.IResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


refRequired

public java.lang.String getRef();
  • Type: java.lang.String

stackRequired

public Stack getStack();
  • Type: com.aliyun.ros.cdk.core.Stack

The stack in which this resource is defined.


resourceOptional

public RosResource getResource();
  • Type: com.aliyun.ros.cdk.core.RosResource

attrArnRequired

public java.lang.Object getAttrArn();
  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Attribute ARN: The ARN for ALIYUN::ROS::CustomResource.


attrFunctionIdRequired

public java.lang.Object getAttrFunctionId();
  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Attribute FunctionId: The function ID.


attrFunctionNameRequired

public java.lang.Object getAttrFunctionName();
  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Attribute FunctionName: The function name.


propsRequired

public FunctionProps getProps();