Skip to content

Commit

Permalink
Merge pull request #662 from kishen-v/support-ws-name
Browse files Browse the repository at this point in the history
Support port creation through workspace name
  • Loading branch information
Power Cloud Robot authored Sep 12, 2024
2 parents a1e721f + b858367 commit 602f144
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 3 additions & 0 deletions cmd/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ func init() {
Cmd.PersistentFlags().StringVarP(&pkg.Options.WorkspaceID, "instance-id", "i", "", "Instance ID of the PowerVS instance")
Cmd.PersistentFlags().MarkDeprecated("instance-id", "instance-id is deprecated, workspace-id should be used")
Cmd.PersistentFlags().StringVarP(&pkg.Options.WorkspaceID, "workspace-id", "", "", "Workspace ID of the PowerVS workspace")
Cmd.PersistentFlags().StringVarP(&pkg.Options.WorkspaceName, "instance-name", "n", "", "Instance name of the PowerVS instance")
Cmd.PersistentFlags().MarkDeprecated("instance-name", "instance-name is deprecated, workspace-name should be used")
Cmd.PersistentFlags().StringVarP(&pkg.Options.WorkspaceName, "workspace-name", "", "", "Workspace name of the PowerVS workspace")
}
5 changes: 1 addition & 4 deletions cmd/create/port/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ var Cmd = &cobra.Command{
Short: "Create PowerVS network port",
Long: `Create PowerVS network port`,
PreRunE: func(cmd *cobra.Command, args []string) error {
if pkg.Options.WorkspaceID == "" {
return fmt.Errorf("--workspace-id required")
}
return nil
return utils.EnsureWorkspaceIDorNameIsSet(pkg.Options.WorkspaceID, pkg.Options.WorkspaceName)
},
RunE: func(cmd *cobra.Command, args []string) error {
opt := pkg.Options
Expand Down

0 comments on commit 602f144

Please sign in to comment.