Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/ctrlc/root/api/upsert/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func NewUpsertPolicyCmd() *cobra.Command {
}

// Create policy request
body := api.CreatePolicyJSONRequestBody{
body := api.UpsertPolicyJSONRequestBody{
Name: name,
WorkspaceId: workspaceId,
Description: &description,
Expand All @@ -115,7 +115,7 @@ func NewUpsertPolicyCmd() *cobra.Command {
DeploymentVersionSelector: parsedDeploymentVersionSelector,
}

resp, err := client.CreatePolicy(cmd.Context(), body)
resp, err := client.UpsertPolicy(cmd.Context(), body)
if err != nil {
return fmt.Errorf("failed to create policy: %w", err)
}
Expand Down
29 changes: 8 additions & 21 deletions cmd/ctrlc/root/api/upsert/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,14 @@ func NewUpsertResourceCmd() *cobra.Command {
}

// Extrat into vars
resp, err := client.UpsertResources(cmd.Context(), api.UpsertResourcesJSONRequestBody{
Resources: []struct {
Config map[string]interface{} `json:"config"`
Identifier string `json:"identifier"`
Kind string `json:"kind"`
Metadata *map[string]string `json:"metadata,omitempty"`
Name string `json:"name"`
Variables *[]api.Variable `json:"variables,omitempty"`
Version string `json:"version"`
}{
{
Version: version,
Identifier: identifier,
Metadata: &metadata,
Name: name,
Kind: kind,
Config: config,
Variables: variablesRequest,
},
},

resp, err := client.UpsertResource(cmd.Context(), api.UpsertResourceJSONRequestBody{
Config: config,
Identifier: identifier,
Kind: kind,
Metadata: &metadata,
Name: name,
Variables: variablesRequest,
Version: version,
WorkspaceId: uuid.Must(uuid.Parse(workspaceId)),
})

Expand Down
Loading