-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Assign an enterprise channel to a vendor (#127)
- Loading branch information
Showing
4 changed files
with
50 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,37 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
func (r *runners) InitEnterpriseChannelAssign(parent *cobra.Command) { | ||
cmd := &cobra.Command{ | ||
Use: "assign", | ||
SilenceUsage: true, | ||
Short: "assign a channel to a vendor", | ||
Long: `Assign a channel to a vendor team. | ||
Example: | ||
replicated enteprise channel assign --channel-id ChannelID --vendor-id VendorID`, | ||
} | ||
parent.AddCommand(cmd) | ||
|
||
cmd.Flags().StringVar(&r.args.enterpriseChannelAssignChannelID, "channel-id", "", "The id of the channel to be assigned") | ||
cmd.Flags().StringVar(&r.args.enterpriseChannelAssignVendorID, "vendor-id", "", "The id of the vendor to assign the channel to") | ||
|
||
cmd.RunE = r.enterpriseChannelAssign | ||
} | ||
|
||
func (r *runners) enterpriseChannelAssign(cmd *cobra.Command, args []string) error { | ||
err := r.enterpriseClient.AssignChannel(r.args.enterpriseChannelAssignChannelID, r.args.enterpriseChannelAssignVendorID) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Fprintf(r.w, "Channel successfully assigned\n") | ||
r.w.Flush() | ||
|
||
return nil | ||
} |
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
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
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