Target attributes update can be (re-)triggered by management API (#690)
* extend Management API with attribute `requestAttributes` * introduce new DMF Event Topic `REQUEST_ATTRIBUTES_UPDATE` * enhance REST documentation by new functionality * add tests for: * Management API * Amqp Message Dispatcher Service * Repository (Target Management) Signed-off-by: Jeroen Jan Laverman (INST/ESY3) <jeroen.laverman@bosch-si.com>
This commit is contained in:
committed by
Dominic Schabel
parent
f4340098d9
commit
ecfe774e53
@@ -219,6 +219,8 @@ public abstract class AbstractApiRestDocumentation extends AbstractRestIntegrati
|
||||
.type("enum")
|
||||
.attributes(key("value").value("['error', 'in_sync', 'pending', 'registered', 'unknown']")),
|
||||
fieldWithPath(fieldArrayPrefix + "securityToken").description(MgmtApiModelProperties.SECURITY_TOKEN),
|
||||
fieldWithPath(fieldArrayPrefix + "requestAttributes")
|
||||
.description(MgmtApiModelProperties.REQUEST_ATTRIBUTES),
|
||||
fieldWithPath(fieldArrayPrefix + "installedAt").description(MgmtApiModelProperties.INSTALLED_AT),
|
||||
fieldWithPath(fieldArrayPrefix + "lastModifiedAt")
|
||||
.description(ApiModelPropertiesGeneric.LAST_MODIFIED_AT).type("Number"),
|
||||
|
||||
@@ -143,6 +143,8 @@ public final class MgmtApiModelProperties {
|
||||
|
||||
public static final String SECURITY_TOKEN = "Pre-Shared key that allows targets to authenticate at Direct Device Integration API if enabled in the tenant settings.";
|
||||
|
||||
public static final String REQUEST_ATTRIBUTES = "Request re-transmission of target attributes.";
|
||||
|
||||
public static final String META_DATA = "List of metadata.";
|
||||
|
||||
public static final String META_DATA_KEY = "Metadata property key.";
|
||||
|
||||
@@ -90,6 +90,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
|
||||
.type("enum").attributes(
|
||||
key("value").value("['error', 'in_sync', 'pending', 'registered', 'unknown']")),
|
||||
fieldWithPath("content[].securityToken").description(MgmtApiModelProperties.SECURITY_TOKEN),
|
||||
fieldWithPath("content[].requestAttributes").description(MgmtApiModelProperties.REQUEST_ATTRIBUTES),
|
||||
fieldWithPath("content[].installedAt").description(MgmtApiModelProperties.INSTALLED_AT),
|
||||
fieldWithPath("content[].lastModifiedAt")
|
||||
.description(ApiModelPropertiesGeneric.LAST_MODIFIED_AT).type("Number"),
|
||||
@@ -141,6 +142,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
|
||||
.attributes(key("value")
|
||||
.value("['error', 'in_sync', 'pending', 'registered', 'unknown']")),
|
||||
fieldWithPath("[]securityToken").description(MgmtApiModelProperties.SECURITY_TOKEN),
|
||||
fieldWithPath("[]requestAttributes").description(MgmtApiModelProperties.REQUEST_ATTRIBUTES),
|
||||
fieldWithPath("[]_links.self").ignored())));
|
||||
}
|
||||
|
||||
@@ -180,12 +182,13 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
|
||||
.andDo(this.document.document(
|
||||
pathParameters(
|
||||
parameterWithName("controllerId").description(ApiModelPropertiesGeneric.ITEM_ID)),
|
||||
requestFields(requestFieldWithPath("name").description(ApiModelPropertiesGeneric.NAME),
|
||||
requestFieldWithPath("description").description(ApiModelPropertiesGeneric.DESCRPTION),
|
||||
requestFieldWithPath("controllerId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||
requestFieldWithPath("address").description(MgmtApiModelProperties.ADDRESS),
|
||||
requestFieldWithPath("securityToken")
|
||||
.description(MgmtApiModelProperties.SECURITY_TOKEN)),
|
||||
requestFields(optionalRequestFieldWithPath("name").description(ApiModelPropertiesGeneric.NAME),
|
||||
optionalRequestFieldWithPath("description").description(ApiModelPropertiesGeneric.DESCRPTION),
|
||||
optionalRequestFieldWithPath("controllerId").description(ApiModelPropertiesGeneric.ITEM_ID),
|
||||
optionalRequestFieldWithPath("address").description(MgmtApiModelProperties.ADDRESS),
|
||||
optionalRequestFieldWithPath("securityToken")
|
||||
.description(MgmtApiModelProperties.SECURITY_TOKEN),
|
||||
optionalRequestFieldWithPath("requestAttributes").description(MgmtApiModelProperties.REQUEST_ATTRIBUTES)),
|
||||
getResponseFieldTarget(false)));
|
||||
}
|
||||
|
||||
@@ -570,6 +573,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
|
||||
target.put("name", name);
|
||||
target.put("address", "https://192.168.0.1");
|
||||
target.put("securityToken", "2345678DGGDGFTDzztgf");
|
||||
target.put("requestAttributes", true);
|
||||
return this.objectMapper.writeValueAsString(target);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user