generated from camaraproject/Template_API_Repository
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdedicated-network-accesses.yaml
421 lines (400 loc) · 15.2 KB
/
dedicated-network-accesses.yaml
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
openapi: 3.0.3
info:
title: Dedicated Network - Network Accesses API
description: |
This API allows for requesting network access for devices. A device is identified by the CAMARA _device object_, containing either an MSIDSN or a Network Access Identifier.
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
version: wip
x-camara-commonalities: 0.5
servers:
- url: "{apiRoot}/dedicated-network-accesses/vwip"
variables:
apiRoot:
default: http://localhost:9091
description: API root, defined by the service provider, e.g. `api.example.com` or `api.example.com/somepath`
tags:
- name: Accesses
description: Manage accesses of devices for a dedicated network
paths:
/accesses:
get:
tags:
- Accesses
summary: Get a list of device accesses to dedicated networks, optionally filtered for a given device and/or for a given dedicated network
operationId: listNetworkAccesses
security:
- openId:
- dedicated-network:accesses:read
parameters:
- name: networkId
in: query
description: Dedicated network id
schema:
$ref: 'dedicated-network.yaml#/components/schemas/NetworkId'
- $ref: "#/components/parameters/x-device"
- $ref: "#/components/parameters/x-correlator"
responses:
'200':
description: List of existing device accesses to dedicated networks, optionally filtered for a given device and/or for a dedicated network (the list can be empty)
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/NetworkAccessInfo'
"400":
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"500":
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
post:
tags:
- Accesses
summary: Create a device access to a dedicated network with given configuration
operationId: createNetworkAccess
security:
- openId:
- dedicated-network:access:create
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateNetworkAccess'
responses:
'201':
description: Successful creation of network access for a device
content:
application/json:
schema:
$ref: '#/components/schemas/NetworkAccessInfo'
headers:
Location:
description: 'URL including the resource identifier of the newly created network access.'
required: true
schema:
type: string
'400':
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"500":
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
/accesses/{accessId}:
get:
tags:
- Accesses
summary: Get a device access to the dedicated network and its configuration
operationId: readNetworkAccess
security:
- openId:
- dedicated-network:access:read
parameters:
- name: accessId
in: path
required: true
schema:
$ref: "#/components/schemas/AccessId"
- $ref: "#/components/parameters/x-correlator"
responses:
'200':
description: A device access to the dedicated network with configuration
content:
application/json:
schema:
$ref: '#/components/schemas/NetworkAccessInfo'
'400':
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"500":
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
delete:
tags:
- Accesses
summary: Delete a device access to the dedicated network
operationId: deleteNetworkAccess
security:
- openId:
- dedicated-network:access:delete
parameters:
- name: accessId
in: path
required: true
schema:
$ref: "#/components/schemas/AccessId"
- $ref: "#/components/parameters/x-correlator"
responses:
'204':
description: Successful deletion of a device access
'400':
$ref: "#/components/responses/Generic400"
"401":
$ref: "#/components/responses/Generic401"
"403":
$ref: "#/components/responses/Generic403"
"404":
$ref: "#/components/responses/Generic404"
"500":
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
components:
securitySchemes:
openId:
type: openIdConnect
openIdConnectUrl: https://example.com/.well-known/openid-configuration
parameters:
x-correlator:
name: x-correlator
in: header
description: Correlation id for the different services
schema:
type: string
x-device:
name: x-device
in: header
description: Device object represented in a header
Device object (#/components/schemas/Device") represented in a header.
It is serialized according to RFC 8941 as a structured field value where
the Device object is a dictionary, with the following additonal provisions
- property names are changed to lower case to comply with the RFC
- serializing property values must comply with the RFC depending on the type, and in particular
- if the property value is a string which contains only ASCII characters, the string can be serialized as String,
as per section 3.3.3 of the RFC
- if the property value is a string and contains non-ASCII characters, the string must be serialized as Byte Sequence using UTF-8 encoding,
as per section 3.3.5 of the RFC
schema:
type: string
example: 'phonenumber="+123456789"'
headers:
x-correlator:
description: Correlation id for the different services
schema:
type: string
schemas:
AccessId:
description: Network access id in UUID format
type: string
format: uuid
BaseNetworkAccessInfo:
description: Common attributes of a device access to a dedicated network
type: object
properties:
networkId:
$ref: "dedicated-network.yaml#/components/schemas/NetworkId"
device:
$ref: "#/components/schemas/Device"
qosProfiles:
description: (Optional) List of supported QOS profiles usable for the device. When absent, all QosProfiles of the Network are supported. Only a subset of the QOS profiles of the network is allowed
type: array
items:
type: string
minItems: 1
defaultQosProfile:
description: (Optional) The default QOS profile of a device access. When absent, the defaultQosProfile of the Network is used
type: string
required:
- networkId
- device
CreateNetworkAccess:
description: Attributes required to create a dedicated network access for a device.
# NOTE this design prepares for adding request specific attributes later
allOf:
- $ref: "#/components/schemas/BaseNetworkAccessInfo"
NetworkAccessInfo:
description: Inforamtion about a dedicated network access for a device
allOf:
- $ref: "#/components/schemas/BaseNetworkAccessInfo"
- type: object
properties:
id:
$ref: "#/components/schemas/AccessId"
required:
- id
Device:
description: |
End-user equipment able to connect to a mobile network. Examples of devices include smartphones or IoT sensors/actuators.
The developer can choose to provide the below specified device identifiers:
* `phoneNumber`
* `networkAccessIdentifier`
NOTE1: the network operator might support only a subset of these options. The API invoker can provide multiple identifiers to be compatible across different network operators. In this case the identifiers MUST belong to the same device.
NOTE2: for the Commonalities release v0.4, we are enforcing that the networkAccessIdentifier is only part of the schema for future-proofing, and CAMARA does not currently allow its use. After the CAMARA meta-release work is concluded and the relevant issues are resolved, its use will need to be explicitly documented in the guidelines.
type: object
properties:
phoneNumber:
$ref: "#/components/schemas/PhoneNumber"
networkAccessIdentifier:
$ref: "#/components/schemas/NetworkAccessIdentifier"
minProperties: 1
PhoneNumber:
description: A public identifier addressing a telephone subscription. In mobile networks it corresponds to the MSISDN (Mobile Station International Subscriber Directory Number). In order to be globally unique it has to be formatted in international format, according to E.164 standard, prefixed with '+'.
type: string
pattern: '^\+[1-9][0-9]{4,14}$'
example: "+123456789"
NetworkAccessIdentifier:
description: A public identifier addressing a subscription in a mobile network. In 3GPP terminology, it corresponds to the GPSI formatted with the External Identifier ({Local Identifier}@{Domain Identifier}). Unlike the telephone number, the network access identifier is not subjected to portability ruling in force, and is individually managed by each operator.
type: string
example: "[email protected]"
ErrorInfo:
description: Common schema for errors
type: object
properties:
status:
type: integer
description: HTTP status code returned along with this error response
code:
type: string
description: Code given to this error
message:
type: string
description: Detailed error description
required:
- status
- code
- message
responses:
Generic400:
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
examples:
GENERIC_400_INVALID_ARGUMENT:
description: Invalid Argument. Generic Syntax Exception
value:
status: 400
code: INVALID_ARGUMENT
message: Client specified an invalid argument, request body or query param.
GENERIC_400_OUT_OF_RANGE:
description: Out of Range. Specific Syntax Exception used when a given field has a pre-defined range or a invalid filter criteria combination is requested
value:
status: 400
code: OUT_OF_RANGE
message: Client specified an invalid range.
Generic401:
description: Unauthorized
headers:
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
examples:
GENERIC_401_UNAUTHENTICATED:
description: Request cannot be authenticated
value:
status: 401
code: UNAUTHENTICATED
message: Request not authenticated due to missing, invalid, or expired credentials.
GENERIC_401_AUTHENTICATION_REQUIRED:
description: New authentication is needed, authentication is no longer valid
value:
status: 401
code: AUTHENTICATION_REQUIRED
message: New authentication is required.
Generic403:
description: Forbidden
headers:
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
examples:
GENERIC_403_PERMISSION_DENIED:
description: Permission denied. OAuth2 token access does not have the required scope or when the user fails operational security
value:
status: 403
code: PERMISSION_DENIED
message: Client does not have sufficient permissions to perform this action.
GENERIC_403_INVALID_TOKEN_CONTEXT:
description: Reflect some inconsistency between information in some field of the API and the related OAuth2 Token
value:
status: 403
code: INVALID_TOKEN_CONTEXT
message: "{{field}} is not consistent with access token."
Generic404:
description: Not found
headers:
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
examples:
GENERIC_404_NOT_FOUND:
description: Resource is not found
value:
status: 404
code: NOT_FOUND
message: The specified resource is not found.
Generic410:
description: Gone
headers:
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
examples:
GENERIC_410_GONE:
description: Use in notifications flow to allow API Consumer to indicate that its callback is no longer available
value:
status: 410
code: GONE
message: Access to the target resource is no longer available.
Generic500:
description: Internal server error
headers:
x-correlator:
$ref: '#/components/headers/x-correlator'
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
status: 500
code: INTERNAL
message: "Internal server error: ..."
Generic503:
description: Service Unavailable
headers:
x-correlator:
$ref: "#/components/headers/x-correlator"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
examples:
GENERIC_503_UNAVAILABLE:
description: Service is not available. Temporary situation usually related to maintenance process in the server side
value:
status: 503
code: UNAVAILABLE
message: Service Unavailable.