-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkspace_outputs.go
More file actions
33 lines (28 loc) · 932 Bytes
/
workspace_outputs.go
File metadata and controls
33 lines (28 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package api
import (
"context"
"fmt"
"github.com/google/uuid"
"gopkg.in/nullstone-io/go-api-client.v0/response"
"gopkg.in/nullstone-io/go-api-client.v0/types"
"net/http"
"net/url"
)
type WorkspaceOutputs struct {
Client *Client
}
func (w WorkspaceOutputs) path(stackId int64, workspaceUid uuid.UUID) string {
return fmt.Sprintf("orgs/%s/stacks/%d/workspaces/%s/current-outputs", w.Client.Config.OrgName, stackId, workspaceUid)
}
// GetCurrent - GET /orgs/:orgName/stacks/:stackId/workspaces/:workspaceUid/current-outputs
func (w WorkspaceOutputs) GetCurrent(ctx context.Context, stackId int64, workspaceUid uuid.UUID, showSensitive bool) (types.Outputs, error) {
q := url.Values{}
if showSensitive {
q.Set("show_sensitive", "true")
}
res, err := w.Client.Do(ctx, http.MethodGet, w.path(stackId, workspaceUid), q, nil, nil)
if err != nil {
return nil, err
}
return response.ReadJsonVal[types.Outputs](res)
}