Files
fleet/server/service/client_secret_variables.go
T
Lucas Manuel RodriguezandCopilot Autofix powered by AI 441e31c705 Move targets and secret variables to server/fleet/ (#46196)
Resolves #36087 (one of several PRs).

## Testing

- [x] QA'd all new/changed functionality manually.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
  * Dry-run support when creating secret variables.

* **Improvements**
* Standardized API models for secret-variables and targets for more
consistent behavior.
  * List secret variables now includes pagination metadata.
* More consistent error reporting across secret-variables and targets
APIs.
* Target search/count behavior refined: pre-selected built-in labels are
omitted as expected.

* **Tests**
* Integration tests updated to validate the new request/response
behavior and target-selection logic.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/fleetdm/fleet/pull/46196?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-03 15:07:54 -03:00

14 lines
465 B
Go

package service
import "github.com/fleetdm/fleet/v4/server/fleet"
func (c *Client) SaveSecretVariables(secretVariables []fleet.SecretVariable, dryRun bool) error {
verb, path := "PUT", "/api/latest/fleet/spec/secret_variables"
params := fleet.CreateSecretVariablesRequest{
SecretVariables: secretVariables,
DryRun: dryRun,
}
var responseBody fleet.CreateSecretVariablesResponse
return c.authenticatedRequest(params, verb, path, &responseBody)
}