-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/add m detach #33
Changes from 55 commits
aeb5c04
5550d7e
573245b
469efd1
bd1c5c4
529e622
b798874
27ba94f
23fa990
259b5f4
b896327
98410a6
db06c76
5404b69
cf1f49c
8e809d5
65a1283
5f4adc2
bd42756
035251e
a02037b
2ee1834
f5899d7
5a72e6d
46af50d
96515b9
d5943dd
4a97ad3
0d7e32d
50d4ecd
ae0ac60
8fb0279
10fae65
6b560c2
2af753f
a61cefa
e04e093
d442755
c469729
453b230
b666fe1
177730c
ec44401
27effa4
14dfe31
7af8b8c
4b45c46
a2d0242
de92bb7
465110f
7e0e2cb
ac9ffb1
eb706cd
2231023
c5b3297
bdcbd6d
70b3dee
98702fc
742b209
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
code: true | ||
type: page | ||
title: mAttach | ||
description: Attach multiple sensors to multiple tenants index | ||
--- | ||
|
||
# mAttachTenant | ||
|
||
Attach multiple sensors to multiple tenants. | ||
|
||
The sensor document will be duplicated inside the tenant "sensors" collection. | ||
|
||
--- | ||
|
||
## Query Syntax | ||
|
||
### HTTP | ||
|
||
``` http | ||
URL: http://kuzzle:7512/_/device-manager/sensors/_mAttach | ||
Method: PUT | ||
Body: | ||
``` | ||
|
||
``` js | ||
{ | ||
// Using JSON | ||
"records" [{ | ||
"tenantId": "tenant-kuzzle", | ||
"sensorId": "test-id" | ||
}], | ||
// Using CSV syntax | ||
"csv": "tenant,id\ntenant-kuzzle,test-id" | ||
} | ||
``` | ||
|
||
### Other protocols | ||
|
||
``` js | ||
{ | ||
"controller": "device-manager/sensor", | ||
"action": "mAttach", | ||
"body": { | ||
// Using JSON | ||
"records" [{ | ||
"tenantId": "tenant-kuzzle", | ||
"sensorId": "test-id" | ||
}], | ||
// Using CSV syntax | ||
"csv": "tenantId,sensorId\ntenant-kuzzle,test-id", | ||
} | ||
} | ||
``` | ||
|
||
--- | ||
|
||
## Body properties | ||
|
||
Body properties, must contain at least one of | ||
|
||
- `records`: an array of object containing `tenantId` and `sensorId` | ||
- `csv`: a csv syntax compatible containing at least this two headers `tenantId,sensorId` with their corresponding values | ||
- `strict`: a boolean value that indicate if the process should fail at first error | ||
|
||
--- | ||
|
||
### Optional: | ||
|
||
* `refresh`: if set to `wait_for`, Kuzzle will not respond until the documents are indexed | ||
|
||
--- | ||
|
||
## Response | ||
|
||
``` js | ||
{ | ||
"status": 200, | ||
"error": null, | ||
"controller": "device-manager/sensor", | ||
"action": "mAttach", | ||
"requestId": "<unique request identifier>", | ||
"result": { | ||
"errors": [], | ||
"successes": [] | ||
} | ||
} | ||
``` |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,89 @@ | ||||||
--- | ||||||
code: true | ||||||
type: page | ||||||
title: detach | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
description: Detach multiple sensors from multiple tenants | ||||||
--- | ||||||
|
||||||
# detach | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
Detach multiple sensors from multiple tenants. | ||||||
|
||||||
--- | ||||||
|
||||||
## Query Syntax | ||||||
|
||||||
### HTTP | ||||||
|
||||||
``` http | ||||||
URL: http://kuzzle:7512/_/device-manager/device-manager/sensors/_mDetach[?refresh=wait_for] | ||||||
Method: PUT | ||||||
Body: | ||||||
``` | ||||||
|
||||||
``` js | ||||||
{ | ||||||
// Using JSON | ||||||
"records" [{ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||||||
"tenant": "tenant-kuzzle", | ||||||
"id": "test-id" | ||||||
}], | ||||||
// Using CSV syntax | ||||||
"csv": "tenant,id\ntenant-kuzzle,test-id" | ||||||
} | ||||||
``` | ||||||
|
||||||
### Other protocols | ||||||
|
||||||
``` js | ||||||
{ | ||||||
"controller": "device-manager/sensor", | ||||||
"action": "mAttachTenant", | ||||||
"body": { | ||||||
// Using JSON | ||||||
"records" [{ | ||||||
"tenantId": "tenant-kuzzle", | ||||||
"sensorId": "test-id" | ||||||
}], | ||||||
// Using CSV syntax | ||||||
"csv": "tenantId,sensorId\ntenant-kuzzle,test-id", | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
--- | ||||||
|
||||||
## Body properties | ||||||
|
||||||
Body properties, must contain at least one of | ||||||
|
||||||
* `records`: an array of object containing `tenantId` and `sensorId` | ||||||
* `csv`: a csv syntax compatible containing at least this two headers `tenantId,sensorId` with their corresponding values | ||||||
* `strict`: a boolean value that indicate if the process should fail at first error | ||||||
|
||||||
--- | ||||||
|
||||||
## Arguments | ||||||
|
||||||
### Optional: | ||||||
|
||||||
* `refresh`: if set to `wait_for`, Kuzzle will not respond until the documents are indexed | ||||||
|
||||||
--- | ||||||
|
||||||
## Response | ||||||
|
||||||
``` js | ||||||
{ | ||||||
"status": 200, | ||||||
"error": null, | ||||||
"index": "<index>", | ||||||
"controller": "device-manager/sensor", | ||||||
"action": "mDetach", | ||||||
"requestId": "<unique request identifier>", | ||||||
"result": { | ||||||
"errors": [], | ||||||
"successes": [] | ||||||
} | ||||||
} | ||||||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const sensors = []; | ||
for (let i = 0; i < 50; i++) { | ||
sensors.push({ index: { _id: `DummyTemp_detached-${i}` } }); | ||
sensors.push({ | ||
reference: 'detached', | ||
model: `DummyTemp-${i}`, | ||
measures: {}, | ||
metadata: {}, | ||
tenantId: null, | ||
assetId: null | ||
}); | ||
} | ||
|
||
const sensorsTests = sensors.filter(test => test.model); | ||
|
||
module.exports = { sensors, sensorsTests }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be name
m-detach