From b6cdfd8b1b1814a0cb312567f5f561a66dffeb6f Mon Sep 17 00:00:00 2001 From: Andreas Pfurtscheller <1051396+aplr@users.noreply.github.com> Date: Tue, 9 Jul 2024 00:05:00 +0100 Subject: [PATCH] add version support --- packages/api/secrets/models.go | 1 + packages/api/secrets/retrieve_secret.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/packages/api/secrets/models.go b/packages/api/secrets/models.go index 6c257b9..c2b5d4e 100644 --- a/packages/api/secrets/models.go +++ b/packages/api/secrets/models.go @@ -31,6 +31,7 @@ type RetrieveSecretV3RawRequest struct { SecretPath string `json:"secretPath,omitempty"` Type string `json:"type,omitempty"` IncludeImports bool `json:"include_imports"` + Version int `json:"version"` } type RetrieveSecretV3RawResponse struct { diff --git a/packages/api/secrets/retrieve_secret.go b/packages/api/secrets/retrieve_secret.go index 36805bd..4ce6819 100644 --- a/packages/api/secrets/retrieve_secret.go +++ b/packages/api/secrets/retrieve_secret.go @@ -21,6 +21,11 @@ func CallRetrieveSecretV3(httpClient *resty.Client, request RetrieveSecretV3RawR request.SecretPath = "/" } + var version string + if request.Version > 0 { + version = fmt.Sprintf("%d", request.Version) + } + req := httpClient.R(). SetResult(&retrieveResponse). SetQueryParams(map[string]string{ @@ -29,6 +34,7 @@ func CallRetrieveSecretV3(httpClient *resty.Client, request RetrieveSecretV3RawR "secretPath": request.SecretPath, "include_imports": fmt.Sprintf("%t", request.IncludeImports), "type": request.Type, + "version": version, }) res, err := req.Get(fmt.Sprintf("/v3/secrets/raw/%s", request.SecretKey))