qaskx.template/document/default/sequence/definitions/sd02/sd02.mermaid.tmpl

52 lines
1.6 KiB
Cheetah

%% {{.ServiceName}} service sequence
sequenceDiagram
participant consumer as Consumer
participant gateway as Gateway
{{ range .Apis}}participant {{ .ServiceId }} as {{.Name}}
{{ end }}
{{ range .Depends}}participant {{ .ServiceId }} as Svc {{ .Name }}
{{ end }}
{{ range .Apis}}
rect rgb(191, 223, 255)
consumer->>+gateway: {{$.ServicePoints}}
note right of gateway: Authentication check at GW
gateway->>+authz: Validate requestor
authz-->>-gateway: 200 or 401/403 status
gateway->>+{{ .ServiceId }}: start
{{ .ServiceId }}->>+authz: Fine grained authz
note right of authz: Authorise to function, data
authz-->>-{{ .ServiceId }}: 200 or 401/403 status
{{ .ServiceId }}->>+featureflag: Check feature switch
featureflag-->>-{{ .ServiceId }}: 200 or 401/403 status
{{ .ServiceId }}->>logger: log request/response
{{ .ServiceId }}->>{{ .ServiceId }}: business logic
note right of {{ .ServiceId }}: Explanation of what happens
{{with $microservice := .ServiceId }}
{{ range $.Depends }}{{ $microservice }}->>+{{ .ServiceId }}: function call
{{ .ServiceId }}-->>- {{ $microservice }}: result, 200 or 4xx status
{{ end }}
{{ end }}
{{ .ServiceId }}->>{{ .ServiceId }}: business logic
note right of {{ .ServiceId }}: Explanation of what happens
alt 200 OK
{{ .ServiceId }}-->>-gateway: 200 OK response
gateway-->>-consumer: 200 OK response
else not OK, error
{{ .ServiceId }}-->>-gateway: !200 ERR response
gateway-->>-consumer: !200 ERR response
end
end
{{ end }}