forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added launchplan update command and moved namedentity (flyteorg#170)
* Added launchplan update command and moved namedentity Signed-off-by: Prafulla Mahindrakar <[email protected]>
- Loading branch information
1 parent
c611187
commit 9502a24
Showing
15 changed files
with
392 additions
and
34 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
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,14 @@ | ||
package launchplan | ||
|
||
//go:generate pflags UpdateConfig --default-var UConfig --bind-default-var | ||
var ( | ||
UConfig = &UpdateConfig{} | ||
) | ||
|
||
// Config | ||
type UpdateConfig struct { | ||
Archive bool `json:"archive" pflag:",archive launchplan."` | ||
Activate bool `json:"activate" pflag:",activate launchplan."` | ||
DryRun bool `json:"dryRun" pflag:",execute command without making any modifications."` | ||
Version string `json:"version" pflag:",version of the launchplan to be fetched."` | ||
} |
58 changes: 58 additions & 0 deletions
58
flytectl/cmd/config/subcommand/launchplan/updateconfig_flags.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
158 changes: 158 additions & 0 deletions
158
flytectl/cmd/config/subcommand/launchplan/updateconfig_flags_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package update | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/flyteorg/flytectl/clierrors" | ||
"github.com/flyteorg/flytectl/cmd/config" | ||
cmdCore "github.com/flyteorg/flytectl/cmd/core" | ||
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" | ||
) | ||
|
||
const ( | ||
updateLPMetaShort = "Updates launch plan metadata" | ||
updateLPMetaLong = ` | ||
Following command updates the description on the launchplan. | ||
:: | ||
flytectl update launchplan -p flytectldemo -d development core.advanced.run_merge_sort.merge_sort --description "Mergesort example" | ||
Archiving launchplan named entity is not supported and would throw an error. | ||
:: | ||
flytectl update launchplan -p flytectldemo -d development core.advanced.run_merge_sort.merge_sort --archive | ||
Activating launchplan named entity would be a noop. | ||
:: | ||
flytectl update launchplan -p flytectldemo -d development core.advanced.run_merge_sort.merge_sort --activate | ||
Usage | ||
` | ||
) | ||
|
||
func updateLPMetaFunc(ctx context.Context, args []string, cmdCtx cmdCore.CommandContext) error { | ||
project := config.GetConfig().Project | ||
domain := config.GetConfig().Domain | ||
if len(args) != 1 { | ||
return fmt.Errorf(clierrors.ErrLPNotPassed) | ||
} | ||
name := args[0] | ||
err := namedEntityConfig.UpdateNamedEntity(ctx, name, project, domain, core.ResourceType_LAUNCH_PLAN, cmdCtx) | ||
if err != nil { | ||
fmt.Printf(clierrors.ErrFailedLPUpdate, name, err) | ||
return err | ||
} | ||
fmt.Printf("updated metadata successfully on %v", name) | ||
return nil | ||
} |
Oops, something went wrong.