From 3a7b1777323c1f9924f3a3b5aedb69946630a455 Mon Sep 17 00:00:00 2001 From: awstools Date: Thu, 29 Aug 2024 19:20:07 +0000 Subject: [PATCH] feat(client-sfn): This release adds support for static analysis to ValidateStateMachineDefinition API, which can now return optional WARNING diagnostics for semantic errors on the definition of an Amazon States Language (ASL) state machine. --- .../ValidateStateMachineDefinitionCommand.ts | 5 +- clients/client-sfn/src/models/models_0.ts | 46 +++++++++++++------ codegen/sdk-codegen/aws-models/sfn.json | 38 +++++++++++++++ 3 files changed, 75 insertions(+), 14 deletions(-) diff --git a/clients/client-sfn/src/commands/ValidateStateMachineDefinitionCommand.ts b/clients/client-sfn/src/commands/ValidateStateMachineDefinitionCommand.ts index e4d917a1c4b1b..ac0bfbc753de4 100644 --- a/clients/client-sfn/src/commands/ValidateStateMachineDefinitionCommand.ts +++ b/clients/client-sfn/src/commands/ValidateStateMachineDefinitionCommand.ts @@ -67,6 +67,8 @@ export interface ValidateStateMachineDefinitionCommandOutput * const input = { // ValidateStateMachineDefinitionInput * definition: "STRING_VALUE", // required * type: "STANDARD" || "EXPRESS", + * severity: "ERROR" || "WARNING", + * maxResults: Number("int"), * }; * const command = new ValidateStateMachineDefinitionCommand(input); * const response = await client.send(command); @@ -74,12 +76,13 @@ export interface ValidateStateMachineDefinitionCommandOutput * // result: "OK" || "FAIL", // required * // diagnostics: [ // ValidateStateMachineDefinitionDiagnosticList // required * // { // ValidateStateMachineDefinitionDiagnostic - * // severity: "ERROR", // required + * // severity: "ERROR" || "WARNING", // required * // code: "STRING_VALUE", // required * // message: "STRING_VALUE", // required * // location: "STRING_VALUE", * // }, * // ], + * // truncated: true || false, * // }; * * ``` diff --git a/clients/client-sfn/src/models/models_0.ts b/clients/client-sfn/src/models/models_0.ts index 033536bf48561..b3137fefe6798 100644 --- a/clients/client-sfn/src/models/models_0.ts +++ b/clients/client-sfn/src/models/models_0.ts @@ -4796,6 +4796,21 @@ export interface UpdateStateMachineAliasOutput { updateDate: Date | undefined; } +/** + * @public + * @enum + */ +export const ValidateStateMachineDefinitionSeverity = { + ERROR: "ERROR", + WARNING: "WARNING", +} as const; + +/** + * @public + */ +export type ValidateStateMachineDefinitionSeverity = + (typeof ValidateStateMachineDefinitionSeverity)[keyof typeof ValidateStateMachineDefinitionSeverity]; + /** * @public */ @@ -4812,21 +4827,20 @@ export interface ValidateStateMachineDefinitionInput { * @public */ type?: StateMachineType; -} -/** - * @public - * @enum - */ -export const ValidateStateMachineDefinitionSeverity = { - ERROR: "ERROR", -} as const; + /** + *

Minimum level of diagnostics to return. ERROR returns only ERROR diagnostics, whereas WARNING returns both WARNING and ERROR diagnostics. The default is ERROR.

+ * @public + */ + severity?: ValidateStateMachineDefinitionSeverity; -/** - * @public - */ -export type ValidateStateMachineDefinitionSeverity = - (typeof ValidateStateMachineDefinitionSeverity)[keyof typeof ValidateStateMachineDefinitionSeverity]; + /** + *

The maximum number of diagnostics that are returned per call. The default and maximum value is 100. Setting the value to 0 will also use the default of 100.

+ *

If the number of diagnostics returned in the response exceeds maxResults, the value of the truncated field in the response will be set to true.

+ * @public + */ + maxResults?: number; +} /** *

Describes an error found during validation. Validation errors found in the definition @@ -4894,6 +4908,12 @@ export interface ValidateStateMachineDefinitionOutput { * @public */ diagnostics: ValidateStateMachineDefinitionDiagnostic[] | undefined; + + /** + *

The result value will be true if the number of diagnostics found in the workflow definition exceeds maxResults. When all diagnostics results are returned, the value will be false.

+ * @public + */ + truncated?: boolean; } /** diff --git a/codegen/sdk-codegen/aws-models/sfn.json b/codegen/sdk-codegen/aws-models/sfn.json index 66c64e979651f..4dc3fd39396d6 100644 --- a/codegen/sdk-codegen/aws-models/sfn.json +++ b/codegen/sdk-codegen/aws-models/sfn.json @@ -7648,6 +7648,19 @@ "traits": { "smithy.api#documentation": "

The target type of state machine for this definition. The default is STANDARD.

" } + }, + "severity": { + "target": "com.amazonaws.sfn#ValidateStateMachineDefinitionSeverity", + "traits": { + "smithy.api#documentation": "

Minimum level of diagnostics to return. ERROR returns only ERROR diagnostics, whereas WARNING returns both WARNING and ERROR diagnostics. The default is ERROR.

" + } + }, + "maxResults": { + "target": "com.amazonaws.sfn#ValidateStateMachineDefinitionMaxResult", + "traits": { + "smithy.api#default": 0, + "smithy.api#documentation": "

The maximum number of diagnostics that are returned per call. The default and maximum value is 100. Setting the value to 0 will also use the default of 100.

\n

If the number of diagnostics returned in the response exceeds maxResults, the value of the truncated field in the response will be set to true.

" + } } }, "traits": { @@ -7657,6 +7670,16 @@ "com.amazonaws.sfn#ValidateStateMachineDefinitionLocation": { "type": "string" }, + "com.amazonaws.sfn#ValidateStateMachineDefinitionMaxResult": { + "type": "integer", + "traits": { + "smithy.api#default": 0, + "smithy.api#range": { + "min": 0, + "max": 100 + } + } + }, "com.amazonaws.sfn#ValidateStateMachineDefinitionMessage": { "type": "string" }, @@ -7676,6 +7699,12 @@ "smithy.api#documentation": "

If the result is OK, this field will be empty. When there are errors,\n this field will contain an array of Diagnostic objects\n to help you troubleshoot.

", "smithy.api#required": {} } + }, + "truncated": { + "target": "com.amazonaws.sfn#ValidateStateMachineDefinitionTruncated", + "traits": { + "smithy.api#documentation": "

The result value will be true if the number of diagnostics found in the workflow definition exceeds maxResults. When all diagnostics results are returned, the value will be false.

" + } } }, "traits": { @@ -7707,9 +7736,18 @@ "traits": { "smithy.api#enumValue": "ERROR" } + }, + "WARNING": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "WARNING" + } } } }, + "com.amazonaws.sfn#ValidateStateMachineDefinitionTruncated": { + "type": "boolean" + }, "com.amazonaws.sfn#ValidationException": { "type": "structure", "members": {