Skip to content

Commit

Permalink
feat: export, bulk delete cps
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
  • Loading branch information
TylerGillson committed Apr 2, 2024
1 parent 6997893 commit f6eec4a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions client/cluster_profile.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package client

import (
"bytes"
"fmt"
"io"
"os"

clientV1 "github.com/spectrocloud/palette-api-go/client/v1"
Expand Down Expand Up @@ -203,3 +205,25 @@ func (h *V1Client) UpdateProfileVariables(variables *models.V1Variables, uid str
_, err := h.Client.V1ClusterProfilesUIDVariablesPut(params)
return err
}

func (h *V1Client) ExportClusterProfile(uid, format string) (bytes.Buffer, error) {
var buf bytes.Buffer
writer := io.Writer(&buf)
params := clientV1.NewV1ClusterProfilesUIDExportParamsWithContext(h.ctx).
WithUID(uid).
WithFormat(&format)
_, err := h.Client.V1ClusterProfilesUIDExport(params, writer)
return buf, err
}

func (h *V1Client) BulkDeleteClusterProfiles(uids []string) (*models.V1BulkDeleteResponse, error) {
params := clientV1.NewV1ClusterProfilesBulkDeleteParamsWithContext(h.ctx).
WithBody(&models.V1BulkDeleteRequest{
Uids: uids,
})
resp, err := h.Client.V1ClusterProfilesBulkDelete(params)
if err != nil {
return nil, err
}
return resp.GetPayload(), nil
}

0 comments on commit f6eec4a

Please sign in to comment.