Skip to content

Commit 5a82bd0

Browse files
committed
Add result
1 parent c13334b commit 5a82bd0

3 files changed

Lines changed: 52 additions & 1 deletion

File tree

sdk/src/main/java/software/amazon/awssdk/iot/iotcommands/IotCommandsV2Client.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ public void close() {
8686

8787
private CommandExecutionEvent createCommandExecutionEvent(IncomingPublishEvent publishEvent) {
8888
CommandExecutionEvent event = new CommandExecutionEvent();
89-
event.executionId = publishEvent.getTopic().split("/")[5];
89+
String[] segments = publishEvent.getTopic().split("/");
90+
if (segments.length <= 5) {
91+
throw new CrtRuntimeException("Invalid topic: " + publishEvent.getTopic());
92+
}
93+
event.executionId = segments[5];
9094
event.payload = publishEvent.getPayload();
9195
String contentType = publishEvent.getContentType();
9296
if (contentType != null) {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0.
4+
*
5+
* This file is generated.
6+
*/
7+
8+
package software.amazon.awssdk.iot.iotcommands.model;
9+
10+
11+
/**
12+
* The result value of the command execution. The device can use the result field to share additional details about the execution such as a return value of a remote function call.
13+
*
14+
*/
15+
public class CommandExecutionResult {
16+
17+
/**
18+
* An attribute of type String.
19+
*
20+
*/
21+
public String s;
22+
23+
24+
/**
25+
* An attribute of type Boolean.
26+
*
27+
*/
28+
public Boolean b;
29+
30+
31+
/**
32+
* An attribute of type Binary.
33+
*
34+
*/
35+
public byte[] bin;
36+
37+
38+
}

sdk/src/main/java/software/amazon/awssdk/iot/iotcommands/model/UpdateCommandExecutionRequest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
package software.amazon.awssdk.iot.iotcommands.model;
99

10+
import java.util.HashMap;
11+
import software.amazon.awssdk.iot.iotcommands.model.CommandExecutionResult;
1012
import software.amazon.awssdk.iot.iotcommands.model.CommandExecutionStatus;
1113
import software.amazon.awssdk.iot.iotcommands.model.DeviceType;
1214
import software.amazon.awssdk.iot.iotcommands.model.StatusReason;
@@ -52,4 +54,11 @@ public class UpdateCommandExecutionRequest {
5254
public StatusReason statusReason;
5355

5456

57+
/**
58+
* The result value for the current state of the command execution. The status provides information about the progress of the command execution. The device can use the result field to share additional details about the execution such as a return value of a remote function call.
59+
*
60+
*/
61+
public HashMap<String, software.amazon.awssdk.iot.iotcommands.model.CommandExecutionResult> result;
62+
63+
5564
}

0 commit comments

Comments
 (0)