class Activity (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.StepFunctions.Activity |
Java | software.amazon.awscdk.services.stepfunctions.Activity |
Python | aws_cdk.aws_stepfunctions.Activity |
TypeScript (source) | @aws-cdk/aws-stepfunctions » Activity |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, IActivity
Define a new Step Functions Activity.
Example
const activity = new sfn.Activity(this, 'Activity');
// Read this CloudFormation Output from your application and use it to poll for work on
// the activity.
new CfnOutput(this, 'ActivityArn', { value: activity.activityArn });
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. |
activityName?
Type:
string
(optional, default: If not supplied, a name is generated)
The name for this activity.
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 | Construct | The construct tree node associated with this construct. |
stack | Stack | The stack in which this resource is defined. |
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:
Construct
The construct tree node associated with this construct.
stack
Type:
Stack
The stack in which this resource is defined.
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. |
RemovalPolicy(policy)
applypublic 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.
Failed(props?)
metricpublic metricFailed(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of times this activity fails.
HeartbeatTimedOut(props?)
metricpublic metricHeartbeatTimedOut(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of times the heartbeat times out for this activity.
RunTime(props?)
metricpublic metricRunTime(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The interval, in milliseconds, between the time the activity starts and the time it closes.
ScheduleTime(props?)
metricpublic metricScheduleTime(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
The interval, in milliseconds, for which the activity stays in the schedule state.
Scheduled(props?)
metricpublic metricScheduled(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of times this activity is scheduled.
Started(props?)
metricpublic metricStarted(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of times this activity is started.
Succeeded(props?)
metricpublic metricSucceeded(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of times this activity succeeds.
Time(props?)
metricpublic 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.
TimedOut(props?)
metricpublic metricTimedOut(props?: MetricOptions): Metric
Parameters
- props
Metric
Options
Returns
Metric for the number of times this activity times out.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
ActivityArn(scope, id, activityArn)
static frompublic 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.
ActivityName(scope, id, activityName)
static frompublic 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.