Skip to content

Commit 398702c

Browse files
APIBot: SDK update based on recent changes in Atlas API (#375)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: wtrocki <[email protected]>
1 parent 84b0cdd commit 398702c

File tree

159 files changed

+4984
-701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+4984
-701
lines changed

.mockery.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ filename: "{{ .InterfaceName | snakecase }}.go"
66
mockname: "{{.InterfaceName}}"
77

88
packages:
9-
go.mongodb.org/atlas-sdk/v20240805001/admin:
9+
go.mongodb.org/atlas-sdk/v20240805002/admin:
1010
config:
1111
include-regex: ".*Api"

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Note that `atlas-sdk-go` only supports the two most recent major versions of Go.
1212
### Adding Dependency
1313

1414
```terminal
15-
go get go.mongodb.org/atlas-sdk/v20240805001
15+
go get go.mongodb.org/atlas-sdk/v20240805002
1616
```
1717

1818
### Using in the code
@@ -21,7 +21,7 @@ Construct a new Atlas SDK client, then use the various services on the client to
2121
access different parts of the Atlas API. For example:
2222

2323
```go
24-
import "go.mongodb.org/atlas-sdk/v20240805001/admin"
24+
import "go.mongodb.org/atlas-sdk/v20240805002/admin"
2525

2626
func example() {
2727
ctx := context.Background()

admin/api_invoices.go

+183
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,31 @@ type InvoicesApi interface {
157157

158158
// Method available only for mocking purposes
159159
ListPendingInvoicesExecute(r ListPendingInvoicesApiRequest) (*PaginatedApiInvoice, *http.Response, error)
160+
161+
/*
162+
QueryLineItemsFromSingleInvoice Query lineItems of the specified invoiceId
163+
164+
Query the lineItems of the specified invoice and return the result JSON. A unique 24-hexadecimal digit string identifies the invoice.
165+
166+
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
167+
@param orgId Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.
168+
@param invoiceId Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.
169+
@param apiPublicUsageDetailsQueryRequest Filter parameters for the lineItems query. Send a request with an empty JSON body to retrieve all line items for a given invoiceID without applying any filters.
170+
@return QueryLineItemsFromSingleInvoiceApiRequest
171+
*/
172+
QueryLineItemsFromSingleInvoice(ctx context.Context, orgId string, invoiceId string, apiPublicUsageDetailsQueryRequest *ApiPublicUsageDetailsQueryRequest) QueryLineItemsFromSingleInvoiceApiRequest
173+
/*
174+
QueryLineItemsFromSingleInvoice Query lineItems of the specified invoiceId
175+
176+
177+
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
178+
@param QueryLineItemsFromSingleInvoiceApiParams - Parameters for the request
179+
@return QueryLineItemsFromSingleInvoiceApiRequest
180+
*/
181+
QueryLineItemsFromSingleInvoiceWithParams(ctx context.Context, args *QueryLineItemsFromSingleInvoiceApiParams) QueryLineItemsFromSingleInvoiceApiRequest
182+
183+
// Method available only for mocking purposes
184+
QueryLineItemsFromSingleInvoiceExecute(r QueryLineItemsFromSingleInvoiceApiRequest) (*PaginatedPublicApiUsageDetailsLineItem, *http.Response, error)
160185
}
161186

162187
// InvoicesApiService InvoicesApi service
@@ -994,3 +1019,161 @@ func (a *InvoicesApiService) ListPendingInvoicesExecute(r ListPendingInvoicesApi
9941019

9951020
return localVarReturnValue, localVarHTTPResponse, nil
9961021
}
1022+
1023+
type QueryLineItemsFromSingleInvoiceApiRequest struct {
1024+
ctx context.Context
1025+
ApiService InvoicesApi
1026+
orgId string
1027+
invoiceId string
1028+
apiPublicUsageDetailsQueryRequest *ApiPublicUsageDetailsQueryRequest
1029+
itemsPerPage *int
1030+
pageNum *int
1031+
}
1032+
1033+
type QueryLineItemsFromSingleInvoiceApiParams struct {
1034+
OrgId string
1035+
InvoiceId string
1036+
ApiPublicUsageDetailsQueryRequest *ApiPublicUsageDetailsQueryRequest
1037+
ItemsPerPage *int
1038+
PageNum *int
1039+
}
1040+
1041+
func (a *InvoicesApiService) QueryLineItemsFromSingleInvoiceWithParams(ctx context.Context, args *QueryLineItemsFromSingleInvoiceApiParams) QueryLineItemsFromSingleInvoiceApiRequest {
1042+
return QueryLineItemsFromSingleInvoiceApiRequest{
1043+
ApiService: a,
1044+
ctx: ctx,
1045+
orgId: args.OrgId,
1046+
invoiceId: args.InvoiceId,
1047+
apiPublicUsageDetailsQueryRequest: args.ApiPublicUsageDetailsQueryRequest,
1048+
itemsPerPage: args.ItemsPerPage,
1049+
pageNum: args.PageNum,
1050+
}
1051+
}
1052+
1053+
// Number of items that the response returns per page.
1054+
func (r QueryLineItemsFromSingleInvoiceApiRequest) ItemsPerPage(itemsPerPage int) QueryLineItemsFromSingleInvoiceApiRequest {
1055+
r.itemsPerPage = &itemsPerPage
1056+
return r
1057+
}
1058+
1059+
// Number of the page that displays the current set of the total objects that the response returns.
1060+
func (r QueryLineItemsFromSingleInvoiceApiRequest) PageNum(pageNum int) QueryLineItemsFromSingleInvoiceApiRequest {
1061+
r.pageNum = &pageNum
1062+
return r
1063+
}
1064+
1065+
func (r QueryLineItemsFromSingleInvoiceApiRequest) Execute() (*PaginatedPublicApiUsageDetailsLineItem, *http.Response, error) {
1066+
return r.ApiService.QueryLineItemsFromSingleInvoiceExecute(r)
1067+
}
1068+
1069+
/*
1070+
QueryLineItemsFromSingleInvoice Query lineItems of the specified invoiceId
1071+
1072+
Query the lineItems of the specified invoice and return the result JSON. A unique 24-hexadecimal digit string identifies the invoice.
1073+
1074+
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
1075+
@param orgId Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.
1076+
@param invoiceId Unique 24-hexadecimal digit string that identifies the invoice submitted to the specified organization. Charges typically post the next day.
1077+
@return QueryLineItemsFromSingleInvoiceApiRequest
1078+
*/
1079+
func (a *InvoicesApiService) QueryLineItemsFromSingleInvoice(ctx context.Context, orgId string, invoiceId string, apiPublicUsageDetailsQueryRequest *ApiPublicUsageDetailsQueryRequest) QueryLineItemsFromSingleInvoiceApiRequest {
1080+
return QueryLineItemsFromSingleInvoiceApiRequest{
1081+
ApiService: a,
1082+
ctx: ctx,
1083+
orgId: orgId,
1084+
invoiceId: invoiceId,
1085+
apiPublicUsageDetailsQueryRequest: apiPublicUsageDetailsQueryRequest,
1086+
}
1087+
}
1088+
1089+
// Execute executes the request
1090+
//
1091+
// @return PaginatedPublicApiUsageDetailsLineItem
1092+
func (a *InvoicesApiService) QueryLineItemsFromSingleInvoiceExecute(r QueryLineItemsFromSingleInvoiceApiRequest) (*PaginatedPublicApiUsageDetailsLineItem, *http.Response, error) {
1093+
var (
1094+
localVarHTTPMethod = http.MethodGet
1095+
localVarPostBody interface{}
1096+
formFiles []formFile
1097+
localVarReturnValue *PaginatedPublicApiUsageDetailsLineItem
1098+
)
1099+
1100+
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "InvoicesApiService.QueryLineItemsFromSingleInvoice")
1101+
if err != nil {
1102+
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
1103+
}
1104+
1105+
localVarPath := localBasePath + "/api/atlas/v2/orgs/{orgId}/invoices/{invoiceId}/lineItems/:search"
1106+
localVarPath = strings.Replace(localVarPath, "{"+"orgId"+"}", url.PathEscape(parameterValueToString(r.orgId, "orgId")), -1)
1107+
localVarPath = strings.Replace(localVarPath, "{"+"invoiceId"+"}", url.PathEscape(parameterValueToString(r.invoiceId, "invoiceId")), -1)
1108+
1109+
localVarHeaderParams := make(map[string]string)
1110+
localVarQueryParams := url.Values{}
1111+
localVarFormParams := url.Values{}
1112+
if r.apiPublicUsageDetailsQueryRequest == nil {
1113+
return localVarReturnValue, nil, reportError("apiPublicUsageDetailsQueryRequest is required and must be specified")
1114+
}
1115+
1116+
if r.itemsPerPage != nil {
1117+
parameterAddToHeaderOrQuery(localVarQueryParams, "itemsPerPage", r.itemsPerPage, "")
1118+
} else {
1119+
var defaultValue int = 100
1120+
r.itemsPerPage = &defaultValue
1121+
parameterAddToHeaderOrQuery(localVarQueryParams, "itemsPerPage", r.itemsPerPage, "")
1122+
}
1123+
if r.pageNum != nil {
1124+
parameterAddToHeaderOrQuery(localVarQueryParams, "pageNum", r.pageNum, "")
1125+
} else {
1126+
var defaultValue int = 1
1127+
r.pageNum = &defaultValue
1128+
parameterAddToHeaderOrQuery(localVarQueryParams, "pageNum", r.pageNum, "")
1129+
}
1130+
// to determine the Content-Type header
1131+
localVarHTTPContentTypes := []string{"application/vnd.atlas.2024-08-05+json"}
1132+
1133+
// set Content-Type header
1134+
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
1135+
if localVarHTTPContentType != "" {
1136+
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
1137+
}
1138+
1139+
// to determine the Accept header
1140+
localVarHTTPHeaderAccepts := []string{"application/vnd.atlas.2024-08-05+json", "application/json"}
1141+
1142+
// set Accept header
1143+
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
1144+
if localVarHTTPHeaderAccept != "" {
1145+
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
1146+
}
1147+
// body params
1148+
localVarPostBody = r.apiPublicUsageDetailsQueryRequest
1149+
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
1150+
if err != nil {
1151+
return localVarReturnValue, nil, err
1152+
}
1153+
1154+
localVarHTTPResponse, err := a.client.callAPI(req)
1155+
if err != nil || localVarHTTPResponse == nil {
1156+
return localVarReturnValue, localVarHTTPResponse, err
1157+
}
1158+
1159+
if localVarHTTPResponse.StatusCode >= 300 {
1160+
newErr := a.client.makeApiError(localVarHTTPResponse, localVarHTTPMethod, localVarPath)
1161+
return localVarReturnValue, localVarHTTPResponse, newErr
1162+
}
1163+
1164+
err = a.client.decode(&localVarReturnValue, localVarHTTPResponse.Body, localVarHTTPResponse.Header.Get("Content-Type"))
1165+
if err != nil {
1166+
defer localVarHTTPResponse.Body.Close()
1167+
buf, readErr := io.ReadAll(localVarHTTPResponse.Body)
1168+
if readErr != nil {
1169+
err = readErr
1170+
}
1171+
newErr := &GenericOpenAPIError{
1172+
body: buf,
1173+
error: err.Error(),
1174+
}
1175+
return localVarReturnValue, localVarHTTPResponse, newErr
1176+
}
1177+
1178+
return localVarReturnValue, localVarHTTPResponse, nil
1179+
}

admin/atlas_client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package admin // import "go.mongodb.org/atlas-sdk/v20240805001/admin"
1+
package admin // import "go.mongodb.org/atlas-sdk/v20240805002/admin"
22

33
import (
44
"errors"
@@ -8,7 +8,7 @@ import (
88
"strings"
99

1010
"github.com/mongodb-forks/digest"
11-
"go.mongodb.org/atlas-sdk/v20240805001/internal/core"
11+
"go.mongodb.org/atlas-sdk/v20240805002/internal/core"
1212
)
1313

1414
const (
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
// Code based on the AtlasAPI V2 OpenAPI file
2+
3+
package admin
4+
5+
import (
6+
"encoding/json"
7+
)
8+
9+
// ApiPublicUsageDetailsQueryRequest Request body for an Invoice Usage Details query with filtering, pagination, and sort.
10+
type ApiPublicUsageDetailsQueryRequest struct {
11+
Filters *UsageDetailsFilterRequest `json:"filters,omitempty"`
12+
// Specify the field used to specify how to sort query results. Default to bill date.
13+
SortField *string `json:"sortField,omitempty"`
14+
// Specify the sort order (ascending / descending) used to specify how to sort query results. Defaults to descending.
15+
SortOrder *string `json:"sortOrder,omitempty"`
16+
}
17+
18+
// NewApiPublicUsageDetailsQueryRequest instantiates a new ApiPublicUsageDetailsQueryRequest object
19+
// This constructor will assign default values to properties that have it defined,
20+
// and makes sure properties required by API are set, but the set of arguments
21+
// will change when the set of required properties is changed
22+
func NewApiPublicUsageDetailsQueryRequest() *ApiPublicUsageDetailsQueryRequest {
23+
this := ApiPublicUsageDetailsQueryRequest{}
24+
return &this
25+
}
26+
27+
// NewApiPublicUsageDetailsQueryRequestWithDefaults instantiates a new ApiPublicUsageDetailsQueryRequest object
28+
// This constructor will only assign default values to properties that have it defined,
29+
// but it doesn't guarantee that properties required by API are set
30+
func NewApiPublicUsageDetailsQueryRequestWithDefaults() *ApiPublicUsageDetailsQueryRequest {
31+
this := ApiPublicUsageDetailsQueryRequest{}
32+
return &this
33+
}
34+
35+
// GetFilters returns the Filters field value if set, zero value otherwise
36+
func (o *ApiPublicUsageDetailsQueryRequest) GetFilters() UsageDetailsFilterRequest {
37+
if o == nil || IsNil(o.Filters) {
38+
var ret UsageDetailsFilterRequest
39+
return ret
40+
}
41+
return *o.Filters
42+
}
43+
44+
// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise
45+
// and a boolean to check if the value has been set.
46+
func (o *ApiPublicUsageDetailsQueryRequest) GetFiltersOk() (*UsageDetailsFilterRequest, bool) {
47+
if o == nil || IsNil(o.Filters) {
48+
return nil, false
49+
}
50+
51+
return o.Filters, true
52+
}
53+
54+
// HasFilters returns a boolean if a field has been set.
55+
func (o *ApiPublicUsageDetailsQueryRequest) HasFilters() bool {
56+
if o != nil && !IsNil(o.Filters) {
57+
return true
58+
}
59+
60+
return false
61+
}
62+
63+
// SetFilters gets a reference to the given UsageDetailsFilterRequest and assigns it to the Filters field.
64+
func (o *ApiPublicUsageDetailsQueryRequest) SetFilters(v UsageDetailsFilterRequest) {
65+
o.Filters = &v
66+
}
67+
68+
// GetSortField returns the SortField field value if set, zero value otherwise
69+
func (o *ApiPublicUsageDetailsQueryRequest) GetSortField() string {
70+
if o == nil || IsNil(o.SortField) {
71+
var ret string
72+
return ret
73+
}
74+
return *o.SortField
75+
}
76+
77+
// GetSortFieldOk returns a tuple with the SortField field value if set, nil otherwise
78+
// and a boolean to check if the value has been set.
79+
func (o *ApiPublicUsageDetailsQueryRequest) GetSortFieldOk() (*string, bool) {
80+
if o == nil || IsNil(o.SortField) {
81+
return nil, false
82+
}
83+
84+
return o.SortField, true
85+
}
86+
87+
// HasSortField returns a boolean if a field has been set.
88+
func (o *ApiPublicUsageDetailsQueryRequest) HasSortField() bool {
89+
if o != nil && !IsNil(o.SortField) {
90+
return true
91+
}
92+
93+
return false
94+
}
95+
96+
// SetSortField gets a reference to the given string and assigns it to the SortField field.
97+
func (o *ApiPublicUsageDetailsQueryRequest) SetSortField(v string) {
98+
o.SortField = &v
99+
}
100+
101+
// GetSortOrder returns the SortOrder field value if set, zero value otherwise
102+
func (o *ApiPublicUsageDetailsQueryRequest) GetSortOrder() string {
103+
if o == nil || IsNil(o.SortOrder) {
104+
var ret string
105+
return ret
106+
}
107+
return *o.SortOrder
108+
}
109+
110+
// GetSortOrderOk returns a tuple with the SortOrder field value if set, nil otherwise
111+
// and a boolean to check if the value has been set.
112+
func (o *ApiPublicUsageDetailsQueryRequest) GetSortOrderOk() (*string, bool) {
113+
if o == nil || IsNil(o.SortOrder) {
114+
return nil, false
115+
}
116+
117+
return o.SortOrder, true
118+
}
119+
120+
// HasSortOrder returns a boolean if a field has been set.
121+
func (o *ApiPublicUsageDetailsQueryRequest) HasSortOrder() bool {
122+
if o != nil && !IsNil(o.SortOrder) {
123+
return true
124+
}
125+
126+
return false
127+
}
128+
129+
// SetSortOrder gets a reference to the given string and assigns it to the SortOrder field.
130+
func (o *ApiPublicUsageDetailsQueryRequest) SetSortOrder(v string) {
131+
o.SortOrder = &v
132+
}
133+
134+
func (o ApiPublicUsageDetailsQueryRequest) MarshalJSONWithoutReadOnly() ([]byte, error) {
135+
toSerialize, err := o.ToMap()
136+
if err != nil {
137+
return []byte{}, err
138+
}
139+
return json.Marshal(toSerialize)
140+
}
141+
func (o ApiPublicUsageDetailsQueryRequest) ToMap() (map[string]interface{}, error) {
142+
toSerialize := map[string]interface{}{}
143+
if !IsNil(o.Filters) {
144+
toSerialize["filters"] = o.Filters
145+
}
146+
if !IsNil(o.SortField) {
147+
toSerialize["sortField"] = o.SortField
148+
}
149+
if !IsNil(o.SortOrder) {
150+
toSerialize["sortOrder"] = o.SortOrder
151+
}
152+
return toSerialize, nil
153+
}

admin/model_cloud_provider_access_awsiam_role.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type CloudProviderAccessAWSIAMRole struct {
3131
RoleId *string `json:"roleId,omitempty"`
3232
// Human-readable label that identifies the cloud provider of the role.
3333
ProviderName string `json:"providerName"`
34-
// Unique 24-hexadecimal digit string that identifies the Azure Service Principal in Atlas.
34+
// Unique 24-hexadecimal digit string that identifies the role.
3535
// Read only field.
3636
Id *string `json:"_id,omitempty"`
3737
// Azure Active Directory Application ID of Atlas.

0 commit comments

Comments
 (0)