DynamoUpdateItem
A StepFunctions task to call DynamoUpdateItem.
Example
declare const myTable: dynamodb.Table;
new tasks.DynamoUpdateItem(this, 'UpdateItem', {
key: {
MessageId: tasks.DynamoAttributeValue.fromString('message-007')
},
table: myTable,
expressionAttributeValues: {
':val': tasks.DynamoAttributeValue.numberFromString(sfn.JsonPath.stringAt('$.Item.TotalCount.N')),
':rand': tasks.DynamoAttributeValue.fromNumber(20),
},
updateExpression: 'SET TotalCount = :val + :rand',
});
# my_table: dynamodb.Table
tasks.DynamoUpdateItem(self, "UpdateItem",
key={
"MessageId": tasks.DynamoAttributeValue.from_string("message-007")
},
table=my_table,
expression_attribute_values={
":val": tasks.DynamoAttributeValue.number_from_string(sfn.JsonPath.string_at("$.Item.TotalCount.N")),
":rand": tasks.DynamoAttributeValue.from_number(20)
},
update_expression="SET TotalCount = :val + :rand"
)
Table myTable;
DynamoUpdateItem.Builder.create(this, "UpdateItem")
.key(Map.of(
"MessageId", DynamoAttributeValue.fromString("message-007")))
.table(myTable)
.expressionAttributeValues(Map.of(
":val", DynamoAttributeValue.numberFromString(JsonPath.stringAt("$.Item.TotalCount.N")),
":rand", DynamoAttributeValue.fromNumber(20)))
.updateExpression("SET TotalCount = :val + :rand")
.build();
// Install: dotnet add package Amazon.CDK.Lib
Table myTable;
new DynamoUpdateItem(this, "UpdateItem", new DynamoUpdateItemProps {
Key = new Dictionary<string, DynamoAttributeValue> {
{ "MessageId", DynamoAttributeValue.FromString("message-007") }
},
Table = myTable,
ExpressionAttributeValues = new Dictionary<string, DynamoAttributeValue> {
{ ":val", DynamoAttributeValue.NumberFromString(JsonPath.StringAt("$.Item.TotalCount.N")) },
{ ":rand", DynamoAttributeValue.FromNumber(20) }
},
UpdateExpression = "SET TotalCount = :val + :rand"
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var myTable Table
tasks.NewDynamoUpdateItem(this, jsii.String("UpdateItem"), &DynamoUpdateItemProps{
Key: map[string]DynamoAttributeValue{
"MessageId": tasks.DynamoAttributeValue_fromString(jsii.String("message-007")),
},
Table: myTable,
ExpressionAttributeValues: map[string]DynamoAttributeValue{
":val": tasks.DynamoAttributeValue_numberFromString(sfn.JsonPath_stringAt(jsii.String("$.Item.TotalCount.N"))),
":rand": tasks.DynamoAttributeValue_fromNumber(jsii.Number(20)),
},
UpdateExpression: jsii.String("SET TotalCount = :val + :rand"),
})
Initializer
new DynamoUpdateItem(scope: Construct, id: string, props: DynamoUpdateItemProps)
DynamoUpdateItem(scope: Construct, id: str, props: DynamoUpdateItemProps)
new DynamoUpdateItem(Construct scope, String id, DynamoUpdateItemProps props)
new DynamoUpdateItem(Construct scope, string id, DynamoUpdateItemProps props)
NewDynamoUpdateItem(Scope Construct, Id *string, Props DynamoUpdateItemProps)
Construct Props
assign{ [key: string]: any }assigntyping.Mapping[str, Any]assignMap<String, Object>AssignIDictionary<string, object>Assign*map[string]interface{}= Not assign variables#Using workflow variables, you can store data in a step and retrieve that data in future steps.
conditionExpressionstringcondition_expressionstrconditionExpressionStringConditionExpressionstringConditionExpression*string= No condition expression#credentialsCredentialscredentialsCredentialscredentialsCredentialsCredentialsCredentialsCredentialsCredentials= None (Task is executed using the…#This enables cross-account resource invocations.
default
Default: None (Task is executed using the State Machine's execution role)
expressionAttributeNames{ [key: string]: string }expression_attribute_namestyping.Mapping[str, str]expressionAttributeNamesMap<String, String>ExpressionAttributeNamesIDictionary<string, string>ExpressionAttributeNames*map[string]*string= No expression attribute names#expressionAttributeValues{ [key: string]: DynamoAttributeValue }expression_attribute_valuestyping.Mapping[str, DynamoAttributeValue]expressionAttributeValuesMap<String, DynamoAttributeValue>ExpressionAttributeValuesIDictionary<string, DynamoAttributeValue>ExpressionAttributeValues*map[string]DynamoAttributeValue= No expression attribute values#heartbeatDurationheartbeatDurationheartbeatDurationHeartbeatDurationHeartbeatDuration= Nonedeprecated#heartbeatTimeoutTimeoutheartbeat_timeoutTimeoutheartbeatTimeoutTimeoutHeartbeatTimeoutTimeoutHeartbeatTimeoutTimeout= None#[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface
May also be the special value JsonPath.DISCARD, which will cause the effective input to be the empty object {}.
integrationPatternIntegrationPatternintegration_patternIntegrationPatternintegrationPatternIntegrationPatternIntegrationPatternIntegrationPatternIntegrationPatternIntegrationPattern= `IntegrationPattern.REQUEST_RESP…#You can control these AWS services using service integration patterns.
Depending on the AWS Service, the Service Integration Pattern availability will vary.
default
Default: IntegrationPattern.REQUEST_RESPONSE for most tasks. IntegrationPattern.RUN_JOB for the following exceptions: BatchSubmitJob, EmrAddStep, EmrCreateCluster, EmrTerminationCluster, and EmrContainersStartJobRun.
key{ [key: string]: DynamoAttributeValue }keytyping.Mapping[str, DynamoAttributeValue]keyMap<String, DynamoAttributeValue>KeyIDictionary<string, DynamoAttributeValue>Key*map[string]DynamoAttributeValuerequired#notes
For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}.
outputsanyoutputsAnyoutputsObjectOutputsobjectOutputsinterface{}= $states.result or $states.errorO…#notes · default
When specified, the value overrides the state output default. The output field accepts any JSON value (object, array, string, number, boolean, null). Any string value, including those inside objects or arrays, will be evaluated as JSONata if surrounded by {% %} characters. Output also accepts a JSONata expression directly.
Default: $states.result or $states.errorOutput
queryLanguageQueryLanguagequery_languageQueryLanguagequeryLanguageQueryLanguageQueryLanguageQueryLanguageQueryLanguageQueryLanguage= JSONPath#If the state does not contain a queryLanguage field, then it will use the query language specified in the top-level queryLanguage field.
May also be the special value JsonPath.DISCARD, which will cause the state's input to become its output.
resultSelector{ [key: string]: any }result_selectortyping.Mapping[str, Any]resultSelectorMap<String, Object>ResultSelectorIDictionary<string, object>ResultSelector*map[string]interface{}= None#You can use ResultSelector to create a payload with values that are static or selected from the state's raw result.
returnConsumedCapacityDynamoConsumedCapacityreturn_consumed_capacityDynamoConsumedCapacityreturnConsumedCapacityDynamoConsumedCapacityReturnConsumedCapacityDynamoConsumedCapacityReturnConsumedCapacityDynamoConsumedCapacity= DynamoConsumedCapacity.NONE#returnItemCollectionMetricsDynamoItemCollectionMetricsreturn_item_collection_metricsDynamoItemCollectionMetricsreturnItemCollectionMetricsDynamoItemCollectionMetricsReturnItemCollectionMetricsDynamoItemCollectionMetricsReturnItemCollectionMetricsDynamoItemCollectionMetrics= DynamoItemCollectionMetrics.NONE#If set to SIZE, the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. If set to NONE (the default), no statistics are returned.
returnValuesDynamoReturnValuesreturn_valuesDynamoReturnValuesreturnValuesDynamoReturnValuesReturnValuesDynamoReturnValuesReturnValuesDynamoReturnValues= DynamoReturnValues.NONE#stateNamestringstate_namestrstateNameStringStateNamestringStateName*string= The construct ID will be used as…#default
Default: The construct ID will be used as state name
[disable-awslint:duration-prop-type] is needed because all props interface in aws-stepfunctions-tasks extend this interface
updateExpressionstringupdate_expressionstrupdateExpressionStringUpdateExpressionstringUpdateExpression*string= No update expression#Properties
Methods
addCatch(handler: IChainable, props?: CatchProps): TaskStateBasedef add_catch(self, handler: IChainable, props: typing.Optional[CatchProps] = None) -> TaskStateBasepublic TaskStateBase addCatch(IChainable handler, CatchProps props)public TaskStateBase AddCatch(IChainable handler, CatchProps? props = null)func AddCatch(Handler IChainable, Props CatchProps) TaskStateBase#When a particular error occurs, execution will continue at the error handler instead of failing the state machine execution.
addPrefix(x: string): voiddef add_prefix(self, x: str) -> Nonepublic void addPrefix(String x)public void AddPrefix(string x)func AddPrefix(X *string)#addRetry(props?: RetryProps): TaskStateBasedef add_retry(self, props: typing.Optional[RetryProps] = None) -> TaskStateBasepublic TaskStateBase addRetry(RetryProps props)public TaskStateBase AddRetry(RetryProps? props = null)func AddRetry(Props RetryProps) TaskStateBase#This controls if and how the execution will be retried if a particular error occurs.
bindToGraph(graph: StateGraph): voiddef bind_to_graph(self, graph: StateGraph) -> Nonepublic void bindToGraph(StateGraph graph)public void BindToGraph(StateGraph graph)func BindToGraph(Graph StateGraph)#Don't call this. It will be called automatically when you work with states normally.
filterNextables(states: State[]): INextable[]@staticmethod def filter_nextables(states: typing.List[State]) -> typing.List[INextable]public static List<INextable> filterNextables(List<State> states)public static INextable[] FilterNextables(State[] states)func FilterNextables(States *[]State) *[]INextablestatic#findReachableEndStates(start: State, options?: FindStateOptions): State[]@staticmethod def find_reachable_end_states(start: State, options: typing.Optional[FindStateOptions] = None) -> typing.List[State]public static List<State> findReachableEndStates(State start, FindStateOptions options)public static State[] FindReachableEndStates(State start, FindStateOptions? options = null)func FindReachableEndStates(Start State, Options FindStateOptions) *[]Statestatic#findReachableStates(start: State, options?: FindStateOptions): State[]@staticmethod def find_reachable_states(start: State, options: typing.Optional[FindStateOptions] = None) -> typing.List[State]public static List<State> findReachableStates(State start, FindStateOptions options)public static State[] FindReachableStates(State start, FindStateOptions? options = null)func FindReachableStates(Start State, Options FindStateOptions) *[]Statestatic#This does not retrieve states from within sub-graphs, such as states within a Parallel state's branch.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
jsonata(scope: Construct, id: string, props: DynamoUpdateItemJsonataProps): DynamoUpdateItem // chainable@staticmethod def jsonata(scope: Construct, id: str, props: DynamoUpdateItemJsonataProps) -> DynamoUpdateItempublic static DynamoUpdateItem jsonata(Construct scope, String id, DynamoUpdateItemJsonataProps props)public static DynamoUpdateItem Jsonata(Construct scope, string id, DynamoUpdateItemJsonataProps props)func Jsonata(Scope Construct, Id *string, Props DynamoUpdateItemJsonataProps) DynamoUpdateItemstatic#jsonPath(scope: Construct, id: string, props: DynamoUpdateItemJsonPathProps): DynamoUpdateItem // chainable@staticmethod def json_path(scope: Construct, id: str, props: DynamoUpdateItemJsonPathProps) -> DynamoUpdateItempublic static DynamoUpdateItem jsonPath(Construct scope, String id, DynamoUpdateItemJsonPathProps props)public static DynamoUpdateItem JsonPath(Construct scope, string id, DynamoUpdateItemJsonPathProps props)func JsonPath(Scope Construct, Id *string, Props DynamoUpdateItemJsonPathProps) DynamoUpdateItemstatic#metric(metricName: string, props?: MetricOptions): Metricdef metric(self, metric_name: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metric(String metricName, MetricOptions props)public Metric Metric(string metricName, MetricOptions? props = null)func Metric(MetricName *string, Props MetricOptions) Metric#metricFailed(props?: MetricOptions): Metricdef metric_failed(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricFailed(MetricOptions props)public Metric MetricFailed(MetricOptions? props = null)func MetricFailed(Props MetricOptions) Metric#metricHeartbeatTimedOut(props?: MetricOptions): Metricdef metric_heartbeat_timed_out(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricHeartbeatTimedOut(MetricOptions props)public Metric MetricHeartbeatTimedOut(MetricOptions? props = null)func MetricHeartbeatTimedOut(Props MetricOptions) Metric#metricRunTime(props?: MetricOptions): Metricdef metric_run_time(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricRunTime(MetricOptions props)public Metric MetricRunTime(MetricOptions? props = null)func MetricRunTime(Props MetricOptions) Metric#metricScheduled(props?: MetricOptions): Metricdef metric_scheduled(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricScheduled(MetricOptions props)public Metric MetricScheduled(MetricOptions? props = null)func MetricScheduled(Props MetricOptions) Metric#metricScheduleTime(props?: MetricOptions): Metricdef metric_schedule_time(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricScheduleTime(MetricOptions props)public Metric MetricScheduleTime(MetricOptions? props = null)func MetricScheduleTime(Props MetricOptions) Metric#metricStarted(props?: MetricOptions): Metricdef metric_started(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricStarted(MetricOptions props)public Metric MetricStarted(MetricOptions? props = null)func MetricStarted(Props MetricOptions) Metric#metricSucceeded(props?: MetricOptions): Metricdef metric_succeeded(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricSucceeded(MetricOptions props)public Metric MetricSucceeded(MetricOptions? props = null)func MetricSucceeded(Props MetricOptions) Metric#metricTime(props?: MetricOptions): Metricdef metric_time(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricTime(MetricOptions props)public Metric MetricTime(MetricOptions? props = null)func MetricTime(Props MetricOptions) Metric#metricTimedOut(props?: MetricOptions): Metricdef metric_timed_out(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricTimedOut(MetricOptions props)public Metric MetricTimedOut(MetricOptions? props = null)func MetricTimedOut(Props MetricOptions) Metric#next(next: IChainable): Chaindef next(self, next: IChainable) -> Chainpublic Chain next(IChainable next)public Chain Next(IChainable next)func Next(Next IChainable) Chain#prefixStates(root: IConstruct, prefix: string): void@staticmethod def prefix_states(root: IConstruct, prefix: str) -> Nonepublic static void prefixStates(IConstruct root, String prefix)public static void PrefixStates(IConstruct root, string prefix)func PrefixStates(Root IConstruct, Prefix *string)static#toStateJson(topLevelQueryLanguage?: QueryLanguage): jsondef to_state_json(self, top_level_query_language: typing.Optional[QueryLanguage] = None) -> Anypublic Object toStateJson(QueryLanguage topLevelQueryLanguage)public object ToStateJson(QueryLanguage? topLevelQueryLanguage = null)func ToStateJson(TopLevelQueryLanguage QueryLanguage) interface{}#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.
1 parameter · returns
Parameters
mixinsmixinsmixinsmixinsMixins— The mixins to apply.
Returns: This construct for chaining