Skip to content

RosFunction

This class is a base encapsulation around the ROS resource type ALIYUN::FC::Function, which is used to create a function.

Functions must be associated with services. All functions of a service share the same attributes as the service, such as service authorization and log configurations.

Initializers

import { RosFunction } from '@alicloud/ros-cdk-fc'
new RosFunction(scope: Construct, id: string, props: RosFunctionProps, enableResourcePropertyConstraint: boolean)
Name Type Description
scope @alicloud/ros-cdk-core.Construct - scope in which this resource is defined.
id string - scoped id of the resource.
props RosFunctionProps - resource properties.
enableResourcePropertyConstraint boolean No description.

scopeRequired

  • Type: @alicloud/ros-cdk-core.Construct

scope in which this resource is defined.


idRequired

  • Type: string

scoped id of the resource.


propsRequired

resource properties.


enableResourcePropertyConstraintRequired

  • Type: boolean

Methods

Name Description
toString Returns a string representation of this construct.
synthesize Allows this construct to emit artifacts into the cloud assembly during synthesis.
overrideLogicalId Overrides the auto-generated logical ID with a specific ID.
addCondition No description.
addCount No description.
addDeletionOverride Syntactic sugar for addOverride(path, undefined).
addDependsOn Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
addDesc No description.
addMetaData No description.
addOverride Adds an override to the synthesized ROS resource.
addPropertyDeletionOverride Adds an override that deletes the value of a property from the resource definition.
addPropertyOverride Adds an override to a resource property.
addRosDependency No description.
applyRemovalPolicy Sets the deletion policy of the resource based on the removal policy specified.
getAtt Returns a token for an runtime attribute of this resource.

toString

public toString(): string

Returns a string representation of this construct.

synthesize

public synthesize(session: ISynthesisSession): void

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: @alicloud/ros-cdk-core.ISynthesisSession

The synthesis session.


overrideLogicalId

public overrideLogicalId(newLogicalId: string): void

Overrides the auto-generated logical ID with a specific ID.

newLogicalIdRequired

  • Type: string

The new logical ID to use for this stack element.


addCondition

public addCondition(con: RosCondition): void

conRequired

  • Type: @alicloud/ros-cdk-core.RosCondition

addCount

public addCount(count: number | IResolvable): void

countRequired

  • Type: number | @alicloud/ros-cdk-core.IResolvable

addDeletionOverride

public addDeletionOverride(path: string): void

Syntactic sugar for addOverride(path, undefined).

pathRequired

  • Type: string

The path of the value to delete.


addDependsOn

public addDependsOn(target: RosResource): void

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

targetRequired

  • Type: @alicloud/ros-cdk-core.RosResource

addDesc

public addDesc(desc: string): void

descRequired

  • Type: string

addMetaData

public addMetaData(key: string, value: any): void

keyRequired

  • Type: string

valueRequired

  • Type: any

addOverride

public addOverride(path: string, value: any): void

Adds an override to the synthesized ROS resource.

To add a property override, either use addPropertyOverride or prefix path with "Properties." (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

For example,

addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute'])
addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE')

would add the overrides

"Properties": {
   "GlobalSecondaryIndexes": [
     {
       "Projection": {
         "NonKeyAttributes": [ "myattribute" ]
         ...
       }
       ...
     },
     {
       "ProjectionType": "INCLUDE"
       ...
     },
   ]
   ...
}

pathRequired

  • Type: string

The path of the property, you can use dot notation to override values in complex types.

Any intermdediate keys will be created as needed.


valueRequired

  • Type: any

The value.

Could be primitive or complex.


addPropertyDeletionOverride

public addPropertyDeletionOverride(propertyPath: string): void

Adds an override that deletes the value of a property from the resource definition.

propertyPathRequired

  • Type: string

The path to the property.


addPropertyOverride

public addPropertyOverride(propertyPath: string, value: any): void

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

propertyPathRequired

  • Type: string

The path of the property.


valueRequired

  • Type: any

The value.


addRosDependency

public addRosDependency(target: string): void

targetRequired

  • Type: string

applyRemovalPolicy

public applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): void

Sets the deletion policy of the resource based on the removal policy specified.

policyOptional

  • Type: @alicloud/ros-cdk-core.RemovalPolicy

optionsOptional

  • Type: @alicloud/ros-cdk-core.RemovalPolicyOptions

getAtt

public getAtt(attributeName: string): Reference

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

attributeNameRequired

  • Type: string

The name of the attribute.


Static Functions

Name Description
isConstruct Return whether the given object is a Construct.
isRosElement Returns true if a construct is a stack element (i.e. part of the synthesized template).
isRosResource Check whether the given construct is a RosResource.

isConstruct

import { RosFunction } from '@alicloud/ros-cdk-fc'
RosFunction.isConstruct(x: any)

Return whether the given object is a Construct.

xRequired

  • Type: any

isRosElement

import { RosFunction } from '@alicloud/ros-cdk-fc'
RosFunction.isRosElement(x: any)

Returns true if a construct is a stack element (i.e. part of the synthesized template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

xRequired

  • Type: any

isRosResource

import { RosFunction } from '@alicloud/ros-cdk-fc'
RosFunction.isRosResource(construct: IConstruct)

Check whether the given construct is a RosResource.

constructRequired

  • Type: @alicloud/ros-cdk-core.IConstruct

Properties

Name Type Description
node @alicloud/ros-cdk-core.ConstructNode The construct tree node associated with this construct.
creationStack string[] No description.
logicalId string The logical ID for this stack element.
stack @alicloud/ros-cdk-core.Stack The stack in which this element is defined.
ref string Return a string that will be resolved to a RosTemplate { Ref } for this element.
rosOptions @alicloud/ros-cdk-core.IRosResourceOptions Options for this resource, such as condition, update policy etc.
rosResourceType string ROS resource type.
attrArn @alicloud/ros-cdk-core.IResolvable No description.
attrFunctionId @alicloud/ros-cdk-core.IResolvable No description.
attrFunctionName @alicloud/ros-cdk-core.IResolvable No description.
attrServiceId @alicloud/ros-cdk-core.IResolvable No description.
attrServiceName @alicloud/ros-cdk-core.IResolvable No description.
enableResourcePropertyConstraint boolean No description.
functionName string | @alicloud/ros-cdk-core.IResolvable No description.
handler string | @alicloud/ros-cdk-core.IResolvable No description.
runtime string | @alicloud/ros-cdk-core.IResolvable No description.
serviceName string | @alicloud/ros-cdk-core.IResolvable No description.
asyncConfiguration @alicloud/ros-cdk-core.IResolvable | AsyncConfigurationProperty No description.
caPort number | @alicloud/ros-cdk-core.IResolvable No description.
code @alicloud/ros-cdk-core.IResolvable | CodeProperty No description.
cpu number | @alicloud/ros-cdk-core.IResolvable No description.
customContainerConfig @alicloud/ros-cdk-core.IResolvable | CustomContainerConfigProperty No description.
customDns @alicloud/ros-cdk-core.IResolvable | CustomDNSProperty No description.
customHealthCheckConfig @alicloud/ros-cdk-core.IResolvable | CustomHealthCheckConfigProperty No description.
customRuntimeConfig @alicloud/ros-cdk-core.IResolvable | CustomRuntimeConfigProperty No description.
description string | @alicloud/ros-cdk-core.IResolvable No description.
diskSize number | @alicloud/ros-cdk-core.IResolvable No description.
environmentVariables @alicloud/ros-cdk-core.IResolvable | {[ key: string ]: any} No description.
gpuMemorySize number | @alicloud/ros-cdk-core.IResolvable No description.
initializationTimeout number | @alicloud/ros-cdk-core.IResolvable No description.
initializer string | @alicloud/ros-cdk-core.IResolvable No description.
instanceConcurrency number | @alicloud/ros-cdk-core.IResolvable No description.
instanceLifecycleConfig @alicloud/ros-cdk-core.IResolvable | InstanceLifecycleConfigProperty No description.
instanceSoftConcurrency number | @alicloud/ros-cdk-core.IResolvable No description.
instanceType string | @alicloud/ros-cdk-core.IResolvable No description.
memorySize number | @alicloud/ros-cdk-core.IResolvable No description.
timeout number | @alicloud/ros-cdk-core.IResolvable No description.

nodeRequired

public readonly node: ConstructNode;
  • Type: @alicloud/ros-cdk-core.ConstructNode

The construct tree node associated with this construct.


creationStackRequired

public readonly creationStack: string[];
  • Type: string[]

logicalIdRequired

public readonly logicalId: string;
  • Type: string

The logical ID for this stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).


stackRequired

public readonly stack: Stack;
  • Type: @alicloud/ros-cdk-core.Stack

The stack in which this element is defined.

RosElements must be defined within a stack scope (directly or indirectly).


refRequired

public readonly ref: string;
  • Type: string

Return a string that will be resolved to a RosTemplate { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).


rosOptionsRequired

public readonly rosOptions: IRosResourceOptions;
  • Type: @alicloud/ros-cdk-core.IRosResourceOptions

Options for this resource, such as condition, update policy etc.


rosResourceTypeRequired

public readonly rosResourceType: string;
  • Type: string

ROS resource type.


attrArnRequired

public readonly attrArn: IResolvable;
  • Type: @alicloud/ros-cdk-core.IResolvable

attrFunctionIdRequired

public readonly attrFunctionId: IResolvable;
  • Type: @alicloud/ros-cdk-core.IResolvable

attrFunctionNameRequired

public readonly attrFunctionName: IResolvable;
  • Type: @alicloud/ros-cdk-core.IResolvable

attrServiceIdRequired

public readonly attrServiceId: IResolvable;
  • Type: @alicloud/ros-cdk-core.IResolvable

attrServiceNameRequired

public readonly attrServiceName: IResolvable;
  • Type: @alicloud/ros-cdk-core.IResolvable

enableResourcePropertyConstraintRequired

public readonly enableResourcePropertyConstraint: boolean;
  • Type: boolean

functionNameRequired

public readonly functionName: string | IResolvable;
  • Type: string | @alicloud/ros-cdk-core.IResolvable

handlerRequired

public readonly handler: string | IResolvable;
  • Type: string | @alicloud/ros-cdk-core.IResolvable

runtimeRequired

public readonly runtime: string | IResolvable;
  • Type: string | @alicloud/ros-cdk-core.IResolvable

serviceNameRequired

public readonly serviceName: string | IResolvable;
  • Type: string | @alicloud/ros-cdk-core.IResolvable

asyncConfigurationOptional

public readonly asyncConfiguration: IResolvable | AsyncConfigurationProperty;

caPortOptional

public readonly caPort: number | IResolvable;
  • Type: number | @alicloud/ros-cdk-core.IResolvable

codeOptional

public readonly code: IResolvable | CodeProperty;

cpuOptional

public readonly cpu: number | IResolvable;
  • Type: number | @alicloud/ros-cdk-core.IResolvable

customContainerConfigOptional

public readonly customContainerConfig: IResolvable | CustomContainerConfigProperty;

customDnsOptional

public readonly customDns: IResolvable | CustomDNSProperty;

customHealthCheckConfigOptional

public readonly customHealthCheckConfig: IResolvable | CustomHealthCheckConfigProperty;

customRuntimeConfigOptional

public readonly customRuntimeConfig: IResolvable | CustomRuntimeConfigProperty;

descriptionOptional

public readonly description: string | IResolvable;
  • Type: string | @alicloud/ros-cdk-core.IResolvable

diskSizeOptional

public readonly diskSize: number | IResolvable;
  • Type: number | @alicloud/ros-cdk-core.IResolvable

environmentVariablesOptional

public readonly environmentVariables: IResolvable | {[ key: string ]: any};
  • Type: @alicloud/ros-cdk-core.IResolvable | {[ key: string ]: any}

gpuMemorySizeOptional

public readonly gpuMemorySize: number | IResolvable;
  • Type: number | @alicloud/ros-cdk-core.IResolvable

initializationTimeoutOptional

public readonly initializationTimeout: number | IResolvable;
  • Type: number | @alicloud/ros-cdk-core.IResolvable

initializerOptional

public readonly initializer: string | IResolvable;
  • Type: string | @alicloud/ros-cdk-core.IResolvable

instanceConcurrencyOptional

public readonly instanceConcurrency: number | IResolvable;
  • Type: number | @alicloud/ros-cdk-core.IResolvable

instanceLifecycleConfigOptional

public readonly instanceLifecycleConfig: IResolvable | InstanceLifecycleConfigProperty;

instanceSoftConcurrencyOptional

public readonly instanceSoftConcurrency: number | IResolvable;
  • Type: number | @alicloud/ros-cdk-core.IResolvable

instanceTypeOptional

public readonly instanceType: string | IResolvable;
  • Type: string | @alicloud/ros-cdk-core.IResolvable

memorySizeOptional

public readonly memorySize: number | IResolvable;
  • Type: number | @alicloud/ros-cdk-core.IResolvable

timeoutOptional

public readonly timeout: number | IResolvable;
  • Type: number | @alicloud/ros-cdk-core.IResolvable

Constants

Name Type Description
ROS_RESOURCE_TYPE_NAME string The resource type name for this resource class.

ROS_RESOURCE_TYPE_NAMERequired

public readonly ROS_RESOURCE_TYPE_NAME: string;
  • Type: string

The resource type name for this resource class.