|
| 1 | +{ |
| 2 | + "asyncapi": "2.3.0", |
| 3 | + "info": { |
| 4 | + "title": "Streetlights Kafka API", |
| 5 | + "version": "1.0.0", |
| 6 | + "description": "The Smartylighting Streetlights API allows you to remotely manage the city lights.\n", |
| 7 | + "license": { |
| 8 | + "name": "Apache 2.0", |
| 9 | + "url": "https://www.apache.org/licenses/LICENSE-2.0" |
| 10 | + } |
| 11 | + }, |
| 12 | + "servers": { |
| 13 | + "test": { |
| 14 | + "url": "test.mykafkacluster.org:8092", |
| 15 | + "protocol": "kafka-secure", |
| 16 | + "description": "Test broker", |
| 17 | + "security": [ |
| 18 | + { |
| 19 | + "saslScram": [] |
| 20 | + } |
| 21 | + ] |
| 22 | + } |
| 23 | + }, |
| 24 | + "defaultContentType": "application/json", |
| 25 | + "channels": { |
| 26 | + "smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured": { |
| 27 | + "description": "The topic on which measured values may be produced and consumed.", |
| 28 | + "parameters": { |
| 29 | + "streetlightId": { |
| 30 | + "$ref": "#/components/parameters/streetlightId" |
| 31 | + } |
| 32 | + }, |
| 33 | + "publish": { |
| 34 | + "summary": "Inform about environmental lighting conditions of a particular streetlight.", |
| 35 | + "operationId": "receiveLightMeasurement", |
| 36 | + "traits": [ |
| 37 | + { |
| 38 | + "$ref": "#/components/operationTraits/kafka" |
| 39 | + } |
| 40 | + ], |
| 41 | + "message": { |
| 42 | + "$ref": "#/components/messages/lightMeasured" |
| 43 | + } |
| 44 | + } |
| 45 | + }, |
| 46 | + "smartylighting.streetlights.1.0.action.{streetlightId}.turn.on": { |
| 47 | + "parameters": { |
| 48 | + "streetlightId": { |
| 49 | + "$ref": "#/components/parameters/streetlightId" |
| 50 | + } |
| 51 | + }, |
| 52 | + "subscribe": { |
| 53 | + "operationId": "turnOn", |
| 54 | + "traits": [ |
| 55 | + { |
| 56 | + "$ref": "#/components/operationTraits/kafka" |
| 57 | + } |
| 58 | + ], |
| 59 | + "message": { |
| 60 | + "$ref": "#/components/messages/turnOnOff" |
| 61 | + } |
| 62 | + } |
| 63 | + }, |
| 64 | + "smartylighting.streetlights.1.0.action.{streetlightId}.turn.off": { |
| 65 | + "parameters": { |
| 66 | + "streetlightId": { |
| 67 | + "$ref": "#/components/parameters/streetlightId" |
| 68 | + } |
| 69 | + }, |
| 70 | + "subscribe": { |
| 71 | + "operationId": "turnOff", |
| 72 | + "traits": [ |
| 73 | + { |
| 74 | + "$ref": "#/components/operationTraits/kafka" |
| 75 | + } |
| 76 | + ], |
| 77 | + "message": { |
| 78 | + "$ref": "#/components/messages/turnOnOff" |
| 79 | + } |
| 80 | + } |
| 81 | + }, |
| 82 | + "smartylighting.streetlights.1.0.action.{streetlightId}.dim": { |
| 83 | + "parameters": { |
| 84 | + "streetlightId": { |
| 85 | + "$ref": "#/components/parameters/streetlightId" |
| 86 | + } |
| 87 | + }, |
| 88 | + "subscribe": { |
| 89 | + "operationId": "dimLight", |
| 90 | + "traits": [ |
| 91 | + { |
| 92 | + "$ref": "#/components/operationTraits/kafka" |
| 93 | + } |
| 94 | + ], |
| 95 | + "message": { |
| 96 | + "$ref": "#/components/messages/dimLight" |
| 97 | + } |
| 98 | + } |
| 99 | + } |
| 100 | + }, |
| 101 | + "components": { |
| 102 | + "messages": { |
| 103 | + "lightMeasured": { |
| 104 | + "name": "lightMeasured", |
| 105 | + "title": "Light measured", |
| 106 | + "summary": "Inform about environmental lighting conditions of a particular streetlight.", |
| 107 | + "contentType": "application/json", |
| 108 | + "traits": [ |
| 109 | + { |
| 110 | + "$ref": "#/components/messageTraits/commonHeaders" |
| 111 | + } |
| 112 | + ], |
| 113 | + "payload": { |
| 114 | + "$ref": "#/components/schemas/lightMeasuredPayload" |
| 115 | + } |
| 116 | + }, |
| 117 | + "turnOnOff": { |
| 118 | + "name": "turnOnOff", |
| 119 | + "title": "Turn on/off", |
| 120 | + "summary": "Command a particular streetlight to turn the lights on or off.", |
| 121 | + "traits": [ |
| 122 | + { |
| 123 | + "$ref": "#/components/messageTraits/commonHeaders" |
| 124 | + } |
| 125 | + ], |
| 126 | + "payload": { |
| 127 | + "$ref": "#/components/schemas/turnOnOffPayload" |
| 128 | + } |
| 129 | + }, |
| 130 | + "dimLight": { |
| 131 | + "name": "dimLight", |
| 132 | + "title": "Dim light", |
| 133 | + "summary": "Command a particular streetlight to dim the lights.", |
| 134 | + "traits": [ |
| 135 | + { |
| 136 | + "$ref": "#/components/messageTraits/commonHeaders" |
| 137 | + } |
| 138 | + ], |
| 139 | + "payload": { |
| 140 | + "$ref": "#/components/schemas/dimLightPayload" |
| 141 | + } |
| 142 | + } |
| 143 | + }, |
| 144 | + "schemas": { |
| 145 | + "lightMeasuredPayload": { |
| 146 | + "type": "object", |
| 147 | + "properties": { |
| 148 | + "lumens": { |
| 149 | + "type": "integer", |
| 150 | + "minimum": "0", |
| 151 | + "description": "Light intensity measured in lumens." |
| 152 | + }, |
| 153 | + "sentAt": { |
| 154 | + "$ref": "#/components/schemas/sentAt" |
| 155 | + } |
| 156 | + } |
| 157 | + }, |
| 158 | + "turnOnOffPayload": { |
| 159 | + "type": "object", |
| 160 | + "properties": { |
| 161 | + "command": { |
| 162 | + "type": "string", |
| 163 | + "enum": [ "on", "off" ], |
| 164 | + "description": "Whether to turn on or off the light." |
| 165 | + }, |
| 166 | + "sentAt": { |
| 167 | + "$ref": "#/components/schemas/sentAt" |
| 168 | + } |
| 169 | + } |
| 170 | + }, |
| 171 | + "dimLightPayload": { |
| 172 | + "type": "object", |
| 173 | + "properties": { |
| 174 | + "percentage": { |
| 175 | + "type": "integer", |
| 176 | + "description": "Percentage to which the light should be dimmed to.", |
| 177 | + "minimum": "0", |
| 178 | + "maximum": "100" |
| 179 | + }, |
| 180 | + "sentAt": { |
| 181 | + "$ref": "#/components/schemas/sentAt" |
| 182 | + } |
| 183 | + } |
| 184 | + }, |
| 185 | + "sentAt": { |
| 186 | + "type": "string", |
| 187 | + "format": "date-time", |
| 188 | + "description": "Date and time when the message was sent." |
| 189 | + } |
| 190 | + }, |
| 191 | + "securitySchemes": { |
| 192 | + "saslScram": { |
| 193 | + "type": "scramSha256", |
| 194 | + "description": "Provide your username and password for SASL/SCRAM authentication" |
| 195 | + } |
| 196 | + }, |
| 197 | + "parameters": { |
| 198 | + "StreetlightId": { |
| 199 | + "description": "The ID of the streetlight.", |
| 200 | + "schema": { |
| 201 | + "type": "string" |
| 202 | + } |
| 203 | + } |
| 204 | + }, |
| 205 | + "messageTraits": { |
| 206 | + "commonHeaders": { |
| 207 | + "headers": { |
| 208 | + "type": "object", |
| 209 | + "properties": { |
| 210 | + "my-app-header": { |
| 211 | + "type": "integer", |
| 212 | + "minimum": "0", |
| 213 | + "maximum": "100" |
| 214 | + } |
| 215 | + } |
| 216 | + } |
| 217 | + } |
| 218 | + }, |
| 219 | + "operationTraits": { |
| 220 | + "kafka": { |
| 221 | + "bindings": { |
| 222 | + "kafka": { |
| 223 | + "clientId": { |
| 224 | + "type": "string", |
| 225 | + "enum": [ "my-app-id" ] |
| 226 | + } |
| 227 | + } |
| 228 | + } |
| 229 | + } |
| 230 | + } |
| 231 | + } |
| 232 | +} |
0 commit comments