aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/doc/puml/aws_plant_example.puml
blob: ca63b2c456a43ca0beef1ae43f401c1d0af5b0fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
@startuml CMS Vehicle Simulator - Run Simulator
'Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
'SPDX-License-Identifier: MIT (For details, see https://github.com/awslabs/aws-icons-for-plantuml/blob/master/LICENSE)

!define AWSPuml https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/v13.0/dist
!include AWSPuml/AWSCommon.puml
!include AWSPuml/Compute/Lambda.puml
!include AWSPuml/ApplicationIntegration/APIGateway.puml
!include AWSPuml/General/Internetalt1.puml
!include AWSPuml/Database/DynamoDB.puml
!include AWSPuml/ApplicationIntegration/StepFunctions.puml
!include AWSPuml/InternetOfThings/InternetOfThings.puml

'Comment out to use default PlantUML sequence formatting
skinparam participant {
    BackgroundColor AWS_BG_COLOR
    BorderColor AWS_BORDER_COLOR
}
skinparam sequence {
    ArrowThickness 2
    LifeLineBorderColor AWS_COLOR
    LifeLineBackgroundColor AWS_BORDER_COLOR
    BoxBorderColor AWS_COLOR
}

actor User as user
box AWS Cloud
'Instead of using ...Participant(), native creole img tags can be used
participant "$APIGatewayIMG()\nDevice API\nGET, PUT, POST, OPTIONS" as api << API Gateway >>
participant "$LambdaIMG()\nVehicle Simulator\nDevice API" as device_lambda << Lambda >>
participant "$LambdaIMG()\nVehicle Simulator\nSimulation API" as simulation_lambda << Lambda >>
participant "$LambdaIMG()\nVehicle Simulator\nSimulator" as simulator_lambda << Lambda >>
participant "$DynamoDBIMG()\nDeviceTypes Table\nsortkey=transaction_id+token" as device_db << DynamoDB >>
participant "$DynamoDBIMG()\nSimulations Table\nsortkey=transaction_id+token" as simulation_db << DynamoDB >>
participant "$StepFunctionsIMG()\nSimulator Step Function\nMap-Map-Lambda-IoT-Done" as step_fns << Step Function >>
participant "$InternetOfThingsIMG()\nURL ---\nMore" as iot << IoT Core >>
endbox

'Use shortcut syntax for activation with colored lifelines and return keyword
activate iot #3F8624
user -> api++ #CC2264: POST /devices/types
api -> device_lambda++ #D86613: Create device type
device_lambda -> device_db++ #3355DA: Put Item
return dynamo response
return success, device type payload
return /device/type

user -> api++ #CC2264: POST /simulations
api -> simulation_lambda++ #D86613: Create simulation
simulation_lambda -> simulation_db++ #3355DA: Put Item
return dynamo response
return success, simulation payload
return /simulations

user -> api++ #CC2264: PUT /simulations/<id>
api -> simulation_lambda++ #D86613: Start simulation
simulation_lambda -> step_fns #CC2264: Start state machine
activate step_fns #CC2264
device_db <- step_fns++ #3355DA: Fetch device type information
return dynamo response
api <-- simulation_lambda: success, simulation payload
deactivate simulation_lambda
user <-- api: /simulations/<id>
deactivate api
step_fns -> iot: Simulation payload
simulation_db <- step_fns++ #3355DA: Set simulation status to "sleeping"
return
deactivate step_fns
deactivate iot

@enduml