'AWS CDK - StepFunction - CallAwsService' 的 BatchGetBuilds 参数的正确格式是什么
What is the correct format of BatchGetBuilds parameters for 'AWS CDK - StepFunction - CallAwsService'
我正在为 CDK 的状态机工作。
并在状态机中检查代码构建项目状态时遇到问题...
问。你能告诉我 CallAwsService
中 batchGetBuilds
参数的正确格式吗?
import { CallAwsService } from "aws-cdk-lib/aws-stepfunctions-tasks"
import { JsonPath } from "aws-cdk-lib/aws-stepfunctions"
new CallAwsService(scope, "Check 1-1: Codebuild Status", {
service: "codebuild",
action: "batchGetBuilds",
parameters: {
Ids: [JsonPath.stringAt("$.results.codebuild.id")],
},
iamResources: ["*"],
inputPath: "$",
resultSelector: { "status.$": "$.builds[0].buildStatus" },
resultPath: "$.results.bulidAmi",
})
我尝试了两种方法。
JsonPath.stringAt("$.results.codebuild.id")
然后下面returns执行失败。
"An error occurred while executing the state 'Check 1-1: Codebuild Status' (entered at the event id #9).
The Parameters '{\"Ids\":\"******-generate-new-ami-project:05763ec2-89a6-4b56-8b44-************\"}' could not be used to start the Task:
[Cannot deserialize instance of `java.util.ArrayList<java.lang.Object>` out of VALUE_STRING token]"
[JsonPath.stringAt("$.results.codebuild.id")]
如果我使用数组,它在构建阶段失败了...(我正在使用 cdk 管道来部署它)
下面是错误消息
Cannot use JsonPath fields in an array, they must be used in objects
+ 额外问题
我在搜索中找到了这个
我可以在 `CallAwsService` 上使用这个 `sync` 吗? (主要 1... 状态也在使用 `CallAwsService`)
如果是,我该如何使用它..?
或者我是否需要将 `CallAwsService` 更改为 `CodeBuildStartBuild`?
Could you let me know the correct format of batchGetBuilds parameters in CallAwsService?
使用States.Array
intrinsic function。这些 CDK 语法是等价的:
parameters = {
'Ids.$': 'States.Array($.results.codebuild.id)',
Ids: JsonPath.stringAt('States.Array($.results.codebuild.id)'),
Ids: JsonPath.array(JsonPath.stringAt('$.results.codebuild.id'))
}
Can I use this sync
on the CallAwsService
?
没有。 CallAwsService
任务为上下文实现 AWS SDK service integrations, which does not support .sync
for CodeBuild actions. As of v2.15, CDK should throw an error if you pass the RUN_JOB
(= .sync
) pattern to CallAwsService
. See this github issue。
Or do I need to change the CallAwsService
to CodeBuildStartBuild
?
是的。 CodeBuildStartBuild 与 RUN_JOB
集成模式一起正常工作。
我正在为 CDK 的状态机工作。
并在状态机中检查代码构建项目状态时遇到问题...
问。你能告诉我 CallAwsService
中 batchGetBuilds
参数的正确格式吗?
import { CallAwsService } from "aws-cdk-lib/aws-stepfunctions-tasks"
import { JsonPath } from "aws-cdk-lib/aws-stepfunctions"
new CallAwsService(scope, "Check 1-1: Codebuild Status", {
service: "codebuild",
action: "batchGetBuilds",
parameters: {
Ids: [JsonPath.stringAt("$.results.codebuild.id")],
},
iamResources: ["*"],
inputPath: "$",
resultSelector: { "status.$": "$.builds[0].buildStatus" },
resultPath: "$.results.bulidAmi",
})
我尝试了两种方法。
JsonPath.stringAt("$.results.codebuild.id")
然后下面returns执行失败。
"An error occurred while executing the state 'Check 1-1: Codebuild Status' (entered at the event id #9).
The Parameters '{\"Ids\":\"******-generate-new-ami-project:05763ec2-89a6-4b56-8b44-************\"}' could not be used to start the Task:
[Cannot deserialize instance of `java.util.ArrayList<java.lang.Object>` out of VALUE_STRING token]"
[JsonPath.stringAt("$.results.codebuild.id")]
如果我使用数组,它在构建阶段失败了...(我正在使用 cdk 管道来部署它)
下面是错误消息
Cannot use JsonPath fields in an array, they must be used in objects
+ 额外问题
我在搜索中找到了这个
我可以在 `CallAwsService` 上使用这个 `sync` 吗? (主要 1... 状态也在使用 `CallAwsService`)
如果是,我该如何使用它..?
或者我是否需要将 `CallAwsService` 更改为 `CodeBuildStartBuild`?
Could you let me know the correct format of batchGetBuilds parameters in CallAwsService?
使用States.Array
intrinsic function。这些 CDK 语法是等价的:
parameters = {
'Ids.$': 'States.Array($.results.codebuild.id)',
Ids: JsonPath.stringAt('States.Array($.results.codebuild.id)'),
Ids: JsonPath.array(JsonPath.stringAt('$.results.codebuild.id'))
}
Can I use this
sync
on theCallAwsService
?
没有。 CallAwsService
任务为上下文实现 AWS SDK service integrations, which does not support .sync
for CodeBuild actions. As of v2.15, CDK should throw an error if you pass the RUN_JOB
(= .sync
) pattern to CallAwsService
. See this github issue。
Or do I need to change the
CallAwsService
toCodeBuildStartBuild
?
是的。 CodeBuildStartBuild 与 RUN_JOB
集成模式一起正常工作。