• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mongodb / mongodb-atlas-cli / 25848964073

14 May 2026 07:59AM UTC coverage: 22.479% (-41.3%) from 63.771%
25848964073

push

github

web-flow
build(deps): bump test-summary/action from 2.4 to 2.6 (#4576)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

8987 of 39979 relevant lines covered (22.48%)

0.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

7.32
/internal/cli/datafederation/delete.go
1
// Copyright 2023 MongoDB Inc
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15
// This code was autogenerated at 2023-06-21T13:32:20+01:00. Note: Manual updates are allowed, but may be overwritten.
16

17
package datafederation
18

19
import (
20
        "context"
21
        "fmt"
22

23
        "github.com/mongodb/atlas-cli-core/config"
24
        "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli"
25
        "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli/require"
26
        "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/flag"
27
        "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store"
28
        "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/usage"
29
        "github.com/spf13/cobra"
30
)
31

32
//go:generate go tool go.uber.org/mock/mockgen -typed -destination=delete_mock_test.go -package=datafederation -source=delete.go
33

34
type Deleter interface {
35
        DeleteDataFederation(string, string) error
36
}
37
type DeleteOpts struct {
38
        cli.ProjectOpts
39
        *cli.DeleteOpts
40
        store Deleter
41
}
42

43
func (opts *DeleteOpts) initStore(ctx context.Context) func() error {
×
44
        return func() error {
×
45
                var err error
×
46
                opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx))
×
47
                return err
×
48
        }
×
49
}
50

51
func (opts *DeleteOpts) Run() error {
1✔
52
        return opts.Delete(opts.store.DeleteDataFederation, opts.ConfigProjectID())
1✔
53
}
1✔
54

55
// atlas dataFederation delete <name> [--projectId projectId].
56
func DeleteBuilder() *cobra.Command {
×
57
        opts := &DeleteOpts{
×
58
                DeleteOpts: cli.NewDeleteOpts("'%s' deleted\n", "Not deleted"),
×
59
        }
×
60
        cmd := &cobra.Command{
×
61
                Use:   "delete <name>",
×
62
                Short: "Remove the specified data federation database from your project.",
×
63
                Long:  fmt.Sprintf(usage.RequiredRole, "Project Owner"),
×
64
                Args:  require.ExactArgs(1),
×
65
                Annotations: map[string]string{
×
66
                        "nameDesc": "Name of the data federation database.",
×
67
                        "output":   opts.SuccessMessage(),
×
68
                },
×
69
                Example: `# deletes data federation 'DataFederation1':
×
70
  atlas dataFederation delete DataFederation1
×
71
`,
×
72
                PreRunE: func(cmd *cobra.Command, args []string) error {
×
73
                        if err := opts.PreRunE(
×
74
                                opts.ValidateProjectID,
×
75
                                opts.initStore(cmd.Context()),
×
76
                        ); err != nil {
×
77
                                return err
×
78
                        }
×
79
                        opts.Entry = args[0]
×
80
                        return opts.Prompt()
×
81
                },
82
                RunE: func(_ *cobra.Command, _ []string) error {
×
83
                        return opts.Run()
×
84
                },
×
85
        }
86

87
        cmd.Flags().BoolVar(&opts.Confirm, flag.Force, false, usage.Force)
×
88
        opts.AddProjectOptsFlags(cmd)
×
89

×
90
        return cmd
×
91
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc