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

mongodb / mongodb-atlas-cli / 18284572001

06 Oct 2025 02:43PM UTC coverage: 64.3%. Remained the same
18284572001

push

github

GitHub
CLOUDP-345026: Update the L1 generation tool to support x-xgen-operation-id-override (#4233)

25691 of 39955 relevant lines covered (64.3%)

0.8 hits per line

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

0.0
/tools/shared/api/api.go
1
// Copyright 2024 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
package api
16

17
import (
18
        "fmt"
19
        "net/http"
20
        "strings"
21
        "time"
22
)
23

24
type GroupedAndSortedCommands []Group
25

26
type Group struct {
27
        Name        string
28
        Description string
29
        Commands    []Command
30
}
31

32
type Command struct {
33
        OperationID       string
34
        ShortOperationID  string
35
        Aliases           []string
36
        Description       string
37
        RequestParameters RequestParameters
38
        Versions          []CommandVersion
39
        Watcher           *WatcherProperties
40
}
41

42
type RequestParameters struct {
43
        URL             string
44
        QueryParameters []Parameter
45
        URLParameters   []Parameter
46
        Verb            string
47
}
48

49
type CommandVersion struct {
50
        Version              Version
51
        Sunset               *time.Time
52
        PublicPreview        bool
53
        RequestContentType   string
54
        ResponseContentTypes []string
55
}
56

57
type Parameter struct {
58
        Name        string
59
        Aliases     []string
60
        Short       string
61
        Description string
62
        Required    bool
63
        Type        ParameterType
64
}
65

66
type ParameterType struct {
67
        IsArray bool
68
        Type    ParameterConcreteType
69
}
70

71
type ParameterConcreteType string
72

73
const (
74
        TypeString ParameterConcreteType = "string"
75
        TypeInt    ParameterConcreteType = "int"
76
        TypeBool   ParameterConcreteType = "bool"
77
)
78

79
type HTTPVerb string
80

81
func ToHTTPVerb(s string) (string, error) {
×
82
        verb := strings.ToUpper(s)
×
83

×
84
        switch verb {
×
85
        case http.MethodDelete:
×
86
                return "http.MethodDelete", nil
×
87
        case http.MethodGet:
×
88
                return "http.MethodGet", nil
×
89
        case http.MethodPatch:
×
90
                return "http.MethodPatch", nil
×
91
        case http.MethodPost:
×
92
                return "http.MethodPost", nil
×
93
        case http.MethodPut:
×
94
                return "http.MethodPut", nil
×
95
        default:
×
96
                return "", fmt.Errorf("invalid HTTP verb: %s", s)
×
97
        }
98
}
99

100
type WatcherProperties struct {
101
        Get    WatcherGetProperties
102
        Expect *WatcherExpectProperties
103
}
104

105
type WatcherGetProperties struct {
106
        OperationID string
107
        Version     Version
108
        Params      map[string]string
109
}
110

111
type WatcherExpectProperties struct {
112
        HTTPCode int
113
        Match    *WatcherMatchProperties
114
}
115

116
type WatcherMatchProperties struct {
117
        Path   string
118
        Values []string
119
}
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