Skip to content

Commit

Permalink
Feature/26414 tag rest api (#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
DC2-DanielKrueger committed Oct 11, 2024
1 parent 5f6991d commit feb5308
Show file tree
Hide file tree
Showing 21 changed files with 1,955 additions and 77 deletions.
231 changes: 231 additions & 0 deletions ext/hivemq-edge-openapi-2024.8-SNAPSHOT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3577,6 +3577,182 @@ paths:
summary: Transition the runtime status of an adapter
tags:
- Protocol Adapters
/api/v1/management/protocol-adapters/adapters/{adapterId}/tags:
get:
description: Get the domain tags for the device connected through this adapter.
operationId: get-adapter-domainTags
parameters:
- description: The adapter id.
in: path
name: adapterId
required: true
schema:
type: string
responses:
"200":
content:
application/json:
examples:
opc ua domain tags example:
description: An example for domain tags in opc ua
summary: 'Example for domain tags for opc ua '
value:
items:
- tagAddress:
address: ns=2;i=test
tagName: tag1
- tagAddress:
address: ns=2;i=test2
tagName: tag2
schema:
$ref: '#/components/schemas/DomainTagList'
description: Success
summary: Get the domain tags for the device connected through this adapter.
tags:
- Protocol Adapters
post:
description: Add a new domain tag to the specified adapter.
operationId: add-adapter-domainTags
parameters:
- description: The adapter id.
in: path
name: adapterId
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DomainTag'
description: The domain tag.
required: true
responses:
"200":
description: Success
"403":
content:
application/json:
examples:
already present example:
description: An example response in case an tag is already present
for this tagId.
summary: An example response in case an tag is already present for
this tagId.
value:
errors:
- title: The resource already exists
detail: The tag 'tag' cannot be created since another item already
exists with the same id.
schema:
$ref: '#/components/schemas/Errors'
description: Already Present
summary: Add a new domain tag to the specified adapter
tags:
- Protocol Adapters
put:
description: Update all domain tags of an adapter.
operationId: update-adapter-domainTags
parameters:
- description: The id of the adapter whose domain tags will be updated.
in: path
name: adapterId
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DomainTagList'
responses:
"200":
description: Success
"403":
content:
application/json:
examples:
already present example:
description: An example response in case no tag is present for this
tagId.
summary: An example response in case no tag is present for this
tagId.
value:
errors:
- title: Resource not found
detail: Tag with id 'tag1' not found
schema:
$ref: '#/components/schemas/Errors'
description: Not Found
summary: Update the domain tag of an adapter.
tags:
- Protocol Adapters
/api/v1/management/protocol-adapters/adapters/{adapterId}/tags/{tagId}:
delete:
description: Delete the specified domain tag on the given adapter.
operationId: delete-adapter-domainTags
parameters:
- description: The adapter Id.
in: path
name: adapterId
required: true
schema:
type: string
- description: The domain tag Id.
in: path
name: tagId
required: true
schema:
type: string
responses:
"200":
description: Success
summary: Delete an domain tag
tags:
- Protocol Adapters
put:
description: Update the domain tag of an adapter.
operationId: update-adapter-domainTag
parameters:
- description: The id of the adapter whose domain tag will be updated.
in: path
name: adapterId
required: true
schema:
type: string
- description: The id of the domain tag that will be changed.
in: path
name: tagId
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DomainTag'
responses:
"200":
description: Success
"403":
content:
application/json:
examples:
already present example:
description: An example response in case no tag is present for this
tagId.
summary: An example response in case no tag is present for this
tagId.
value:
errors:
- title: Resource not found
detail: Tag with id 'tag1' not found
schema:
$ref: '#/components/schemas/Errors'
description: Not Found
summary: Update the domain tag of an adapter.
tags:
- Protocol Adapters
/api/v1/management/protocol-adapters/adapters/{adapterType}:
post:
description: Add adapter to the system.
Expand Down Expand Up @@ -3624,6 +3800,32 @@ paths:
summary: Get the status of all the adapters in the system.
tags:
- Protocol Adapters
/api/v1/management/protocol-adapters/tags:
get:
description: Get the list of all domain tags created in this Edge instance
operationId: get-domain-tags
responses:
"200":
content:
application/json:
examples:
opc ua domain tags example:
description: An example for domain tags in opc ua
summary: 'Example for domain tags for opc ua '
value:
items:
- tagAddress:
address: ns=2;i=test
tagName: tag1
- tagAddress:
address: ns=2;i=test2
tagName: tag2
schema:
$ref: '#/components/schemas/DomainTagList'
description: Success
summary: Get the list of all domain tags created in this Edge instance
tags:
- Protocol Adapters
/api/v1/management/protocol-adapters/types:
get:
description: Obtain a list of available protocol adapter types.
Expand Down Expand Up @@ -4267,6 +4469,29 @@ components:
required:
- arguments
- type
DomainTag:
type: object
description: List of result items that are returned by this endpoint
properties:
description:
type: string
description: A user created description for this tag.
protocolId:
type: string
description: The protocol id of the protocol for which this tag was created.
tagAddress:
$ref: '#/components/schemas/TagAddress'
tagName:
type: string
description: The name of the tag that identifies it within this edge instance.
DomainTagList:
type: object
properties:
items:
type: array
description: List of result items that are returned by this endpoint
items:
$ref: '#/components/schemas/DomainTag'
EnvironmentProperties:
type: object
description: A map of properties relating to the installation
Expand Down Expand Up @@ -5069,6 +5294,12 @@ components:
type:
type: string
description: The type of the object in transition
TagAddress:
type: object
description: The address for the data point on the device.
properties:
address:
$ref: '#/components/schemas/JsonNode'
TlsConfiguration:
type: object
description: tlsConfiguration associated with the bridge
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2019-present HiveMQ GmbH
*
* 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.api.model;

public interface TagResourceExamples {

String EXAMPLE_OPC_UA = "{\n" +
" \"items\":[\n" +
" {\n" +
" \"tagAddress\":{\n" +
" \"address\":\"ns=2;i=test\"\n" +
" },\n" +
" \"tagName\":\"tag1\"\n" +
" },\n" +
" {\n" +
" \"tagAddress\":{\n" +
" \"address\":\"ns=2;i=test2\"\n" +
" },\n" +
" \"tagName\":\"tag2\"\n" +
" }\n" +
" ]\n" +
"}";


String EXAMPLE_ALREADY_PRESENT = "{\n" +
" \"errors\" : [ {\n" +
" \"title\" : \"The resource already exists\",\n" +
" \"detail\" : \"The tag 'tag' cannot be created since another item already exists with the same id.\"\n" +
" } ]\n" +
"}";

String EXAMPLE_NOT_PRESENT = "{\n" +
" \"errors\" : [ {\n" +
" \"title\" : \"Resource not found\",\n" +
" \"detail\" : \"Tag with id 'tag1' not found\"\n" +
" } ]\n" +
"}";
}
Loading

0 comments on commit feb5308

Please sign in to comment.