/
create.go
40 lines (34 loc) · 908 Bytes
/
create.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
package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var createExample = `
# Create an ExecAccessRequest with ExecAccessTemplate "some-template"
ozctl create ExecAccessRequest --target some-template
# Create a PodAccessRequest with PodAccessTemplate "some-template"
ozctl create PodAccessRequest --target some-template
`
var createCmd = &cobra.Command{
Use: "create <resource> ...options",
Short: "Command used to create an Access Request",
Long: `This command creates the Access Request objects for you and waits until they are available.`,
Example: createExample,
Args: cobra.NoArgs,
PreRunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
if err := cmd.Help(); err != nil {
fmt.Println(err)
os.Exit(1)
}
os.Exit(0)
}
return nil
},
Run: func(_ *cobra.Command, _ []string) {
},
}
func init() {
rootCmd.AddCommand(createCmd)
}