Skip to content

print(): maxAttempts step attribute not set, maxAttempts receives timeoutInSeconds value #38

@alemartini

Description

@alemartini
  1. When setting just maxAttempts for a step, the step attribute is not set when printing the document content.\
        default_values = {
            "max_attempts": 1
        }
        # Define your steps...
        describe_snapshot = ssm.AwsApiStep(
                self,
                f"{id}describeSnapshot",
                name="describeSnapshot",
                description="Describe the provided snapshot id",
                service="ec2",
                pascal_case_api="DescribeSnapshots",
                api_params={"SnapshotIds": ["{{ SnapshotId }}"]},
                outputs=[
                    ssm.Output(
                        name="VolumeId",
                        output_type=ssm.DataTypeEnum.STRING,
                        selector="$.Snapshots[0].VolumeId",
                    ),
                    ssm.Output(
                        name="State",
                        output_type=ssm.DataTypeEnum.STRING,
                        selector="$.Snapshots[0].State",
                    ),
                ],
                is_end=False,
                **default_values
        )

produces:

...
mainSteps:
- description: Describe the provided snapshot id
  name: describeSnapshot
  action: aws:executeAwsApi
  inputs:
    Service: ec2
    Api: DescribeSnapshots
    SnapshotIds:
    - '{{ SnapshotId }}'
  outputs:
  - Name: VolumeId
    Selector: $.Snapshots[0].VolumeId
    Type: String
  - Name: State
    Selector: $.Snapshots[0].State
    Type: String
....
  1. When setting timeoutInSeconds for a step, maxAttempts is set:

In Python:

        default_values = {
            "timeout_seconds": 100
        }
        # Define your steps...
        describe_snapshot = ssm.AwsApiStep(
                self,
                f"{id}describeSnapshot",
                name="describeSnapshot",
                description="Describe the provided snapshot id",
                service="ec2",
                pascal_case_api="DescribeSnapshots",
                api_params={"SnapshotIds": ["{{ SnapshotId }}"]},
                outputs=[
                    ssm.Output(
                        name="VolumeId",
                        output_type=ssm.DataTypeEnum.STRING,
                        selector="$.Snapshots[0].VolumeId",
                    ),
                    ssm.Output(
                        name="State",
                        output_type=ssm.DataTypeEnum.STRING,
                        selector="$.Snapshots[0].State",
                    ),
                ],
                is_end=False,
                **default_values
        )

produces:

...
mainSteps:
- description: Describe the provided snapshot id
  name: describeSnapshot
  action: aws:executeAwsApi
  inputs:
    Service: ec2
    Api: DescribeSnapshots
    SnapshotIds:
    - '{{ SnapshotId }}'
  outputs:
  - Name: VolumeId
    Selector: $.Snapshots[0].VolumeId
    Type: String
  - Name: State
    Selector: $.Snapshots[0].State
    Type: String
  maxAttempts: 100
....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions