mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 17:28:54 +00:00
0122f6cb0a
This PR adds the `host_ids` and `label_ids` field to the packs HTTP API so that one can operate on the hosts/labels which a pack is scheduled to be executed on. This replaces (and deletes) the `/api/v1/kolide/packs/123/labels/456` API in favor of `PATCH /api/v1/packs/123` and specifying the `label_ids` field. This also allows for bulk operations. Consider the following API examples: ## Creating a pack with a known set of hosts and labels The key addition is the `host_ids` and `label_ids` field in both the request and the response. ### Request ``` POST /api/v1/kolide/packs ``` ```json { "name": "My new pack", "description": "The newest of the packs", "host_ids": [1, 2, 3], "label_ids": [1, 3, 5] } ``` ### Response ```json { "pack": { "id": 123, "name": "My new pack", "description": "The newest of the packs", "platform": "", "created_by": 1, "disabled": false, "query_count": 0, "total_hosts_count": 5, "host_ids": [1, 2, 3], "label_ids": [1, 3, 5] } } ``` ## Modifying the hosts and/or labels that a pack is scheduled to execute on ### Request ``` PATCH /api/v1/kolide/packs/123 ``` ```json { "host_ids": [1, 2, 3, 4, 5], "label_ids": [1, 3, 5, 7] } ``` ### Response ```json { "pack": { "id": 123, "name": "My new pack", "description": "The newest of the packs", "platform": "", "created_by": 1, "disabled": false, "query_count": 0, "total_hosts_count": 5, "host_ids": [1, 2, 3, 4, 5], "label_ids": [1, 3, 5, 7] } } ``` close #633 |
||
---|---|---|
.. | ||
inmem | ||
internal/appstate | ||
mysql | ||
datastore_app_test.go | ||
datastore_campaigns_test.go | ||
datastore_hosts_test.go | ||
datastore_invites_test.go | ||
datastore_labels_test.go | ||
datastore_options_test.go | ||
datastore_packs_test.go | ||
datastore_password_reset_test.go | ||
datastore_queries_test.go | ||
datastore_scheduled_queries_test.go | ||
datastore_test.go | ||
datastore_users_test.go | ||
inmem_test.go | ||
mysql_test.go |