diff --git a/docs/atlascli/command/atlas-liveMigrations-create.txt b/docs/atlascli/command/atlas-liveMigrations-create.txt index 709d881739..29f1b04ab8 100644 --- a/docs/atlascli/command/atlas-liveMigrations-create.txt +++ b/docs/atlascli/command/atlas-liveMigrations-create.txt @@ -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 diff --git a/docs/atlascli/command/atlas-liveMigrations-validation-create.txt b/docs/atlascli/command/atlas-liveMigrations-validation-create.txt index 1d0ebfb8cd..efd93ce380 100644 --- a/docs/atlascli/command/atlas-liveMigrations-validation-create.txt +++ b/docs/atlascli/command/atlas-liveMigrations-validation-create.txt @@ -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 diff --git a/docs/mongocli/command/mongocli-atlas-liveMigrations-create.txt b/docs/mongocli/command/mongocli-atlas-liveMigrations-create.txt index f03b00b8be..3e23160980 100644 --- a/docs/mongocli/command/mongocli-atlas-liveMigrations-create.txt +++ b/docs/mongocli/command/mongocli-atlas-liveMigrations-create.txt @@ -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 diff --git a/docs/mongocli/command/mongocli-atlas-liveMigrations-validation-create.txt b/docs/mongocli/command/mongocli-atlas-liveMigrations-validation-create.txt index 465315fb43..f9d078a12c 100644 --- a/docs/mongocli/command/mongocli-atlas-liveMigrations-validation-create.txt +++ b/docs/mongocli/command/mongocli-atlas-liveMigrations-validation-create.txt @@ -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 diff --git a/internal/cli/atlas/livemigrations/create_test.go b/internal/cli/atlas/livemigrations/create_test.go index 7fac88a566..da4450bd75 100644 --- a/internal/cli/atlas/livemigrations/create_test.go +++ b/internal/cli/atlas/livemigrations/create_test.go @@ -65,7 +65,7 @@ func TestCreateBuilder(t *testing.T) { CreateBuilder(), 0, []string{ - flag.OrgID, + flag.ProjectID, flag.LiveMigrationSourceClusterName, flag.LiveMigrationSourceProjectID, flag.LiveMigrationSourceUsername, diff --git a/internal/cli/atlas/livemigrations/cutover.go b/internal/cli/atlas/livemigrations/cutover.go index c8ed8d16ee..a37da34510 100644 --- a/internal/cli/atlas/livemigrations/cutover.go +++ b/internal/cli/atlas/livemigrations/cutover.go @@ -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 } @@ -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, opts.initStore(cmd.Context()), opts.InitOutput(cmd.OutOrStdout(), cutoverTemplate), ) diff --git a/internal/cli/atlas/livemigrations/options/live_migrations_opts.go b/internal/cli/atlas/livemigrations/options/live_migrations_opts.go index bcd692dccc..0b957f368a 100644 --- a/internal/cli/atlas/livemigrations/options/live_migrations_opts.go +++ b/internal/cli/atlas/livemigrations/options/live_migrations_opts.go @@ -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) } @@ -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) 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) @@ -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) diff --git a/internal/cli/atlas/livemigrations/validation/create_test.go b/internal/cli/atlas/livemigrations/validation/create_test.go index 4b01750a64..bae1fc83e2 100644 --- a/internal/cli/atlas/livemigrations/validation/create_test.go +++ b/internal/cli/atlas/livemigrations/validation/create_test.go @@ -64,7 +64,7 @@ func TestCreateBuilder(t *testing.T) { CreateBuilder(), 0, []string{ - flag.OrgID, + flag.ProjectID, flag.LiveMigrationSourceClusterName, flag.LiveMigrationSourceProjectID, flag.LiveMigrationSourceUsername, diff --git a/internal/store/live_migrations.go b/internal/store/live_migrations.go index 9088f7ddba..9124387a45 100644 --- a/internal/store/live_migrations.go +++ b/internal/store/live_migrations.go @@ -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: @@ -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: