From 1d1de7cbeb367320baef699d94e4b2ea6ed7441a Mon Sep 17 00:00:00 2001 From: Lev Tverdokhlebov Date: Sun, 19 Nov 2023 23:49:35 +0100 Subject: [PATCH 01/10] Script commands added. --- docs/_docs/hivemq/script.md | 240 ++ specs/hivemq-openapi.yaml | 3138 +++++++++-------- .../datahub/ScriptDefinitionOptions.java | 53 + .../commands/hivemq/script/ScriptCommand.java | 54 + .../hivemq/script/ScriptCreateCommand.java | 139 + .../hivemq/script/ScriptDeleteCommand.java | 79 + .../hivemq/script/ScriptGetCommand.java | 85 + .../hivemq/script/ScriptListCommand.java | 99 + .../cli/converters/ScriptTypeConverter.java | 35 + .../cli/hivemq/scripts/CreateScriptTask.java | 67 + .../cli/hivemq/scripts/DeleteScriptTask.java | 32 + .../cli/hivemq/scripts/GetScriptTask.java | 48 + .../cli/hivemq/scripts/ListScriptsTask.java | 127 + .../java/com/hivemq/cli/ioc/HiveMqModule.java | 15 + .../hivemq/cli/rest/HiveMQRestService.java | 7 + .../cli/utils/json/ScriptSerializer.java | 51 + .../script/ScriptCreateCommandTest.java | 155 + .../script/ScriptDeleteCommandTest.java | 81 + .../hivemq/script/ScriptGetCommandTest.java | 87 + .../hivemq/script/ScriptListCommandTest.java | 100 + .../hivemq/scripts/CreateScriptTaskTest.java | 120 + .../hivemq/scripts/DeleteScriptTaskTest.java | 53 + .../cli/hivemq/scripts/GetScriptTaskTest.java | 59 + .../hivemq/scripts/ListScriptsTaskTest.java | 152 + 24 files changed, 3616 insertions(+), 1460 deletions(-) create mode 100644 docs/_docs/hivemq/script.md create mode 100644 src/main/java/com/hivemq/cli/commands/hivemq/datahub/ScriptDefinitionOptions.java create mode 100644 src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptCommand.java create mode 100644 src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptCreateCommand.java create mode 100644 src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptDeleteCommand.java create mode 100644 src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptGetCommand.java create mode 100644 src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptListCommand.java create mode 100644 src/main/java/com/hivemq/cli/converters/ScriptTypeConverter.java create mode 100644 src/main/java/com/hivemq/cli/hivemq/scripts/CreateScriptTask.java create mode 100644 src/main/java/com/hivemq/cli/hivemq/scripts/DeleteScriptTask.java create mode 100644 src/main/java/com/hivemq/cli/hivemq/scripts/GetScriptTask.java create mode 100644 src/main/java/com/hivemq/cli/hivemq/scripts/ListScriptsTask.java create mode 100644 src/main/java/com/hivemq/cli/utils/json/ScriptSerializer.java create mode 100644 src/test/java/com/hivemq/cli/commands/hivemq/script/ScriptCreateCommandTest.java create mode 100644 src/test/java/com/hivemq/cli/commands/hivemq/script/ScriptDeleteCommandTest.java create mode 100644 src/test/java/com/hivemq/cli/commands/hivemq/script/ScriptGetCommandTest.java create mode 100644 src/test/java/com/hivemq/cli/commands/hivemq/script/ScriptListCommandTest.java create mode 100644 src/test/java/com/hivemq/cli/hivemq/scripts/CreateScriptTaskTest.java create mode 100644 src/test/java/com/hivemq/cli/hivemq/scripts/DeleteScriptTaskTest.java create mode 100644 src/test/java/com/hivemq/cli/hivemq/scripts/GetScriptTaskTest.java create mode 100644 src/test/java/com/hivemq/cli/hivemq/scripts/ListScriptsTaskTest.java diff --git a/docs/_docs/hivemq/script.md b/docs/_docs/hivemq/script.md new file mode 100644 index 000000000..fff7c9a50 --- /dev/null +++ b/docs/_docs/hivemq/script.md @@ -0,0 +1,240 @@ +--- +nav_order: 1 +redirect_from: + - /docs/hivemq/scripts.html + -/docs/hivemq/script.html +--- + +# Scripts + +*** + +The script command of the HiveMQ command line offers a set of commands to work with scripts using a HiveMQ Data Hub API +endpoint. + +**NOTE**: The HiveMQ Data Hub is a new product in the HiveMQ platform and commands using it may be subject to breaking +changes in the future. + +``` +mqtt hivemq script +``` + +*** + +## Commands + +| Command | Explanation | +|---------|-------------------------------------| +| create | See [Create Script](#create-script) | +| get | See [Get Script](#get-script) | +| list | See [List Scripts](#list-scripts) | +| delete | See [Delete Script](#delete-script) | + +*** + +## Options + +### Help Options + +{% include options/help-options.md defaultHelp=true %} + +*** + +# Create Script + +*** + +Create a new script and upload it to a HiveMQ node. +The script definition may be provided either directly from the command line or from a file. + +``` +mqtt hivemq script create +``` + +*** + +## Simple Example + +``` +mqtt hivemq script create --id hello_world --description "Yet another hello world script." --file hello.js --type transformation +``` + +*** + +## Options + +| Option | Long Version | Explanation | Default | Required | +|--------|-------------------|---------------------------------------------------------------------------------|---------|:-----------------------------------------------:| +| `-i` | `--id` | The id of the script to be created. | | X | +| | `--type` | The function type of the script. (Currently supported types [`TRANSFORMATION`]) | | X | +| | `--definition` | The source code of the script. | | Either `--definition` or `--file`, but not both | +| | `--description` | Short human-readable description of what the script does. | | | +| | `--file` | A path to a file containing the source code of the script. | | Either `--definition` or `--file`, but not both | +| | `--print-version` | Print the assigned script version after creation. | `false` | | + +### API Connection Options + +{% include options/api-connection-options.md %} + +### Logging Options + +{% include options/logging-options.md %} + +### Help Options + +{% include options/help-options.md defaultHelp=true %} + +*** + +# Get Script + +*** + +Retrieve a single existing script. + +``` +mqtt hivemq script get +``` + +*** + +## Simple Example + +``` +$ mqtt hivemq script get --id hello_world +{ + "id": "hello_world", + "version": 1, + "createdAt": "2023-11-03T13:07:15.650Z", + "description": "This function greets a person.", + "functionType": "TRANSFORMATION", + "source": "ZnVuY3Rpb24gdHJhbnNmb3JtKHBlcnNvbikgeyByZXR1cm4gJ2hlbGxvICcgKyBwZXJzb24gfQ==" +} + +``` + +*** + +## Options + +| Option | Long Version | Explanation | Required | +|--------|--------------|-----------------------------------------------------------------------------------|:--------:| +| `-i` | `--id` | The id of the script to fetch. | X | +| `-f` | `--field` | Select which JSON fields appear in the response. Can be specified multiple times. | | + +### API Connection Options + +{% include options/api-connection-options.md %} + +### Logging Options + +{% include options/logging-options.md %} + +### Help Options + +{% include options/help-options.md defaultHelp=true %} + +*** + +# List Scripts + +*** + +List every script that exists on a HiveMQ node. +This list may optionally be filtered by script id and script type. + +``` +mqtt hivemq script list +``` + +*** + +## Simple Example + +``` +$ mqtt hivemq script list --id hello_world +{ + "items": [ + { + "id": "hello_world", + "version": 1, + "createdAt": "2023-11-03T13:59:47.262Z", + "description": "This function greets a person.", + "functionType": "TRANSFORMATION", + "source": "ZnVuY3Rpb24gdHJhbnNmb3JtKHBlcnNvbikgeyByZXR1cm4gJ2hlbGxvICcgKyBwZXJzb24gfQ==" + }, + { + "id": "hello_world", + "version": 2, + "createdAt": "2023-11-03T13:59:48.348Z", + "description": "This function greets a person.", + "functionType": "TRANSFORMATION", + "source": "ZnVuY3Rpb24gdHJhbnNmb3JtKHBlcnNvbikgeyByZXR1cm4gJ2hlbGxvICcgKyBwZXJzb24gfQ==" + } + ] +} +``` + +*** + +## Options + +| Option | Long Version | Explanation | Required | +|--------|--------------|-----------------------------------------------------------------------------------|:--------:| +| `-i` | `--id` | Filter by scripts with a matching script id. Can be specified multiple times. | | +| `-t` | `--type` | Filter by scripts of a matching script type. Can be specified multiple times | | +| `-f` | `--field` | Select which JSON fields appear in the response. Can be specified multiple times. | | +| | `--limit` | Limit the maximum number of scripts returned. | | + +### API Connection Options + +{% include options/api-connection-options.md %} + +### Logging Options + +{% include options/logging-options.md %} + +### Help Options + +{% include options/help-options.md defaultHelp=true %} + + +*** + +# Delete Script + +*** + +Delete a single existing script. + +``` +mqtt hivemq script delete +``` + +*** + +## Simple Example + +``` +mqtt hivemq script delete --id hello_world +``` + +*** + +## Options + +| Option | Long Version | Explanation | Required | +|--------|--------------|-------------------------------------|:--------:| +| `-i` | `--id` | The id of the script to be deleted. | X | + +### API Connection Options + +{% include options/api-connection-options.md %} + +### Logging Options + +{% include options/logging-options.md %} + +### Help Options + +{% include options/help-options.md defaultHelp=true %} diff --git a/specs/hivemq-openapi.yaml b/specs/hivemq-openapi.yaml index 74ac7ac20..08a68a088 100644 --- a/specs/hivemq-openapi.yaml +++ b/specs/hivemq-openapi.yaml @@ -78,110 +78,117 @@ info: ## OpenAPI HiveMQ's REST API provides an OpenAPI 3.0 schema definition that can imported into popular API tooling (e.g. Postman) or can be used to generate client-code for multiple programming languages. title: HiveMQ REST API - version: 4.20.0 + version: 4.23.0-SNAPSHOT x-logo: url: https://www.hivemq.com/img/svg/hivemq-bee.svg tags: -- description: |- - These endpoints can be used to manage the Data Hub. + - description: |- + These endpoints can be used to manage the Data Hub. + + Currently, this includes the option to start a 5-hour long trial mode that temporarily removes all limitations.For more information on all capabilities the HiveMQ Data Hub offers, see the [HiveMQ documentation](https://docs.hivemq.com/hivemq/latest/data-hub/index.html). + name: Data Hub - Management + - description: |- + Policies describe how you want the HiveMQ broker to validate the behavior of MQTT clients. + Each policy has four sections: + + - Matching: Specifies which clients the policy engine validates. + - Deserialization: Specifies deserializers for different message payloads. + - Behavior: Specifies the behavior that is considered valid for matched clients. + - onTransitions: Specifies custom actions that are executed when a client transitions to a different state within the specified behavior model that is valid for that client. + These endpoints can be used to create, update, delete, and list behavior policies. + + For more information on all capabilities the HiveMQ Data Hub offers, see the [HiveMQ documentation](https://docs.hivemq.com/hivemq/latest/data-hub/index.html). + name: Data Hub - Behavior Policies + - description: |- + Data Policies describe how you want the HiveMQ broker to apply schemas to incoming MQTT message payload data and act on the validation results. + Each policy has four sections: + + - Matching: Specifies which packets the policy engine validates. + - Validation: Specifies how the packets are validated. For example, based on a JSON Schema. + - OnSuccess: Defines which actions are executed when the outcome of a validation is successful. + - OnFailure: Defines which actions are executed when the validation fails. + + These endpoints can be used to create, update, delete, and list data policies. + + For more information on all capabilities the HiveMQ Data Hub offers, see the [HiveMQ documentation](https://docs.hivemq.com/hivemq/latest/data-hub/index.html). + name: Data Hub - Data Policies + - description: |- + A schema defines the expected structure and format of incoming MQTT message payload data. + + This endpoint can be used to create, get, and delete schemas. + + Schemas can be enforced with the use of a policy. + + Currently, the following schema definitions are supported: + + - [JSON Schema](https://json-schema.org/) + - [Protocol Buffers (Protobuf)](https://protobuf.dev/) + + For more information on how to define and use a schema in HiveMQ, see [Schemas](https://docs.hivemq.com/hivemq/latest/data-hub/schemas.html). + name: Data Hub - Schemas + - description: |- + A script represents custom logic that can be executed in response to MQTT messages. + + This endpoint can be used to create, get, and delete scripts. + + For more information on how to define and use a script in HiveMQ, see [Scripts](https://docs.hivemq.com/hivemq/latest/data-hub/scripts.html). + name: Data Hub - Scripts + - description: |+ + These endpoints can be used to retrieve states of clients for the Data Hub. - Currently, this includes the option to start a 5-hour long trial mode that temporarily removes all limitations.For more information on all capabilities the HiveMQ Data Hub offers, see the [HiveMQ documentation](https://docs.hivemq.com/hivemq/latest/data-hub/index.html). - name: Data Hub - Management -- description: |- - Policies describe how you want the HiveMQ broker to validate the behavior of MQTT clients. - Each policy has four sections: - - - Matching: Specifies which clients the policy engine validates. - - Deserialization: Specifies deserializers for different message payloads. - - Behavior: Specifies the behavior that is considered valid for matched clients. - - onTransitions: Specifies custom actions that are executed when a client transitions to a different state within the specified behavior model that is valid for that client. - These endpoints can be used to create, update, delete, and list behavior policies. - - For more information on all capabilities the HiveMQ Data Hub offers, see the [HiveMQ documentation](https://docs.hivemq.com/hivemq/latest/data-hub/index.html). - name: Data Hub - Behavior Policies -- description: |- - Data Policies describe how you want the HiveMQ broker to apply schemas to incoming MQTT message payload data and act on the validation results. - Each policy has four sections: - - - Matching: Specifies which packets the policy engine validates. - - Validation: Specifies how the packets are validated. For example, based on a JSON Schema. - - OnSuccess: Defines which actions are executed when the outcome of a validation is successful. - - OnFailure: Defines which actions are executed when the validation fails. - - These endpoints can be used to create, update, delete, and list data policies. - - For more information on all capabilities the HiveMQ Data Hub offers, see the [HiveMQ documentation](https://docs.hivemq.com/hivemq/latest/data-hub/index.html). - name: Data Hub - Data Policies -- description: |- - A schema defines the expected structure and format of incoming MQTT message payload data. - - This endpoint can be used to create, get, and delete schemas. - - Schemas can be enforced with the use of a policy. - - Currently, the following schema definitions are supported: - - - [JSON Schema](https://json-schema.org/) - - [Protocol Buffers (Protobuf)](https://protobuf.dev/) - - For more information on how to define and use a schema in HiveMQ, see [Schemas](https://docs.hivemq.com/hivemq/latest/data-hub/schemas.html). - name: Data Hub - Schemas -- description: |+ - These endpoints can be used to retrieve states of clients for the Data Hub. - - name: Data Hub - State -- description: |- - These endpoints can be used to create, download, inspect and restore backups created by HiveMQ. - - More information about the backup and restore capabilities of HiveMQ can be found in the [HiveMQ documentation](https://www.hivemq.com/docs/hivemq/latest/user-guide/backup-restore.html). - - ### Backup Requirements - Some prerequisites are necessary to create a backup or restore from a backup: - - - All HiveMQ nodes have at least version 4.4.0 - - Only one backup/restore can be executed at the same time - - ### Export Requirements - The following requirements are necessary to successfully create a backup: - - - All HiveMQ nodes have at least 1GB of free disk space - - No cluster topology changes occur during the export. The backup is aborted when the topology changes to avoid inconsistent data in the backup. - - - ### Restore Requirements - - The requirements to successfully restore data from a backup are: - - - A clean HiveMQ deployment. This means that no clients must be connected and no persistent data exists on every HiveMQ node. The import will not start if there is data available in your cluster. - - Message data used by Extensions are only restored if the corresponding extension is already started before the restore is started. - name: Backup & Restore -- description: |- - This endpoint can be used to create diagnostic archives. - - More information about the diagnostic archive can be found in the [HiveMQ documentation](https://www.hivemq.com/docs/hivemq/latest/control-center/diagnostic-archive.html). - - ### Diagnostic Archive Requirements - Some prerequisites are necessary to create a diagnostic archive: - - - Only HiveMQ nodes with at least version 4.11.0 will create an archive - - Only one diagnostic archive can be created at the same time - name: Diagnostic Archive -- description: | - A Trace Recording is a combination of filters which allows you to select messages of specific clients or topics, which are logged to a file in a human readable format. - Each trace recording creates cluster-wide trace files that can be downloaded as a collective zip file. - - You can log any MQTT message sent or received by the broker with a filter you apply. A Filter can either be a client identifier or a topic. Many filter combinations are possible. All filters are regular expressions. - - These endpoints can be used to create, download, inspect, stop and delete trace recordings. - - More information about the trace recording capabilities of HiveMQ can be found in the [HiveMQ documentation](https://www.hivemq.com/docs/hivemq/latest/control-center/analytic.html#trace-recording). - name: Trace Recordings -- description: "These endpoints can be used to inspect the MQTT clients that are known\ + name: Data Hub - State + - description: |- + These endpoints can be used to create, download, inspect and restore backups created by HiveMQ. + + More information about the backup and restore capabilities of HiveMQ can be found in the [HiveMQ documentation](https://www.hivemq.com/docs/hivemq/latest/user-guide/backup-restore.html). + + ### Backup Requirements + Some prerequisites are necessary to create a backup or restore from a backup: + + - All HiveMQ nodes have at least version 4.4.0 + - Only one backup/restore can be executed at the same time + + ### Export Requirements + The following requirements are necessary to successfully create a backup: + + - All HiveMQ nodes have at least 1GB of free disk space + - No cluster topology changes occur during the export. The backup is aborted when the topology changes to avoid inconsistent data in the backup. + + + ### Restore Requirements + + The requirements to successfully restore data from a backup are: + + - A clean HiveMQ deployment. This means that no clients must be connected and no persistent data exists on every HiveMQ node. The import will not start if there is data available in your cluster. + - Message data used by Extensions are only restored if the corresponding extension is already started before the restore is started. + name: Backup & Restore + - description: |- + This endpoint can be used to create diagnostic archives. + + More information about the diagnostic archive can be found in the [HiveMQ documentation](https://www.hivemq.com/docs/hivemq/latest/control-center/diagnostic-archive.html). + + ### Diagnostic Archive Requirements + Some prerequisites are necessary to create a diagnostic archive: + + - Only HiveMQ nodes with at least version 4.11.0 will create an archive + - Only one diagnostic archive can be created at the same time + name: Diagnostic Archive + - description: | + A Trace Recording is a combination of filters which allows you to select messages of specific clients or topics, which are logged to a file in a human readable format. + Each trace recording creates cluster-wide trace files that can be downloaded as a collective zip file. + + You can log any MQTT message sent or received by the broker with a filter you apply. A Filter can either be a client identifier or a topic. Many filter combinations are possible. All filters are regular expressions. + + These endpoints can be used to create, download, inspect, stop and delete trace recordings. + + More information about the trace recording capabilities of HiveMQ can be found in the [HiveMQ documentation](https://www.hivemq.com/docs/hivemq/latest/control-center/analytic.html#trace-recording). + name: Trace Recordings + - description: "These endpoints can be used to inspect the MQTT clients that are known\ \ to HiveMQ.\n\nWith millions of connected clients, keeping track of specific\ \ clients can become a challenge. The HiveMQ REST API provides endpoints to list\ \ and view all the MQTT clients known to HiveMQ. \nInformation about subscriptions,\ \ connection status, TLS, and more, offer detailed insights into every client." - name: MQTT Clients + name: MQTT Clients paths: /api/v1/data-hub/behavior-validation/policies: get: @@ -190,49 +197,44 @@ paths: \ at least HiveMQ version 4.20.0 on all cluster nodes." operationId: getAllBehaviorPolicies parameters: - - description: "Comma-separated list of fields to include in the response. Allowed\ + - description: "Comma-separated list of fields to include in the response. Allowed\ \ values are: id, createdAt, lastUpdatedAt, deserialization, matching, behavior,\ \ onTransitions" - example: "id,createdAt" - in: query - name: fields - schema: - type: string - example: null - - description: Comma-separated list of policy ids used for filtering. Multiple - filters can be applied together. - example: "policy1,policy2" - in: query - name: policyIds - schema: - type: string - example: null - - description: Comma-separated list of MQTT client identifiers that are used - for filtering. Client identifiers are matched by the retrieved policies. - Multiple filters can be applied together. - example: "client1,client2" - in: query - name: clientIds - schema: - type: string - example: null - - description: Specifies the page size for the returned results. Has to be between - 10 and 500. Default page size is 50. Limit is ignored if the 'topic' query - parameter is set. - example: 100 - in: query - name: limit - schema: - type: integer - format: int32 - example: null - - description: The cursor that has been returned by the previous result page. - Do not pass this parameter if you want to fetch the first page. - in: query - name: cursor - schema: - type: string - example: null + example: "id,createdAt" + in: query + name: fields + schema: + type: string + - description: Comma-separated list of policy ids used for filtering. Multiple + filters can be applied together. + example: "policy1,policy2" + in: query + name: policyIds + schema: + type: string + - description: Comma-separated list of MQTT client identifiers that are used + for filtering. Client identifiers are matched by the retrieved policies. + Multiple filters can be applied together. + example: "client1,client2" + in: query + name: clientIds + schema: + type: string + - description: Specifies the page size for the returned results. Has to be between + 10 and 500. Default page size is 50. Limit is ignored if the 'topic' query + parameter is set. + example: 100 + in: query + name: limit + schema: + type: integer + format: int32 + - description: The cursor that has been returned by the previous result page. + Do not pass this parameter if you want to fetch the first page. + in: query + name: cursor + schema: + type: string responses: "200": content: @@ -244,84 +246,84 @@ paths: summary: "Multiple results, last page" value: items: - - id: P18 - createdAt: 2023-07-28T07:27:24.531Z - lastUpdatedAt: 2023-07-28T07:27:24.531Z - matching: - clientIdRegex: .* - behavior: - id: Mqtt.events - arguments: {} - onTransitions: - - fromState: Any.* - toState: Any.* - Event.OnAny: - pipeline: - - id: log1 - functionId: System.log - arguments: - level: INFO - message: transition happened - - id: P19 - createdAt: 2023-07-28T07:27:24.532Z - lastUpdatedAt: 2023-07-28T07:27:24.532Z - matching: - clientIdRegex: .* - behavior: - id: Mqtt.events - arguments: {} - onTransitions: - - fromState: Any.* - toState: Any.* - Event.OnAny: - pipeline: - - id: log1 - functionId: System.log - arguments: - level: INFO - message: transition happened + - id: P18 + createdAt: 2023-07-28T07:27:24.531Z + lastUpdatedAt: 2023-07-28T07:27:24.531Z + matching: + clientIdRegex: .* + behavior: + id: Mqtt.events + arguments: {} + onTransitions: + - fromState: Any.* + toState: Any.* + Event.OnAny: + pipeline: + - id: log1 + functionId: System.log + arguments: + level: INFO + message: transition happened + - id: P19 + createdAt: 2023-07-28T07:27:24.532Z + lastUpdatedAt: 2023-07-28T07:27:24.532Z + matching: + clientIdRegex: .* + behavior: + id: Mqtt.events + arguments: {} + onTransitions: + - fromState: Any.* + toState: Any.* + Event.OnAny: + pipeline: + - id: log1 + functionId: System.log + arguments: + level: INFO + message: transition happened list-response-b: description: Example response with multiple policies. More pages left summary: "Multiple results, more pages left" value: items: - - id: P0 - createdAt: 2023-07-28T07:44:35.382Z - lastUpdatedAt: 2023-07-28T07:44:35.382Z - matching: - clientIdRegex: .* - behavior: - id: Mqtt.events - arguments: {} - onTransitions: - - fromState: Any.* - toState: Any.* - Event.OnAny: - pipeline: - - id: log1 - functionId: System.log - arguments: - level: INFO - message: transition happened - - id: P1 - createdAt: 2023-07-28T07:44:35.405Z - lastUpdatedAt: 2023-07-28T07:44:35.405Z - matching: - clientIdRegex: .* - behavior: - id: Mqtt.events - arguments: {} - onTransitions: - - fromState: Any.* - toState: Any.* - Event.OnAny: - pipeline: - - id: log1 - functionId: System.log - arguments: - level: INFO - message: transition happened + - id: P0 + createdAt: 2023-07-28T07:44:35.382Z + lastUpdatedAt: 2023-07-28T07:44:35.382Z + matching: + clientIdRegex: .* + behavior: + id: Mqtt.events + arguments: {} + onTransitions: + - fromState: Any.* + toState: Any.* + Event.OnAny: + pipeline: + - id: log1 + functionId: System.log + arguments: + level: INFO + message: transition happened + - id: P1 + createdAt: 2023-07-28T07:44:35.405Z + lastUpdatedAt: 2023-07-28T07:44:35.405Z + matching: + clientIdRegex: .* + behavior: + id: Mqtt.events + arguments: {} + onTransitions: + - fromState: Any.* + toState: Any.* + Event.OnAny: + pipeline: + - id: log1 + functionId: System.log + arguments: + level: INFO + message: transition happened _links: next: /api/v1/data-hub/behavior-validation/policies?cursor=a-Wva-QBoB5yAX_HJ0WRQ8ng==&limit=2 list-response-c: @@ -330,8 +332,8 @@ paths: summary: "Multiple results, requested 'id' field" value: items: - - id: P0 - - id: P1 + - id: P0 + - id: P1 _links: next: /api/v1/data-hub/behavior-validation/policies?cursor=a-Wva-QBoB5yAX_HZxWBM9mQ==&limit=2&fields=id list-response-d: @@ -339,24 +341,24 @@ paths: summary: Single Result value: items: - - id: policy1 - createdAt: 2023-07-28T07:34:14.150Z - lastUpdatedAt: 2023-07-28T07:34:14.150Z - matching: - clientIdRegex: .* - behavior: - id: Mqtt.events - arguments: {} - onTransitions: - - fromState: Any.* - toState: Any.* - Event.OnAny: - pipeline: - - id: log1 - functionId: System.log - arguments: - level: INFO - message: transition happened + - id: policy1 + createdAt: 2023-07-28T07:34:14.150Z + lastUpdatedAt: 2023-07-28T07:34:14.150Z + matching: + clientIdRegex: .* + behavior: + id: Mqtt.events + arguments: {} + onTransitions: + - fromState: Any.* + toState: Any.* + Event.OnAny: + pipeline: + - id: log1 + functionId: System.log + arguments: + level: INFO + message: transition happened schema: $ref: '#/components/schemas/BehaviorPolicyList' description: Success @@ -369,15 +371,15 @@ paths: summary: Version check failed value: errors: - - title: Endpoint not active yet - detail: "Not all cluster nodes support this endpoint yet, please\ + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ \ try again later" schema: $ref: '#/components/schemas/Errors' description: Not all cluster nodes at minimum version summary: Get all policies tags: - - Data Hub - Behavior Policies + - Data Hub - Behavior Policies post: description: |- Create a behavior policy @@ -405,15 +407,15 @@ paths: id: Mqtt.events arguments: {} onTransitions: - - fromState: Any.* - toState: Any.* - Event.OnAny: - pipeline: - - id: log1 - functionId: System.log - arguments: - level: INFO - message: transition happened + - fromState: Any.* + toState: Any.* + Event.OnAny: + pipeline: + - id: log1 + functionId: System.log + arguments: + level: INFO + message: transition happened schema: $ref: '#/components/schemas/BehaviorPolicy' description: The policy that should be created. @@ -446,15 +448,15 @@ paths: id: Mqtt.events arguments: {} onTransitions: - - fromState: Any.* - toState: Any.* - Event.OnAny: - pipeline: - - id: log1 - functionId: System.log - arguments: - level: INFO - message: transition happened + - fromState: Any.* + toState: Any.* + Event.OnAny: + pipeline: + - id: log1 + functionId: System.log + arguments: + level: INFO + message: transition happened schema: $ref: '#/components/schemas/BehaviorPolicy' description: Success @@ -467,32 +469,32 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing policy-id-already-in-use: description: Example response when the policy uses an already existing id. summary: The given policy ID is already in use value: errors: - - title: Policy id already used - detail: The given policy id 'policy-id' is already in use. + - title: Policy id already used + detail: The given policy id 'policy-id' is already in use. policy-not-parsable: description: Example response when the submitted policy could not be parsed as JSON. summary: The submitted policy cannot be parsed. value: errors: - - title: Policy not parsable - detail: The submitted policy 'policy' can not be parsed. + - title: Policy not parsable + detail: The submitted policy 'policy' can not be parsed. policy-not-valid: description: "Example response when the policy is invalid, because\ \ a field is missing." summary: The submitted policy is not valid value: errors: - - title: Policy is not valid - detail: Required body entity parameter is missing + - title: Policy is not valid + detail: Required body entity parameter is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -505,36 +507,35 @@ paths: summary: Temporarily not available value: errors: - - title: The endpoint is temporarily not available - detail: "The endpoint is temporarily not available, please try\ + - title: The endpoint is temporarily not available + detail: "The endpoint is temporarily not available, please try\ \ again later" version-check-failed: description: Version check failed summary: Version check failed value: errors: - - title: Endpoint not active yet - detail: "Not all cluster nodes support this endpoint yet, please\ + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ \ try again later" schema: $ref: '#/components/schemas/Errors' description: Temporarily not available summary: Create a new policy tags: - - Data Hub - Behavior Policies + - Data Hub - Behavior Policies /api/v1/data-hub/behavior-validation/policies/{policyId}: delete: description: "Deletes an existing policy. \n\n " operationId: deleteBehaviorPolicy parameters: - - description: The identifier of the policy to delete. - example: policy1 - in: path - name: policyId - required: true - schema: - type: string - example: null + - description: The identifier of the policy to delete. + example: policy1 + in: path + name: policyId + required: true + schema: + type: string responses: "204": description: "Success, no response body" @@ -547,8 +548,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -561,8 +562,8 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found @@ -575,38 +576,36 @@ paths: summary: Version check failed value: errors: - - title: Endpoint not active yet - detail: "Not all cluster nodes support this endpoint yet, please\ + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ \ try again later" schema: $ref: '#/components/schemas/Errors' description: Not all cluster nodes at minimum version summary: Delete a behavior policy tags: - - Data Hub - Behavior Policies + - Data Hub - Behavior Policies get: description: "Get a specific policy. \n\n This endpoint returns the content\ \ of the policy with the content-type `application/json`. \n\n This endpoint\ \ requires at least HiveMQ version 4.20.0 on all cluster nodes." operationId: getBehaviorPolicy parameters: - - description: The identifier of the policy. - example: policy1 - in: path - name: policyId - required: true - schema: - type: string - example: null - - description: "Comma-separated list of fields to include in the response. Allowed\ + - description: The identifier of the policy. + example: policy1 + in: path + name: policyId + required: true + schema: + type: string + - description: "Comma-separated list of fields to include in the response. Allowed\ \ values are: id, createdAt, lastUpdatedAt, deserialization, matching, behavior,\ \ onTransitions" - example: "id,createdAt" - in: query - name: fields - schema: - type: string - example: null + example: "id,createdAt" + in: query + name: fields + schema: + type: string responses: "200": content: @@ -635,15 +634,15 @@ paths: id: Mqtt.events arguments: {} onTransitions: - - fromState: Any.* - toState: Any.* - Event.OnAny: - pipeline: - - id: log1 - functionId: System.log - arguments: - level: INFO - message: transition happened + - fromState: Any.* + toState: Any.* + Event.OnAny: + pipeline: + - id: log1 + functionId: System.log + arguments: + level: INFO + message: transition happened schema: $ref: '#/components/schemas/BehaviorPolicy' description: Success @@ -656,8 +655,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -670,14 +669,14 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found summary: Get a policy tags: - - Data Hub - Behavior Policies + - Data Hub - Behavior Policies put: description: |- Update a behavior policy @@ -686,14 +685,13 @@ paths: This endpoint requires at least HiveMQ version 4.20.0 on all cluster nodes. operationId: updateBehaviorPolicy parameters: - - description: The identifier of the policy. - example: policy1 - in: path - name: policyId - required: true - schema: - type: string - example: null + - description: The identifier of the policy. + example: policy1 + in: path + name: policyId + required: true + schema: + type: string requestBody: content: application/json: @@ -715,15 +713,15 @@ paths: id: Mqtt.events arguments: {} onTransitions: - - fromState: Any.* - toState: Any.* - Event.OnAny: - pipeline: - - id: log1 - functionId: System.log - arguments: - level: INFO - message: transition happened + - fromState: Any.* + toState: Any.* + Event.OnAny: + pipeline: + - id: log1 + functionId: System.log + arguments: + level: INFO + message: transition happened schema: $ref: '#/components/schemas/BehaviorPolicy' description: The policy that should be updated. @@ -756,15 +754,15 @@ paths: id: Mqtt.events arguments: {} onTransitions: - - fromState: Any.* - toState: Any.* - Event.OnAny: - pipeline: - - id: log1 - functionId: System.log - arguments: - level: INFO - message: transition happened + - fromState: Any.* + toState: Any.* + Event.OnAny: + pipeline: + - id: log1 + functionId: System.log + arguments: + level: INFO + message: transition happened schema: $ref: '#/components/schemas/BehaviorPolicy' description: Success @@ -777,23 +775,23 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing policy-not-parsable: description: The submitted policy cannot be parsed. summary: The submitted policy can not be parsed value: errors: - - title: Policy not parsable - detail: The submitted policy 'policy' can not be parsed. + - title: Policy not parsable + detail: The submitted policy 'policy' can not be parsed. policy-not-valid: description: "Example response when the policy is invalid, because\ \ a field is missing." summary: The submitted policy is not valid value: errors: - - title: Policy is not valid - detail: Required body entity parameter is missing + - title: Policy is not valid + detail: Required body entity parameter is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -806,8 +804,8 @@ paths: summary: Not found value: errors: - - title: Referenced policy not found - detail: The referenced policy with id 'policyId' was not found. + - title: Referenced policy not found + detail: The referenced policy with id 'policyId' was not found. schema: $ref: '#/components/schemas/Errors' description: Policy not found @@ -820,8 +818,8 @@ paths: summary: Etag not matching value: errors: - - title: Precondition Failed - detail: Policy does not match the given etag '123456789'. + - title: Precondition Failed + detail: Policy does not match the given etag '123456789'. schema: $ref: '#/components/schemas/Errors' description: Precondition failed @@ -834,15 +832,15 @@ paths: summary: Version check failed value: errors: - - title: Endpoint not active yet - detail: "Not all cluster nodes support this endpoint yet, please\ + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ \ try again later" schema: $ref: '#/components/schemas/Errors' description: Not all cluster nodes at minimum version summary: Update an existing policy tags: - - Data Hub - Behavior Policies + - Data Hub - Behavior Policies /api/v1/data-hub/behavior-validation/states/{clientId}: get: description: |- @@ -851,14 +849,13 @@ paths: This endpoint requires at least HiveMQ version 4.20.0 on the REST API node. operationId: getClientState parameters: - - description: The client identifier. - example: client1 - in: path - name: clientId - required: true - schema: - type: string - example: null + - description: The client identifier. + example: client1 + in: path + name: clientId + required: true + schema: + type: string responses: "200": content: @@ -869,18 +866,18 @@ paths: summary: Get the state of a client value: items: - - policyId: reallyCoolBehaviorPolicy - behaviorId: Publish.quota - stateType: INTERMEDIATE - stateName: Connected - firstSetAt: 2023-09-05T09:46:47.854Z - arguments: - minPublishes: 5 - maxPublishes: 10 - variables: - minPublishes: "5" - publishCount: "0" - maxPublishes: "10" + - policyId: reallyCoolBehaviorPolicy + behaviorId: Publish.quota + stateType: INTERMEDIATE + stateName: Connected + firstSetAt: 2023-09-05T09:46:47.854Z + arguments: + minPublishes: 5 + maxPublishes: 10 + variables: + minPublishes: "5" + publishCount: "0" + maxPublishes: "10" schema: $ref: '#/components/schemas/FsmStatesInformationListItem' description: Success @@ -893,8 +890,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -934,8 +931,8 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found @@ -948,15 +945,15 @@ paths: summary: Temporarily not available value: errors: - - title: The endpoint is temporarily not available - detail: "The endpoint is temporarily not available, please try\ + - title: The endpoint is temporarily not available + detail: "The endpoint is temporarily not available, please try\ \ again later" schema: $ref: '#/components/schemas/Errors' description: Temporarily not available summary: Get the state of a client tags: - - Data Hub - State + - Data Hub - State /api/v1/data-hub/data-validation/policies: get: description: "Get all data policies. \n\n This endpoint returns the content\ @@ -964,57 +961,51 @@ paths: \ requires at least HiveMQ version 4.15.0 on all cluster nodes." operationId: getAllDataPolicies parameters: - - description: "Comma-separated list of fields to include in the response. Allowed\ + - description: "Comma-separated list of fields to include in the response. Allowed\ \ values are: id, createdAt, lastUpdatedAt, matching, validation, onSuccess,\ \ onFailure" - example: "id,createdAt" - in: query - name: fields - schema: - type: string - example: null - - description: Comma-separated list of policy IDs used for filtering. Multiple - filters can be applied together. - example: "policy1,policy2" - in: query - name: policyIds - schema: - type: string - example: null - - description: Comma-separated list of schema IDs used for filtering. Multiple - filters can be applied together. - example: "schema1,schema2" - in: query - name: schemaIds - schema: - type: string - example: null - - description: MQTT topic string that the retrieved policies must match. Returned - policies are sorted in the same way as they are applied to matching publishes. - 'topic' filtering does not support pagination - example: topic/my-topic - in: query - name: topic - schema: - type: string - example: null - - description: Specifies the page size for the returned results. The value must - be between 10 and 500. The default page size is 50. The limit is ignored - if the 'topic' query parameter is set. - example: 100 - in: query - name: limit - schema: - type: integer - format: int32 - example: null - - description: The cursor that has been returned by the previous result page. - Do not pass this parameter if you want to fetch the first page. - in: query - name: cursor - schema: - type: string - example: null + example: "id,createdAt" + in: query + name: fields + schema: + type: string + - description: Comma-separated list of policy IDs used for filtering. Multiple + filters can be applied together. + example: "policy1,policy2" + in: query + name: policyIds + schema: + type: string + - description: Comma-separated list of schema IDs used for filtering. Multiple + filters can be applied together. + example: "schema1,schema2" + in: query + name: schemaIds + schema: + type: string + - description: MQTT topic string that the retrieved policies must match. Returned + policies are sorted in the same way as they are applied to matching publishes. + 'topic' filtering does not support pagination + example: topic/my-topic + in: query + name: topic + schema: + type: string + - description: Specifies the page size for the returned results. The value must + be between 10 and 500. The default page size is 50. The limit is ignored + if the 'topic' query parameter is set. + example: 100 + in: query + name: limit + schema: + type: integer + format: int32 + - description: The cursor that has been returned by the previous result page. + Do not pass this parameter if you want to fetch the first page. + in: query + name: cursor + schema: + type: string responses: "200": content: @@ -1026,63 +1017,63 @@ paths: summary: "Multiple results, last page" value: items: - - id: policy1 - createdAt: 2023-04-26T13:32:47.032Z - lastUpdatedAt: 2023-04-26T13:32:47.032Z - matching: - topicFilter: topic1 - validation: - validators: - - type: schema - arguments: - strategy: ALL_OF - schemas: - - schemaId: schema - version: "1" - onSuccess: - pipeline: - - id: logSuccessOperation - functionId: System.log - arguments: - level: DEBUG - message: "${clientId} sent a publish on topic '${topic}'\ + - id: policy1 + createdAt: 2023-04-26T13:32:47.032Z + lastUpdatedAt: 2023-04-26T13:32:47.032Z + matching: + topicFilter: topic1 + validation: + validators: + - type: schema + arguments: + strategy: ALL_OF + schemas: + - schemaId: schema + version: "1" + onSuccess: + pipeline: + - id: logSuccessOperation + functionId: System.log + arguments: + level: DEBUG + message: "${clientId} sent a publish on topic '${topic}'\ \ with result '${validationResult}'" - onFailure: - pipeline: - - id: logFailureOperation - functionId: System.log - arguments: - level: WARN - message: "${clientId} sent an invalid publish on topic\ + onFailure: + pipeline: + - id: logFailureOperation + functionId: System.log + arguments: + level: WARN + message: "${clientId} sent an invalid publish on topic\ \ '${topic}' with result '${validationResult}'" - - id: policy2 - createdAt: 2023-04-26T13:32:47.049Z - lastUpdatedAt: 2023-04-26T13:32:47.049Z - matching: - topicFilter: topic2 - validation: - validators: - - type: schema - arguments: - strategy: ALL_OF - schemas: - - schemaId: schema - version: "1" - onSuccess: - pipeline: - - id: logSuccessOperation - functionId: System.log - arguments: - level: DEBUG - message: "${clientId} sent a publish on topic '${topic}'\ + - id: policy2 + createdAt: 2023-04-26T13:32:47.049Z + lastUpdatedAt: 2023-04-26T13:32:47.049Z + matching: + topicFilter: topic2 + validation: + validators: + - type: schema + arguments: + strategy: ALL_OF + schemas: + - schemaId: schema + version: "1" + onSuccess: + pipeline: + - id: logSuccessOperation + functionId: System.log + arguments: + level: DEBUG + message: "${clientId} sent a publish on topic '${topic}'\ \ with result '${validationResult}'" - onFailure: - pipeline: - - id: logSuccessOperation - functionId: System.log - arguments: - level: WARN - message: "${clientId} sent an invalid publish on topic\ + onFailure: + pipeline: + - id: logSuccessOperation + functionId: System.log + arguments: + level: WARN + message: "${clientId} sent an invalid publish on topic\ \ '${topic}' with result '${validationResult}'" list-response-b: description: Example response with multiple policies. More pages @@ -1090,93 +1081,93 @@ paths: summary: "Multiple results, more pages left" value: items: - - id: policy1 - createdAt: 2023-04-26T13:32:47.032Z - lastUpdatedAt: 2023-04-26T13:32:47.032Z - matching: - topicFilter: topic1 - validation: - validators: - - type: schema - arguments: - strategy: ALL_OF - schemas: - - schemaId: schema - version: "1" - onSuccess: - pipeline: - - id: logSuccessOperation - functionId: System.log - arguments: - level: DEBUG - message: $clientId sent a publish on topic '$topic' with - result '$validationResult' - onFailure: - pipeline: - - id: logFailureOperation - functionId: System.log - arguments: - level: WARN - message: $clientId sent an invalid publish on topic '$topic' - with result '$validationResult' - - id: policy2 - createdAt: 2023-04-26T13:32:47.049Z - lastUpdatedAt: 2023-04-26T13:32:47.049Z - matching: - topicFilter: topic2 - validation: - validators: - - type: schema - arguments: - strategy: ALL_OF - schemas: - - schemaId: schema - version: "1" - onSuccess: - pipeline: - - id: logSuccessOperation - functionId: System.log - arguments: - level: DEBUG - message: $clientId sent a publish on topic '$topic' with - result '$validationResult' - onFailure: - pipeline: - - id: logSuccessOperation - functionId: System.log - arguments: - level: WARN - message: $clientId sent an invalid publish on topic '$topic' - with result '$validationResult' - - id: policy3 - createdAt: 2023-04-26T13:32:47.049Z - lastUpdatedAt: 2023-04-26T13:32:47.049Z - matching: - topicFilter: topic3 - validation: - validators: - - type: schema - arguments: - strategy: ALL_OF - schemas: - - schemaId: schema - version: "1" - onSuccess: - pipeline: - - id: logSuccessOperation - functionId: System.log - arguments: - level: DEBUG - message: $clientId sent a publish on topic '$topic' with - result '$validationResult' - onFailure: - pipeline: - - id: logSuccessOperation - functionId: System.log - arguments: - level: WARN - message: $clientId sent an invalid publish on topic '$topic' - with result '$validationResult' + - id: policy1 + createdAt: 2023-04-26T13:32:47.032Z + lastUpdatedAt: 2023-04-26T13:32:47.032Z + matching: + topicFilter: topic1 + validation: + validators: + - type: schema + arguments: + strategy: ALL_OF + schemas: + - schemaId: schema + version: "1" + onSuccess: + pipeline: + - id: logSuccessOperation + functionId: System.log + arguments: + level: DEBUG + message: $clientId sent a publish on topic '$topic' with + result '$validationResult' + onFailure: + pipeline: + - id: logFailureOperation + functionId: System.log + arguments: + level: WARN + message: $clientId sent an invalid publish on topic '$topic' + with result '$validationResult' + - id: policy2 + createdAt: 2023-04-26T13:32:47.049Z + lastUpdatedAt: 2023-04-26T13:32:47.049Z + matching: + topicFilter: topic2 + validation: + validators: + - type: schema + arguments: + strategy: ALL_OF + schemas: + - schemaId: schema + version: "1" + onSuccess: + pipeline: + - id: logSuccessOperation + functionId: System.log + arguments: + level: DEBUG + message: $clientId sent a publish on topic '$topic' with + result '$validationResult' + onFailure: + pipeline: + - id: logSuccessOperation + functionId: System.log + arguments: + level: WARN + message: $clientId sent an invalid publish on topic '$topic' + with result '$validationResult' + - id: policy3 + createdAt: 2023-04-26T13:32:47.049Z + lastUpdatedAt: 2023-04-26T13:32:47.049Z + matching: + topicFilter: topic3 + validation: + validators: + - type: schema + arguments: + strategy: ALL_OF + schemas: + - schemaId: schema + version: "1" + onSuccess: + pipeline: + - id: logSuccessOperation + functionId: System.log + arguments: + level: DEBUG + message: $clientId sent a publish on topic '$topic' with + result '$validationResult' + onFailure: + pipeline: + - id: logSuccessOperation + functionId: System.log + arguments: + level: WARN + message: $clientId sent an invalid publish on topic '$topic' + with result '$validationResult' _links: next: /api/v1/data-validation/policies?cursor=a-eqj-GE9B5DkV-nhwVBk-nTL807ty&limit=3 list-response-c: @@ -1185,9 +1176,9 @@ paths: summary: "Multiple results, requested 'id' field" value: items: - - id: policy1 - - id: policy2 - - id: policy3 + - id: policy1 + - id: policy2 + - id: policy3 _links: next: /api/v1/data-validation/policies?cursor=a-eqj-GE9B5DkV-nhwVBk-nTL807ty&limit=3&fields=id list-response-d: @@ -1195,35 +1186,35 @@ paths: summary: Single Result value: items: - - id: policy1 - createdAt: 2023-04-26T13:32:47.032Z - lastUpdatedAt: 2023-04-26T13:32:47.032Z - matching: - topicFilter: topic1 - validation: - validators: - - type: schema - arguments: - strategy: ALL_OF - schemas: - - schemaId: schema - version: "1" - onSuccess: - pipeline: - - id: logSuccessOperation - functionId: System.log - arguments: - level: DEBUG - message: $clientId sent a publish on topic '$topic' with - result '$validationResult' - onFailure: - pipeline: - - id: logFailureOperation - functionId: System.log - arguments: - level: WARN - message: $clientId sent an invalid publish on topic '$topic' - with result '$validationResult' + - id: policy1 + createdAt: 2023-04-26T13:32:47.032Z + lastUpdatedAt: 2023-04-26T13:32:47.032Z + matching: + topicFilter: topic1 + validation: + validators: + - type: schema + arguments: + strategy: ALL_OF + schemas: + - schemaId: schema + version: "1" + onSuccess: + pipeline: + - id: logSuccessOperation + functionId: System.log + arguments: + level: DEBUG + message: $clientId sent a publish on topic '$topic' with + result '$validationResult' + onFailure: + pipeline: + - id: logFailureOperation + functionId: System.log + arguments: + level: WARN + message: $clientId sent an invalid publish on topic '$topic' + with result '$validationResult' schema: $ref: '#/components/schemas/DataPolicyList' description: Success @@ -1236,15 +1227,15 @@ paths: summary: Version check failed value: errors: - - title: Endpoint not active yet - detail: "Not all cluster nodes support this endpoint yet, please\ + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ \ try again later" schema: $ref: '#/components/schemas/Errors' description: Not all cluster nodes at minimum version summary: Get all data policies tags: - - Data Hub - Data Policies + - Data Hub - Data Policies post: description: |- Create a data policy @@ -1260,27 +1251,27 @@ paths: topicFilter: topic/+ validation: validators: - - type: schema - arguments: - strategy: ALL_OF - schemas: - - schemaId: schema - version: "1" + - type: schema + arguments: + strategy: ALL_OF + schemas: + - schemaId: schema + version: "1" onSuccess: pipeline: - - id: logOperationSuccess - functionId: System.log - arguments: - level: DEBUG - message: "${clientId} sent a publish on topic '${topic}' with\ + - id: logOperationSuccess + functionId: System.log + arguments: + level: DEBUG + message: "${clientId} sent a publish on topic '${topic}' with\ \ result '${validationResult}'" onFailure: pipeline: - - id: logOperationFailure - functionId: System.log - arguments: - level: WARN - message: "${clientId} sent an invalid publish on topic '${topic}'\ + - id: logOperationFailure + functionId: System.log + arguments: + level: WARN + message: "${clientId} sent an invalid publish on topic '${topic}'\ \ with result '${validationResult}'" schema: $ref: '#/components/schemas/DataPolicy' @@ -1302,27 +1293,27 @@ paths: topicFilter: topic/+ validation: validators: - - type: schema - arguments: - strategy: ALL_OF - schemas: - - schemaId: schema1 - version: "1" + - type: schema + arguments: + strategy: ALL_OF + schemas: + - schemaId: schema1 + version: "1" onSuccess: pipeline: - - id: logOperationSuccess - functionId: System.log - arguments: - level: DEBUG - message: "${clientId} sent a publish on topic '${topic}'\ + - id: logOperationSuccess + functionId: System.log + arguments: + level: DEBUG + message: "${clientId} sent a publish on topic '${topic}'\ \ with result '${validationResult}'" onFailure: pipeline: - - id: logOperationFailure - functionId: System.log - arguments: - level: WARN - message: "${clientId} sent an invalid publish on topic '${topic}'\ + - id: logOperationFailure + functionId: System.log + arguments: + level: WARN + message: "${clientId} sent an invalid publish on topic '${topic}'\ \ with result '${validationResult}'" schema: $ref: '#/components/schemas/DataPolicy' @@ -1336,39 +1327,39 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing policy-id-already-in-use: description: Example response when the policy uses an already existing id. summary: The given policy identifier is already in use value: errors: - - title: Policy id already used - detail: The given policy id 'policy-id' is already in use. + - title: Policy id already used + detail: The given policy id 'policy-id' is already in use. policy-not-parsable: description: Example response when the submitted policy could not be parsed as JSON. summary: The submitted policy can not be parsed value: errors: - - title: Policy not parsable - detail: The submitted policy 'policy' can not be parsed. + - title: Policy not parsable + detail: The submitted policy 'policy' can not be parsed. policy-not-valid: description: "Example response when the policy is invalid, because\ \ a field is missing." summary: The submitted policy is not valid value: errors: - - title: Policy is not valid - detail: Required body entity parameter is missing + - title: Policy is not valid + detail: Required body entity parameter is missing referenced-schema-does-not-exist: description: Example response when a referenced schema was not found. summary: A schema that is referenced in the policy does not exist value: errors: - - title: Referenced schema does not exist - detail: The referenced schema with id 'schema-id' does not exist. + - title: Referenced schema does not exist + detail: The referenced schema with id 'schema-id' does not exist. schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -1381,36 +1372,35 @@ paths: summary: Temporarily not available value: errors: - - title: The endpoint is temporarily not available - detail: "The endpoint is temporarily not available, please try\ + - title: The endpoint is temporarily not available + detail: "The endpoint is temporarily not available, please try\ \ again later" version-check-failed: description: Version check failed summary: Version check failed value: errors: - - title: Endpoint not active yet - detail: "Not all cluster nodes support this endpoint yet, please\ + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ \ try again later" schema: $ref: '#/components/schemas/Errors' description: Not all cluster nodes at minimum version summary: Create a new data policy tags: - - Data Hub - Data Policies + - Data Hub - Data Policies /api/v1/data-hub/data-validation/policies/{policyId}: delete: description: "Deletes an existing data policy. \n\n " operationId: deleteDataPolicy parameters: - - description: The identifier of the data policy to delete. - example: policy1 - in: path - name: policyId - required: true - schema: - type: string - example: null + - description: The identifier of the data policy to delete. + example: policy1 + in: path + name: policyId + required: true + schema: + type: string responses: "204": description: "Success, no response body" @@ -1423,8 +1413,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -1437,8 +1427,8 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found @@ -1451,38 +1441,36 @@ paths: summary: Version check failed value: errors: - - title: Endpoint not active yet - detail: "Not all cluster nodes support this endpoint yet, please\ + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ \ try again later" schema: $ref: '#/components/schemas/Errors' description: Not all cluster nodes at minimum version summary: Delete a data policy tags: - - Data Hub - Data Policies + - Data Hub - Data Policies get: description: "Get a specific data policy. \n\n This endpoint returns the content\ \ of the policy with the content-type `application/json`. \n\n This endpoint\ \ requires at least HiveMQ version 4.15.0 on all cluster nodes." operationId: getDataPolicy parameters: - - description: The identifier of the policy. - example: policy1 - in: path - name: policyId - required: true - schema: - type: string - example: null - - description: "Comma-separated list of fields to include in the response. Allowed\ + - description: The identifier of the policy. + example: policy1 + in: path + name: policyId + required: true + schema: + type: string + - description: "Comma-separated list of fields to include in the response. Allowed\ \ values are: id, createdAt, lastUpdatedAt, matching, validation, onSuccess,\ \ onFailure" - example: "id,createdAt" - in: query - name: fields - schema: - type: string - example: null + example: "id,createdAt" + in: query + name: fields + schema: + type: string responses: "200": content: @@ -1499,27 +1487,27 @@ paths: topicFilter: topic/+ validation: validators: - - type: schema - arguments: - strategy: ALL_OF - schemas: - - schemaId: schema1 - version: "1" + - type: schema + arguments: + strategy: ALL_OF + schemas: + - schemaId: schema1 + version: "1" onSuccess: pipeline: - - id: logOperationSuccess - functionId: System.log - arguments: - level: DEBUG - message: "${clientId} sent a publish on topic '${topic}'\ + - id: logOperationSuccess + functionId: System.log + arguments: + level: DEBUG + message: "${clientId} sent a publish on topic '${topic}'\ \ with result '${validationResult}'" onFailure: pipeline: - - id: logOperationFailure - functionId: System.log - arguments: - level: WARN - message: "${clientId} sent an invalid publish on topic '${topic}'\ + - id: logOperationFailure + functionId: System.log + arguments: + level: WARN + message: "${clientId} sent an invalid publish on topic '${topic}'\ \ with result '${validationResult}'" schema: $ref: '#/components/schemas/DataPolicy' @@ -1533,8 +1521,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -1547,14 +1535,14 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found summary: Get a data policy tags: - - Data Hub - Data Policies + - Data Hub - Data Policies put: description: |- Update a data policy @@ -1564,14 +1552,13 @@ paths: This endpoint requires at least HiveMQ version 4.17.0 on all cluster nodes. operationId: updateDataPolicy parameters: - - description: The identifier of the policy. - example: policy1 - in: path - name: policyId - required: true - schema: - type: string - example: null + - description: The identifier of the policy. + example: policy1 + in: path + name: policyId + required: true + schema: + type: string requestBody: content: application/json: @@ -1581,27 +1568,27 @@ paths: topicFilter: topic/+ validation: validators: - - type: schema - arguments: - strategy: ALL_OF - schemas: - - schemaId: schema - version: "1" + - type: schema + arguments: + strategy: ALL_OF + schemas: + - schemaId: schema + version: "1" onSuccess: pipeline: - - id: logOperationSuccess - functionId: System.log - arguments: - level: DEBUG - message: "${clientId} sent a publish on topic '${topic}' with\ + - id: logOperationSuccess + functionId: System.log + arguments: + level: DEBUG + message: "${clientId} sent a publish on topic '${topic}' with\ \ result '${validationResult}'" onFailure: pipeline: - - id: logOperationFailure - functionId: System.log - arguments: - level: WARN - message: "${clientId} sent an invalid publish on topic '${topic}'\ + - id: logOperationFailure + functionId: System.log + arguments: + level: WARN + message: "${clientId} sent an invalid publish on topic '${topic}'\ \ with result '${validationResult}'" schema: $ref: '#/components/schemas/DataPolicy' @@ -1623,27 +1610,27 @@ paths: topicFilter: topic/+ validation: validators: - - type: schema - arguments: - strategy: ALL_OF - schemas: - - schemaId: schema1 - version: "1" + - type: schema + arguments: + strategy: ALL_OF + schemas: + - schemaId: schema1 + version: "1" onSuccess: pipeline: - - id: logOperationSuccess - functionId: System.log - arguments: - level: DEBUG - message: "${clientId} sent a publish on topic '${topic}'\ + - id: logOperationSuccess + functionId: System.log + arguments: + level: DEBUG + message: "${clientId} sent a publish on topic '${topic}'\ \ with result '${validationResult}'" onFailure: pipeline: - - id: logOperationFailure - functionId: System.log - arguments: - level: WARN - message: "${clientId} sent an invalid publish on topic '${topic}'\ + - id: logOperationFailure + functionId: System.log + arguments: + level: WARN + message: "${clientId} sent an invalid publish on topic '${topic}'\ \ with result '${validationResult}'" schema: $ref: '#/components/schemas/DataPolicy' @@ -1657,40 +1644,40 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing policy-not-parsable: description: Example response when the submitted policy could not be parsed as JSON. summary: The submitted policy can not be parsed value: errors: - - title: Policy not parsable - detail: The submitted policy 'policy' can not be parsed. + - title: Policy not parsable + detail: The submitted policy 'policy' can not be parsed. policy-not-valid: description: "Example response when the policy is invalid, because\ \ a field is missing." summary: The submitted policy is not valid value: errors: - - title: Policy is not valid - detail: Required body entity parameter is missing + - title: Policy is not valid + detail: Required body entity parameter is missing policy-topic-filter-not-matching: description: Example response when the given topic filter does not match the present one. summary: The policy topic filter does not match value: errors: - - title: Topic filter does not match - detail: The policy with id 'policyId' has a topic filter 'my/topic/filter' - that does not match the topic filter of the current policy. + - title: Topic filter does not match + detail: The policy with id 'policyId' has a topic filter 'my/topic/filter' + that does not match the topic filter of the current policy. referenced-schema-does-not-exist: description: Example response when a referenced schema was not found. summary: A schema that is referenced in the policy does not exist value: errors: - - title: Referenced schema does not exist - detail: The referenced schema with id 'schema-id' does not exist. + - title: Referenced schema does not exist + detail: The referenced schema with id 'schema-id' does not exist. schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -1703,8 +1690,8 @@ paths: summary: Not found value: errors: - - title: Referenced policy not found - detail: The referenced policy with id 'policyId' was not found. + - title: Referenced policy not found + detail: The referenced policy with id 'policyId' was not found. schema: $ref: '#/components/schemas/Errors' description: Policy not found @@ -1717,8 +1704,8 @@ paths: summary: Etag not matching value: errors: - - title: Precondition Failed - detail: Policy does not match the given etag '123456789'. + - title: Precondition Failed + detail: Policy does not match the given etag '123456789'. schema: $ref: '#/components/schemas/Errors' description: Precondition failed @@ -1731,15 +1718,15 @@ paths: summary: Version check failed value: errors: - - title: Endpoint not active yet - detail: "Not all cluster nodes support this endpoint yet, please\ + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ \ try again later" schema: $ref: '#/components/schemas/Errors' description: Not all cluster nodes at minimum version summary: Update an existing data policy tags: - - Data Hub - Data Policies + - Data Hub - Data Policies /api/v1/data-hub/management/start-trial: post: description: |- @@ -1754,183 +1741,550 @@ paths: content: application/json: examples: - trial-already-expired: - description: Bad request - summary: Data Hub trial mode is already expired - value: - errors: - - title: Trial mode already expired - detail: The trial mode period for data hub has already expired. - Restart HiveMQ to get another 5 hours trial mode. - trial-already-running: + trial-already-expired: + description: Bad request + summary: Data Hub trial mode is already expired + value: + errors: + - title: Trial mode already expired + detail: The trial mode period for data hub has already expired. + Restart HiveMQ to get another 5 hours trial mode. + trial-already-running: + description: Bad request + summary: Data Hub trial mode is already running + value: + errors: + - title: Trial mode already running + detail: "The trial mode for data hub cannot be started, as it\ + \ is already running." + schema: + $ref: '#/components/schemas/Errors' + description: Bad request + "503": + content: + application/json: + examples: + temporarily-not-available: + description: The endpoint is temporarily not available + summary: Temporarily not available + value: + errors: + - title: The endpoint is temporarily not available + detail: "The endpoint is temporarily not available, please try\ + \ again later" + schema: + $ref: '#/components/schemas/Errors' + description: Temporarily not available + summary: Start trial mode + tags: + - Data Hub - Management + /api/v1/data-hub/schemas: + get: + description: "Get all schemas. \n\n This endpoint returns the content of the\ + \ schemas with the content-type `application/json`. \n\n This endpoint requires\ + \ at least HiveMQ version 4.16.0 on all cluster nodes." + operationId: getAllSchemas + parameters: + - description: "Comma-separated list of fields to include in the response. Allowed\ + \ values are: id, type, schemaDefinition, createdAt" + example: "id,createdAt" + in: query + name: fields + schema: + type: string + - description: Comma-separated list of schema types used for filtering. Multiple + filters can be applied together. + example: "JSON,PROTOBUF" + in: query + name: types + schema: + type: string + - description: Comma-separated list of schema ids used for filtering. Multiple + filters can be applied together. + example: "schema1,schema2" + in: query + name: schemaIds + schema: + type: string + - description: Specifies the page size for the returned results. Has to be between + 10 and 500. Default page size is 50. + example: 100 + in: query + name: limit + schema: + type: integer + format: int32 + - description: The cursor that has been returned by the previous result page. + Do not pass this parameter if you want to fetch the first page. + in: query + name: cursor + schema: + type: string + responses: + "200": + content: + application/json: + examples: + list-response-a: + description: Example response with multiple schemas. No more pages + left + summary: "Multiple results, last page" + value: + items: + - id: schema1 + version: 1 + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + createdAt: 2023-03-01T13:28:35.164Z + - id: schema2 + version: 1 + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + createdAt: 2023-03-01T13:38:35.164Z + - id: schema3 + version: 1 + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + createdAt: 2023-03-01T13:48:35.164Z + list-response-b: + description: Example response with multiple schemas. More pages + left + summary: "Multiple results, more pages left" + value: + items: + - id: schema1 + version: 1 + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + createdAt: 2023-03-01T13:28:35.164Z + - id: schema2 + version: 1 + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + createdAt: 2023-03-01T13:38:35.164Z + - id: schema3 + version: 1 + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + createdAt: 2023-03-01T13:48:35.164Z + _links: + next: /api/v1/data-hub/schemas?cursor=a-eqj-GE9B5DkV-nhwVBk-nTL807ty&limit=3 + list-response-c: + description: Example response with requested fields and multiple + schemas. More pages left + summary: "Multiple results, requested 'id' field" + value: + items: + - id: schema1 + - id: schema2 + - id: schema3 + _links: + next: /api/v1/data-hub/schemas?cursor=a-eqj-GE9B5DkV-nhwVBk-nTL807ty&limit=3&fields=id + list-response-d: + description: Example response with a single schema + summary: Single Result + value: + items: + - id: schema1 + version: 1 + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + createdAt: 2023-03-01T13:28:35.164Z + list-response-e: + description: Example response with all versions of specific schema + id. + summary: "List versions of one schema, last page" + value: + items: + - id: schema1 + version: 1 + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + createdAt: 2023-03-01T13:28:35.164Z + - id: schema1 + version: 2 + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + createdAt: 2023-03-01T13:38:35.164Z + - id: schema1 + version: 3 + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + createdAt: 2023-03-01T13:48:35.164Z + schema: + $ref: '#/components/schemas/SchemaList' + description: Success + "503": + content: + application/json: + examples: + version-check-failed: + description: Version check failed + summary: Version check failed + value: + errors: + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ + \ try again later" + schema: + $ref: '#/components/schemas/Errors' + description: Not all cluster nodes at minimum version + summary: Get all schemas + tags: + - Data Hub - Schemas + post: + description: |- + Creates a schema + + This endpoint requires at least HiveMQ version 4.15.0 on all cluster nodes. + operationId: createSchema + requestBody: + content: + application/json: + example: + id: schema + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + schema: + $ref: '#/components/schemas/Schema' + description: The schema that should be created. + required: true + responses: + "201": + content: + application/json: + examples: + response-example: + description: Example response. + summary: Schema was created successfully + value: + id: schema + version: 1 + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + createdAt: 2023-03-01T13:28:35.164Z + schema: + $ref: '#/components/schemas/Schema' + description: Success + "400": + content: + application/json: + examples: + Schema-already-present: + description: Example response when the schema is already present. + summary: The given schema is already present as latest version + value: + errors: + - title: Schema already present + detail: The given schema is already present as the latest version + for the schema id 'schemaId'. + param-missing: + description: Example response when a required parameter is missing. + summary: Required URL parameter missing + value: + errors: + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing + schema-not-parsable: + description: Example response when the submitted schema could not + be parsed as JSON. + summary: The submitted schema can not be parsed + value: + errors: + - title: Schema not parsable + detail: The submitted schema 'schema' can not be parsed. + schema-type-not-supported: + description: Example response when the specified schema type is + not supported. + summary: The submitted schema type is not supported + value: + errors: + - title: Schema type not supported + detail: The submitted schema type 'schema-type' is not supported + schema: + $ref: '#/components/schemas/Errors' + description: Bad request + "503": + content: + application/json: + examples: + temporarily-not-available: + description: The endpoint is temporarily not available + summary: Temporarily not available + value: + errors: + - title: The endpoint is temporarily not available + detail: "The endpoint is temporarily not available, please try\ + \ again later" + version-check-failed: + description: Version check failed + summary: Version check failed + value: + errors: + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ + \ try again later" + schema: + $ref: '#/components/schemas/Errors' + description: Not all cluster nodes at minimum version + summary: Create a new schema + tags: + - Data Hub - Schemas + /api/v1/data-hub/schemas/{schemaId}: + delete: + description: "Deletes the selected schema and all associated versions of the\ + \ schema. \n\n This endpoint requires HiveMQ version4.15.0 or above on all\ + \ cluster nodes." + operationId: deleteSchema + parameters: + - description: The schema identifier of the schema versions to delete. + example: schema1 + in: path + name: schemaId + required: true + schema: + type: string + responses: + "204": + description: "Success, no response body" + "400": + content: + application/json: + examples: + param-missing: + description: Bad request + summary: Required URL parameter missing + value: + errors: + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing + schema: + $ref: '#/components/schemas/Errors' + description: Bad request + "404": + content: + application/json: + examples: + not-found: + description: Resource not found + summary: Not found + value: + errors: + - title: Resource not found + detail: Resource with id 'my-resource-id' not found + schema: + $ref: '#/components/schemas/Errors' + description: Resource not found + "503": + content: + application/json: + examples: + version-check-failed: + description: Version check failed + summary: Version check failed + value: + errors: + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ + \ try again later" + schema: + $ref: '#/components/schemas/Errors' + description: Not all cluster nodes at minimum version + summary: Delete all versions of the schema + tags: + - Data Hub - Schemas + get: + description: "Get a specific schema. \n\n This endpoint returns the content\ + \ of the latest version of the schema with the content-type `application/json`.\ + \ \n\n This endpoint requires at least HiveMQ version 4.15.0 on all cluster\ + \ nodes." + operationId: getSchema + parameters: + - description: The identifier of the schema. + example: schema1 + in: path + name: schemaId + required: true + schema: + type: string + - description: "Comma-separated list of fields to include in the response. Allowed\ + \ values are: id, type, schemaDefinition, createdAt" + example: "id,type" + in: query + name: fields + schema: + type: string + responses: + "200": + content: + application/json: + examples: + get-response: + description: Get schema + summary: Get schema + value: + id: schema + version: 1 + type: JSON + schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + createdAt: 2023-03-01T13:28:35.164Z + schema: + $ref: '#/components/schemas/Schema' + description: Success + "400": + content: + application/json: + examples: + param-missing: description: Bad request - summary: Data Hub trial mode is already running + summary: Required URL parameter missing value: errors: - - title: Trial mode already running - detail: "The trial mode for data hub cannot be started, as it\ - \ is already running." + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request - "503": + "404": content: application/json: examples: - temporarily-not-available: - description: The endpoint is temporarily not available - summary: Temporarily not available + not-found: + description: Resource not found + summary: Not found value: errors: - - title: The endpoint is temporarily not available - detail: "The endpoint is temporarily not available, please try\ - \ again later" + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' - description: Temporarily not available - summary: Start trial mode + description: Resource not found + summary: Get a schema tags: - - Data Hub - Management - /api/v1/data-hub/schemas: + - Data Hub - Schemas + /api/v1/data-hub/scripts: get: - description: "Get all schemas. \n\n This endpoint returns the content of the\ - \ schemas with the content-type `application/json`. \n\n This endpoint requires\ - \ at least HiveMQ version 4.16.0 on all cluster nodes." - operationId: getAllSchemas + description: Get all scripts. + operationId: getAllScripts parameters: - - description: "Comma-separated list of fields to include in the response. Allowed\ - \ values are: id, type, schemaDefinition, createdAt" - example: "id,createdAt" - in: query - name: fields - schema: - type: string - example: null - - description: Comma-separated list of schema types used for filtering. Multiple - filters can be applied together. - example: "JSON,PROTOBUF" - in: query - name: types - schema: - type: string - example: null - - description: Comma-separated list of schema ids used for filtering. Multiple - filters can be applied together. - example: "schema1,schema2" - in: query - name: schemaIds - schema: - type: string - example: null - - description: Specifies the page size for the returned results. Has to be between - 10 and 500. Default page size is 50. - example: 100 - in: query - name: limit - schema: - type: integer - format: int32 - example: null - - description: The cursor that has been returned by the previous result page. - Do not pass this parameter if you want to fetch the first page. - in: query - name: cursor - schema: - type: string - example: null + - description: "Comma-separated list of fields to include in the response. Allowed\ + \ values are: id, version, description, runtime, functionType, createdAt" + example: "id,createdAt,source" + in: query + name: fields + schema: + type: string + - description: Comma-separated list of function types used for filtering. Multiple + filters can be applied together. + example: TRANSFORMATION + in: query + name: functionTypes + schema: + type: string + - description: Comma-separated list of script ids used for filtering. Multiple + filters can be applied together. + example: "script1,script2" + in: query + name: scriptIds + schema: + type: string + - description: Specifies the page size for the returned results. Has to be between + 10 and 500. Default page size is 50. + example: 100 + in: query + name: limit + schema: + type: integer + format: int32 + - description: The cursor that has been returned by the previous result page. + Do not pass this parameter if you want to fetch the first page. + in: query + name: cursor + schema: + type: string responses: "200": content: application/json: examples: - list-response-a: - description: Example response with multiple schemas. No more pages - left - summary: "Multiple results, last page" + list-response-1: + description: Example response with a single script + summary: Single Result value: items: - - id: schema1 - version: 1 - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= - createdAt: 2023-03-01T13:28:35.164Z - - id: schema2 - version: 1 - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= - createdAt: 2023-03-01T13:38:35.164Z - - id: schema3 - version: 1 - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= - createdAt: 2023-03-01T13:48:35.164Z + - id: greet_function0 + version: 1 + createdAt: 2023-11-03T14:02:41.378Z + description: This function greets a person. + functionType: TRANSFORMATION + source: ZnVuY3Rpb24gdHJhbnNmb3JtKHBlcnNvbikgeyByZXR1cm4gJ2hlbGxvICcgKyBwZXJzb24gfQ== list-response-b: - description: Example response with multiple schemas. More pages - left + description: Example response with multiple sripts. More pages left summary: "Multiple results, more pages left" value: items: - - id: schema1 - version: 1 - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= - createdAt: 2023-03-01T13:28:35.164Z - - id: schema2 - version: 1 - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= - createdAt: 2023-03-01T13:38:35.164Z - - id: schema3 - version: 1 - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= - createdAt: 2023-03-01T13:48:35.164Z + - id: greet_function0 + version: 1 + createdAt: 2023-11-03T13:59:47.262Z + description: This function greets a person. + functionType: TRANSFORMATION + source: ZnVuY3Rpb24gdHJhbnNmb3JtKHBlcnNvbikgeyByZXR1cm4gJ2hlbGxvICcgKyBwZXJzb24gfQ== + - id: greet_function1 + version: 1 + createdAt: 2023-11-03T13:59:48.348Z + description: This function greets a person. + functionType: TRANSFORMATION + source: ZnVuY3Rpb24gdHJhbnNmb3JtKHBlcnNvbikgeyByZXR1cm4gJ2hlbGxvICcgKyBwZXJzb24gfQ== _links: - next: /api/v1/data-validation/schemas?cursor=a-eqj-GE9B5DkV-nhwVBk-nTL807ty&limit=3 + next: /api/v1/data-hub/scripts?cursor=a-WfW-QB4L4Q==&limit=3 list-response-c: description: Example response with requested fields and multiple - schemas. More pages left + scripts. More pages left summary: "Multiple results, requested 'id' field" value: items: - - id: schema1 - - id: schema2 - - id: schema3 + - id: script1 + - id: script2 + - id: script3 _links: - next: /api/v1/data-validation/schemas?cursor=a-eqj-GE9B5DkV-nhwVBk-nTL807ty&limit=3&fields=id - list-response-d: - description: Example response with a single schema - summary: Single Result - value: - items: - - id: schema1 - version: 1 - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= - createdAt: 2023-03-01T13:28:35.164Z + next: /api/v1/data-hub/scripts?cursor=a-eqj-GE9B5DkV-nhwVBk-nTL807ty&limit=3&fields=id list-response-e: - description: Example response with all versions of specific schema + description: Example response with all versions of specific script id. - summary: "List versions of one schema, last page" + summary: "List versions of one script, last page" value: items: - - id: schema1 - version: 1 - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= - createdAt: 2023-03-01T13:28:35.164Z - - id: schema1 - version: 2 - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= - createdAt: 2023-03-01T13:38:35.164Z - - id: schema1 - version: 3 - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= - createdAt: 2023-03-01T13:48:35.164Z + - id: greet_function + version: 1 + createdAt: 2023-11-03T13:59:47.262Z + description: This function greets a person. + functionType: TRANSFORMATION + source: ZnVuY3Rpb24gdHJhbnNmb3JtKHBlcnNvbikgeyByZXR1cm4gJ2hlbGxvICcgKyBwZXJzb24gfQ== + - id: greet_function + version: 2 + createdAt: 2023-11-03T13:59:48.348Z + description: This function greets a person. + functionType: TRANSFORMATION + source: ZnVuY3Rpb24gdHJhbnNmb3JtKHBlcnNvbikgeyByZXR1cm4gJ2hlbGxvICcgKyBwZXJzb24gfQ== + list-response-many: + description: Example response with multiple scripts + summary: Multiple results + value: + items: + - id: greet_function0 + version: 1 + createdAt: 2023-11-03T13:59:47.262Z + description: This function greets a person. + functionType: TRANSFORMATION + source: ZnVuY3Rpb24gdHJhbnNmb3JtKHBlcnNvbikgeyByZXR1cm4gJ2hlbGxvICcgKyBwZXJzb24gfQ== + - id: greet_function1 + version: 1 + createdAt: 2023-11-03T13:59:48.348Z + description: This function greets a person. + functionType: TRANSFORMATION + source: ZnVuY3Rpb24gdHJhbnNmb3JtKHBlcnNvbikgeyByZXR1cm4gJ2hlbGxvICcgKyBwZXJzb24gfQ== schema: - $ref: '#/components/schemas/SchemaList' + $ref: '#/components/schemas/ScriptList' description: Success "503": content: @@ -1941,31 +2295,29 @@ paths: summary: Version check failed value: errors: - - title: Endpoint not active yet - detail: "Not all cluster nodes support this endpoint yet, please\ + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ \ try again later" schema: $ref: '#/components/schemas/Errors' description: Not all cluster nodes at minimum version - summary: Get all schemas + summary: Get all scripts tags: - - Data Hub - Schemas + - Data Hub - Scripts post: - description: |- - Creates a schema - - This endpoint requires at least HiveMQ version 4.15.0 on all cluster nodes. - operationId: createSchema + description: Creates a script + operationId: createScript requestBody: content: application/json: example: - id: schema - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= + id: greet_function + description: This function greets a person. + functionType: TRANSFORMATION + source: ZnVuY3Rpb24gdHJhbnNmb3JtKHBlcnNvbikgeyByZXR1cm4gJ2hlbGxvICcgKyBwZXJzb24gfQ== schema: - $ref: '#/components/schemas/Schema' - description: The schema that should be created. + $ref: '#/components/schemas/Script' + description: The script that should be created. required: true responses: "201": @@ -1974,51 +2326,36 @@ paths: examples: response-example: description: Example response. - summary: Schema was created successfully + summary: Script was created successfully value: - id: schema + id: greet_function version: 1 - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= - createdAt: 2023-03-01T13:28:35.164Z + createdAt: 2023-11-03T13:07:15.650Z + description: This function greets a person. + functionType: TRANSFORMATION + source: ZnVuY3Rpb24gdHJhbnNmb3JtKHBlcnNvbikgeyByZXR1cm4gJ2hlbGxvICcgKyBwZXJzb24gfQ== schema: - $ref: '#/components/schemas/Schema' + $ref: '#/components/schemas/Script' description: Success "400": content: application/json: examples: - Schema-already-present: - description: Example response when the schema is already present. - summary: The given schema is already present as latest version - value: - errors: - - title: Schema already present - detail: The given schema is already present as the latest version - for the schema id 'schemaId'. - param-missing: - description: Example response when a required parameter is missing. - summary: Required URL parameter missing - value: - errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing - schema-not-parsable: - description: Example response when the submitted schema could not - be parsed as JSON. - summary: The submitted schema can not be parsed + input-cannot-be-parsed: + description: Example response when input cannot be parsed. + summary: Unable to parse JSON body value: errors: - - title: Schema not parsable - detail: The submitted schema 'schema' can not be parsed. - schema-type-not-supported: - description: Example response when the specified schema type is - not supported. - summary: The submitted schema type is not supported + - title: Invalid input + detail: Unable to parse JSON body + script-already-present: + description: Example response when the script is already present. + summary: The given script is already present as latest version value: errors: - - title: Schema type not supported - detail: The submitted schema type 'schema-type' is not supported + - title: Script already present + detail: The given script is already present as the latest version + for the script id 'scriptId'. schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -2026,43 +2363,32 @@ paths: content: application/json: examples: - temporarily-not-available: - description: The endpoint is temporarily not available - summary: Temporarily not available - value: - errors: - - title: The endpoint is temporarily not available - detail: "The endpoint is temporarily not available, please try\ - \ again later" version-check-failed: description: Version check failed summary: Version check failed value: errors: - - title: Endpoint not active yet - detail: "Not all cluster nodes support this endpoint yet, please\ + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ \ try again later" schema: $ref: '#/components/schemas/Errors' description: Not all cluster nodes at minimum version - summary: Create a new schema + summary: Create a new script tags: - - Data Hub - Schemas - /api/v1/data-hub/schemas/{schemaId}: + - Data Hub - Scripts + /api/v1/data-hub/scripts/{scriptId}: delete: - description: "Deletes the selected schema and all associated versions of the\ - \ schema. \n\n This endpoint requires HiveMQ version4.15.0 or above on all\ - \ cluster nodes." - operationId: deleteSchema + description: Deletes the selected script. + operationId: deleteScript parameters: - - description: The schema identifier of the schema versions to delete. - example: schema1 - in: path - name: schemaId - required: true - schema: - type: string - example: null + - description: The script identifier of the script to delete. + example: hello_world_function + in: path + name: scriptId + required: true + schema: + type: string responses: "204": description: "Success, no response body" @@ -2073,10 +2399,6 @@ paths: param-missing: description: Bad request summary: Required URL parameter missing - value: - errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -2089,8 +2411,8 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found @@ -2103,54 +2425,50 @@ paths: summary: Version check failed value: errors: - - title: Endpoint not active yet - detail: "Not all cluster nodes support this endpoint yet, please\ + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ \ try again later" schema: $ref: '#/components/schemas/Errors' description: Not all cluster nodes at minimum version - summary: Delete all versions of the schema + summary: Delete a script tags: - - Data Hub - Schemas + - Data Hub - Scripts get: - description: "Get a specific schema. \n\n This endpoint returns the content\ - \ of the latest version of the schema with the content-type `application/json`.\ - \ \n\n This endpoint requires at least HiveMQ version 4.15.0 on all cluster\ - \ nodes." - operationId: getSchema + description: Get a specific script. + operationId: getScript parameters: - - description: The identifier of the schema. - example: schema1 - in: path - name: schemaId - required: true - schema: - type: string - example: null - - description: "Comma-separated list of fields to include in the response. Allowed\ - \ values are: id, type, schemaDefinition, createdAt" - example: "id,type" - in: query - name: fields - schema: - type: string - example: null + - description: The identifier of the script. + example: hello_world_function + in: path + name: scriptId + required: true + schema: + type: string + - description: "Comma-separated list of fields to include in the response. Allowed\ + \ values are: id, version, description, runtime, functionType, createdAt" + example: "id,createdAt,source" + in: query + name: fields + schema: + type: string responses: "200": content: application/json: examples: get-response: - description: Get schema - summary: Get schema + description: Get script + summary: Get script value: - id: schema + id: someFunction version: 1 - type: JSON - schemaDefinition: ewogICIkaWQiOiAiaHR0cHM6Ly9leGFtcGxlLmNvbS9hZGRyZXNzLmpzb24iLAogICIkc2NoZW1hIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIiwKICAidHlwZSI6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIjogewogICAgInN0cmVldF9hZGRyZXNzIjogeyAidHlwZSI6ICJzdHJpbmciIH0sCiAgICAiY2l0eSI6IHsgInR5cGUiOiAic3RyaW5nIiB9LAogICAgInN0YXRlIjogeyAidHlwZSI6ICJzdHJpbmciIH0KICB9LAogICJyZXF1aXJlZCI6IFsic3RyZWV0X2FkZHJlc3MiLCAiY2l0eSIsICJzdGF0ZSJdCn0= - createdAt: 2023-03-01T13:28:35.164Z + createdAt: 2023-11-03T13:27:14.387Z + description: "" + functionType: TRANSFORMATION + source: Wm5WdVkzUnBiMjRnWVdOMEtIQmxjbk52YmlrZ2V5QnlaWFIxY200Z0oyaGxiR3h2SUNjZ0t5QndaWEp6YjI0Z2ZRPT0= schema: - $ref: '#/components/schemas/Schema' + $ref: '#/components/schemas/Script' description: Success "400": content: @@ -2161,8 +2479,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -2175,14 +2493,14 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found - summary: Get a schema + summary: Get a script tags: - - Data Hub - Schemas + - Data Hub - Scripts /api/v1/management/backups: get: description: |- @@ -2210,17 +2528,17 @@ paths: summary: Multiple results in different states value: items: - - id: 20200506-081317 - createdAt: 2020-05-06T08:13:17Z - bytes: 85550653 - state: COMPLETED - - id: 20201006-1902318 - createdAt: 2020-05-06T08:13:17Z - state: IN_PROGRESS - - id: 20201006-1902318 - createdAt: 2020-05-06T08:13:17Z - state: FAILED - failReason: Another backup is already in progress. + - id: 20200506-081317 + createdAt: 2020-05-06T08:13:17Z + bytes: 85550653 + state: COMPLETED + - id: 20201006-1902318 + createdAt: 2020-05-06T08:13:17Z + state: IN_PROGRESS + - id: 20201006-1902318 + createdAt: 2020-05-06T08:13:17Z + state: FAILED + failReason: Another backup is already in progress. schema: $ref: '#/components/schemas/BackupList' description: Success @@ -2233,15 +2551,15 @@ paths: summary: Temporarily not available value: errors: - - title: The endpoint is temporarily not available - detail: "The endpoint is temporarily not available, please try\ + - title: The endpoint is temporarily not available + detail: "The endpoint is temporarily not available, please try\ \ again later" schema: $ref: '#/components/schemas/Errors' description: Temporarily not available summary: List all available backups tags: - - Backup & Restore + - Backup & Restore post: description: |- Triggers the creation of a new backup. @@ -2273,15 +2591,15 @@ paths: summary: Temporarily not available value: errors: - - title: The endpoint is temporarily not available - detail: "The endpoint is temporarily not available, please try\ + - title: The endpoint is temporarily not available + detail: "The endpoint is temporarily not available, please try\ \ again later" schema: $ref: '#/components/schemas/Errors' description: Temporarily not available summary: Create a new backup tags: - - Backup & Restore + - Backup & Restore /api/v1/management/backups/{backupId}: get: description: |- @@ -2294,13 +2612,12 @@ paths: This endpoint requires at least HiveMQ version 4.4.0. on all cluster nodes. operationId: getBackup parameters: - - description: The id of the backup. - in: path - name: backupId - required: true - schema: - type: string - example: null + - description: The id of the backup. + in: path + name: backupId + required: true + schema: + type: string responses: "200": content: @@ -2327,8 +2644,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -2341,8 +2658,8 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found @@ -2355,15 +2672,15 @@ paths: summary: Temporarily not available value: errors: - - title: The endpoint is temporarily not available - detail: "The endpoint is temporarily not available, please try\ + - title: The endpoint is temporarily not available + detail: "The endpoint is temporarily not available, please try\ \ again later" schema: $ref: '#/components/schemas/Errors' description: Temporarily not available summary: Get backup information tags: - - Backup & Restore + - Backup & Restore post: description: |- Triggers the restore of a stored backup. @@ -2371,13 +2688,12 @@ paths: This endpoint requires at least HiveMQ version 4.4.0. on all cluster nodes. operationId: restoreBackup parameters: - - description: The id of the backup. - in: path - name: backupId - required: true - schema: - type: string - example: null + - description: The id of the backup. + in: path + name: backupId + required: true + schema: + type: string responses: "200": content: @@ -2403,8 +2719,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -2417,8 +2733,8 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found @@ -2431,15 +2747,15 @@ paths: summary: Temporarily not available value: errors: - - title: The endpoint is temporarily not available - detail: "The endpoint is temporarily not available, please try\ + - title: The endpoint is temporarily not available + detail: "The endpoint is temporarily not available, please try\ \ again later" schema: $ref: '#/components/schemas/Errors' description: Temporarily not available summary: Restore a new backup tags: - - Backup & Restore + - Backup & Restore /api/v1/management/diagnostic-archives: post: description: Triggers the creation of a new diagnostic archive. @@ -2463,7 +2779,7 @@ paths: description: Success summary: Create a new diagnostic archive tags: - - Diagnostic Archive + - Diagnostic Archive /api/v1/management/files/backups/{backupId}: get: description: "Download a specific backup file. \n\n This endpoint returns the\ @@ -2473,13 +2789,12 @@ paths: \ least HiveMQ version 4.4.0. on all cluster nodes." operationId: downloadBackupFile parameters: - - description: The id of the backup. - in: path - name: backupId - required: true - schema: - type: string - example: null + - description: The id of the backup. + in: path + name: backupId + required: true + schema: + type: string responses: "200": content: @@ -2492,7 +2807,6 @@ paths: schema: type: string format: binary - example: null description: Success "400": content: @@ -2503,8 +2817,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -2517,8 +2831,8 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found @@ -2531,15 +2845,15 @@ paths: summary: Temporarily not available value: errors: - - title: The endpoint is temporarily not available - detail: "The endpoint is temporarily not available, please try\ + - title: The endpoint is temporarily not available + detail: "The endpoint is temporarily not available, please try\ \ again later" schema: $ref: '#/components/schemas/Errors' description: Temporarily not available summary: Download a backup file tags: - - Backup & Restore + - Backup & Restore /api/v1/management/files/trace-recordings/{traceRecordingId}: get: description: "Download a specific trace recording. \n\n This endpoint returns\ @@ -2548,13 +2862,12 @@ paths: \ can be downloaded." operationId: downloadTraceRecordingFile parameters: - - description: The id of the trace recording. - in: path - name: traceRecordingId - required: true - schema: - type: string - example: null + - description: The id of the trace recording. + in: path + name: traceRecordingId + required: true + schema: + type: string responses: "200": content: @@ -2567,7 +2880,6 @@ paths: schema: type: string format: binary - example: null description: Success "400": content: @@ -2578,8 +2890,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -2592,14 +2904,14 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found summary: Download a trace recording tags: - - Trace Recordings + - Trace Recordings /api/v1/management/trace-recordings: get: description: "Lists all known trace recordings. \n\nTrace recordings can be\ @@ -2619,23 +2931,23 @@ paths: summary: Single result value: items: - - name: test - startAt: 2020-07-23T12:07:30.000Z - endAt: 2020-07-23T13:07:30.000Z - clientIdFilters: - - regex: "client-[0-9]" - topicFilters: - - regex: topic/.* - events: - - MQTT_MESSAGE_CONNECT - - MQTT_MESSAGE_DISCONNECT - state: IN_PROGRESS + - name: test + startAt: 2020-07-23T12:07:30.000Z + endAt: 2020-07-23T13:07:30.000Z + clientIdFilters: + - regex: "client-[0-9]" + topicFilters: + - regex: topic/.* + events: + - MQTT_MESSAGE_CONNECT + - MQTT_MESSAGE_DISCONNECT + state: IN_PROGRESS schema: $ref: '#/components/schemas/TraceRecordingList' description: Success summary: Get all trace recordings tags: - - Trace Recordings + - Trace Recordings post: description: "Creates a new trace recording. \n\n To create a trace recording\ \ you must specify a name, start date, end date, a set of filters and the\ @@ -2657,11 +2969,11 @@ paths: startAt: 2020-07-23T12:07:30.000Z endAt: 2020-07-23T13:07:30.000Z clientIdFilters: - - regex: "client-[0-9]" + - regex: "client-[0-9]" topicFilters: - - regex: topic/.* + - regex: topic/.* events: - - MQTT_MESSAGE_CONNECT + - MQTT_MESSAGE_CONNECT schema: $ref: '#/components/schemas/TraceRecordingItem' description: The trace recording to create @@ -2680,11 +2992,11 @@ paths: startAt: 2020-07-23T12:07:30.000Z endAt: 2020-07-23T13:07:30.000Z clientIdFilters: - - regex: test + - regex: test topicFilters: - - regex: test-topic + - regex: test-topic events: - - MQTT_MESSAGE_CONNECT + - MQTT_MESSAGE_CONNECT state: IN_PROGRESS schema: $ref: '#/components/schemas/TraceRecordingItem' @@ -2698,41 +3010,40 @@ paths: summary: Required body entity parameter missing value: errors: - - title: Required parameter missing - detail: Required body entity parameter is missing + - title: Required parameter missing + detail: Required body entity parameter is missing invalid-resource: description: Bad request summary: Invalid resource value: errors: - - title: Invalid resource - detail: "The fields {name, events, startAt, endAt} must be specified\ + - title: Invalid resource + detail: "The fields {name, events, startAt, endAt} must be specified\ \ at creation" param-missing: description: Bad request summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request summary: Create a trace recording tags: - - Trace Recordings + - Trace Recordings /api/v1/management/trace-recordings/{traceRecordingId}: delete: description: "Deletes an existing trace recording. \n\n " operationId: deleteTraceRecording parameters: - - description: The name of the trace recording to delete. - in: path - name: traceRecordingId - required: true - schema: - type: string - example: null + - description: The name of the trace recording to delete. + in: path + name: traceRecordingId + required: true + schema: + type: string responses: "204": description: "Success, no response body" @@ -2745,8 +3056,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -2759,14 +3070,14 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found summary: Delete a trace recording tags: - - Trace Recordings + - Trace Recordings patch: description: |- Stops an existing trace recording. @@ -2774,13 +3085,12 @@ paths: Only the state of the trace recording can be set to `STOPPED` with this endpoint, changes to other fields are ignored. operationId: stopTraceRecording parameters: - - description: The name of the trace recording to patch/stop. - in: path - name: traceRecordingId - required: true - schema: - type: string - example: null + - description: The name of the trace recording to patch/stop. + in: path + name: traceRecordingId + required: true + schema: + type: string requestBody: content: application/json: @@ -2810,11 +3120,11 @@ paths: startAt: 2020-07-23T12:07:30.000Z endAt: 2020-07-23T13:07:30.000Z clientIdFilters: - - regex: test + - regex: test topicFilters: - - regex: test-topic + - regex: test-topic events: - - MQTT_MESSAGE_CONNECT + - MQTT_MESSAGE_CONNECT state: STOPPED schema: $ref: '#/components/schemas/TraceRecordingItem' @@ -2828,23 +3138,23 @@ paths: summary: Required body entity parameter missing value: errors: - - title: Required parameter missing - detail: Required body entity parameter is missing + - title: Required parameter missing + detail: Required body entity parameter is missing invalid-resource: description: Bad request summary: Invalid resource value: errors: - - title: Invalid resource - detail: "The fields {name, events, startAt, endAt} must be specified\ + - title: Invalid resource + detail: "The fields {name, events, startAt, endAt} must be specified\ \ at creation" param-missing: description: Bad request summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -2857,14 +3167,14 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found summary: Stop a trace recording. tags: - - Trace Recordings + - Trace Recordings /api/v1/mqtt/clients: get: description: |- @@ -2878,21 +3188,19 @@ paths: This endpoint requires at least HiveMQ version 4.4.0. on all cluster nodes. operationId: getAllMqttClients parameters: - - description: Specifies the page size for the returned results. Has to be between - 50 and 2500. Default page size is 500. - in: query - name: limit - schema: - type: integer - format: int32 - example: null - - description: The cursor that has been returned by the previous result page. - Do not pass this parameter if you want to fetch the first page. - in: query - name: cursor - schema: - type: string - example: null + - description: Specifies the page size for the returned results. Has to be between + 50 and 2500. Default page size is 500. + in: query + name: limit + schema: + type: integer + format: int32 + - description: The cursor that has been returned by the previous result page. + Do not pass this parameter if you want to fetch the first page. + in: query + name: cursor + schema: + type: string responses: "200": content: @@ -2909,22 +3217,22 @@ paths: summary: "Multiple results, last page" value: items: - - id: client-12 - - id: client-5 - - id: client-32 - - id: my-client-id2 - - id: my-client-id + - id: client-12 + - id: client-5 + - id: client-32 + - id: my-client-id2 + - id: my-client-id multiple-results-pages-left: description: Example response with multiple clients. More pages left. summary: "Multiple results, more pages left" value: items: - - id: client-12 - - id: client-5 - - id: client-32 - - id: my-client-id2 - - id: my-client-id + - id: client-12 + - id: client-5 + - id: client-32 + - id: my-client-id2 + - id: my-client-id _links: next: /api/v1/mqtt/clients?cursor=a-MvelExpd5y0SrXBxDhBvnGmohbpzwGDQFdUyOYWBACqs1TgI4-cUo-A=&limit=5 single-result: @@ -2932,7 +3240,7 @@ paths: summary: Single result value: items: - - id: client-12 + - id: client-12 schema: $ref: '#/components/schemas/ClientList' description: Success @@ -2945,8 +3253,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -2959,8 +3267,8 @@ paths: summary: The passed cursor is not valid anymore value: errors: - - title: Cursor not valid anymore - detail: "The passed cursor is not valid anymore, you can request\ + - title: Cursor not valid anymore + detail: "The passed cursor is not valid anymore, you can request\ \ this resource without a cursor to start from the beginning" schema: $ref: '#/components/schemas/Errors' @@ -2974,15 +3282,15 @@ paths: summary: Version check failed value: errors: - - title: Endpoint not active yet - detail: "Not all cluster nodes support this endpoint yet, please\ + - title: Endpoint not active yet + detail: "Not all cluster nodes support this endpoint yet, please\ \ try again later" schema: $ref: '#/components/schemas/Errors' description: Not all cluster nodes at minimum version summary: List all MQTT clients tags: - - MQTT Clients + - MQTT Clients /api/v1/mqtt/clients/{clientId}: delete: description: |- @@ -2991,20 +3299,18 @@ paths: If your client identifiers contain special characters, please make sure that the clientId is URL encoded (a.k.a. percent-encoding, as in RFC 3986). operationId: invalidateClientSession parameters: - - description: The MQTT client identifier. - in: path - name: clientId - required: true - schema: - type: string - example: null - - description: Whether to prevent the will message. - in: query - name: preventWillMessage - schema: - type: boolean - default: false - example: null + - description: The MQTT client identifier. + in: path + name: clientId + required: true + schema: + type: string + - description: Whether to prevent the will message. + in: query + name: preventWillMessage + schema: + type: boolean + default: false responses: "204": content: @@ -3019,8 +3325,8 @@ paths: summary: Query parameter can not be parsed value: errors: - - title: Parameter invalid - detail: Query parameter 'parameter-name' is invalid + - title: Parameter invalid + detail: Query parameter 'parameter-name' is invalid schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -3033,14 +3339,14 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found summary: Invalidate a client session tags: - - MQTT Clients + - MQTT Clients get: description: |- Returns detailed information for a specific client with it is current state. @@ -3049,13 +3355,12 @@ paths: If your client identifiers contain special characters, please make sure that the clientId is URL Encoded (a.k.a. percent-encoding, as in RFC 3986). operationId: getMqttClientDetails parameters: - - description: The MQTT client identifier. - in: path - name: clientId - required: true - schema: - type: string - example: null + - description: The MQTT client identifier. + in: path + name: clientId + required: true + schema: + type: string responses: "200": content: @@ -3121,10 +3426,10 @@ paths: destinationIp: 127.0.0.3 destinationPort: 50123 tlvs: - - key: PP2_TYPE_ALPN - value: "1" - - key: PP2_TYPE_AUTHORITY - value: "2" + - key: PP2_TYPE_ALPN + value: "1" + - key: PP2_TYPE_AUTHORITY + value: "2" tlsInformation: cipherSuite: cipher_suite tlsVersion: "1.2" @@ -3150,8 +3455,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -3164,14 +3469,14 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found summary: Get detailed client information tags: - - MQTT Clients + - MQTT Clients /api/v1/mqtt/clients/{clientId}/connection: delete: description: |- @@ -3180,20 +3485,18 @@ paths: If your client identifiers contain special characters, please make sure that the clientId is URL Encoded (a.k.a. percent-encoding, as in RFC 3986). operationId: disconnectClient parameters: - - description: The MQTT client identifier. - in: path - name: clientId - required: true - schema: - type: string - example: null - - description: Whether to prevent the will message. - in: query - name: preventWillMessage - schema: - type: boolean - default: false - example: null + - description: The MQTT client identifier. + in: path + name: clientId + required: true + schema: + type: string + - description: Whether to prevent the will message. + in: query + name: preventWillMessage + schema: + type: boolean + default: false responses: "204": content: @@ -3208,8 +3511,8 @@ paths: summary: Query parameter can not be parsed value: errors: - - title: Parameter invalid - detail: Query parameter 'parameter-name' is invalid + - title: Parameter invalid + detail: Query parameter 'parameter-name' is invalid schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -3222,14 +3525,14 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found summary: Disconnect a client tags: - - MQTT Clients + - MQTT Clients get: description: |- Returns the information if a specific client is currently connected. @@ -3238,13 +3541,12 @@ paths: If your client identifiers contain special characters, please make sure that the clientId is URL Encoded (a.k.a. percent-encoding, as in RFC 3986). operationId: getMqttClientConnectionState parameters: - - description: The MQTT client identifier. - in: path - name: clientId - required: true - schema: - type: string - example: null + - description: The MQTT client identifier. + in: path + name: clientId + required: true + schema: + type: string responses: "200": content: @@ -3268,8 +3570,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -3282,14 +3584,14 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found summary: Get a clients connection state tags: - - MQTT Clients + - MQTT Clients /api/v1/mqtt/clients/{clientId}/subscriptions: get: description: |- @@ -3298,13 +3600,12 @@ paths: This endpoint does not support pagination with cursor at the moment, but it might be added in future versions. Please make sure to check if a cursor is returned and another page is available to have a future-proof implementation. operationId: getSubscriptionsForMqttClient parameters: - - description: The MQTT client identifier. - in: path - name: clientId - required: true - schema: - type: string - example: null + - description: The MQTT client identifier. + in: path + name: clientId + required: true + schema: + type: string responses: "200": content: @@ -3320,24 +3621,24 @@ paths: summary: Multiple results value: items: - - topicFilter: topic/0 - qos: AT_MOST_ONCE - retainHandling: SEND - retainAsPublished: true - noLocal: false - subscriptionIdentifier: 1 - - topicFilter: topic/2 - qos: EXACTLY_ONCE - retainHandling: SEND - retainAsPublished: false - noLocal: true - subscriptionIdentifier: 3 - - topicFilter: $share/sharename/topic/1 - qos: AT_LEAST_ONCE - retainHandling: DO_NOT_SEND - retainAsPublished: false - noLocal: false - subscriptionIdentifier: 2 + - topicFilter: topic/0 + qos: AT_MOST_ONCE + retainHandling: SEND + retainAsPublished: true + noLocal: false + subscriptionIdentifier: 1 + - topicFilter: topic/2 + qos: EXACTLY_ONCE + retainHandling: SEND + retainAsPublished: false + noLocal: true + subscriptionIdentifier: 3 + - topicFilter: $share/sharename/topic/1 + qos: AT_LEAST_ONCE + retainHandling: DO_NOT_SEND + retainAsPublished: false + noLocal: false + subscriptionIdentifier: 2 schema: $ref: '#/components/schemas/ClientSubscriptionList' description: Success @@ -3350,8 +3651,8 @@ paths: summary: Required URL parameter missing value: errors: - - title: Required parameter missing - detail: Required URL parameter 'parameterName' is missing + - title: Required parameter missing + detail: Required URL parameter 'parameterName' is missing schema: $ref: '#/components/schemas/Errors' description: Bad request @@ -3364,73 +3665,63 @@ paths: summary: Not found value: errors: - - title: Resource not found - detail: Resource with id 'my-resource-id' not found + - title: Resource not found + detail: Resource with id 'my-resource-id' not found schema: $ref: '#/components/schemas/Errors' description: Resource not found summary: List all subscriptions for MQTT client tags: - - MQTT Clients + - MQTT Clients components: schemas: Backup: type: object - example: null properties: bytes: type: integer format: int64 description: The size of this backup file in bytes. - example: null nullable: true createdAt: type: string format: date-time description: Time the backup was created at - example: null failReason: type: string description: "The reason why this backup failed, only present for failed\ \ backups." - example: null nullable: true id: type: string description: The id of this backup - example: null state: type: string description: The current state of the backup enum: - - COMPLETED - - RESTORE_COMPLETED - - IN_PROGRESS - - RESTORE_IN_PROGRESS - - FAILED - - RESTORE_FAILED - example: null + - COMPLETED + - RESTORE_COMPLETED + - IN_PROGRESS + - RESTORE_IN_PROGRESS + - FAILED + - RESTORE_FAILED BackupItem: type: object - example: null properties: backup: $ref: '#/components/schemas/Backup' BackupList: type: object - example: null properties: items: type: array description: List of result items that are returned by this endpoint - example: null items: $ref: '#/components/schemas/Backup' BehaviorPolicy: type: object description: A policy which is used to validate and execute certain actions based on the validation result. - example: null properties: behavior: $ref: '#/components/schemas/BehaviorPolicyBehavior' @@ -3439,47 +3730,45 @@ components: format: date-time description: The formatted UTC timestamp indicating when the policy was created. - example: null readOnly: true deserialization: $ref: '#/components/schemas/BehaviorPolicyDeserialization' id: type: string description: The unique identifier of the policy. - example: null lastUpdatedAt: type: string format: date-time description: The formatted UTC timestamp indicating when the policy was updated the last time. - example: null readOnly: true matching: $ref: '#/components/schemas/BehaviorPolicyMatching' onTransitions: type: array - example: null items: $ref: '#/components/schemas/BehaviorPolicyOnTransition' + required: + - behavior + - id + - matching BehaviorPolicyBehavior: type: object description: "The behavior referenced by the policy, that is validated by the\ \ policy." - example: null properties: arguments: type: object description: The arguments that the referenced validator type requires. - example: null id: type: string description: The unique identifier of a pre-defined behavior. - example: null + required: + - id BehaviorPolicyDeserialization: type: object description: The deserializers used by the policy for particular message and/or payload types. - example: null properties: publish: $ref: '#/components/schemas/BehaviorPolicyDeserializer' @@ -3488,47 +3777,45 @@ components: BehaviorPolicyDeserializer: type: object description: The deserializer applied to a particular message or payload type. - example: null properties: schema: $ref: '#/components/schemas/SchemaReference' + required: + - schema BehaviorPolicyList: type: object description: A listing of behavior policies. - example: null properties: _links: $ref: '#/components/schemas/PaginationCursor' items: type: array description: List of result items that are returned by this endpoint - example: null items: $ref: '#/components/schemas/BehaviorPolicy' BehaviorPolicyMatching: type: object description: The matching rules the policy applies. - example: null properties: clientIdRegex: type: string description: The regex pattern to match the client id against. - example: null + required: + - clientIdRegex BehaviorPolicyOnEvent: type: object description: "One or more operations that are triggered on the event. When this\ \ field is empty, the transition does not trigger any operations." - example: null properties: pipeline: type: array - example: null items: $ref: '#/components/schemas/PolicyOperation' + required: + - pipeline BehaviorPolicyOnTransition: type: object description: The actions that are executed for the specified transition. - example: null properties: Connection.OnDisconnect: $ref: '#/components/schemas/BehaviorPolicyOnEvent' @@ -3546,260 +3833,214 @@ components: type: string description: The exact state from which the transition happened. Alternatively a state filter can be used. - example: null toState: type: string description: The exact state to which the transition happened. Alternatively a state filter can be used. - example: null + required: + - fromState + - toState CertificateInformation: type: object description: The client certificate sent by the client - example: null nullable: true properties: commonName: type: string description: Common name - example: null nullable: true country: type: string description: Country - example: null nullable: true organization: type: string description: Organization - example: null nullable: true organizationalUnit: type: string description: Organizational unit - example: null nullable: true serial: type: string description: The certificates serial - example: null nullable: true state: type: string description: State - example: null nullable: true validFrom: type: string format: date-time description: Valid from date - example: null validUntil: type: string format: date-time description: Valid until date - example: null version: type: string description: Certificate version - example: null nullable: true Client: type: object description: List of result items that are returned by this endpoint - example: null properties: id: type: string - example: null ClientDetails: type: object - example: null properties: connected: type: boolean description: If this client is connected - example: null connectedAt: type: string format: date-time description: Time the client connection was established - example: null nullable: true connection: $ref: '#/components/schemas/ConnectionDetails' id: type: string description: The MQTT client identifier - example: null messageQueueSize: type: integer format: int64 description: The current message queue size for this client - example: null restrictions: $ref: '#/components/schemas/ClientRestrictions' sessionExpiryInterval: type: integer format: int64 description: The session expiry interval - example: null nullable: true willPresent: type: boolean description: If a will is present for this client - example: null ClientItem: type: object - example: null properties: client: $ref: '#/components/schemas/ClientDetails' ClientList: type: object - example: null properties: _links: $ref: '#/components/schemas/PaginationCursor' items: type: array description: List of result items that are returned by this endpoint - example: null items: $ref: '#/components/schemas/Client' ClientRestrictions: type: object description: The restrictions that are in effect for this client - example: null nullable: true properties: maxMessageSize: type: integer format: int64 description: maximum MQTT message size - example: null nullable: true maxQueueSize: type: integer format: int64 description: maximum queue size - example: null nullable: true queuedMessageStrategy: type: string description: The queue strategy if the queue is full - example: null nullable: true ClientSubscription: type: object description: List of result items that are returned by this endpoint - example: null properties: noLocal: type: boolean description: The No Local flag - example: null qos: type: string description: The Quality of Service level enum: - - AT_MOST_ONCE - - AT_LEAST_ONCE - - EXACTLY_ONCE - example: null + - AT_MOST_ONCE + - AT_LEAST_ONCE + - EXACTLY_ONCE retainAsPublished: type: boolean description: The Retain As Published flag - example: null retainHandling: type: string description: Retain handling option enum: - - SEND - - SEND_IF_NEW_SUBSCRIPTION - - DO_NOT_SEND - example: null + - SEND + - SEND_IF_NEW_SUBSCRIPTION + - DO_NOT_SEND subscriptionIdentifier: type: integer format: int32 description: The subscription identifier - example: null nullable: true topicFilter: type: string description: The MQTT topic filter - example: null ClientSubscriptionList: type: object - example: null properties: _links: $ref: '#/components/schemas/PaginationCursor' items: type: array description: List of result items that are returned by this endpoint - example: null items: $ref: '#/components/schemas/ClientSubscription' Connection: type: object description: Information about the client's connection state - example: null properties: connected: type: boolean description: If this client is currently connected - example: null ConnectionDetails: type: object description: Information about the clients connection - example: null nullable: true properties: cleanStart: type: boolean description: Clean start flag - example: null connectedListenerId: type: string description: Id of the HiveMQ listener the client is connected to - example: null connectedNodeId: type: string description: Id of the HiveMQ node the client is connected to - example: null keepAlive: type: integer format: int32 description: Connection Keep Alive in seconds - example: null nullable: true mqttVersion: type: string description: MQTT version of the client - example: null password: type: string format: byte description: Password - example: null nullable: true proxyInformation: $ref: '#/components/schemas/ProxyInformation' sourceIp: type: string description: The client's IP - example: null nullable: true tlsInformation: $ref: '#/components/schemas/TlsInformation' username: type: string description: Username - example: null nullable: true ConnectionItem: type: object - example: null properties: connection: $ref: '#/components/schemas/Connection' @@ -3807,25 +4048,21 @@ components: type: object description: A data policy which is used to validate and execute certain actions based on the validation result. - example: null properties: createdAt: type: string format: date-time description: The formatted UTC timestamp indicating when the policy was created. - example: null readOnly: true id: type: string description: The unique identifier of the policy. - example: null lastUpdatedAt: type: string format: date-time description: The formatted UTC timestamp indicating when the policy was updated the last time. - example: null readOnly: true matching: $ref: '#/components/schemas/DataPolicyMatching' @@ -3835,316 +4072,313 @@ components: $ref: '#/components/schemas/DataPolicyAction' validation: $ref: '#/components/schemas/DataPolicyValidation' + required: + - id + - matching DataPolicyAction: type: object description: "One or more operations the outcome of the validation triggers.\ \ When this field is empty, the outcome of the policy validation does not\ \ trigger any operations." - example: null properties: pipeline: type: array description: "The pipeline to execute, when this action is triggered. The\ \ operations in the pipeline are executed in-order." - example: null items: $ref: '#/components/schemas/PolicyOperation' DataPolicyList: type: object description: A listing of data policies. - example: null properties: _links: $ref: '#/components/schemas/PaginationCursor' items: type: array description: List of result items that are returned by this endpoint - example: null items: $ref: '#/components/schemas/DataPolicy' DataPolicyMatching: type: object description: The matching rules the policy applies. - example: null properties: topicFilter: type: string description: The topic filter for which the policy is matched. - example: null + required: + - topicFilter DataPolicyValidation: type: object description: "The section of the policy that defines how incoming MQTT messages\ \ are validated. If this section is empty, the result of the policy validation\ \ is always successful." - example: null properties: validators: type: array description: The validators of the policy. - example: null items: $ref: '#/components/schemas/DataPolicyValidator' DataPolicyValidator: type: object description: A policy validator which executes the defined validation. - example: null properties: arguments: type: object description: The required arguments of the referenced validator type. - example: null type: type: string description: The type of the validator. - example: null + required: + - arguments + - type DiagnosticArchive: type: object - example: null properties: bytes: type: integer format: int64 description: The size of this diagnostic archive file in bytes. - example: null nullable: true createdAt: type: string format: date-time description: Time the diagnostic archive was created at. - example: null failReason: type: string description: "The reason why this diagnostic archive failed, only present\ \ for failed diagnostic archives." - example: null nullable: true id: type: string description: The id of this diagnostic archive. - example: null state: type: string description: The current state of the diagnostic archive. enum: - - COMPLETED - - IN_PROGRESS - - FAILED - example: null + - COMPLETED + - IN_PROGRESS + - FAILED DiagnosticArchiveItem: type: object - example: null properties: diagnosticArchive: $ref: '#/components/schemas/DiagnosticArchive' Error: type: object - example: null properties: detail: type: string description: Detailed contextual description of this error - example: null title: type: string description: The type of this error - example: null Errors: type: object - example: null properties: errors: type: array - example: null items: $ref: '#/components/schemas/Error' FsmStateInformationItem: type: object description: List of result items that are returned by this endpoint - example: null properties: arguments: $ref: '#/components/schemas/JsonNode' behaviorId: type: string description: The unique identifier of the policy. - example: null firstSetAt: type: string description: The timestamp when this state was set the first time. - example: null policyId: type: string description: The unique identifier of the policy. - example: null stateName: type: string description: The name of the fsm state. - example: null stateType: type: string description: The type of the fsm state. - example: null variables: type: object additionalProperties: type: string description: The variables for this fsm. - example: null description: The variables for this fsm. - example: null FsmStatesInformationListItem: type: object - example: null properties: items: type: array description: List of result items that are returned by this endpoint - example: null items: $ref: '#/components/schemas/FsmStateInformationItem' JsonNode: type: object description: The arguments of the fsm derived from the behavior policy. - example: null PaginationCursor: type: object description: Links for pagination - example: null nullable: true properties: next: type: string - example: null PolicyOperation: type: object description: The pipeline to execute when this action is triggered. The operations in the pipeline are executed in order. - example: null properties: arguments: type: object description: The required arguments of the referenced function. - example: null functionId: type: string description: The unique id of the referenced function to execute in this operation. - example: null id: type: string description: The unique id of the operation in the pipeline. - example: null + required: + - arguments + - functionId + - id ProxyInformation: type: object description: Proxy Protocol information - example: null nullable: true properties: destinationIp: type: string description: The client's destination IP as seen by the proxy - example: null destinationPort: type: integer format: int32 description: The client's destination port as seen by the proxy - example: null sourceIp: type: string description: The client's IP as seen by the proxy - example: null sourcePort: type: integer format: int32 description: The client's Port as seen by the proxy - example: null tlvs: type: array description: Additional TLV fields contained in the proxy protocol information - example: null items: $ref: '#/components/schemas/TLV' nullable: true Schema: type: object - example: null properties: arguments: type: object additionalProperties: type: string description: The schema type dependent arguments. - example: null description: The schema type dependent arguments. - example: null createdAt: type: string description: The formatted UTC timestamp when the schema was created. - example: null readOnly: true id: type: string description: The unique identifier of the schema. - example: null schemaDefinition: type: string description: The base64 encoded schema definition. - example: null type: type: string description: The type of the schema. - example: null version: type: integer format: int32 description: The version of the schema. - example: null readOnly: true + required: + - id + - schemaDefinition + - type SchemaList: type: object description: A listing of schemas. - example: null properties: _links: $ref: '#/components/schemas/PaginationCursor' items: type: array description: List of result items that are returned by this endpoint - example: null items: $ref: '#/components/schemas/Schema' SchemaReference: type: object description: A schema reference is a unique identifier for a schema. - example: null properties: schemaId: type: string description: The identifier of the schema. - example: null version: type: string description: The version of the schema. The value "latest" may be used to always refer to the latest schema. - example: null + required: + - schemaId + - version + Script: + type: object + properties: + createdAt: + type: string + description: The formatted UTC timestamp when the script was created. + readOnly: true + description: + type: string + description: A free text that describes the function. + functionType: + type: string + description: "The type of the function. Restricted to only one value: TRANSFORMATION." + id: + type: string + description: The unique identifier of the script. + source: + type: string + description: "The base64 encoded function source code. An example of a function\ + \ before it is encoded:
function transform(person) {
    return\ + \ 'hello ' + person
}" + version: + type: integer + format: int32 + description: The version of the script. + readOnly: true + required: + - functionType + - id + - source + ScriptList: + type: object + description: A listing of scripts. + properties: + _links: + $ref: '#/components/schemas/PaginationCursor' + items: + type: array + description: List of result items that are returned by this endpoint + items: + $ref: '#/components/schemas/Script' TLV: type: object description: Additional TLV fields contained in the proxy protocol information - example: null nullable: true properties: key: type: string description: TLV Key - example: null value: type: string description: TLV value - example: null TlsInformation: type: object description: TLS information - example: null nullable: true properties: certificateInformation: @@ -4152,30 +4386,24 @@ components: cipherSuite: type: string description: The used cipher suite - example: null tlsVersion: type: string description: The used TLS version - example: null TraceFilter: type: object description: Topic filters to trace - example: null properties: regex: type: string description: Regex pattern this filter will trace for. - example: null TraceRecording: type: object description: "Trace recording item describing the desired (and optionally, when\ \ receiving from the server: current) state of a trace recording" - example: null properties: clientIdFilters: type: array description: Client ID filters to trace - example: null items: $ref: '#/components/schemas/TraceFilter' uniqueItems: true @@ -4184,75 +4412,65 @@ components: format: date-time description: Time the trace recording is scheduled to stop at. Must be at a later time from the start time - example: null events: type: array description: MQTT events to trace - example: null items: type: string description: MQTT events to trace enum: - - MQTT_MESSAGE_CONNECT - - MQTT_MESSAGE_CONNACK - - MQTT_MESSAGE_SUBSCRIBE - - MQTT_MESSAGE_SUBACK - - MQTT_MESSAGE_PUBLISH - - MQTT_MESSAGE_PUBACK - - MQTT_MESSAGE_PUBREC - - MQTT_MESSAGE_PUBREL - - MQTT_MESSAGE_PUBCOMP - - MQTT_MESSAGE_UNSUBSCRIBE - - MQTT_MESSAGE_UNSUBACK - - MQTT_MESSAGE_PINGREQ - - MQTT_MESSAGE_PINGRESP - - MQTT_MESSAGE_DISCONNECT - - MQTT_MESSAGE_AUTH - example: null + - MQTT_MESSAGE_CONNECT + - MQTT_MESSAGE_CONNACK + - MQTT_MESSAGE_SUBSCRIBE + - MQTT_MESSAGE_SUBACK + - MQTT_MESSAGE_PUBLISH + - MQTT_MESSAGE_PUBACK + - MQTT_MESSAGE_PUBREC + - MQTT_MESSAGE_PUBREL + - MQTT_MESSAGE_PUBCOMP + - MQTT_MESSAGE_UNSUBSCRIBE + - MQTT_MESSAGE_UNSUBACK + - MQTT_MESSAGE_PINGREQ + - MQTT_MESSAGE_PINGRESP + - MQTT_MESSAGE_DISCONNECT + - MQTT_MESSAGE_AUTH uniqueItems: true name: type: string description: "Name of the trace recording. Must be unique, contain at least\ \ three characters and only combinations of numbers, letters, dashes and\ \ underscores are allowed" - example: null startAt: type: string format: date-time description: Time the trace recording is scheduled to start at - example: null state: type: string description: "Current state of the recording. Only sent by the API, ignored\ \ if specified on POST" enum: - - SCHEDULED - - IN_PROGRESS - - ABORTED - - STOPPED - example: null + - SCHEDULED + - IN_PROGRESS + - ABORTED + - STOPPED topicFilters: type: array description: Topic filters to trace - example: null items: $ref: '#/components/schemas/TraceFilter' uniqueItems: true TraceRecordingItem: type: object - example: null properties: traceRecording: $ref: '#/components/schemas/TraceRecording' required: - - traceRecording + - traceRecording TraceRecordingList: type: object - example: null properties: items: type: array description: List of result items that are returned by this endpoint - example: null items: $ref: '#/components/schemas/TraceRecording' diff --git a/src/main/java/com/hivemq/cli/commands/hivemq/datahub/ScriptDefinitionOptions.java b/src/main/java/com/hivemq/cli/commands/hivemq/datahub/ScriptDefinitionOptions.java new file mode 100644 index 000000000..fcbd2e319 --- /dev/null +++ b/src/main/java/com/hivemq/cli/commands/hivemq/datahub/ScriptDefinitionOptions.java @@ -0,0 +1,53 @@ +/* + * Copyright 2019-present HiveMQ and the HiveMQ Community + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.cli.commands.hivemq.datahub; + +import com.hivemq.cli.converters.ByteBufferConverter; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import picocli.CommandLine; + +import java.nio.ByteBuffer; + +public class ScriptDefinitionOptions { + + @SuppressWarnings("unused") + @CommandLine.Option(names = {"--file"}, + description = "The file containing the script definition. " + + "This option is mutually exclusive with --definition.") + private @Nullable String file; + + @SuppressWarnings("unused") + @CommandLine.Option(names = {"--definition"}, + converter = ByteBufferConverter.class, + description = "The script definition provided directly. " + + "This option is mutually exclusive with --file.") + private @Nullable ByteBuffer argument; + + public @Nullable String getFile() { + return file; + } + + public @Nullable ByteBuffer getArgument() { + return argument; + } + + @Override + public @NotNull String toString() { + return "ScriptDefinitionOptions{" + "file=" + file + ", definition=" + argument + '}'; + } +} diff --git a/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptCommand.java b/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptCommand.java new file mode 100644 index 000000000..7ebf92b82 --- /dev/null +++ b/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptCommand.java @@ -0,0 +1,54 @@ +/* + * Copyright 2019-present HiveMQ and the HiveMQ Community + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.cli.commands.hivemq.script; + +import com.hivemq.cli.MqttCLIMain; +import org.jetbrains.annotations.NotNull; +import picocli.CommandLine; + +import javax.inject.Inject; +import java.util.concurrent.Callable; + +@CommandLine.Command(name = "script", + description = "Operations for scripts in a HiveMQ broker", + synopsisHeading = "%n@|bold Usage:|@ ", + descriptionHeading = "%n", + optionListHeading = "%n@|bold Options:|@%n", + commandListHeading = "%n@|bold Commands:|@%n", + versionProvider = MqttCLIMain.CLIVersionProvider.class, + mixinStandardHelpOptions = true) +public class ScriptCommand implements Callable { + + @SuppressWarnings({"NotNullFieldNotInitialized", "unused"}) + @CommandLine.Spec + private @NotNull CommandLine.Model.CommandSpec spec; + + @Inject + public ScriptCommand() { + } + + @Override + public @NotNull Integer call() { + System.out.println(spec.commandLine().getUsageMessage(spec.commandLine().getColorScheme())); + return 0; + } + + @Override + public @NotNull String toString() { + return "ScriptCommand{" + "spec=" + spec + '}'; + } +} diff --git a/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptCreateCommand.java b/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptCreateCommand.java new file mode 100644 index 000000000..c4a56c019 --- /dev/null +++ b/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptCreateCommand.java @@ -0,0 +1,139 @@ +/* + * Copyright 2019-present HiveMQ and the HiveMQ Community + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.cli.commands.hivemq.script; + +import com.hivemq.cli.MqttCLIMain; +import com.hivemq.cli.commands.hivemq.datahub.DataHubOptions; +import com.hivemq.cli.commands.hivemq.datahub.OutputFormatter; +import com.hivemq.cli.commands.hivemq.datahub.ScriptDefinitionOptions; +import com.hivemq.cli.converters.ScriptTypeConverter; +import com.hivemq.cli.hivemq.scripts.CreateScriptTask; +import com.hivemq.cli.openapi.hivemq.DataHubScriptsApi; +import com.hivemq.cli.rest.HiveMQRestService; +import org.jetbrains.annotations.NotNull; +import org.tinylog.Logger; +import picocli.CommandLine; + +import javax.inject.Inject; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.concurrent.Callable; + +@CommandLine.Command(name = "create", + description = "Create a new script", + synopsisHeading = "%n@|bold Usage:|@ ", + descriptionHeading = "%n", + optionListHeading = "%n@|bold Options:|@%n", + commandListHeading = "%n@|bold Commands:|@%n", + versionProvider = MqttCLIMain.CLIVersionProvider.class, + mixinStandardHelpOptions = true) +public class ScriptCreateCommand implements Callable { + + @SuppressWarnings({"NotNullFieldNotInitialized", "unused"}) + @CommandLine.Option(names = {"-i", "--id"}, required = true, description = "The id of the script") + private @NotNull String scriptId; + + @SuppressWarnings({"NotNullFieldNotInitialized", "unused"}) + @CommandLine.Option(names = {"--type"}, + required = true, + converter = ScriptTypeConverter.class, + description = "The function type") + private @NotNull String functionType; + + @SuppressWarnings("unused") + @CommandLine.Option(names = {"--print-version"}, + defaultValue = "false", + description = "Print the assigned script version after successful creation.") + private boolean printVersion; + + @SuppressWarnings({"NotNullFieldNotInitialized", "unused"}) + @CommandLine.ArgGroup(multiplicity = "1") + private @NotNull ScriptDefinitionOptions definitionOptions; + + @SuppressWarnings({"NotNullFieldNotInitialized", "unused"}) + @CommandLine.Option(names = {"--description"}, required = true, description = "The description of the script") + private @NotNull String description; + + @CommandLine.Mixin + private final @NotNull DataHubOptions dataHubOptions = new DataHubOptions(); + + private final @NotNull OutputFormatter outputFormatter; + private final @NotNull HiveMQRestService hiveMQRestService; + + @Inject + public ScriptCreateCommand( + final @NotNull HiveMQRestService hiveMQRestService, final @NotNull OutputFormatter outputFormatter) { + this.outputFormatter = outputFormatter; + this.hiveMQRestService = hiveMQRestService; + } + + @Override + public @NotNull Integer call() throws IOException { + Logger.trace("Command {}", this); + + final DataHubScriptsApi scriptsApi = + hiveMQRestService.getScriptsApi(dataHubOptions.getUrl(), dataHubOptions.getRateLimit()); + + final String fileDefinition = definitionOptions.getFile(); + final ByteBuffer argumentDefinition = definitionOptions.getArgument(); + final ByteBuffer definitionBytes; + if (fileDefinition != null) { + try { + final Path path = Paths.get(fileDefinition); + definitionBytes = ByteBuffer.wrap(Files.readAllBytes(path)); + } catch (final IOException exception) { + outputFormatter.printError("File not found or not readable: " + fileDefinition); + return 1; + } + } else if (argumentDefinition != null) { + definitionBytes = argumentDefinition; + } else { + throw new RuntimeException("One of --file or --definition must be set."); + } + + final CreateScriptTask createScriptTask = new CreateScriptTask(outputFormatter, + scriptsApi, + scriptId, + functionType, + description, + printVersion, + definitionBytes); + if (createScriptTask.execute()) { + return 0; + } else { + return 1; + } + } + + @Override + public @NotNull String toString() { + return "ScriptCreateCommand{" + + "scriptId='" + scriptId + '\'' + + ", functionType='" + functionType + '\'' + + ", printVersion=" + printVersion + + ", definitionOptions=" + definitionOptions + + ", description='" + description + '\'' + + ", dataHubOptions=" + dataHubOptions + + ", outputFormatter=" + outputFormatter + + ", hiveMQRestService=" + hiveMQRestService + + '}'; + } + +} diff --git a/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptDeleteCommand.java b/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptDeleteCommand.java new file mode 100644 index 000000000..ba71fbcf1 --- /dev/null +++ b/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptDeleteCommand.java @@ -0,0 +1,79 @@ +/* + * Copyright 2019-present HiveMQ and the HiveMQ Community + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.cli.commands.hivemq.script; + +import com.hivemq.cli.MqttCLIMain; +import com.hivemq.cli.commands.hivemq.datahub.DataHubOptions; +import com.hivemq.cli.commands.hivemq.datahub.OutputFormatter; +import com.hivemq.cli.hivemq.scripts.DeleteScriptTask; +import com.hivemq.cli.openapi.hivemq.DataHubScriptsApi; +import com.hivemq.cli.rest.HiveMQRestService; +import org.jetbrains.annotations.NotNull; +import org.tinylog.Logger; +import picocli.CommandLine; + +import javax.inject.Inject; +import java.util.concurrent.Callable; + +@CommandLine.Command(name = "delete", + description = "Delete an existing script", + synopsisHeading = "%n@|bold Usage:|@ ", + descriptionHeading = "%n", + optionListHeading = "%n@|bold Options:|@%n", + commandListHeading = "%n@|bold Commands:|@%n", + versionProvider = MqttCLIMain.CLIVersionProvider.class, + mixinStandardHelpOptions = true) +public class ScriptDeleteCommand implements Callable { + + @SuppressWarnings({"NotNullFieldNotInitialized", "unused"}) + @CommandLine.Option(names = {"-i", "--id"}, required = true, description = "The id of the script") + private @NotNull String scriptId; + + @CommandLine.Mixin + private final @NotNull DataHubOptions dataHubOptions = new DataHubOptions(); + + private final @NotNull OutputFormatter outputFormatter; + private final @NotNull HiveMQRestService hiveMQRestService; + + @Inject + public ScriptDeleteCommand( + final @NotNull HiveMQRestService hiveMQRestService, final @NotNull OutputFormatter outputFormatter) { + this.outputFormatter = outputFormatter; + this.hiveMQRestService = hiveMQRestService; + } + + @Override + public @NotNull Integer call() { + Logger.trace("Command {}", this); + + final DataHubScriptsApi scriptsApi = + hiveMQRestService.getScriptsApi(dataHubOptions.getUrl(), dataHubOptions.getRateLimit()); + + if (scriptId.isEmpty()) { + outputFormatter.printError("The script id must not be empty."); + return 1; + } + + final DeleteScriptTask deleteScriptTask = new DeleteScriptTask(outputFormatter, scriptsApi, scriptId); + if (deleteScriptTask.execute()) { + return 0; + } else { + return 1; + } + } + +} diff --git a/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptGetCommand.java b/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptGetCommand.java new file mode 100644 index 000000000..f1b610516 --- /dev/null +++ b/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptGetCommand.java @@ -0,0 +1,85 @@ +/* + * Copyright 2019-present HiveMQ and the HiveMQ Community + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.cli.commands.hivemq.script; + +import com.hivemq.cli.MqttCLIMain; +import com.hivemq.cli.commands.hivemq.datahub.DataHubOptions; +import com.hivemq.cli.commands.hivemq.datahub.OutputFormatter; +import com.hivemq.cli.hivemq.scripts.GetScriptTask; +import com.hivemq.cli.openapi.hivemq.DataHubScriptsApi; +import com.hivemq.cli.rest.HiveMQRestService; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.tinylog.Logger; +import picocli.CommandLine; + +import javax.inject.Inject; +import java.util.concurrent.Callable; + +@CommandLine.Command(name = "get", + description = "Get an existing script", + synopsisHeading = "%n@|bold Usage:|@ ", + descriptionHeading = "%n", + optionListHeading = "%n@|bold Options:|@%n", + commandListHeading = "%n@|bold Commands:|@%n", + versionProvider = MqttCLIMain.CLIVersionProvider.class, + mixinStandardHelpOptions = true) +public class ScriptGetCommand implements Callable { + + @SuppressWarnings({"NotNullFieldNotInitialized", "unused"}) + @CommandLine.Option(names = {"-i", "--id"}, required = true, description = "The id of the script") + private @NotNull String scriptId; + + @SuppressWarnings("unused") + @CommandLine.Option(names = {"-f", "--field"}, + description = "Filter which JSON fields are included in the response") + private @Nullable String @Nullable [] fields; + + @CommandLine.Mixin + private final @NotNull DataHubOptions dataHubOptions = new DataHubOptions(); + + private final @NotNull OutputFormatter outputFormatter; + private final @NotNull HiveMQRestService hiveMQRestService; + + @Inject + public ScriptGetCommand( + final @NotNull HiveMQRestService hiveMQRestService, final @NotNull OutputFormatter outputFormatter) { + this.outputFormatter = outputFormatter; + this.hiveMQRestService = hiveMQRestService; + } + + @Override + public @NotNull Integer call() { + Logger.trace("Command {}", this); + + final DataHubScriptsApi scriptsApi = + hiveMQRestService.getScriptsApi(dataHubOptions.getUrl(), dataHubOptions.getRateLimit()); + + if (scriptId.isEmpty()) { + outputFormatter.printError("The script id must not be empty."); + return 1; + } + + final GetScriptTask getScriptTask = new GetScriptTask(outputFormatter, scriptsApi, scriptId, fields); + if (getScriptTask.execute()) { + return 0; + } else { + return 1; + } + } + +} diff --git a/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptListCommand.java b/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptListCommand.java new file mode 100644 index 000000000..81a2582af --- /dev/null +++ b/src/main/java/com/hivemq/cli/commands/hivemq/script/ScriptListCommand.java @@ -0,0 +1,99 @@ +/* + * Copyright 2019-present HiveMQ and the HiveMQ Community + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.cli.commands.hivemq.script; + +import com.hivemq.cli.MqttCLIMain; +import com.hivemq.cli.commands.hivemq.datahub.DataHubOptions; +import com.hivemq.cli.commands.hivemq.datahub.OutputFormatter; +import com.hivemq.cli.converters.ScriptTypeConverter; +import com.hivemq.cli.hivemq.scripts.ListScriptsTask; +import com.hivemq.cli.openapi.hivemq.DataHubScriptsApi; +import com.hivemq.cli.rest.HiveMQRestService; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.tinylog.Logger; +import picocli.CommandLine; + +import javax.inject.Inject; +import java.util.concurrent.Callable; + +@CommandLine.Command(name = "list", + description = "List all existing scripts", + sortOptions = false, + synopsisHeading = "%n@|bold Usage:|@ ", + descriptionHeading = "%n", + optionListHeading = "%n@|bold Options:|@%n", + commandListHeading = "%n@|bold Commands:|@%n", + versionProvider = MqttCLIMain.CLIVersionProvider.class, + mixinStandardHelpOptions = true) +public class ScriptListCommand implements Callable { + + @SuppressWarnings("unused") + @CommandLine.Option(names = {"-t", "--type"}, + converter = ScriptTypeConverter.class, + description = "Filter by script type") + private @Nullable String @Nullable [] functionTypes; + + @SuppressWarnings("unused") + @CommandLine.Option(names = {"-i", "--id"}, description = "Filter by script id") + private @Nullable String @Nullable [] scriptIds; + + @SuppressWarnings("unused") + @CommandLine.Option(names = {"-f", "--field"}, + description = "Filter which JSON fields are included in the response") + private @Nullable String @Nullable [] fields; + + @SuppressWarnings("unused") + @CommandLine.Option(names = {"--limit"}, description = "Limit the number of returned scripts") + private @Nullable Integer limit; + + @CommandLine.Mixin + private final @NotNull DataHubOptions dataHubOptions = new DataHubOptions(); + + private final @NotNull OutputFormatter outputFormatter; + private final @NotNull HiveMQRestService hiveMQRestService; + + @Inject + public ScriptListCommand( + final @NotNull HiveMQRestService hiveMQRestService, final @NotNull OutputFormatter outputFormatter) { + this.outputFormatter = outputFormatter; + this.hiveMQRestService = hiveMQRestService; + } + + @Override + public @NotNull Integer call() { + Logger.trace("Command {}", this); + + final DataHubScriptsApi scriptsApi = + hiveMQRestService.getScriptsApi(dataHubOptions.getUrl(), dataHubOptions.getRateLimit()); + + if (limit != null && limit < 0) { + outputFormatter.printError("The limit must not be negative."); + return 1; + } + + final ListScriptsTask listScriptsTask = + new ListScriptsTask(outputFormatter, scriptsApi, functionTypes, scriptIds, fields, limit); + + if (listScriptsTask.execute()) { + return 0; + } else { + return 1; + } + } + +} diff --git a/src/main/java/com/hivemq/cli/converters/ScriptTypeConverter.java b/src/main/java/com/hivemq/cli/converters/ScriptTypeConverter.java new file mode 100644 index 000000000..d9b1114ee --- /dev/null +++ b/src/main/java/com/hivemq/cli/converters/ScriptTypeConverter.java @@ -0,0 +1,35 @@ +/* + * Copyright 2019-present HiveMQ and the HiveMQ Community + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.cli.converters; + +import org.jetbrains.annotations.NotNull; +import picocli.CommandLine; + +public class ScriptTypeConverter implements CommandLine.ITypeConverter { + + static final @NotNull String WRONG_INPUT_MESSAGE = "Value must be transformation only"; + + @Override + public @NotNull String convert(final @NotNull String s) throws Exception { + switch (s.toLowerCase()) { + case "transformation": + return "TRANSFORMATION"; + default: + throw new Exception(WRONG_INPUT_MESSAGE); + } + } +} diff --git a/src/main/java/com/hivemq/cli/hivemq/scripts/CreateScriptTask.java b/src/main/java/com/hivemq/cli/hivemq/scripts/CreateScriptTask.java new file mode 100644 index 000000000..70e3ec9c2 --- /dev/null +++ b/src/main/java/com/hivemq/cli/hivemq/scripts/CreateScriptTask.java @@ -0,0 +1,67 @@ +package com.hivemq.cli.hivemq.scripts; + +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import com.hivemq.cli.commands.hivemq.datahub.OutputFormatter; +import com.hivemq.cli.openapi.ApiException; +import com.hivemq.cli.openapi.hivemq.DataHubScriptsApi; +import com.hivemq.cli.openapi.hivemq.Script; +import org.jetbrains.annotations.NotNull; + +import java.nio.ByteBuffer; + +public class CreateScriptTask { + + private final @NotNull OutputFormatter outputFormatter; + private final @NotNull DataHubScriptsApi scriptsApi; + private final @NotNull String scriptId; + private final @NotNull String functionType; + private final @NotNull String description; + private final @NotNull ByteBuffer definition; + private final boolean printVersion; + + public CreateScriptTask( + final @NotNull OutputFormatter outputFormatter, + final @NotNull DataHubScriptsApi scriptsApi, + final @NotNull String scriptId, + final @NotNull String functionType, + final @NotNull String description, + final boolean printVersion, + final @NotNull ByteBuffer definition) { + this.outputFormatter = outputFormatter; + this.scriptsApi = scriptsApi; + this.scriptId = scriptId; + this.functionType = functionType; + this.description = description; + this.definition = definition; + this.printVersion = printVersion; + } + + public boolean execute() { + final String definitionBase64 = java.util.Base64.getEncoder().encodeToString(definition.array()); + final Script script = new Script().id(scriptId).functionType(functionType).description(description).source(definitionBase64); + + System.out.println("script.getId() = " + script.getId()); + System.out.println("script.getFunctionType() = " + script.getFunctionType()); + + final Script createdScript; + try { + createdScript = scriptsApi.createScript(script); + } catch (final ApiException apiException) { + outputFormatter.printApiException("Failed to create script", apiException); + return false; + } + + if (printVersion) { + final JsonObject versionObject = new JsonObject(); + if (createdScript.getVersion() != null) { + versionObject.add(Script.SERIALIZED_NAME_VERSION, new JsonPrimitive(createdScript.getVersion())); + } + outputFormatter.printJson(versionObject); + } + + return true; + } + + +} diff --git a/src/main/java/com/hivemq/cli/hivemq/scripts/DeleteScriptTask.java b/src/main/java/com/hivemq/cli/hivemq/scripts/DeleteScriptTask.java new file mode 100644 index 000000000..f2df09c0d --- /dev/null +++ b/src/main/java/com/hivemq/cli/hivemq/scripts/DeleteScriptTask.java @@ -0,0 +1,32 @@ +package com.hivemq.cli.hivemq.scripts; + +import com.hivemq.cli.commands.hivemq.datahub.OutputFormatter; +import com.hivemq.cli.openapi.ApiException; +import com.hivemq.cli.openapi.hivemq.DataHubScriptsApi; +import org.jetbrains.annotations.NotNull; + +public class DeleteScriptTask { + private final @NotNull OutputFormatter outputFormatter; + private final @NotNull DataHubScriptsApi scriptsApi; + private final @NotNull String scriptId; + + public DeleteScriptTask( + final @NotNull OutputFormatter outputFormatter, + final @NotNull DataHubScriptsApi scriptsApi, + final @NotNull String scriptId) { + this.outputFormatter = outputFormatter; + this.scriptsApi = scriptsApi; + this.scriptId = scriptId; + } + + public boolean execute() { + try { + scriptsApi.deleteScript(scriptId); + } catch (final ApiException apiException) { + outputFormatter.printApiException("Failed to delete script", apiException); + return false; + } + + return true; + } +} diff --git a/src/main/java/com/hivemq/cli/hivemq/scripts/GetScriptTask.java b/src/main/java/com/hivemq/cli/hivemq/scripts/GetScriptTask.java new file mode 100644 index 000000000..6e627b575 --- /dev/null +++ b/src/main/java/com/hivemq/cli/hivemq/scripts/GetScriptTask.java @@ -0,0 +1,48 @@ +package com.hivemq.cli.hivemq.scripts; + +import com.hivemq.cli.commands.hivemq.datahub.OutputFormatter; +import com.hivemq.cli.openapi.ApiException; +import com.hivemq.cli.openapi.hivemq.DataHubScriptsApi; +import com.hivemq.cli.openapi.hivemq.Script; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class GetScriptTask { + + private final @NotNull OutputFormatter outputFormatter; + private final @NotNull DataHubScriptsApi scriptsApi; + private final @NotNull String scriptId; + private final @Nullable String @Nullable [] fields; + + public GetScriptTask( + final @NotNull OutputFormatter outputFormatter, + final @NotNull DataHubScriptsApi scriptsApi, + final @NotNull String scriptId, + final @Nullable String @Nullable [] fields) { + this.outputFormatter = outputFormatter; + this.scriptsApi = scriptsApi; + this.scriptId = scriptId; + this.fields = fields; + } + + public boolean execute() { + final String fieldsQueryParam; + if (fields == null) { + fieldsQueryParam = null; + } else { + fieldsQueryParam = String.join(",", fields); + } + + final Script script; + try { + script = scriptsApi.getScript(scriptId, fieldsQueryParam); + } catch (final ApiException apiException) { + outputFormatter.printApiException("Failed to get script", apiException); + return false; + } + + outputFormatter.printJson(script); + + return true; + } +} diff --git a/src/main/java/com/hivemq/cli/hivemq/scripts/ListScriptsTask.java b/src/main/java/com/hivemq/cli/hivemq/scripts/ListScriptsTask.java new file mode 100644 index 000000000..046c36534 --- /dev/null +++ b/src/main/java/com/hivemq/cli/hivemq/scripts/ListScriptsTask.java @@ -0,0 +1,127 @@ +/* + * Copyright 2019-present HiveMQ and the HiveMQ Community + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hivemq.cli.hivemq.scripts; + +import com.hivemq.cli.commands.hivemq.datahub.OutputFormatter; +import com.hivemq.cli.openapi.ApiException; +import com.hivemq.cli.openapi.hivemq.DataHubScriptsApi; +import com.hivemq.cli.openapi.hivemq.PaginationCursor; +import com.hivemq.cli.openapi.hivemq.Script; +import com.hivemq.cli.openapi.hivemq.ScriptList; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +public class ListScriptsTask { + + private static final @NotNull Pattern CURSOR_PATTERN = Pattern.compile("cursor=([^&]*)"); + + private final @NotNull OutputFormatter outputFormatter; + private final @NotNull DataHubScriptsApi scriptsApi; + private final @Nullable String @Nullable [] functionTypes; + private final @Nullable String @Nullable [] scriptIds; + private final @Nullable String @Nullable [] fields; + private final @Nullable Integer limit; + + public ListScriptsTask( + final @NotNull OutputFormatter outputFormatter, + final @NotNull DataHubScriptsApi scriptApi, + final @Nullable String @Nullable [] functionTypes, + final @Nullable String @Nullable [] scriptIds, + final @Nullable String @Nullable [] fields, + final @Nullable Integer limit) { + this.outputFormatter = outputFormatter; + this.scriptsApi = scriptApi; + this.functionTypes = functionTypes; + this.scriptIds = scriptIds; + this.limit = limit; + this.fields = fields; + } + + public boolean execute() { + final String fieldsQueryParam; + if (fields == null) { + fieldsQueryParam = null; + } else { + fieldsQueryParam = String.join(",", fields); + } + + final String scriptIdsQueryParam; + if (scriptIds == null) { + scriptIdsQueryParam = null; + } else { + scriptIdsQueryParam = String.join(",", scriptIds); + } + + final String functionTypesQueryParam; + if (functionTypes == null) { + functionTypesQueryParam = null; + } else { + functionTypesQueryParam = String.join(",", functionTypes); + } + + List