Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/atlascli/command/atlas-liveMigrations-create.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ Options
- strings
- true
- List of hosts running the MongoDB Agent that can transfer your MongoDB data from the source (Cloud Manager or Ops Manager) to destination (Atlas) deployments. Each live migration process uses its own dedicated migration host.
* - --orgId
- string
- false
- Organization ID to use. Overrides the settings in the configuration file or environment variable.
* - -o, --output
- string
- false
- Output format. Valid values are json, json-path, go-template, or go-template-file.
* - --projectId
- string
- false
- Project ID to use. Overrides the settings in the configuration file or environment variable.
* - --sourceCACertificatePath
- string
- false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ Options
- strings
- true
- List of hosts running the MongoDB Agent that can transfer your MongoDB data from the source (Cloud Manager or Ops Manager) to destination (Atlas) deployments. Each live migration process uses its own dedicated migration host.
* - --orgId
- string
- false
- Organization ID to use. Overrides the settings in the configuration file or environment variable.
* - -o, --output
- string
- false
- Output format. Valid values are json, json-path, go-template, or go-template-file.
* - --projectId
- string
- false
- Project ID to use. Overrides the settings in the configuration file or environment variable.
* - --sourceCACertificatePath
- string
- false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ Options
- strings
- true
- List of hosts running the MongoDB Agent that can transfer your MongoDB data from the source (Cloud Manager or Ops Manager) to destination (Atlas) deployments. Each live migration process uses its own dedicated migration host.
* - --orgId
- string
- false
- Organization ID to use. Overrides the settings in the configuration file or environment variable.
* - -o, --output
- string
- false
- Output format. Valid values are json, json-path, go-template, or go-template-file.
* - --projectId
- string
- false
- Project ID to use. Overrides the settings in the configuration file or environment variable.
* - --sourceCACertificatePath
- string
- false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ Options
- strings
- true
- List of hosts running the MongoDB Agent that can transfer your MongoDB data from the source (Cloud Manager or Ops Manager) to destination (Atlas) deployments. Each live migration process uses its own dedicated migration host.
* - --orgId
- string
- false
- Organization ID to use. Overrides the settings in the configuration file or environment variable.
* - -o, --output
- string
- false
- Output format. Valid values are json, json-path, go-template, or go-template-file.
* - --projectId
- string
- false
- Project ID to use. Overrides the settings in the configuration file or environment variable.
* - --sourceCACertificatePath
- string
- false
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/atlas/livemigrations/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestCreateBuilder(t *testing.T) {
CreateBuilder(),
0,
[]string{
flag.OrgID,
flag.ProjectID,
flag.LiveMigrationSourceClusterName,
flag.LiveMigrationSourceProjectID,
flag.LiveMigrationSourceUsername,
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/atlas/livemigrations/cutover.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (opts *CutoverOpts) initStore(ctx context.Context) func() error {
}

func (opts *CutoverOpts) Run() error {
r, err := opts.store.CreateLiveMigrationCutover(opts.ConfigOrgID(), opts.liveMigrationID)
r, err := opts.store.CreateLiveMigrationCutover(opts.ConfigProjectID(), opts.liveMigrationID)
if err != nil {
return err
}
Expand All @@ -60,7 +60,7 @@ func CutoverBuilder() *cobra.Command {
Long: "Your API Key must have the Organization Owner role to successfully run this command.",
PreRunE: func(cmd *cobra.Command, args []string) error {
return opts.PreRunE(
opts.ValidateOrgID,
opts.ValidateProjectID,
Copy link
Collaborator

@colm-quinn colm-quinn Dec 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done here on the prompt reply.

Not blocking: Can you do a quick audit of the other LiveMigration commands to make sure they are using the correct parameter? Patterns like this tend to happen in multiple places easily, so would be good to confirm in case it's in other places.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

opts.initStore(cmd.Context()),
opts.InitOutput(cmd.OutOrStdout(), cutoverTemplate),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ func (opts *LiveMigrationsOpts) Validate() error {
return err
}

if opts.SourceManagedAuthentication && opts.SourceUsername != "" {
return fmt.Errorf("--%s and --%s are exclusive", flag.LiveMigrationSourceManagedAuthentication, flag.LiveMigrationSourceUsername)
}
if !opts.SourceManagedAuthentication && opts.SourceUsername == "" {
return fmt.Errorf("MongoDB Automation is not managing authentication, --%s must be set", flag.LiveMigrationSourceUsername)
}
Expand All @@ -138,7 +135,7 @@ func (opts *LiveMigrationsOpts) Validate() error {
}

func (opts *LiveMigrationsOpts) GenerateFlags(cmd *cobra.Command) {
cmd.Flags().StringVar(&opts.OrgID, flag.OrgID, "", usage.OrgID)
cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 128, there's a built in feature now for that can you migrate to it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

cmd.Flags().StringVar(&opts.SourceClusterName, flag.LiveMigrationSourceClusterName, "", usage.LiveMigrationSourceClusterName)
cmd.Flags().StringVar(&opts.SourceProjectID, flag.LiveMigrationSourceProjectID, "", usage.LiveMigrationSourceProjectID)
cmd.Flags().StringVarP(&opts.SourceUsername, flag.LiveMigrationSourceUsername, flag.UsernameShort, "", usage.LiveMigrationSourceUsername)
Expand All @@ -152,6 +149,8 @@ func (opts *LiveMigrationsOpts) GenerateFlags(cmd *cobra.Command) {
cmd.Flags().BoolVar(&opts.Force, flag.Force, false, usage.Force)
cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut)

cmd.MarkFlagsMutuallyExclusive(flag.LiveMigrationSourceManagedAuthentication, flag.LiveMigrationSourceUsername)

_ = cmd.MarkFlagRequired(flag.LiveMigrationSourceClusterName)
_ = cmd.MarkFlagRequired(flag.LiveMigrationSourceProjectID)
_ = cmd.MarkFlagRequired(flag.ClusterName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestCreateBuilder(t *testing.T) {
CreateBuilder(),
0,
[]string{
flag.OrgID,
flag.ProjectID,
flag.LiveMigrationSourceClusterName,
flag.LiveMigrationSourceProjectID,
flag.LiveMigrationSourceUsername,
Expand Down
4 changes: 2 additions & 2 deletions internal/store/live_migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type LiveMigrationDescriber interface {
LiveMigrationDescribe(string, string) (*atlas.LiveMigration, error)
}

// LiveMigrationCreate encapsulate the logic to manage different cloud providers.
// LiveMigrationCreate encapsulates the logic to manage different cloud providers.
func (s *Store) LiveMigrationCreate(groupID string, liveMigration *atlas.LiveMigration) (*atlas.LiveMigration, error) {
switch s.service {
case config.CloudService:
Expand All @@ -43,7 +43,7 @@ func (s *Store) LiveMigrationCreate(groupID string, liveMigration *atlas.LiveMig
}
}

// LiveMigrationCreate encapsulate the logic to manage different cloud providers.
// LiveMigrationDescribe encapsulates the logic to manage different cloud providers.
func (s *Store) LiveMigrationDescribe(groupID, migrationID string) (*atlas.LiveMigration, error) {
switch s.service {
case config.CloudService:
Expand Down