Commit 3490045f964367f96bdc11a985a6704c4bef7dea
Committed by
GitHub
Merge pull request #5461 from volodymyr-babak/master
[3.2.2] Edge Swagger docs - part 2
Showing
10 changed files
with
145 additions
and
31 deletions
... | ... | @@ -542,7 +542,7 @@ public class AssetController extends BaseController { |
542 | 542 | notes = "Creates assignment of an existing asset to an instance of The Edge. " + |
543 | 543 | EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + |
544 | 544 | "Second, remote edge service will receive a copy of assignment asset " + |
545 | - EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + | |
545 | + EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + | |
546 | 546 | "Third, once asset will be delivered to edge service, it's going to be available for usage on remote edge instance.", |
547 | 547 | produces = MediaType.APPLICATION_JSON_VALUE) |
548 | 548 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
... | ... | @@ -582,7 +582,7 @@ public class AssetController extends BaseController { |
582 | 582 | notes = "Clears assignment of the asset to the edge. " + |
583 | 583 | EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + |
584 | 584 | "Second, remote edge service will receive an 'unassign' command to remove asset " + |
585 | - EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + | |
585 | + EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + | |
586 | 586 | "Third, once 'unassign' command will be delivered to edge service, it's going to remove asset locally.", |
587 | 587 | produces = MediaType.APPLICATION_JSON_VALUE) |
588 | 588 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") | ... | ... |
... | ... | @@ -23,6 +23,7 @@ public class ControllerConstants { |
23 | 23 | protected static final String CUSTOMER_ID = "customerId"; |
24 | 24 | protected static final String TENANT_ID = "tenantId"; |
25 | 25 | protected static final String DEVICE_ID = "deviceId"; |
26 | + protected static final String EDGE_ID = "edgeId"; | |
26 | 27 | protected static final String RPC_ID = "rpcId"; |
27 | 28 | protected static final String ENTITY_ID = "entityId"; |
28 | 29 | protected static final String PAGE_DATA_PARAMETERS = "You can specify parameters to filter the results. " + |
... | ... | @@ -128,9 +129,9 @@ public class ControllerConstants { |
128 | 129 | protected static final String EVENT_END_TIME_DESCRIPTION = "Timestamp. Events with creation time after it won't be queried."; |
129 | 130 | |
130 | 131 | protected static final String EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION = "Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. "; |
131 | - protected static final String EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION = "(Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform)"; | |
132 | + protected static final String EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION = "(Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). "; | |
132 | 133 | protected static final String EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION = "Assignment works in async way - first, notification event pushed to edge service queue on platform. "; |
133 | - protected static final String EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION = "(Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform)"; | |
134 | + protected static final String EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION = "(Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). "; | |
134 | 135 | |
135 | 136 | protected static final String MARKDOWN_CODE_BLOCK_START = "```json\n"; |
136 | 137 | protected static final String MARKDOWN_CODE_BLOCK_END = "\n```"; | ... | ... |
... | ... | @@ -51,7 +51,6 @@ import org.thingsboard.server.common.data.id.EdgeId; |
51 | 51 | import org.thingsboard.server.common.data.id.TenantId; |
52 | 52 | import org.thingsboard.server.common.data.page.PageData; |
53 | 53 | import org.thingsboard.server.common.data.page.PageLink; |
54 | -import org.thingsboard.server.common.data.page.TimePageLink; | |
55 | 54 | import org.thingsboard.server.queue.util.TbCoreComponent; |
56 | 55 | import org.thingsboard.server.service.security.model.SecurityUser; |
57 | 56 | import org.thingsboard.server.service.security.permission.Operation; |
... | ... | @@ -69,6 +68,8 @@ import static org.thingsboard.server.controller.ControllerConstants.DASHBOARD_SO |
69 | 68 | import static org.thingsboard.server.controller.ControllerConstants.DASHBOARD_TEXT_SEARCH_DESCRIPTION; |
70 | 69 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION; |
71 | 70 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION; |
71 | +import static org.thingsboard.server.controller.ControllerConstants.EDGE_ID; | |
72 | +import static org.thingsboard.server.controller.ControllerConstants.EDGE_ID_PARAM_DESCRIPTION; | |
72 | 73 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION; |
73 | 74 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION; |
74 | 75 | import static org.thingsboard.server.controller.ControllerConstants.PAGE_DATA_PARAMETERS; |
... | ... | @@ -829,7 +830,7 @@ public class DashboardController extends BaseController { |
829 | 830 | notes = "Creates assignment of an existing dashboard to an instance of The Edge. " + |
830 | 831 | EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + |
831 | 832 | "Second, remote edge service will receive a copy of assignment dashboard " + |
832 | - EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + | |
833 | + EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + | |
833 | 834 | "Third, once dashboard will be delivered to edge service, it's going to be available for usage on remote edge instance." + |
834 | 835 | TENANT_AUTHORITY_PARAGRAPH, |
835 | 836 | produces = MediaType.APPLICATION_JSON_VALUE) |
... | ... | @@ -870,7 +871,7 @@ public class DashboardController extends BaseController { |
870 | 871 | notes = "Clears assignment of the dashboard to the edge. " + |
871 | 872 | EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + |
872 | 873 | "Second, remote edge service will receive an 'unassign' command to remove dashboard " + |
873 | - EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + | |
874 | + EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + | |
874 | 875 | "Third, once 'unassign' command will be delivered to edge service, it's going to remove dashboard locally." + |
875 | 876 | TENANT_AUTHORITY_PARAGRAPH, |
876 | 877 | produces = MediaType.APPLICATION_JSON_VALUE) |
... | ... | @@ -906,24 +907,32 @@ public class DashboardController extends BaseController { |
906 | 907 | } |
907 | 908 | } |
908 | 909 | |
910 | + @ApiOperation(value = "Get Edge Dashboards (getEdgeDashboards)", | |
911 | + notes = "Returns a page of dashboard info objects assigned to the specified edge. " | |
912 | + + DASHBOARD_INFO_DEFINITION + " " + PAGE_DATA_PARAMETERS + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH, | |
913 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
909 | 914 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
910 | 915 | @RequestMapping(value = "/edge/{edgeId}/dashboards", params = {"pageSize", "page"}, method = RequestMethod.GET) |
911 | 916 | @ResponseBody |
912 | 917 | public PageData<DashboardInfo> getEdgeDashboards( |
913 | - @PathVariable("edgeId") String strEdgeId, | |
918 | + @ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
919 | + @PathVariable(EDGE_ID) String strEdgeId, | |
920 | + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | |
914 | 921 | @RequestParam int pageSize, |
922 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | |
915 | 923 | @RequestParam int page, |
924 | + @ApiParam(value = DASHBOARD_TEXT_SEARCH_DESCRIPTION) | |
916 | 925 | @RequestParam(required = false) String textSearch, |
926 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = DASHBOARD_SORT_PROPERTY_ALLOWABLE_VALUES) | |
917 | 927 | @RequestParam(required = false) String sortProperty, |
918 | - @RequestParam(required = false) String sortOrder, | |
919 | - @RequestParam(required = false) Long startTime, | |
920 | - @RequestParam(required = false) Long endTime) throws ThingsboardException { | |
928 | + @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) | |
929 | + @RequestParam(required = false) String sortOrder) throws ThingsboardException { | |
921 | 930 | checkParameter("edgeId", strEdgeId); |
922 | 931 | try { |
923 | 932 | TenantId tenantId = getCurrentUser().getTenantId(); |
924 | 933 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); |
925 | 934 | checkEdgeId(edgeId, Operation.READ); |
926 | - TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, startTime, endTime); | |
935 | + PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder); | |
927 | 936 | PageData<DashboardInfo> nonFilteredResult = dashboardService.findDashboardsByTenantIdAndEdgeId(tenantId, edgeId, pageLink); |
928 | 937 | List<DashboardInfo> filteredDashboards = nonFilteredResult.getData().stream().filter(dashboardInfo -> { |
929 | 938 | try { | ... | ... |
... | ... | @@ -849,7 +849,7 @@ public class DeviceController extends BaseController { |
849 | 849 | notes = "Creates assignment of an existing device to an instance of The Edge. " + |
850 | 850 | EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + |
851 | 851 | "Second, remote edge service will receive a copy of assignment device " + |
852 | - EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + | |
852 | + EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + | |
853 | 853 | "Third, once device will be delivered to edge service, it's going to be available for usage on remote edge instance." + TENANT_AUTHORITY_PARAGRAPH, |
854 | 854 | produces = MediaType.APPLICATION_JSON_VALUE) |
855 | 855 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
... | ... | @@ -892,7 +892,7 @@ public class DeviceController extends BaseController { |
892 | 892 | notes = "Clears assignment of the device to the edge. " + |
893 | 893 | EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + |
894 | 894 | "Second, remote edge service will receive an 'unassign' command to remove device " + |
895 | - EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + | |
895 | + EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + | |
896 | 896 | "Third, once 'unassign' command will be delivered to edge service, it's going to remove device locally." + TENANT_AUTHORITY_PARAGRAPH, |
897 | 897 | produces = MediaType.APPLICATION_JSON_VALUE) |
898 | 898 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") | ... | ... |
... | ... | @@ -452,17 +452,17 @@ public class EdgeController extends BaseController { |
452 | 452 | } |
453 | 453 | } |
454 | 454 | |
455 | - @ApiOperation(value = "Set root rule chain for provided edge (setRootRuleChain)", | |
455 | + @ApiOperation(value = "Set root rule chain for provided edge (setEdgeRootRuleChain)", | |
456 | 456 | notes = "Change root rule chain of the edge to the new provided rule chain. \n" + |
457 | 457 | "This operation will send a notification to update root rule chain on remote edge service." + TENANT_AUTHORITY_PARAGRAPH, |
458 | 458 | produces = MediaType.APPLICATION_JSON_VALUE) |
459 | 459 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") |
460 | 460 | @RequestMapping(value = "/edge/{edgeId}/{ruleChainId}/root", method = RequestMethod.POST) |
461 | 461 | @ResponseBody |
462 | - public Edge setRootRuleChain(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
463 | - @PathVariable(EDGE_ID) String strEdgeId, | |
464 | - @ApiParam(value = RULE_CHAIN_ID_PARAM_DESCRIPTION, required = true) | |
465 | - @PathVariable("ruleChainId") String strRuleChainId) throws ThingsboardException { | |
462 | + public Edge setEdgeRootRuleChain(@ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
463 | + @PathVariable(EDGE_ID) String strEdgeId, | |
464 | + @ApiParam(value = RULE_CHAIN_ID_PARAM_DESCRIPTION, required = true) | |
465 | + @PathVariable("ruleChainId") String strRuleChainId) throws ThingsboardException { | |
466 | 466 | checkParameter(EDGE_ID, strEdgeId); |
467 | 467 | checkParameter("ruleChainId", strRuleChainId); |
468 | 468 | try { |
... | ... | @@ -736,6 +736,9 @@ public class EdgeController extends BaseController { |
736 | 736 | edge.setEdgeLicenseKey(null); |
737 | 737 | } |
738 | 738 | |
739 | + @ApiOperation(value = "Check edge license (checkInstance)", | |
740 | + notes = "Checks license request from edge service by forwarding request to license portal.", | |
741 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
739 | 742 | @RequestMapping(value = "/license/checkInstance", method = RequestMethod.POST) |
740 | 743 | @ResponseBody |
741 | 744 | public ResponseEntity<JsonNode> checkInstance(@RequestBody JsonNode request) throws ThingsboardException { |
... | ... | @@ -748,6 +751,9 @@ public class EdgeController extends BaseController { |
748 | 751 | } |
749 | 752 | } |
750 | 753 | |
754 | + @ApiOperation(value = "Activate edge instance (activateInstance)", | |
755 | + notes = "Activates edge license on license portal.", | |
756 | + produces = MediaType.APPLICATION_JSON_VALUE) | |
751 | 757 | @RequestMapping(value = "/license/activateInstance", params = {"licenseSecret", "releaseDate"}, method = RequestMethod.POST) |
752 | 758 | @ResponseBody |
753 | 759 | public ResponseEntity<JsonNode> activateInstance(@RequestParam String licenseSecret, | ... | ... |
... | ... | @@ -728,7 +728,7 @@ public class EntityViewController extends BaseController { |
728 | 728 | notes = "Creates assignment of an existing entity view to an instance of The Edge. " + |
729 | 729 | EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + |
730 | 730 | "Second, remote edge service will receive a copy of assignment entity view " + |
731 | - EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + | |
731 | + EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + | |
732 | 732 | "Third, once entity view will be delivered to edge service, it's going to be available for usage on remote edge instance.", |
733 | 733 | produces = MediaType.APPLICATION_JSON_VALUE) |
734 | 734 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
... | ... | @@ -765,7 +765,7 @@ public class EntityViewController extends BaseController { |
765 | 765 | notes = "Clears assignment of the entity view to the edge. " + |
766 | 766 | EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + |
767 | 767 | "Second, remote edge service will receive an 'unassign' command to remove entity view " + |
768 | - EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + | |
768 | + EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + | |
769 | 769 | "Third, once 'unassign' command will be delivered to edge service, it's going to remove entity view locally.", |
770 | 770 | produces = MediaType.APPLICATION_JSON_VALUE) |
771 | 771 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") | ... | ... |
... | ... | @@ -83,6 +83,8 @@ import java.util.stream.Collectors; |
83 | 83 | |
84 | 84 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION; |
85 | 85 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION; |
86 | +import static org.thingsboard.server.controller.ControllerConstants.EDGE_ID; | |
87 | +import static org.thingsboard.server.controller.ControllerConstants.EDGE_ID_PARAM_DESCRIPTION; | |
86 | 88 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION; |
87 | 89 | import static org.thingsboard.server.controller.ControllerConstants.EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION; |
88 | 90 | import static org.thingsboard.server.controller.ControllerConstants.MARKDOWN_CODE_BLOCK_END; |
... | ... | @@ -600,7 +602,7 @@ public class RuleChainController extends BaseController { |
600 | 602 | notes = "Creates assignment of an existing rule chain to an instance of The Edge. " + |
601 | 603 | EDGE_ASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + |
602 | 604 | "Second, remote edge service will receive a copy of assignment rule chain " + |
603 | - EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + | |
605 | + EDGE_ASSIGN_RECEIVE_STEP_DESCRIPTION + | |
604 | 606 | "Third, once rule chain will be delivered to edge service, it's going to start processing messages locally. " + |
605 | 607 | "\n\nOnly rule chain with type 'EDGE' can be assigned to edge." + TENANT_AUTHORITY_PARAGRAPH, |
606 | 608 | produces = MediaType.APPLICATION_JSON_VALUE) |
... | ... | @@ -641,7 +643,7 @@ public class RuleChainController extends BaseController { |
641 | 643 | notes = "Clears assignment of the rule chain to the edge. " + |
642 | 644 | EDGE_UNASSIGN_ASYNC_FIRST_STEP_DESCRIPTION + |
643 | 645 | "Second, remote edge service will receive an 'unassign' command to remove rule chain " + |
644 | - EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + ". " + | |
646 | + EDGE_UNASSIGN_RECEIVE_STEP_DESCRIPTION + | |
645 | 647 | "Third, once 'unassign' command will be delivered to edge service, it's going to remove rule chain locally." + TENANT_AUTHORITY_PARAGRAPH, |
646 | 648 | produces = MediaType.APPLICATION_JSON_VALUE) |
647 | 649 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
... | ... | @@ -676,17 +678,25 @@ public class RuleChainController extends BaseController { |
676 | 678 | } |
677 | 679 | } |
678 | 680 | |
681 | + @ApiOperation(value = "Get Edge Rule Chains (getEdgeRuleChains)", | |
682 | + notes = "Returns a page of Rule Chains assigned to the specified edge. " + RULE_CHAIN_DESCRIPTION + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH) | |
679 | 683 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") |
680 | 684 | @RequestMapping(value = "/edge/{edgeId}/ruleChains", params = {"pageSize", "page"}, method = RequestMethod.GET) |
681 | 685 | @ResponseBody |
682 | 686 | public PageData<RuleChain> getEdgeRuleChains( |
683 | - @PathVariable("edgeId") String strEdgeId, | |
687 | + @ApiParam(value = EDGE_ID_PARAM_DESCRIPTION, required = true) | |
688 | + @PathVariable(EDGE_ID) String strEdgeId, | |
689 | + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | |
684 | 690 | @RequestParam int pageSize, |
691 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | |
685 | 692 | @RequestParam int page, |
693 | + @ApiParam(value = RULE_CHAIN_TEXT_SEARCH_DESCRIPTION) | |
686 | 694 | @RequestParam(required = false) String textSearch, |
695 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = RULE_CHAIN_SORT_PROPERTY_ALLOWABLE_VALUES) | |
687 | 696 | @RequestParam(required = false) String sortProperty, |
697 | + @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) | |
688 | 698 | @RequestParam(required = false) String sortOrder) throws ThingsboardException { |
689 | - checkParameter("edgeId", strEdgeId); | |
699 | + checkParameter(EDGE_ID, strEdgeId); | |
690 | 700 | try { |
691 | 701 | TenantId tenantId = getCurrentUser().getTenantId(); |
692 | 702 | EdgeId edgeId = new EdgeId(toUUID(strEdgeId)); |
... | ... | @@ -698,10 +708,14 @@ public class RuleChainController extends BaseController { |
698 | 708 | } |
699 | 709 | } |
700 | 710 | |
711 | + @ApiOperation(value = "Set Edge Template Root Rule Chain (setEdgeTemplateRootRuleChain)", | |
712 | + notes = "Makes the rule chain to be root rule chain for any new edge that will be created. " + | |
713 | + "Does not update root rule chain for already created edges. " + TENANT_AUTHORITY_PARAGRAPH) | |
701 | 714 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") |
702 | 715 | @RequestMapping(value = "/ruleChain/{ruleChainId}/edgeTemplateRoot", method = RequestMethod.POST) |
703 | 716 | @ResponseBody |
704 | - public RuleChain setEdgeTemplateRootRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | |
717 | + public RuleChain setEdgeTemplateRootRuleChain(@ApiParam(value = RULE_CHAIN_ID_PARAM_DESCRIPTION) | |
718 | + @PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | |
705 | 719 | checkParameter(RULE_CHAIN_ID, strRuleChainId); |
706 | 720 | try { |
707 | 721 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
... | ... | @@ -717,10 +731,14 @@ public class RuleChainController extends BaseController { |
717 | 731 | } |
718 | 732 | } |
719 | 733 | |
734 | + @ApiOperation(value = "Set Auto Assign To Edge Rule Chain (setAutoAssignToEdgeRuleChain)", | |
735 | + notes = "Makes the rule chain to be automatically assigned for any new edge that will be created. " + | |
736 | + "Does not assign this rule chain for already created edges. " + TENANT_AUTHORITY_PARAGRAPH) | |
720 | 737 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
721 | 738 | @RequestMapping(value = "/ruleChain/{ruleChainId}/autoAssignToEdge", method = RequestMethod.POST) |
722 | 739 | @ResponseBody |
723 | - public RuleChain setAutoAssignToEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | |
740 | + public RuleChain setAutoAssignToEdgeRuleChain(@ApiParam(value = RULE_CHAIN_ID_PARAM_DESCRIPTION) | |
741 | + @PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | |
724 | 742 | checkParameter(RULE_CHAIN_ID, strRuleChainId); |
725 | 743 | try { |
726 | 744 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
... | ... | @@ -736,10 +754,14 @@ public class RuleChainController extends BaseController { |
736 | 754 | } |
737 | 755 | } |
738 | 756 | |
757 | + @ApiOperation(value = "Unset Auto Assign To Edge Rule Chain (unsetAutoAssignToEdgeRuleChain)", | |
758 | + notes = "Removes the rule chain from the list of rule chains that are going to be automatically assigned for any new edge that will be created. " + | |
759 | + "Does not unassign this rule chain for already assigned edges. " + TENANT_AUTHORITY_PARAGRAPH) | |
739 | 760 | @PreAuthorize("hasAuthority('TENANT_ADMIN')") |
740 | 761 | @RequestMapping(value = "/ruleChain/{ruleChainId}/autoAssignToEdge", method = RequestMethod.DELETE) |
741 | 762 | @ResponseBody |
742 | - public RuleChain unsetAutoAssignToEdgeRuleChain(@PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | |
763 | + public RuleChain unsetAutoAssignToEdgeRuleChain(@ApiParam(value = RULE_CHAIN_ID_PARAM_DESCRIPTION) | |
764 | + @PathVariable(RULE_CHAIN_ID) String strRuleChainId) throws ThingsboardException { | |
743 | 765 | checkParameter(RULE_CHAIN_ID, strRuleChainId); |
744 | 766 | try { |
745 | 767 | RuleChainId ruleChainId = new RuleChainId(toUUID(strRuleChainId)); |
... | ... | @@ -756,6 +778,8 @@ public class RuleChainController extends BaseController { |
756 | 778 | } |
757 | 779 | |
758 | 780 | // TODO: @voba refactor this - add new config to edge rule chain to set it as auto-assign |
781 | + @ApiOperation(value = "Get Auto Assign To Edge Rule Chains (getAutoAssignToEdgeRuleChains)", | |
782 | + notes = "Returns a list of Rule Chains that will be assigned to a newly created edge. " + RULE_CHAIN_DESCRIPTION + TENANT_AUTHORITY_PARAGRAPH) | |
759 | 783 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')") |
760 | 784 | @RequestMapping(value = "/ruleChain/autoAssignToEdgeRuleChains", method = RequestMethod.GET) |
761 | 785 | @ResponseBody | ... | ... |
... | ... | @@ -15,8 +15,9 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.common.data.edge; |
17 | 17 | |
18 | +import io.swagger.annotations.ApiModel; | |
19 | +import io.swagger.annotations.ApiModelProperty; | |
18 | 20 | import lombok.EqualsAndHashCode; |
19 | -import lombok.Getter; | |
20 | 21 | import lombok.Setter; |
21 | 22 | import lombok.ToString; |
22 | 23 | import org.thingsboard.server.common.data.HasCustomerId; |
... | ... | @@ -28,9 +29,9 @@ import org.thingsboard.server.common.data.id.EdgeId; |
28 | 29 | import org.thingsboard.server.common.data.id.RuleChainId; |
29 | 30 | import org.thingsboard.server.common.data.id.TenantId; |
30 | 31 | |
32 | +@ApiModel | |
31 | 33 | @EqualsAndHashCode(callSuper = true) |
32 | 34 | @ToString |
33 | -@Getter | |
34 | 35 | @Setter |
35 | 36 | public class Edge extends SearchTextBasedWithAdditionalInfo<EdgeId> implements HasName, HasTenantId, HasCustomerId { |
36 | 37 | |
... | ... | @@ -82,8 +83,77 @@ public class Edge extends SearchTextBasedWithAdditionalInfo<EdgeId> implements H |
82 | 83 | this.cloudEndpoint = edge.getCloudEndpoint(); |
83 | 84 | } |
84 | 85 | |
86 | + @ApiModelProperty(position = 1, value = "JSON object with the Edge Id. " + | |
87 | + "Specify this field to update the Edge. " + | |
88 | + "Referencing non-existing Edge Id will cause error. " + | |
89 | + "Omit this field to create new Edge." ) | |
90 | + @Override | |
91 | + public EdgeId getId() { | |
92 | + return super.getId(); | |
93 | + } | |
94 | + | |
95 | + @ApiModelProperty(position = 2, value = "Timestamp of the edge creation, in milliseconds", example = "1609459200000", readOnly = true) | |
96 | + @Override | |
97 | + public long getCreatedTime() { | |
98 | + return super.getCreatedTime(); | |
99 | + } | |
100 | + | |
101 | + @ApiModelProperty(position = 3, value = "JSON object with Tenant Id. Use 'assignDeviceToTenant' to change the Tenant Id.", readOnly = true) | |
102 | + @Override | |
103 | + public TenantId getTenantId() { | |
104 | + return this.tenantId; | |
105 | + } | |
106 | + | |
107 | + @ApiModelProperty(position = 4, value = "JSON object with Customer Id. Use 'assignEdgeToCustomer' to change the Customer Id.", readOnly = true) | |
108 | + @Override | |
109 | + public CustomerId getCustomerId() { | |
110 | + return this.customerId; | |
111 | + } | |
112 | + | |
113 | + @ApiModelProperty(position = 5, value = "JSON object with Root Rule Chain Id. Use 'setEdgeRootRuleChain' to change the Root Rule Chain Id.", readOnly = true) | |
114 | + public RuleChainId getRootRuleChainId() { | |
115 | + return this.rootRuleChainId; | |
116 | + } | |
117 | + | |
118 | + @ApiModelProperty(position = 6, required = true, value = "Unique Edge Name in scope of Tenant", example = "Silo_A_Edge") | |
119 | + @Override | |
120 | + public String getName() { | |
121 | + return this.name; | |
122 | + } | |
123 | + | |
124 | + @ApiModelProperty(position = 7, required = true, value = "Edge type", example = "Silos") | |
125 | + public String getType() { | |
126 | + return this.type; | |
127 | + } | |
128 | + | |
129 | + @ApiModelProperty(position = 8, value = "Label that may be used in widgets", example = "Silo Edge on far field") | |
130 | + public String getLabel() { | |
131 | + return this.label; | |
132 | + } | |
133 | + | |
85 | 134 | @Override |
86 | 135 | public String getSearchText() { |
87 | 136 | return getName(); |
88 | 137 | } |
138 | + | |
139 | + @ApiModelProperty(position = 9, required = true, value = "Edge routing key ('username') to authorize on cloud") | |
140 | + public String getRoutingKey() { | |
141 | + return this.routingKey; | |
142 | + } | |
143 | + | |
144 | + @ApiModelProperty(position = 10, required = true, value = "Edge secret ('password') to authorize on cloud") | |
145 | + public String getSecret() { | |
146 | + return this.secret; | |
147 | + } | |
148 | + | |
149 | + @ApiModelProperty(position = 11, required = true, value = "Edge license key obtained from license portal", example = "AgcnI24Z06XC&m6Sxsdgf") | |
150 | + public String getEdgeLicenseKey() { | |
151 | + return this.edgeLicenseKey; | |
152 | + } | |
153 | + | |
154 | + @ApiModelProperty(position = 12, required = true, value = "Edge uses this cloud URL to activate and periodically check it's license", example = "https://thingsboard.cloud") | |
155 | + public String getCloudEndpoint() { | |
156 | + return this.cloudEndpoint; | |
157 | + } | |
158 | + | |
89 | 159 | } | ... | ... |
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.common.data.edge; |
17 | 17 | |
18 | +import io.swagger.annotations.ApiModelProperty; | |
18 | 19 | import lombok.Data; |
19 | 20 | import org.thingsboard.server.common.data.EntityType; |
20 | 21 | import org.thingsboard.server.common.data.relation.EntityRelation; |
... | ... | @@ -28,8 +29,11 @@ import java.util.List; |
28 | 29 | @Data |
29 | 30 | public class EdgeSearchQuery { |
30 | 31 | |
32 | + @ApiModelProperty(position = 3, value = "Main search parameters.") | |
31 | 33 | private RelationsSearchParameters parameters; |
34 | + @ApiModelProperty(position = 1, value = "Type of the relation between root entity and edge (e.g. 'Contains' or 'Manages').") | |
32 | 35 | private String relationType; |
36 | + @ApiModelProperty(position = 2, value = "Array of edge types to filter the related entities (e.g. 'Silos', 'Stores').") | |
33 | 37 | private List<String> edgeTypes; |
34 | 38 | |
35 | 39 | public EntityRelationsQuery toEntitySearchQuery() { | ... | ... |