Skip to content

Commit dd51ca8

Browse files
committed
Create mqtt-api.yaml
1 parent 83634d7 commit dd51ca8

File tree

1 file changed

+206
-0
lines changed

1 file changed

+206
-0
lines changed

static/mqtt-api.yaml

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
asyncapi: 3.0.0
2+
info:
3+
title: Streetlights Kafka API
4+
version: 1.0.0
5+
description: |-
6+
The Smartylighting Streetlights API allows you to remotely manage the city
7+
lights.
8+
### Check out its awesome features:
9+
10+
* Turn a specific streetlight on/off 🌃
11+
* Dim a specific streetlight 😎
12+
* Receive real-time information about environmental lighting conditions 📈
13+
license:
14+
name: Apache 2.0
15+
url: https://www.apache.org/licenses/LICENSE-2.0
16+
defaultContentType: application/json
17+
servers:
18+
scram-connections:
19+
host: test.mykafkacluster.org:18092
20+
protocol: kafka-secure
21+
description: Test broker secured with scramSha256
22+
security:
23+
- $ref: '#/components/securitySchemes/saslScram'
24+
tags:
25+
- name: env:test-scram
26+
description: >-
27+
This environment is meant for running internal tests through
28+
scramSha256
29+
- name: kind:remote
30+
description: This server is a remote server. Not exposed by the application
31+
- name: visibility:private
32+
description: This resource is private and only available to certain users
33+
mtls-connections:
34+
host: test.mykafkacluster.org:28092
35+
protocol: kafka-secure
36+
description: Test broker secured with X509
37+
security:
38+
- $ref: '#/components/securitySchemes/certs'
39+
tags:
40+
- name: env:test-mtls
41+
description: This environment is meant for running internal tests through mtls
42+
- name: kind:remote
43+
description: This server is a remote server. Not exposed by the application
44+
- name: visibility:private
45+
description: This resource is private and only available to certain users
46+
channels:
47+
lightingMeasured:
48+
address: smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured
49+
messages:
50+
lightMeasured:
51+
$ref: '#/components/messages/lightMeasured'
52+
description: The topic on which measured values may be produced and consumed.
53+
parameters:
54+
streetlightId:
55+
$ref: '#/components/parameters/streetlightId'
56+
lightTurnOn:
57+
address: smartylighting.streetlights.1.0.action.{streetlightId}.turn.on
58+
messages:
59+
turnOn:
60+
$ref: '#/components/messages/turnOnOff'
61+
parameters:
62+
streetlightId:
63+
$ref: '#/components/parameters/streetlightId'
64+
lightTurnOff:
65+
address: smartylighting.streetlights.1.0.action.{streetlightId}.turn.off
66+
messages:
67+
turnOff:
68+
$ref: '#/components/messages/turnOnOff'
69+
parameters:
70+
streetlightId:
71+
$ref: '#/components/parameters/streetlightId'
72+
lightsDim:
73+
address: smartylighting.streetlights.1.0.action.{streetlightId}.dim
74+
messages:
75+
dimLight:
76+
$ref: '#/components/messages/dimLight'
77+
parameters:
78+
streetlightId:
79+
$ref: '#/components/parameters/streetlightId'
80+
operations:
81+
receiveLightMeasurement:
82+
action: receive
83+
channel:
84+
$ref: '#/channels/lightingMeasured'
85+
summary: >-
86+
Inform about environmental lighting conditions of a particular
87+
streetlight.
88+
traits:
89+
- $ref: '#/components/operationTraits/kafka'
90+
messages:
91+
- $ref: '#/channels/lightingMeasured/messages/lightMeasured'
92+
turnOn:
93+
action: send
94+
channel:
95+
$ref: '#/channels/lightTurnOn'
96+
traits:
97+
- $ref: '#/components/operationTraits/kafka'
98+
messages:
99+
- $ref: '#/channels/lightTurnOn/messages/turnOn'
100+
turnOff:
101+
action: send
102+
channel:
103+
$ref: '#/channels/lightTurnOff'
104+
traits:
105+
- $ref: '#/components/operationTraits/kafka'
106+
messages:
107+
- $ref: '#/channels/lightTurnOff/messages/turnOff'
108+
dimLight:
109+
action: send
110+
channel:
111+
$ref: '#/channels/lightsDim'
112+
traits:
113+
- $ref: '#/components/operationTraits/kafka'
114+
messages:
115+
- $ref: '#/channels/lightsDim/messages/dimLight'
116+
components:
117+
messages:
118+
lightMeasured:
119+
name: lightMeasured
120+
title: Light measured
121+
summary: >-
122+
Inform about environmental lighting conditions of a particular
123+
streetlight.
124+
contentType: application/json
125+
traits:
126+
- $ref: '#/components/messageTraits/commonHeaders'
127+
payload:
128+
$ref: '#/components/schemas/lightMeasuredPayload'
129+
turnOnOff:
130+
name: turnOnOff
131+
title: Turn on/off
132+
summary: Command a particular streetlight to turn the lights on or off.
133+
traits:
134+
- $ref: '#/components/messageTraits/commonHeaders'
135+
payload:
136+
$ref: '#/components/schemas/turnOnOffPayload'
137+
dimLight:
138+
name: dimLight
139+
title: Dim light
140+
summary: Command a particular streetlight to dim the lights.
141+
traits:
142+
- $ref: '#/components/messageTraits/commonHeaders'
143+
payload:
144+
$ref: '#/components/schemas/dimLightPayload'
145+
schemas:
146+
lightMeasuredPayload:
147+
type: object
148+
properties:
149+
lumens:
150+
type: integer
151+
minimum: 0
152+
description: Light intensity measured in lumens.
153+
sentAt:
154+
$ref: '#/components/schemas/sentAt'
155+
turnOnOffPayload:
156+
type: object
157+
properties:
158+
command:
159+
type: string
160+
enum:
161+
- 'on'
162+
- 'off'
163+
description: Whether to turn on or off the light.
164+
sentAt:
165+
$ref: '#/components/schemas/sentAt'
166+
dimLightPayload:
167+
type: object
168+
properties:
169+
percentage:
170+
type: integer
171+
description: Percentage to which the light should be dimmed to.
172+
minimum: 0
173+
maximum: 100
174+
sentAt:
175+
$ref: '#/components/schemas/sentAt'
176+
sentAt:
177+
type: string
178+
format: date-time
179+
description: Date and time when the message was sent.
180+
securitySchemes:
181+
saslScram:
182+
type: scramSha256
183+
description: Provide your username and password for SASL/SCRAM authentication
184+
certs:
185+
type: X509
186+
description: Download the certificate files from service provider
187+
parameters:
188+
streetlightId:
189+
description: The ID of the streetlight.
190+
messageTraits:
191+
commonHeaders:
192+
headers:
193+
type: object
194+
properties:
195+
my-app-header:
196+
type: integer
197+
minimum: 0
198+
maximum: 100
199+
operationTraits:
200+
kafka:
201+
bindings:
202+
kafka:
203+
clientId:
204+
type: string
205+
enum:
206+
- my-app-id

0 commit comments

Comments
 (0)