-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #998 from jihoon-seo/211126_Update_gRPC_codes_2
Update gRPC codes (2)
- Loading branch information
Showing
14 changed files
with
1,671 additions
and
834 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,45 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// ===== [ Constants and Variables ] ===== | ||
|
||
// ===== [ Types ] ===== | ||
|
||
// ===== [ Implementations ] ===== | ||
|
||
// ===== [ Private Functions ] ===== | ||
|
||
// ===== [ Public Functions ] ===== | ||
|
||
// NewCommonResourceCmd : "cbadm commonresource *" (for CB-Spider) | ||
func NewCommonResourceCmd() *cobra.Command { | ||
|
||
commonResourceCmd := &cobra.Command{ | ||
Use: "commonresource", | ||
Short: "This is a manageable command for common resources", | ||
Long: "This is a manageable command for common resources", | ||
} | ||
|
||
// Adds the commands for application. | ||
commonResourceCmd.AddCommand(NewCommonResourceLoadCmd()) | ||
|
||
return commonResourceCmd | ||
} | ||
|
||
// NewCommonResourceLoadCmd : "cbadm commonresource load" | ||
func NewCommonResourceLoadCmd() *cobra.Command { | ||
|
||
loadCmd := &cobra.Command{ | ||
Use: "load", | ||
Short: "Load common resources into the namespace 'common'.", | ||
Long: "Load common resources into the namespace 'common'.", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
SetupAndRun(cmd, args) | ||
}, | ||
} | ||
|
||
return loadCmd | ||
} |
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,65 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/cloud-barista/cb-tumblebug/src/api/grpc/logger" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// ===== [ Constants and Variables ] ===== | ||
|
||
// ===== [ Types ] ===== | ||
|
||
// ===== [ Implementations ] ===== | ||
|
||
// ===== [ Private Functions ] ===== | ||
|
||
// ===== [ Public Functions ] ===== | ||
|
||
// NewDefaultResourceCmd : "cbadm defaultresource *" (for CB-Spider) | ||
func NewDefaultResourceCmd() *cobra.Command { | ||
|
||
defaultResourceCmd := &cobra.Command{ | ||
Use: "defaultresource", | ||
Short: "This is a manageable command for default resources", | ||
Long: "This is a manageable command for default resources", | ||
} | ||
|
||
// Adds the commands for application. | ||
defaultResourceCmd.AddCommand(NewDefaultResourceLoadCmd()) | ||
|
||
return defaultResourceCmd | ||
} | ||
|
||
// NewDefaultResourceLoadCmd : "cbadm defaultresource load" | ||
func NewDefaultResourceLoadCmd() *cobra.Command { | ||
|
||
loadCmd := &cobra.Command{ | ||
Use: "load", | ||
Short: "Load default resources into the namespace 'default'.", | ||
Long: "Load default resources into the namespace 'default'.", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
logger := logger.NewLogger() | ||
if nameSpaceID == "" { | ||
logger.Error("failed to validate --ns parameter") | ||
return | ||
} else if resourceType == "" { | ||
logger.Error("failed to validate --resourceType parameter") | ||
return | ||
} //else if connConfigName == "" { | ||
// logger.Error("failed to validate --connConfigName parameter") | ||
// return | ||
// } | ||
logger.Debug("--ns parameter value : ", nameSpaceID) | ||
logger.Debug("--resourceType parameter value : ", resourceType) | ||
logger.Debug("--connConfigName parameter value : ", connConfigName) | ||
|
||
SetupAndRun(cmd, args) | ||
}, | ||
} | ||
|
||
loadCmd.PersistentFlags().StringVarP(&nameSpaceID, "ns", "", "", "namespace id") | ||
loadCmd.PersistentFlags().StringVarP(&resourceType, "resourceType", "", "", "resource type [all, vnet, sg, sshkey]") | ||
loadCmd.PersistentFlags().StringVarP(&connConfigName, "connConfigName", "", "", "connection config name (optional)") | ||
|
||
return loadCmd | ||
} |
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
Oops, something went wrong.