class Activity (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.StepFunctions.Activity |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctions#Activity |
![]() | software.amazon.awscdk.services.stepfunctions.Activity |
![]() | aws_cdk.aws_stepfunctions.Activity |
![]() | aws-cdk-lib » aws_stepfunctions » Activity |
Implements
IConstruct
, IDependable
, IResource
, IActivity
Define a new Step Functions Activity.
Example
const activity = new sfn.Activity(this, 'Activity');
const role = new iam.Role(this, 'Role', {
assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
});
activity.grant(role, 'states:SendTaskSuccess');
Initializer
new Activity(scope: Construct, id: string, props?: ActivityProps)
Parameters
- scope
Construct
- id
string
- props
Activity
Props
Construct Props
Name | Type | Description |
---|---|---|
activity | string | The name for this activity. |
encryption | Encryption | The encryptionConfiguration object used for server-side encryption of the activity inputs. |
activityName?
Type:
string
(optional, default: If not supplied, a name is generated)
The name for this activity.
encryptionConfiguration?
Type:
Encryption
(optional, default: data is transparently encrypted using an AWS owned key)
The encryptionConfiguration object used for server-side encryption of the activity inputs.
Properties
Name | Type | Description |
---|---|---|
activity | string | The ARN of the activity. |
activity | string | The name of the activity. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
encryption | Encryption | The encryptionConfiguration object used for server-side encryption of the activity inputs. |
activityArn
Type:
string
The ARN of the activity.
activityName
Type:
string
The name of the activity.
env
Type:
Resource
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.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
encryptionConfiguration?
Type:
Encryption
(optional)
The encryptionConfiguration object used for server-side encryption of the activity inputs.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
grant(identity, ...actions) | Grant the given identity permissions on this Activity. |
metric(metricName, props?) | Return the given named metric for this Activity. |
metric | Metric for the number of times this activity fails. |
metric | Metric for the number of times the heartbeat times out for this activity. |
metric | The interval, in milliseconds, between the time the activity starts and the time it closes. |
metric | The interval, in milliseconds, for which the activity stays in the schedule state. |
metric | Metric for the number of times this activity is scheduled. |
metric | Metric for the number of times this activity is started. |
metric | Metric for the number of times this activity succeeds. |
metric | The interval, in milliseconds, between the time the activity is scheduled and the time it closes. |
metric | Metric for the number of times this activity times out. |
to | Returns a string representation of this construct. |
static from | Construct an Activity from an existing Activity ARN. |
static from | Construct an Activity from an existing Activity Name. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
grant(identity, ...actions)
public grant(identity: IGrantable, ...actions: string[]): Grant
Parameters
- identity
IGrantable
— The principal. - actions
string
— The list of desired actions.
Returns
Grant the given identity permissions on this Activity.
metric(metricName, props?)
public metric(metricName: string, props?: MetricOptions): Metric
Parameters
- metricName
string
- props
Metric
Options
Returns
Return the given named metric for this Activity.
metricFailed(props?)
public metricFailed(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of times this activity fails.
metricHeartbeatTimedOut(props?)
public metricHeartbeatTimedOut(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of times the heartbeat times out for this activity.
metricRunTime(props?)
public metricRunTime(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The interval, in milliseconds, between the time the activity starts and the time it closes.
metricScheduleTime(props?)
public metricScheduleTime(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The interval, in milliseconds, for which the activity stays in the schedule state.
metricScheduled(props?)
public metricScheduled(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of times this activity is scheduled.
metricStarted(props?)
public metricStarted(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of times this activity is started.
metricSucceeded(props?)
public metricSucceeded(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of times this activity succeeds.
metricTime(props?)
public metricTime(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The interval, in milliseconds, between the time the activity is scheduled and the time it closes.
metricTimedOut(props?)
public metricTimedOut(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of times this activity times out.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromActivityArn(scope, id, activityArn)
public static fromActivityArn(scope: Construct, id: string, activityArn: string): IActivity
Parameters
- scope
Construct
- id
string
- activityArn
string
Returns
Construct an Activity from an existing Activity ARN.
static fromActivityName(scope, id, activityName)
public static fromActivityName(scope: Construct, id: string, activityName: string): IActivity
Parameters
- scope
Construct
- id
string
- activityName
string
Returns
Construct an Activity from an existing Activity Name.