/
apps-set-include.go
53 lines (43 loc) · 1.07 KB
/
apps-set-include.go
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package cmd
import (
"context"
"github.com/freshly/tuber/graph/model"
"github.com/spf13/cobra"
)
var appsSetIncludeCmd = &cobra.Command{
SilenceErrors: true,
SilenceUsage: true,
Use: "include [app name] [resource kind] [resource name]",
Short: "delete an exclusion for a resource that would otherwise prevent it from being deployed along with this app",
Args: cobra.ExactArgs(3),
PreRunE: promptCurrentContext,
RunE: runAppsSetInclude,
}
func runAppsSetInclude(cmd *cobra.Command, args []string) error {
graphql, err := gqlClient()
if err != nil {
return err
}
appName := args[0]
kind := args[1]
name := args[2]
input := &model.SetResourceInput{
AppName: appName,
Kind: kind,
Name: name,
}
var respData struct {
unsetExcludedResource *model.TuberApp
}
gql := `
mutation($input: SetResourceInput!) {
unsetExcludedResource(input: $input) {
name
}
}
`
return graphql.Mutation(context.Background(), gql, nil, input, &respData)
}
func init() {
appsSetCmd.AddCommand(appsSetIncludeCmd)
}