forked from Microservice-API-Patterns/MDSL-Specification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomerRelationshipManagementExample.mdsl
178 lines (150 loc) · 6.18 KB
/
CustomerRelationshipManagementExample.mdsl
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/* Grammar "cheat sheet" aka abstract examples (payload structure only):
*
* payload [ {ptree1}; {ptree2} ] // Parameter Forest
* payload {{subtree1},{subtree2}, apl} // Parameter Tree (can also appear in pforest)
* payload (apl) // Atomic Parameter List (can also appear in ptree)
* payload ap // Atomic Parameter (can also appear in ptree and apl)
*
* AP syntax:
* <<pattern>>"name":Role<Type> // pattern stereotype, name and type are optional; stereotype can also be assigned to other tree nodes (apls and ptrees)
*
* Concrete AP types: ID, D, V, L, MD; abstract type: P
* */
API description SampleCRMScenario
usage context PUBLIC_API for FRONTEND_INTEGRATION and BACKEND_INTEGRATION
endpoint type CustomerManagementContract
serves as INFORMATION_HOLDER_RESOURCE and DATA_TRANSFER_RESOURCE
exposes
operation lookupSingleCustomer
with responsibility RETRIEVAL_OPERATION
expecting
// request message payload (representation)
payload ID<string> // some entity E whose structure is not yet known
delivering
// response message payload (representation)
payload {"customerId":ID,
"name":D,
"address"} // name and of atomic parameters known, but type not specified yet; two roles known, one left open (default V)
structured as MAP_TYPE
operation lookupCustomerDirectory
with responsibility RETRIEVAL_OPERATION
expecting
payload <<Request_Bundle>> "customerId":D<int> // Atomic Parameter, with name, role, type known and specified
delivering
payload
"customerRecord": {
"cid":ID!, // ! means mandatory, exactly one (default)
"nameTuple":("firstname":D, "lastname":D),
"addressTuple":("street":D<string>, "poBox":D?, "zipCode":D, "city":D)+, // po box is optional, one or more addresses can be given
"segment":("REGULAR":D|"VIP":D) // the mid symbol | represents XOR choice (here: enum)
}*
// copy pasted and comments removed (for screenshot):
endpoint type CustomerManagementContractPlain
serves as INFORMATION_HOLDER_RESOURCE and DATA_TRANSFER_RESOURCE
exposes
operation lookupSingleCustomer
with responsibility RETRIEVAL_OPERATION
expecting
// request message payload (representation)
payload ID<string> // some entity E whose structure is not yet known
delivering
// response message payload (representation)
payload {"customerId":ID,
"name":D,
"address"} // name and of atomic parameters known, type not specified yet
structured as MAP_TYPE
operation lookupCustomerDiretory
with responsibility RETRIEVAL_OPERATION
expecting
payload "customerId":D<int> // Atomic Parameter, name, role, type known and specified
delivering
payload
"customerRecord": {
"cid":ID!, // ! means mandatory, exactly one (default)
"nameTuple":("firstname":D, "lastname":D),
"addressTuple":("street":D<string>, "poBox":D?, "zipCode":D, "city":D)+,
"segment":("REGULAR":D|"VIP":D)
}*
endpoint type CustomerManagementContract2
serves as INFORMATION_HOLDER_RESOURCE and DATA_TRANSFER_RESOURCE // endpoint serves as. not CT
exposes
operation lookupSingleCustomer
with responsibility RETRIEVAL_OPERATION
expecting
payload "uri":ID<string> // "customerId":D<int>
delivering
payload {("cid":ID, "name":D, "address":D, "dataOwner":MD, "moreInformation":L)}
structured as MAP_TYPE
operation lookupCustomerDirecory
with responsibility RETRIEVAL_OPERATION
expecting
payload "customerId":D<int>
delivering
payload {
<<Entity>>"customerRecord":
("cid":ID!),
"segment":("REGULAR":D|"VIP":D), // XOR (choice/union)
{"name":("firstname":D, "lastname":D)},
"address":("street":D<string>, "poBox":D?, "zipCode":D, "city":D)+
}*
// ** provider example
SLA template externalPerformanceSLAExample
type QUANTITATIVE
objective performanceSLO1 "responseTimeUnder" 5 seconds
penalty "If the SLA is not met, the penalty is ..."
notification "To report SLA violations, you have to ..."
rate plan FREEMIUM
rate limit DATA_QUOTA 1 call within 24 hours
SLA template externalPerformanceSLAExampleLandingZone
type QUANTITATIVE
objective performanceSLO1 "responseTimeUnder"
minimal 5 seconds
target 3 seconds
optimal 1 seconds
API provider SampleAPIProvider1
offers CustomerManagementContract
at endpoint location "http://www.testdomain.io:80/path/subpath"
via protocol HTTP binding resource SampleAPIProvider1Resource
with endpoint SLA externalPerformanceSLAExample
at endpoint location "http://www.testdomain.io:81/path/subpath"
via protocol "undisclosed/proprietary"
with endpoint SLA objective o1 "concurrentRequestsPerSecond" 100
offers CustomerManagementContract2
at endpoint location "http://www.testdomain.io:80/path2/subpath2" // full URI: https://a.b.c:9090/d/e.map?p1=v1&p2=v2;
via protocol HTTP binding resource CustomerManagementContract2Resource
with endpoint SLA // inlined/embedded SLA
type QUANTITATIVE
objective performanceSLO1 "responseTimeUnder" 5 seconds
penalty "If the SLA is not met, the penalty is ..."
notification "To report SLA violations, you have to ..."
rate plan FREEMIUM
rate limit DATA_QUOTA 1 "call" within 24 hours
endpoint governance AGGRESSIVE_OBSOLESCENCE
/*
with providerSLA provider1SLA
type QUALITATIVE
objective performanceSLO2 "availability": 100 "every commercially reasonable effort, but not guaranteed"
*/
under conditions "Some Ts and Cs"
provider governance LIMITED_GUARANTEED_LIFETIME
// ** client example
API client SampleAPICLient
consumes CustomerManagementContract
consumes CustomerManagementContract2
// ** gateway example
API gateway SampleAPIGatweway
// Gate 1
offers CustomerManagementContract
at endpoint location "ExternalURI"
via protocol HTTP binding resource CustomerManagementRemoteFacade
consumes CustomerManagementContract2
from SampleAPIProvider1
via protocol gRPC
// Gate 2:
offers CustomerManagementContract
at endpoint location "ExternalURI2"
via protocol HTTP binding resource CustomerManagementRemoteFacade2
consumes CustomerManagementContract2
from SampleAPIProvider1
via protocol gRPC
IPA // end of API specification