Skip to content

Commit

Permalink
Merge pull request eclipse#3833 from Coduz/feat-deviceConfigurationSt…
Browse files Browse the repository at this point in the history
…oreOpenAPIMappings

feat(openapi): Added OpenAPI mappings for deviceConfigurationStoreService DeviceApplicationSettings
  • Loading branch information
Coduz authored Jul 31, 2023
2 parents 20739c5 + b0158db commit 4456841
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
Expand Down Expand Up @@ -155,7 +154,7 @@ public DeviceConfigurationStoreSettings getSettings(
return deviceConfigurationStoreService.getApplicationSettings(scopeId, deviceId);
}

@POST
@PUT
@Path("_settings")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response postSettings(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
openapi: 3.0.2

info:
title: Eclipse Kapua REST API - Configurations
version: '1.0'
contact:
name: Eclipse Kapua Dev Team
url: https://eclipse.org/kapua
email: [email protected]
license:
name: Eclipse Public License 2.0
url: https://www.eclipse.org/legal/epl-2.0

paths:
/{scopeId}/devices/{deviceId}/configurations/_settings:
get:
tags:
- Device Management - Configuration
summary: Gets the settings of the Device Configurations Store settings of this Device
operationId: getDeviceConfigurationsStoreSettings
parameters:
- $ref: '../openapi.yaml#/components/parameters/scopeId'
- $ref: '../device/device.yaml#/components/parameters/deviceId'
responses:
200:
description: The Device Management Settings retrieved
content:
application/json:
schema:
$ref: './deviceConfiguration.yaml#/components/schemas/deviceConfigurationStoreSettings'
401:
$ref: '../openapi.yaml#/components/responses/unauthenticated'
403:
$ref: '../openapi.yaml#/components/responses/subjectUnauthorized'
404:
$ref: '../openapi.yaml#/components/responses/entityNotFound'
500:
$ref: '../openapi.yaml#/components/responses/kapuaError'
put:
tags:
- Device Management - Configuration
summary: Applies the given settings to the Device Configurations Store settings of this Device
operationId: putDeviceConfigurationsStoreSettings
parameters:
- $ref: '../openapi.yaml#/components/parameters/scopeId'
- $ref: '../device/device.yaml#/components/parameters/deviceId'
requestBody:
description: The Device Configurations Store Settings for this Device
content:
application/json:
schema:
$ref: './deviceConfiguration.yaml#/components/schemas/deviceConfigurationStoreSettings'
required: true
responses:
204:
description: The Device Management Settings have been applied
401:
$ref: '../openapi.yaml#/components/responses/unauthenticated'
403:
$ref: '../openapi.yaml#/components/responses/subjectUnauthorized'
404:
$ref: '../openapi.yaml#/components/responses/entityNotFound'
500:
$ref: '../openapi.yaml#/components/responses/kapuaError'
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ info:
name: Eclipse Public License 2.0
url: https://www.eclipse.org/legal/epl-2.0

paths: {}
paths: { }

components:
parameters:
Expand Down Expand Up @@ -55,7 +55,7 @@ components:
name: WireGraph
required: true
type: String
Option: []
Option: [ ]
propertyDefinition:
type: object
properties:
Expand Down Expand Up @@ -120,8 +120,8 @@ components:
name: WireGraph
required: true
type: String
Option: []
Icon: []
Option: [ ]
Icon: [ ]
properties:
property:
- name: WireGraph
Expand Down Expand Up @@ -176,8 +176,8 @@ components:
name: WireGraph
required: true
type: String
Option: []
Icon: []
Option: [ ]
Icon: [ ]
properties:
property:
- name: WireGraph
Expand Down Expand Up @@ -230,3 +230,20 @@ components:
type: string
value:
type: string
deviceConfigurationStoreEnablementPolicy:
description: The policy for which the Device Configuration Store Application is enabled or not for this device. 'INHERITED' means that it inherits the setting from the Account-wide Configuration Store Service Configuration
enum:
- ENABLED
- DISABLED
- INHERITED
deviceConfigurationStoreSettings:
allOf:
- $ref: '../openapi.yaml#/components/schemas/byDeviceAppManagementSettings'
- type: object
properties:
enablementPolicy:
$ref: '#/components/schemas/deviceConfigurationStoreEnablementPolicy'
example:
scopeId: AQ
deviceId: dIVxI5QpFUI
enablementPolicy: ENABLED
3 changes: 3 additions & 0 deletions rest-api/resources/src/main/resources/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ paths:
$ref: './deviceConfiguration/deviceConfiguration-scopeId-deviceId.yaml#/paths/~1{scopeId}~1devices~1{deviceId}~1configurations'
/{scopeId}/devices/{deviceId}/configurations/{componentId}:
$ref: './deviceConfiguration/deviceConfiguration-scopeId-deviceId-componentId.yaml#/paths/~1{scopeId}~1devices~1{deviceId}~1configurations~1{componentId}'
### Device Configuration Store ###
/{scopeId}/devices/{deviceId}/configurations/_settings:
$ref: './deviceConfiguration/deviceConfiguration-scopeId-deviceId-_settings.yaml#/paths/~1{scopeId}~1devices~1{deviceId}~1configurations~1_settings'
### Device Inventory ###
/{scopeId}/devices/{deviceId}/inventory:
$ref: './deviceInventory/deviceInventory-scopeId-deviceId.yaml#/paths/~1{scopeId}~1devices~1{deviceId}~1inventory'
Expand Down

0 comments on commit 4456841

Please sign in to comment.