@@ -17,6 +17,7 @@ package cmd
17
17
import (
18
18
"errors"
19
19
"fmt"
20
+ "strings"
20
21
21
22
"github.com/equinor/radix-cli/generated-client/client/platform"
22
23
"github.com/equinor/radix-cli/generated-client/models"
@@ -37,6 +38,7 @@ var createApplicationCmd = &cobra.Command{
37
38
38
39
repository , _ := cmd .Flags ().GetString ("repository" )
39
40
owner , _ := cmd .Flags ().GetString ("owner" )
41
+ sharedSecret , _ := cmd .Flags ().GetString ("shared-secret" )
40
42
41
43
if appName == nil || * appName == "" || repository == "" || owner == "" {
42
44
return errors .New ("Application name, repository and owner are required fields" )
@@ -46,10 +48,11 @@ var createApplicationCmd = &cobra.Command{
46
48
47
49
registerApplicationParams := platform .NewRegisterApplicationParams ()
48
50
registerApplicationParams .SetApplicationRegistration (& models.ApplicationRegistration {
49
- Name : appName ,
50
- Repository : & repository ,
51
- Owner : & owner ,
52
- AdGroups : adGroups ,
51
+ Name : appName ,
52
+ Repository : & repository ,
53
+ Owner : & owner ,
54
+ SharedSecret : & sharedSecret ,
55
+ AdGroups : adGroups ,
53
56
})
54
57
55
58
apiClient , err := client .GetForCommand (cmd )
@@ -60,7 +63,7 @@ var createApplicationCmd = &cobra.Command{
60
63
resp , err := apiClient .Platform .RegisterApplication (registerApplicationParams , nil )
61
64
62
65
if err == nil {
63
- print (resp .Payload .PublicKey )
66
+ print (strings . TrimRight ( resp .Payload .PublicKey , " \t \n " ) )
64
67
} else {
65
68
println (fmt .Sprintf ("%v" , err ))
66
69
}
@@ -71,7 +74,8 @@ var createApplicationCmd = &cobra.Command{
71
74
72
75
func init () {
73
76
createApplicationCmd .Flags ().StringP ("application" , "" , "" , "Name of the application to create" )
74
- createApplicationCmd .Flags ().StringP ("repository" , "" , "" , "Repository" )
75
- createApplicationCmd .Flags ().StringP ("owner" , "" , "" , "Owner" )
77
+ createApplicationCmd .Flags ().StringP ("repository" , "" , "" , "Repository path" )
78
+ createApplicationCmd .Flags ().StringP ("owner" , "" , "" , "Email adress of owner" )
79
+ createApplicationCmd .Flags ().StringP ("shared-secret" , "" , "" , "Shared secret for the webhook" )
76
80
createApplicationCmd .Flags ().StringSliceP ("ad-groups" , "" , []string {}, "Admin groups" )
77
81
}
0 commit comments