-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdelete.go
More file actions
101 lines (79 loc) · 3.17 KB
/
delete.go
File metadata and controls
101 lines (79 loc) · 3.17 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package delete
import (
"io"
"github.com/ibm-verify/verify-sdk-go/pkg/i18n"
"github.com/ibm-verify/verifyctl/pkg/config"
cmdutil "github.com/ibm-verify/verifyctl/pkg/util/cmd"
"github.com/ibm-verify/verifyctl/pkg/util/templates"
"github.com/spf13/cobra"
)
const (
usage = "delete [resource-type] --name=name"
messagePrefix = "Delete"
)
var (
shortDesc = cmdutil.TranslateShortDesc(messagePrefix, "Delete a Verify resource.")
longDesc = templates.LongDesc(cmdutil.TranslateLongDesc(messagePrefix, `
Delete a Verify resource.
Resources managed on Verify require specific entitlements, so ensure that the application or API client used
with the 'auth' command is configured with the appropriate entitlements.
You can identify the entitlement required by running:
verifyctl delete [resource-type] --entitlements
Certain resources may offer additional options and can be determined using:
verifyctl delete [resource-type] -h`))
examples = templates.Examples(cmdutil.TranslateExamples(messagePrefix, `
# Delete an application
verifyctl delete application --applicationID "applicationID"`))
entitlementsMessage = i18n.Translate("Choose any of the following entitlements to configure your application or API client:\n")
)
type options struct {
entitlements bool
name string
config *config.CLIConfig
}
func NewCommand(config *config.CLIConfig, streams io.ReadWriter, groupID string) *cobra.Command {
o := &options{
config: config,
}
cmd := &cobra.Command{
Use: usage,
Short: shortDesc,
Long: longDesc,
Example: examples,
DisableFlagsInUseLine: true,
Run: func(cmd *cobra.Command, args []string) {
cmdutil.ExitOnError(cmd, o.Complete(cmd, args))
cmdutil.ExitOnError(cmd, o.Validate(cmd, args))
cmdutil.ExitOnError(cmd, o.Run(cmd, args))
},
GroupID: groupID,
}
cmd.SetOut(streams)
cmd.SetErr(streams)
cmd.SetIn(streams)
// add sub commands
cmd.AddCommand(NewUserCommand(config, streams))
cmd.AddCommand(NewGroupCommand(config, streams))
cmd.AddCommand(NewAccessPolicyCommand(config, streams))
cmd.AddCommand(NewIdentitySourceCommand(config, streams))
cmd.AddCommand(NewAPIClientCommand(config, streams))
cmd.AddCommand(NewApplicationCommand(config, streams))
cmd.AddCommand(NewIdentityAgentCommand(config, streams))
cmd.AddCommand(NewPasswordPolicyCommand(config, streams))
cmd.AddCommand(NewAttributeCommand(config, streams))
cmd.AddCommand(NewPersonalCertCommand(config, streams))
cmd.AddCommand(NewSignerCertCommand(config, streams))
return cmd
}
func (o *options) addCommonFlags(cmd *cobra.Command) {
cmd.Flags().BoolVar(&o.entitlements, "entitlements", o.entitlements, i18n.Translate("List the entitlements that can be configured to grant access to the resource. This is useful to know what to configure on the application or API client used to generate the login token. When this flag is used, the others are ignored."))
}
func (o *options) Complete(cmd *cobra.Command, args []string) error {
return nil
}
func (o *options) Validate(cmd *cobra.Command, args []string) error {
return nil
}
func (o *options) Run(cmd *cobra.Command, args []string) error {
return nil
}