Skip to content
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

Allows to define custom mappings for devices and assets for a tenant group only #61

Merged
merged 35 commits into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2f29747
wip [ci skip]
Yoann-Abbes Mar 25, 2021
3fbc0af
wip [ci skip]
Yoann-Abbes Apr 1, 2021
c09ae96
Merge branch '1-dev' into add-custom-mappings
Yoann-Abbes Apr 13, 2021
909caa0
wip [ci skip]
Yoann-Abbes Apr 13, 2021
c7f4cba
Merge branch '1-dev' into add-custom-mappings
Yoann-Abbes Apr 13, 2021
dbe9a20
wip [ci skip]
Yoann-Abbes Apr 13, 2021
0d180aa
wip [ci skip]
Yoann-Abbes Apr 14, 2021
0db7785
wip [ci skip]
Yoann-Abbes Apr 15, 2021
cbbd097
Merge branch '1-dev' into add-custom-mappings
Yoann-Abbes Apr 15, 2021
401e900
wip [ci skip]
Yoann-Abbes Apr 15, 2021
f54c12f
remove uselss map
Yoann-Abbes Apr 15, 2021
cdaac7a
comment
Yoann-Abbes Apr 15, 2021
6be922b
lint
Yoann-Abbes Apr 15, 2021
3fc906a
fix func tests
Yoann-Abbes Apr 15, 2021
107cb6b
com
Yoann-Abbes Apr 15, 2021
33d202b
add test
Yoann-Abbes Apr 15, 2021
1e50735
add field text for keyword properties
Yoann-Abbes Apr 16, 2021
b1009b8
nit
Yoann-Abbes Apr 16, 2021
043e5bb
remove asset-history collection
Yoann-Abbes Apr 16, 2021
16d75cc
remove asset-history collection from test
Yoann-Abbes Apr 16, 2021
4837eb9
@aschen requested changed
Yoann-Abbes Apr 20, 2021
fabec15
Add doc
Yoann-Abbes Apr 20, 2021
4d9966a
Merge branch '1-dev' into add-custom-mappings
Yoann-Abbes Apr 20, 2021
e444812
engine:create doc
Yoann-Abbes Apr 20, 2021
f639b56
remove duplicate comment
Yoann-Abbes Apr 20, 2021
b888cc3
typo
Yoann-Abbes Apr 20, 2021
f25d8d5
nit
Yoann-Abbes Apr 20, 2021
c28ab1f
package lock
Yoann-Abbes Apr 21, 2021
07f6231
update doc
Yoann-Abbes Apr 23, 2021
7f1b942
fix merge measures and shared properties
Yoann-Abbes Apr 23, 2021
ba320c1
add guard
Yoann-Abbes Apr 23, 2021
ffb1b91
Add guide
Yoann-Abbes Apr 29, 2021
2d0c972
Update doc/1/guides/mappings/index.md
Yoann-Abbes Apr 29, 2021
6563501
Update doc/1/guides/mappings/index.md
Yoann-Abbes Apr 29, 2021
3d73752
Update doc/1/guides/mappings/index.md
Yoann-Abbes Apr 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions doc/1/classes/assets-custom-properties/constructor/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
code: false
type: page
title: Constructor
description: AssetsCustomProperties class constructor
---

# AssetsCustomProperties

This class is used within the plugin in order to register custom properties definitions to the `assets` collection.
They are automatically loaded at application startup.
---

## Constructor

```ts
AssetsCustomProperties()
```
6 changes: 6 additions & 0 deletions doc/1/classes/assets-custom-properties/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
code: true
type: branch
title: AssetsCustomProperties
description: Kuzzle IoT Platform - AssetsCustomProperties class
---
44 changes: 44 additions & 0 deletions doc/1/classes/assets-custom-properties/register-metadata/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
code: true
type: page
title: registerMetadata
description: Add properties definition to the 'metadata' field
---

# registerMetadata

Add properties definition to the `metadata` field of the `assets` collection.


```ts
registerMetadata (mapping: JSONObject, options: JSONObject);
```

<br/>

| Arguments | Type | Description |
|-----------|-----------------------|---------------------------------------------|
| `mapping` | <pre>JSONObject</pre> | Mapping definiton of the `metadata` property |
| `options` | <pre>JSONObject</pre> | Additional options |

### options

| Properties | Type | Description |
|-----------|-----------------------|---------------------------------------------|
| `tenantGroup` | <pre>string</pre> | Name of the group for which the mapping should apply. If unspecified, mappings will apply to every group who does not have specific definition. |

## Usage

```ts
import { DeviceManagerPlugin } from 'kuzzle-plugin-device-manager';

const deviceManagerPlugin = new DeviceManagerPlugin();

deviceManagerPlugin.assets.registerMetadata({
serial: {
type: 'keyword',
fields: {
text: { type: 'text' } }
}
}, { tenantGroup: 'water_management' });
```
18 changes: 18 additions & 0 deletions doc/1/classes/devices-custom-properties/constructor/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
code: false
type: page
title: Constructor
description: DevicesCustomProperties class constructor
---

# DevicesCustomProperties

This class is used within the plugin in order to register custom properties definitions to the `devices` collection.
They are automatically loaded at application startup.
---

## Constructor

```ts
DeviceCustomProperties()
```
6 changes: 6 additions & 0 deletions doc/1/classes/devices-custom-properties/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
code: true
type: branch
title: DevicesCustomProperties
description: Kuzzle IoT Platform - DevicesCustomProperties class
---
62 changes: 62 additions & 0 deletions doc/1/classes/devices-custom-properties/register-measure/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
code: true
type: page
title: registerMeasure
description: Add properties definition to the 'measures' field
---

# registerMeasure

Add properties definition to the `measures` field of the `devices` collection.


```ts
registerMeasure (measureName: string, mapping: JSONObject, options: JSONObject);
```

<br/>

| Arguments | Type | Description |
|-----------|-----------------------|---------------------------------------------|
| `measureName` | <pre>string</pre> | Name of the measure you are willing to add to the `measures` field |
| `mapping` | <pre>JSONObject</pre> | Mapping definiton of the custom measure property |
| `options` | <pre>JSONObject</pre> | Additional options |

### options

| Properties | Type | Description |
|-----------|-----------------------|---------------------------------------------|
| `tenantGroup` | <pre>string</pre> | Name of the group for which the mapping should apply. If unspecified, mappings will apply to every group who does not have specific definition |

## Usage

```ts
import { DeviceManagerPlugin } from 'kuzzle-plugin-device-manager';

const deviceManagerPlugin = new DeviceManagerPlugin();

deviceManagerPlugin.devices.registerMeasure(
'temperature',
{
dynamic: 'false',
properties: {
fahrenheit: { type: 'float' },
celsius: { type: 'float' }
}
},
{ tenantGroup: 'water_management' });

deviceManagerPlugin.devices.registerMeasure(
'humidity',
{
dynamic: 'false',
properties: {
percentage: {
type: 'keyword',
fields: {
text: { type: 'text' } }
}
}
},
{ tenantGroup: 'air_quality' });
```
44 changes: 44 additions & 0 deletions doc/1/classes/devices-custom-properties/register-metadata/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
code: true
type: page
title: registerMetadata
description: Add properties definition to the 'metadata' field
---

# registerMetadata

Add properties definition to the `metadata` field of the `devices` collection.


```ts
registerMetadata (mapping: JSONObject, options: JSONObject);
```

<br/>

| Arguments | Type | Description |
|-----------|-----------------------|---------------------------------------------|
| `mapping` | <pre>JSONObject</pre> | Mapping definiton of the `metadata` property |
| `options` | <pre>JSONObject</pre> | Additional options |

### options

| Properties | Type | Description |
|-----------|-----------------------|---------------------------------------------|
| `tenantGroup` | <pre>string</pre> | Name of the group for which the mapping should apply. If unspecified, mappings will apply to every group who does not have specific definition. |

## Usage

```ts
import { DeviceManagerPlugin } from 'kuzzle-plugin-device-manager';

const deviceManagerPlugin = new DeviceManagerPlugin();

deviceManagerPlugin.devices.registerMetadata({
serial: {
type: 'keyword',
fields: {
text: { type: 'text' } }
}
}, { tenantGroup: 'water_management' });
```
40 changes: 40 additions & 0 deletions doc/1/classes/devices-custom-properties/register-qos/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
code: true
type: page
title: registerQos
description: Add properties definition to the 'qos' field
---

# registerQos

Add properties definition to the `qos` field of the `devices` collection.


```ts
registerQos (mapping: JSONObject, options: JSONObject);
```

<br/>

| Arguments | Type | Description |
|-----------|-----------------------|---------------------------------------------|
| `mapping` | <pre>JSONObject</pre> | Mapping definiton of the `qos` property |
| `options` | <pre>JSONObject</pre> | Additional options |

### options

| Properties | Type | Description |
|-----------|-----------------------|---------------------------------------------|
| `tenantGroup` | <pre>string</pre> | Name of the group for which the mapping should apply. If unspecified, mappings will apply to every group who does not have specific definition. |

## Usage

```ts
import { DeviceManagerPlugin } from 'kuzzle-plugin-device-manager';

const deviceManagerPlugin = new DeviceManagerPlugin();

deviceManagerPlugin.devices.registerQos({
battery: { type: 'integer' }
}, { tenantGroup: 'water_management' });
```
5 changes: 3 additions & 2 deletions doc/1/controllers/engine/create/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Creates a new device manager engine on an index
### HTTP

```http
URL: http://kuzzle:7512/_/device-manager/engine/:index
URL: http://kuzzle:7512/_/device-manager/engine/:index/[?group]
Method: POST
```

Expand All @@ -28,13 +28,14 @@ Method: POST
"controller": "device-manager/engine",
"action": "create",
"index": "tenant-ayse"
"group": "tenant-group" // Optional. Specify the tenant group to apply custom mappings.
}
```

### Kourou

```bash
kourou device-manager/engine:create <index>
kourou device-manager/engine:create <index> [group]
```
---

Expand Down
Loading