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

mongodb / mongodb-atlas-cli / 26228926989

21 May 2026 01:27PM UTC coverage: 22.63% (-41.6%) from 64.198%
26228926989

push

github

apix-bot[bot]
Update compliance report for v1.55.0

8987 of 39713 relevant lines covered (22.63%)

0.25 hits per line

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

6.82
/internal/cli/datafederation/querylimits/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-23T15:50:56+01:00. Note: Manual updates are allowed, but may be overwritten.
16

17
package querylimits
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=querylimits -source=delete.go
33

34
type DataFederationQueryLimitDeleter interface {
35
        DeleteDataFederationQueryLimit(string, string, string) error
36
}
37

38
type DeleteOpts struct {
39
        cli.ProjectOpts
40
        *cli.DeleteOpts
41
        store      DataFederationQueryLimitDeleter
42
        tenantName string
43
}
44

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

53
func (opts *DeleteOpts) Run() error {
1✔
54
        return opts.Delete(opts.store.DeleteDataFederationQueryLimit, opts.ConfigProjectID(), opts.tenantName)
1✔
55
}
1✔
56

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

89
        cmd.Flags().StringVar(&opts.tenantName, flag.DataFederation, "", usage.DataFederation)
×
90
        cmd.Flags().BoolVar(&opts.Confirm, flag.Force, false, usage.Force)
×
91
        opts.AddProjectOptsFlags(cmd)
×
92

×
93
        _ = cmd.MarkFlagRequired(flag.DataFederation)
×
94

×
95
        return cmd
×
96
}
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