Function
- Implements: IFunction
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 ros_cdk_fc3
ros_cdk_fc3.Function(
scope: Construct,
id: str,
function_name: typing.Union[str, IResolvable],
handler: typing.Union[str, IResolvable],
runtime: typing.Union[str, IResolvable],
code: typing.Union[IResolvable, CodeProperty] = None,
cpu: typing.Union[typing.Union[int, float], IResolvable] = None,
custom_container_config: typing.Union[IResolvable, CustomContainerConfigProperty] = None,
custom_dns: typing.Union[IResolvable, CustomDnsProperty] = None,
custom_runtime_config: typing.Union[IResolvable, CustomRuntimeConfigProperty] = None,
description: typing.Union[str, IResolvable] = None,
disable_ondemand: typing.Union[bool, IResolvable] = None,
disk_size: typing.Union[typing.Union[int, float], IResolvable] = None,
environment_variables: typing.Union[IResolvable, typing.Mapping[typing.Any]] = None,
gpu_config: typing.Union[IResolvable, GpuConfigProperty] = None,
instance_concurrency: typing.Union[typing.Union[int, float], IResolvable] = None,
instance_isolation_mode: typing.Union[str, IResolvable] = None,
instance_lifecycle_config: typing.Union[IResolvable, InstanceLifecycleConfigProperty] = None,
internet_access: typing.Union[bool, IResolvable] = None,
layers: typing.Union[IResolvable, typing.List[typing.Union[str, IResolvable]]] = None,
log_config: typing.Union[IResolvable, LogConfigProperty] = None,
memory_size: typing.Union[typing.Union[int, float], IResolvable] = None,
nas_config: typing.Union[IResolvable, NasConfigProperty] = None,
oss_mount_config: typing.Union[IResolvable, OssMountConfigProperty] = None,
role: typing.Union[str, IResolvable] = None,
session_affinity: typing.Union[str, IResolvable] = None,
session_affinity_config: typing.Union[IResolvable, typing.Mapping[typing.Any]] = None,
tags: typing.List[TagsProperty] = None,
timeout: typing.Union[typing.Union[int, float], IResolvable] = None,
tracing_config: typing.Union[IResolvable, TracingConfigProperty] = None,
vpc_config: typing.Union[IResolvable, VpcConfigProperty] = None,
enable_resource_property_constraint: bool = None
)
| Name | Type | Description |
|---|---|---|
scope | ros_cdk_core.Construct | No description. |
id | str | No description. |
function_name | typing.Union[str, ros_cdk_core.IResolvable] | Property functionName: The name of the function. |
handler | typing.Union[str, ros_cdk_core.IResolvable] | Property handler: The handler of the function. |
runtime | typing.Union[str, ros_cdk_core.IResolvable] | Property runtime: The programming language of the function. |
code | typing.Union[ros_cdk_core.IResolvable, CodeProperty] | Property code: Function code ZIP package. |
cpu | typing.Union[typing.Union[int, float], 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. |
custom_container_config | typing.Union[ros_cdk_core.IResolvable, CustomContainerConfigProperty] | Property customContainerConfig: Custom container configuration. |
custom_dns | typing.Union[ros_cdk_core.IResolvable, CustomDnsProperty] | Property customDns: Custom DNS configuration. |
custom_runtime_config | typing.Union[ros_cdk_core.IResolvable, CustomRuntimeConfigProperty] | Property customRuntimeConfig: Custom runtime configuration. |
description | typing.Union[str, ros_cdk_core.IResolvable] | Property description: Function description. |
disable_ondemand | typing.Union[bool, ros_cdk_core.IResolvable] | Property disableOndemand: Whether to disable the creation of on-demand instances. |
disk_size | typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] | Property diskSize: The disk size of the function, in MB. |
environment_variables | typing.Union[ros_cdk_core.IResolvable, typing.Mapping[typing.Any]] | Property environmentVariables: The environment variables of the function. |
gpu_config | typing.Union[ros_cdk_core.IResolvable, GpuConfigProperty] | Property gpuConfig: The GPU configuration of the function. |
instance_concurrency | typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] | Property instanceConcurrency: The maximum number of concurrent instances of the function. |
instance_isolation_mode | typing.Union[str, ros_cdk_core.IResolvable] | Property instanceIsolationMode: Instance isolation mode. |
instance_lifecycle_config | typing.Union[ros_cdk_core.IResolvable, InstanceLifecycleConfigProperty] | Property instanceLifecycleConfig: The instance lifecycle configuration of the function. |
internet_access | typing.Union[bool, ros_cdk_core.IResolvable] | Property internetAccess: Whether the function can access the Internet. |
layers | typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[str, ros_cdk_core.IResolvable]]] | Property layers: The layers of the function. |
log_config | typing.Union[ros_cdk_core.IResolvable, LogConfigProperty] | Property logConfig: The log configuration of the function. |
memory_size | typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] | Property memorySize: The memory size of the function, in MB. |
nas_config | typing.Union[ros_cdk_core.IResolvable, NasConfigProperty] | Property nasConfig: The NAS configuration of the function. |
oss_mount_config | typing.Union[ros_cdk_core.IResolvable, OssMountConfigProperty] | Property ossMountConfig: The OSS mount configuration of the function. |
role | typing.Union[str, ros_cdk_core.IResolvable] | Property role: The user is authorized to the RAM role of Function Compute. |
session_affinity | typing.Union[str, ros_cdk_core.IResolvable] | Property sessionAffinity: The session affinity policy for Function Compute requests. |
session_affinity_config | typing.Union[ros_cdk_core.IResolvable, typing.Mapping[typing.Any]] | Property sessionAffinityConfig: Session affinity configuration. |
tags | typing.List[TagsProperty] | Property tags: Tags to attach to function. |
timeout | typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] | Property timeout: The timeout of the function. |
tracing_config | typing.Union[ros_cdk_core.IResolvable, TracingConfigProperty] | Property tracingConfig: The tracing configuration of the function. |
vpc_config | typing.Union[ros_cdk_core.IResolvable, VpcConfigProperty] | Property vpcConfig: The VPC configuration of the function. |
enable_resource_property_constraint | bool | No description. |
scopeRequired
- Type: ros_cdk_core.Construct
idRequired
- Type: str
function_nameRequired
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property functionName: The name of the function.
handlerRequired
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property handler: The handler of the function.
runtimeRequired
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property runtime: The programming language of the function.
codeOptional
- Type: typing.Union[ros_cdk_core.IResolvable, CodeProperty]
Property code: Function code ZIP package.
Choose one of Code and CustomContainerConfig.
cpuOptional
- Type: typing.Union[typing.Union[int, float], 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.
custom_container_configOptional
- Type: typing.Union[ros_cdk_core.IResolvable, CustomContainerConfigProperty]
Property customContainerConfig: Custom container configuration.
Choose one of Code and CustomContainerConfig.
custom_dnsOptional
- Type: typing.Union[ros_cdk_core.IResolvable, CustomDnsProperty]
Property customDns: Custom DNS configuration.
custom_runtime_configOptional
- Type: typing.Union[ros_cdk_core.IResolvable, CustomRuntimeConfigProperty]
Property customRuntimeConfig: Custom runtime configuration.
descriptionOptional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property description: Function description.
disable_ondemandOptional
- Type: typing.Union[bool, 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.
disk_sizeOptional
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property diskSize: The disk size of the function, in MB.
environment_variablesOptional
- Type: typing.Union[ros_cdk_core.IResolvable, typing.Mapping[typing.Any]]
Property environmentVariables: The environment variables of the function.
gpu_configOptional
- Type: typing.Union[ros_cdk_core.IResolvable, GpuConfigProperty]
Property gpuConfig: The GPU configuration of the function.
instance_concurrencyOptional
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property instanceConcurrency: The maximum number of concurrent instances of the function.
instance_isolation_modeOptional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property instanceIsolationMode: Instance isolation mode.
instance_lifecycle_configOptional
- Type: typing.Union[ros_cdk_core.IResolvable, InstanceLifecycleConfigProperty]
Property instanceLifecycleConfig: The instance lifecycle configuration of the function.
internet_accessOptional
- Type: typing.Union[bool, ros_cdk_core.IResolvable]
Property internetAccess: Whether the function can access the Internet.
layersOptional
- Type: typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[str, ros_cdk_core.IResolvable]]]
Property layers: The layers of the function.
log_configOptional
- Type: typing.Union[ros_cdk_core.IResolvable, LogConfigProperty]
Property logConfig: The log configuration of the function.
memory_sizeOptional
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property memorySize: The memory size of the function, in MB.
nas_configOptional
- Type: typing.Union[ros_cdk_core.IResolvable, NasConfigProperty]
Property nasConfig: The NAS configuration of the function.
oss_mount_configOptional
- Type: typing.Union[ros_cdk_core.IResolvable, OssMountConfigProperty]
Property ossMountConfig: The OSS mount configuration of the function.
roleOptional
- Type: typing.Union[str, 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.
session_affinityOptional
- Type: typing.Union[str, 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.
session_affinity_configOptional
- Type: typing.Union[ros_cdk_core.IResolvable, typing.Mapping[typing.Any]]
Property sessionAffinityConfig: Session affinity configuration.
tagsOptional
- Type: typing.List[TagsProperty]
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: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property timeout: The timeout of the function.
tracing_configOptional
- Type: typing.Union[ros_cdk_core.IResolvable, TracingConfigProperty]
Property tracingConfig: The tracing configuration of the function.
vpc_configOptional
- Type: typing.Union[ros_cdk_core.IResolvable, VpcConfigProperty]
Property vpcConfig: The VPC configuration of the function.
enable_resource_property_constraintOptional
- Type: bool
Methods
| Name | Description |
|---|---|
to_string | Returns a string representation of this construct. |
synthesize | Allows this construct to emit artifacts into the cloud assembly during synthesis. |
add_condition | No description. |
add_count | No description. |
add_dependency | No description. |
add_resource_desc | No description. |
apply_removal_policy | No description. |
fetch_condition | No description. |
fetch_dependency | No description. |
fetch_resource_desc | No description. |
get_att | No description. |
set_metadata | No description. |
to_string
def to_string() -> str
Returns a string representation of this construct.
synthesize
def synthesize(
session: ISynthesisSession
) -> None
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.
- Type: ros_cdk_core.ISynthesisSession
The synthesis session.
add_condition
def add_condition(
condition: RosCondition
) -> None
- Type: ros_cdk_core.RosCondition
add_count
def add_count(
count: typing.Union[typing.Union[int, float], IResolvable]
) -> None
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
add_dependency
def add_dependency(
resource: Resource
) -> None
- Type: ros_cdk_core.Resource
add_resource_desc
def add_resource_desc(
desc: str
) -> None
- Type: str
apply_removal_policy
def apply_removal_policy(
policy: RemovalPolicy
) -> None
- Type: ros_cdk_core.RemovalPolicy
fetch_condition
def fetch_condition() -> RosCondition
fetch_dependency
def fetch_dependency() -> typing.List[str]
fetch_resource_desc
def fetch_resource_desc() -> str
get_att
def get_att(
name: str
) -> IResolvable
- Type: str
set_metadata
def set_metadata(
key: str,
value: typing.Any
) -> None
- Type: str
- Type: typing.Any
Static Functions
| Name | Description |
|---|---|
is_construct | Return whether the given object is a Construct. |
is_construct
import ros_cdk_fc3
ros_cdk_fc3.Function.is_construct(
x: typing.Any
)
Return whether the given object is a Construct.
- Type: typing.Any
Properties
| Name | Type | Description |
|---|---|---|
node | ros_cdk_core.ConstructNode | The construct tree node associated with this construct. |
env | ros_cdk_core.IResourceEnvironment | The environment this resource belongs to. |
ref | str | No description. |
stack | ros_cdk_core.Stack | The stack in which this resource is defined. |
resource | ros_cdk_core.RosResource | No description. |
attr_arn | typing.Union[str, ros_cdk_core.IResolvable] | Attribute ARN: The ARN for ALIYUN::ROS::CustomResource. |
attr_function_id | typing.Union[str, ros_cdk_core.IResolvable] | Attribute FunctionId: The function ID. |
attr_function_name | typing.Union[str, ros_cdk_core.IResolvable] | Attribute FunctionName: The function name. |
props | FunctionProps | No description. |
nodeRequired
node: ConstructNode
- Type: ros_cdk_core.ConstructNode
The construct tree node associated with this construct.
envRequired
env: IResourceEnvironment
- Type: 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
ref: str
- Type: str
stackRequired
stack: Stack
- Type: ros_cdk_core.Stack
The stack in which this resource is defined.
resourceOptional
resource: RosResource
- Type: ros_cdk_core.RosResource
attr_arnRequired
attr_arn: typing.Union[str, IResolvable]
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Attribute ARN: The ARN for ALIYUN::ROS::CustomResource.
attr_function_idRequired
attr_function_id: typing.Union[str, IResolvable]
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Attribute FunctionId: The function ID.
attr_function_nameRequired
attr_function_name: typing.Union[str, IResolvable]
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Attribute FunctionName: The function name.
propsRequired
props: FunctionProps
- Type: FunctionProps