|
| 1 | +{ |
| 2 | + "swagger": "2.0", |
| 3 | + "info": { |
| 4 | + "title": "MQTT configuration", |
| 5 | + "version": "2021-02-10", |
| 6 | + "license": { |
| 7 | + "name": "OCF Data Model License", |
| 8 | + "url": "https://github.com/openconnectivityfoundation/core/blob/e28a9e0a92e17042ba3e83661e4c0fbce8bdc4ba/LICENSE.md", |
| 9 | + "x-copyright": "Copyright 2021 Open Connectivity Foundation, Inc. All rights reserved." |
| 10 | + }, |
| 11 | + "termsOfService": "https://openconnectivityfoundation.github.io/core/DISCLAIMER.md" |
| 12 | + }, |
| 13 | + "schemes": ["http"], |
| 14 | + "consumes": ["application/json"], |
| 15 | + "produces": ["application/json"], |
| 16 | + "paths": { |
| 17 | + "/mqttconfResURI" : { |
| 18 | + "get": { |
| 19 | + "description": "The Resource through which the MQTT server information can be set.", |
| 20 | + "parameters": [ |
| 21 | + {"$ref": "#/parameters/interface-all"} |
| 22 | + ], |
| 23 | + "responses": { |
| 24 | + "200": { |
| 25 | + "description" : "", |
| 26 | + "x-example": { |
| 27 | + "rt": ["oic.r.mqtt.conf"], |
| 28 | + "server": "", |
| 29 | + "port": 8, |
| 30 | + "kai" : 60, |
| 31 | + "uid" : "", |
| 32 | + "pwd" : "", |
| 33 | + "cacert" : "", |
| 34 | + "clcert" : "", |
| 35 | + "log" : "not connected", |
| 36 | + "crcode" : -1 |
| 37 | + }, |
| 38 | + "schema": { "$ref": "#/definitions/mqttconf" } |
| 39 | + } |
| 40 | + } |
| 41 | + }, |
| 42 | + "post": { |
| 43 | + "description": "Set information to connect to an MQTT server\n", |
| 44 | + "parameters": [ |
| 45 | + {"$ref": "#/parameters/interface-all"}, |
| 46 | + { |
| 47 | + "name": "body", |
| 48 | + "in": "body", |
| 49 | + "required": true, |
| 50 | + "schema": { "$ref": "#/definitions/mqttconf" }, |
| 51 | + "x-example": { |
| 52 | + "server": "test.mosquitto.org", |
| 53 | + "port": 1883 , |
| 54 | + "kai" : 60 |
| 55 | + } |
| 56 | + } |
| 57 | + ], |
| 58 | + "responses": { |
| 59 | + "200": { |
| 60 | + "description" : "", |
| 61 | + "x-example": { |
| 62 | + "rt": ["oic.r.mqtt.conf"], |
| 63 | + "server": "test.mosquitto.org", |
| 64 | + "port": 8, |
| 65 | + "kai" : 60, |
| 66 | + "uid" : "", |
| 67 | + "pwd" : "", |
| 68 | + "cacert" : "", |
| 69 | + "clcert" : "", |
| 70 | + "log" : "connected", |
| 71 | + "crcode" : 0 |
| 72 | + }, |
| 73 | + "schema": { "$ref": "#/definitions/mqttconf" } |
| 74 | + } |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + }, |
| 79 | + "parameters": { |
| 80 | + "interface-all" : { |
| 81 | + "in" : "query", |
| 82 | + "name" : "if", |
| 83 | + "type" : "string", |
| 84 | + "enum" : ["oic.if.rw", "oic.if.baseline"] |
| 85 | + } |
| 86 | + }, |
| 87 | + "definitions": { |
| 88 | + "mqttconf" : { |
| 89 | + "properties": { |
| 90 | + "server" : { |
| 91 | + "description": "The connection information of the MQTT server. Can be a URI or IP address", |
| 92 | + "type": "string" |
| 93 | + }, |
| 94 | + "port" : { |
| 95 | + "description": "The port to connect too", |
| 96 | + "type": "integer" |
| 97 | + }, |
| 98 | + "kai" : { |
| 99 | + "description": "The keep alive interval, in seconds", |
| 100 | + "type": "integer" |
| 101 | + }, |
| 102 | + "uid" : { |
| 103 | + "description": "The user id to be supplied when connecting to the MQTT server", |
| 104 | + "type": "string" |
| 105 | + }, |
| 106 | + "pwd" : { |
| 107 | + "description": "The password to be supplied when connecting to the MQTT server", |
| 108 | + "type": "string" |
| 109 | + }, |
| 110 | + "cacert" : { |
| 111 | + "description": "The certificate authority certificate to be supplied when connecting to the MQTT server", |
| 112 | + "type": "string" |
| 113 | + }, |
| 114 | + "clcert" : { |
| 115 | + "description": "The client certificate to be supplied when connecting to the MQTT server", |
| 116 | + "type": "string" |
| 117 | + }, |
| 118 | + "log" : { |
| 119 | + "description": "Logging information, giving status information back, formatting not defined", |
| 120 | + "type": "string" |
| 121 | + }, |
| 122 | + "crcode" : { |
| 123 | + "description": "MQTT connection reason codes, see MQTT v5 table 3-1 for values. note that -1 indicates 'not yet connected' ", |
| 124 | + "type": "integer" |
| 125 | + }, |
| 126 | + "rt" : { |
| 127 | + "description": "Resource Type of the Resource", |
| 128 | + "items": { |
| 129 | + "enum": ["oic.r.mqtt.conf"], |
| 130 | + "type": "string", |
| 131 | + "maxLength": 64 |
| 132 | + }, |
| 133 | + "minItems": 1, |
| 134 | + "uniqueItems": true, |
| 135 | + "readOnly": true, |
| 136 | + "type": "array" |
| 137 | + }, |
| 138 | + "id" : { |
| 139 | + "$ref": "https://openconnectivityfoundation.github.io/core/schemas/oic.common.properties.core-schema.json#/definitions/id" |
| 140 | + }, |
| 141 | + "n" : { |
| 142 | + "$ref": "https://openconnectivityfoundation.github.io/core/schemas/oic.common.properties.core-schema.json#/definitions/n" |
| 143 | + }, |
| 144 | + "if" : { |
| 145 | + "description": "The OCF Interfaces supported by this Resource", |
| 146 | + "items": { |
| 147 | + "enum": [ |
| 148 | + "oic.if.rw", |
| 149 | + "oic.if.baseline" |
| 150 | + ], |
| 151 | + "type": "string", |
| 152 | + "maxLength": 64 |
| 153 | + }, |
| 154 | + "minItems": 1, |
| 155 | + "readOnly": true, |
| 156 | + "uniqueItems": true, |
| 157 | + "type": "array" |
| 158 | + } |
| 159 | + }, |
| 160 | + "type" : "object", |
| 161 | + "required": ["server", "port"] |
| 162 | + } |
| 163 | + } |
| 164 | +} |
0 commit comments