• 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

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
        Deprecated           bool
54
        RequestContentType   string
55
        ResponseContentTypes []string
56
}
57

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

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

72
type ParameterConcreteType string
73

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

80
type HTTPVerb string
81

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

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

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

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

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

117
type WatcherMatchProperties struct {
118
        Path   string
119
        Values []string
120
}
121

122
// NewSunset creates a pointer to a time.Time representing a sunset date.
123
// It takes year, month, and day parameters and returns a *time.Time set to UTC midnight.
124
func NewSunset(year int, month int, day int) *time.Time {
×
125
        t := time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.UTC)
×
126
        return &t
×
127
}
×
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