This repository has been archived by the owner on May 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package crtdev | ||
|
||
import ( | ||
"../../shared" | ||
"github.com/spf13/cobra" | ||
"net/url" | ||
"path" | ||
"strings" | ||
) | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "create", | ||
Short: "Create a developer", | ||
Long: "Create a developer", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
u, _ := url.Parse(shared.BaseURL) | ||
|
||
developer := []string{} | ||
|
||
developer = append(developer, "\"email\":\""+email+"\"") | ||
developer = append(developer, "\"firstName\":\""+firstName+"\"") | ||
developer = append(developer, "\"lastName\":\""+lastName+"\"") | ||
developer = append(developer, "\"userName\":\""+userName+"\"") | ||
|
||
payload := "{"+strings.Join(developer,",")+"}" | ||
u.Path = path.Join(u.Path, shared.RootArgs.Org, "developers") | ||
shared.HttpClient(u.String(), payload) | ||
}, | ||
} | ||
|
||
var email, lastName, firstName, userName string | ||
|
||
func init() { | ||
|
||
Cmd.Flags().StringVarP(&email, "email", "n", | ||
"", "The developer's email") | ||
Cmd.Flags().StringVarP(&firstName, "first", "f", | ||
"", "The first name of the developer") | ||
Cmd.Flags().StringVarP(&lastName, "last", "s", | ||
"", "The last name of the developer") | ||
Cmd.Flags().StringVarP(&userName, "user", "u", | ||
"", "The username of the developer") | ||
|
||
Cmd.MarkFlagRequired("email") | ||
Cmd.MarkFlagRequired("first") | ||
Cmd.MarkFlagRequired("last") | ||
Cmd.MarkFlagRequired("user") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package deldev | ||
|
||
import ( | ||
"../../shared" | ||
"github.com/spf13/cobra" | ||
"net/url" | ||
"path" | ||
) | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "delete", | ||
Short: "Deletes an App Developer from an organization", | ||
Long: "Deletes an App Developer from an organization", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
u, _ := url.Parse(shared.BaseURL) | ||
u.Path = path.Join(u.Path, shared.RootArgs.Org, "developers", name) | ||
shared.HttpClient(u.String(),"","DELETE") | ||
}, | ||
} | ||
|
||
var name string | ||
|
||
func init() { | ||
|
||
Cmd.Flags().StringVarP(&name, "name", "n", | ||
"", "Name of the developer") | ||
|
||
Cmd.MarkFlagRequired("name") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters