Skip to content

Commit

Permalink
feat(client-sfn): This release adds support for static analysis to Va…
Browse files Browse the repository at this point in the history
…lidateStateMachineDefinition API, which can now return optional WARNING diagnostics for semantic errors on the definition of an Amazon States Language (ASL) state machine.
  • Loading branch information
awstools committed Aug 29, 2024
1 parent 7c99350 commit 3a7b177
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,22 @@ 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);
* // { // ValidateStateMachineDefinitionOutput
* // 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,
* // };
*
* ```
Expand Down
46 changes: 33 additions & 13 deletions clients/client-sfn/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -4812,21 +4827,20 @@ export interface ValidateStateMachineDefinitionInput {
* @public
*/
type?: StateMachineType;
}

/**
* @public
* @enum
*/
export const ValidateStateMachineDefinitionSeverity = {
ERROR: "ERROR",
} as const;
/**
* <p>Minimum level of diagnostics to return. <code>ERROR</code> returns only <code>ERROR</code> diagnostics, whereas <code>WARNING</code> returns both <code>WARNING</code> and <code>ERROR</code> diagnostics. The default is <code>ERROR</code>. </p>
* @public
*/
severity?: ValidateStateMachineDefinitionSeverity;

/**
* @public
*/
export type ValidateStateMachineDefinitionSeverity =
(typeof ValidateStateMachineDefinitionSeverity)[keyof typeof ValidateStateMachineDefinitionSeverity];
/**
* <p>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.</p>
* <p>If the number of diagnostics returned in the response exceeds <code>maxResults</code>, the value of the <code>truncated</code> field in the response will be set to <code>true</code>.</p>
* @public
*/
maxResults?: number;
}

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

/**
* <p>The result value will be <code>true</code> if the number of diagnostics found in the workflow definition exceeds <code>maxResults</code>. When all diagnostics results are returned, the value will be <code>false</code>.</p>
* @public
*/
truncated?: boolean;
}

/**
Expand Down
38 changes: 38 additions & 0 deletions codegen/sdk-codegen/aws-models/sfn.json
Original file line number Diff line number Diff line change
Expand Up @@ -7648,6 +7648,19 @@
"traits": {
"smithy.api#documentation": "<p>The target type of state machine for this definition. The default is <code>STANDARD</code>.</p>"
}
},
"severity": {
"target": "com.amazonaws.sfn#ValidateStateMachineDefinitionSeverity",
"traits": {
"smithy.api#documentation": "<p>Minimum level of diagnostics to return. <code>ERROR</code> returns only <code>ERROR</code> diagnostics, whereas <code>WARNING</code> returns both <code>WARNING</code> and <code>ERROR</code> diagnostics. The default is <code>ERROR</code>. </p>"
}
},
"maxResults": {
"target": "com.amazonaws.sfn#ValidateStateMachineDefinitionMaxResult",
"traits": {
"smithy.api#default": 0,
"smithy.api#documentation": "<p>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.</p>\n <p>If the number of diagnostics returned in the response exceeds <code>maxResults</code>, the value of the <code>truncated</code> field in the response will be set to <code>true</code>.</p>"
}
}
},
"traits": {
Expand All @@ -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"
},
Expand All @@ -7676,6 +7699,12 @@
"smithy.api#documentation": "<p>If the result is <code>OK</code>, this field will be empty. When there are errors,\n this field will contain an array of <b>Diagnostic</b> objects\n to help you troubleshoot.</p>",
"smithy.api#required": {}
}
},
"truncated": {
"target": "com.amazonaws.sfn#ValidateStateMachineDefinitionTruncated",
"traits": {
"smithy.api#documentation": "<p>The result value will be <code>true</code> if the number of diagnostics found in the workflow definition exceeds <code>maxResults</code>. When all diagnostics results are returned, the value will be <code>false</code>.</p>"
}
}
},
"traits": {
Expand Down Expand Up @@ -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": {
Expand Down

0 comments on commit 3a7b177

Please sign in to comment.