|
|
|
@ -21,8 +21,11 @@ import com.google.common.util.concurrent.ListenableFuture; |
|
|
|
import com.google.common.util.concurrent.MoreExecutors; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
import io.swagger.annotations.ApiResponse; |
|
|
|
import io.swagger.annotations.ApiResponses; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
import org.springframework.http.HttpStatus; |
|
|
|
import org.springframework.http.MediaType; |
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
@ -175,6 +178,15 @@ public class DeviceController extends BaseController { |
|
|
|
"If the user has the authority of 'Tenant Administrator', the server checks that the device is owned by the same tenant. " + |
|
|
|
"If the user has the authority of 'Customer User', the server checks that the device is assigned to the same customer. " + |
|
|
|
TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH) |
|
|
|
@ApiResponses(value = { |
|
|
|
@ApiResponse(code = 200, message = "OK", |
|
|
|
examples = @io.swagger.annotations.Example( |
|
|
|
value = { |
|
|
|
@io.swagger.annotations.ExampleProperty( |
|
|
|
mediaType="application/json", |
|
|
|
value="{\"http\":\"curl -v -X POST http://localhost:8080/api/v1/0ySs4FTOn5WU15XLmal8/telemetry --header Content-Type:application/json --data {temperature:25}\"," + |
|
|
|
"\"mqtt\":\"mosquitto_pub -d -q 1 -h localhost -t v1/devices/me/telemetry -i myClient1 -u myUsername1 -P myPassword -m {temperature:25}\"," + |
|
|
|
"\"coap\":\"coap-client -m POST coap://localhost:5683/api/v1/0ySs4FTOn5WU15XLmal8/telemetry -t json -e {temperature:25}\"}")}))}) |
|
|
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
|
|
|
@RequestMapping(value = "/device/{deviceId}/commands", method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
|