Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion samtranslator/model/sam_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,8 @@ class SamStateMachine(SamResourceMacro):
"Name": PropertyType(False, is_str()),
"Type": PropertyType(False, is_str()),
"Tags": PropertyType(False, is_type(dict)),
"Policies": PropertyType(False, one_of(is_str(), is_type(dict), list_of(one_of(is_str(), is_type(dict))))),
"Policies": PropertyType(False, one_of(is_str(), list_of(one_of(is_str(), is_type(dict), is_type(dict))))),
"Tracing": PropertyType(False, is_type(dict)),
}
event_resolver = ResourceTypeResolver(samtranslator.model.stepfunctions.events,)

Expand All @@ -1142,6 +1143,7 @@ def to_cloudformation(self, **kwargs):
definition_substitutions=self.DefinitionSubstitutions,
role=self.Role,
state_machine_type=self.Type,
tracing=self.Tracing,
events=self.Events,
event_resources=event_resources,
event_resolver=self.event_resolver,
Expand Down
4 changes: 4 additions & 0 deletions samtranslator/model/stepfunctions/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(
definition_substitutions,
role,
state_machine_type,
tracing,
events,
event_resources,
event_resolver,
Expand All @@ -62,6 +63,7 @@ def __init__(
:param definition_substitutions: Variable-to-value mappings to be replaced in the State Machine definition
:param role: Role ARN to use for the execution role
:param state_machine_type: Type of the State Machine
:param tracing: Tracing configuration for the State Machine
:param events: List of event sources for the State Machine
:param event_resources: Event resources to link
:param event_resolver: Resolver that maps Event types to Event classes
Expand All @@ -83,6 +85,7 @@ def __init__(
self.definition_substitutions = definition_substitutions
self.role = role
self.type = state_machine_type
self.tracing = tracing
self.events = events
self.event_resources = event_resources
self.event_resolver = event_resolver
Expand Down Expand Up @@ -144,6 +147,7 @@ def to_cloudformation(self):
self.state_machine.StateMachineName = self.name
self.state_machine.StateMachineType = self.type
self.state_machine.LoggingConfiguration = self.logging
self.state_machine.TracingConfiguration = self.tracing
self.state_machine.Tags = self._construct_tag_list()

event_resources = self._generate_event_resources()
Expand Down
1 change: 1 addition & 0 deletions samtranslator/model/stepfunctions/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class StepFunctionsStateMachine(Resource):
"StateMachineType": PropertyType(False, is_str()),
"Tags": PropertyType(False, list_of(is_type(dict))),
"DefinitionSubstitutions": PropertyType(False, is_type(dict)),
"TracingConfiguration": PropertyType(False, is_type(dict)),
}

runtime_attrs = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def setUp(self):
"definition_substitutions": None,
"role": None,
"state_machine_type": None,
"tracing": None,
"events": None,
"event_resources": None,
"event_resolver": None,
Expand Down
10 changes: 10 additions & 0 deletions tests/translator/input/state_machine_with_xray.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Resources:
StateMachine:
Type: AWS::Serverless::StateMachine
Properties:
Name: MyStateMachineWithXRayTracing
Type: STANDARD
DefinitionUri: s3://sam-demo-bucket/my-state-machine.asl.json
Role: arn:aws:iam::123456123456:role/service-role/SampleRole
Tracing:
Enabled: true
25 changes: 25 additions & 0 deletions tests/translator/output/aws-cn/state_machine_with_xray.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"Resources": {
"StateMachine": {
"Type": "AWS::StepFunctions::StateMachine",
"Properties": {
"Tags": [
{
"Value": "SAM",
"Key": "stateMachine:createdBy"
}
],
"RoleArn": "arn:aws:iam::123456123456:role/service-role/SampleRole",
"StateMachineName": "MyStateMachineWithXRayTracing",
"TracingConfiguration": {
"Enabled": true
},
"StateMachineType": "STANDARD",
"DefinitionS3Location": {
"Bucket": "sam-demo-bucket",
"Key": "my-state-machine.asl.json"
}
}
}
}
}
25 changes: 25 additions & 0 deletions tests/translator/output/aws-us-gov/state_machine_with_xray.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"Resources": {
"StateMachine": {
"Type": "AWS::StepFunctions::StateMachine",
"Properties": {
"Tags": [
{
"Value": "SAM",
"Key": "stateMachine:createdBy"
}
],
"RoleArn": "arn:aws:iam::123456123456:role/service-role/SampleRole",
"StateMachineName": "MyStateMachineWithXRayTracing",
"TracingConfiguration": {
"Enabled": true
},
"StateMachineType": "STANDARD",
"DefinitionS3Location": {
"Bucket": "sam-demo-bucket",
"Key": "my-state-machine.asl.json"
}
}
}
}
}
25 changes: 25 additions & 0 deletions tests/translator/output/state_machine_with_xray.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"Resources": {
"StateMachine": {
"Type": "AWS::StepFunctions::StateMachine",
"Properties": {
"Tags": [
{
"Value": "SAM",
"Key": "stateMachine:createdBy"
}
],
"RoleArn": "arn:aws:iam::123456123456:role/service-role/SampleRole",
"StateMachineName": "MyStateMachineWithXRayTracing",
"TracingConfiguration": {
"Enabled": true
},
"StateMachineType": "STANDARD",
"DefinitionS3Location": {
"Bucket": "sam-demo-bucket",
"Key": "my-state-machine.asl.json"
}
}
}
}
}
1 change: 1 addition & 0 deletions tests/translator/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ class TestTranslatorEndToEnd(TestCase):
"state_machine_with_api_resource_policy",
"state_machine_with_api_auth_default_scopes",
"state_machine_with_condition_and_events",
"state_machine_with_xray",
"function_with_file_system_config",
],
[
Expand Down