Skip to content

Commit

Permalink
temp: client update
Browse files Browse the repository at this point in the history
  • Loading branch information
wtrocki authored and github-actions[bot] committed Dec 4, 2024
1 parent 7a3496b commit b6a5591
Show file tree
Hide file tree
Showing 128 changed files with 11,798 additions and 925 deletions.
2 changes: 1 addition & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ filename: "{{ .InterfaceName | snakecase }}.go"
mockname: "{{.InterfaceName}}"

packages:
go.mongodb.org/atlas-sdk/v20241113002/admin:
github.com/mongodb/atlas-sdk-go/admin:
config:
include-regex: ".*Api"
4 changes: 2 additions & 2 deletions admin/api_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ type EventsApi interface {
/*
ListProjectEvents Return All Events from One Project
Returns one event for the specified project. Events identify significant database, billing, or security activities or status changes. To use this resource, the requesting API Key must have the Project Read Only role.
Returns all events for the specified project. Events identify significant database, billing, or security activities or status changes. To use this resource, the requesting API Key must have the Project Read Only role.
This resource remains under revision and may change.
Expand Down Expand Up @@ -888,7 +888,7 @@ func (r ListProjectEventsApiRequest) Execute() (*GroupPaginatedEvent, *http.Resp
/*
ListProjectEvents Return All Events from One Project
Returns one event for the specified project. Events identify significant database, billing, or security activities or status changes. To use this resource, the requesting API Key must have the Project Read Only role.
Returns all events for the specified project. Events identify significant database, billing, or security activities or status changes. To use this resource, the requesting API Key must have the Project Read Only role.
This resource remains under revision and may change.
Expand Down
1,886 changes: 1,790 additions & 96 deletions admin/api_mongo_db_cloud_users.go

Large diffs are not rendered by default.

187 changes: 187 additions & 0 deletions admin/api_open_api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
// Code based on the AtlasAPI V2 OpenAPI file

package admin

import (
"context"
"io"
"net/http"
"net/url"
)

type OpenAPIApi interface {

/*
GetApiVersions Provides a list of versions for a given environment.
API that provides a list of available versionsfor a given environment.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return GetApiVersionsApiRequest
*/
GetApiVersions(ctx context.Context) GetApiVersionsApiRequest
/*
GetApiVersions Provides a list of versions for a given environment.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param GetApiVersionsApiParams - Parameters for the request
@return GetApiVersionsApiRequest
*/
GetApiVersionsWithParams(ctx context.Context, args *GetApiVersionsApiParams) GetApiVersionsApiRequest

// Method available only for mocking purposes
GetApiVersionsExecute(r GetApiVersionsApiRequest) (*PaginatedApiVersions, *http.Response, error)
}

// OpenAPIApiService OpenAPIApi service
type OpenAPIApiService service

type GetApiVersionsApiRequest struct {
ctx context.Context
ApiService OpenAPIApi
itemsPerPage *int
pageNum *int
env *string
}

type GetApiVersionsApiParams struct {
ItemsPerPage *int
PageNum *int
Env *string
}

func (a *OpenAPIApiService) GetApiVersionsWithParams(ctx context.Context, args *GetApiVersionsApiParams) GetApiVersionsApiRequest {
return GetApiVersionsApiRequest{
ApiService: a,
ctx: ctx,
itemsPerPage: args.ItemsPerPage,
pageNum: args.PageNum,
env: args.Env,
}
}

// Number of items that the response returns per page.
func (r GetApiVersionsApiRequest) ItemsPerPage(itemsPerPage int) GetApiVersionsApiRequest {
r.itemsPerPage = &itemsPerPage
return r
}

// Number of the page that displays the current set of the total objects that the response returns.
func (r GetApiVersionsApiRequest) PageNum(pageNum int) GetApiVersionsApiRequest {
r.pageNum = &pageNum
return r
}

// The environment to get the versions from. If not provided, it returnsthe versions for the given MongoDB URL. (E.g. prod for cloud.mongodb.com)
func (r GetApiVersionsApiRequest) Env(env string) GetApiVersionsApiRequest {
r.env = &env
return r
}

func (r GetApiVersionsApiRequest) Execute() (*PaginatedApiVersions, *http.Response, error) {
return r.ApiService.GetApiVersionsExecute(r)
}

/*
GetApiVersions Provides a list of versions for a given environment.
API that provides a list of available versionsfor a given environment.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return GetApiVersionsApiRequest
*/
func (a *OpenAPIApiService) GetApiVersions(ctx context.Context) GetApiVersionsApiRequest {
return GetApiVersionsApiRequest{
ApiService: a,
ctx: ctx,
}
}

// GetApiVersionsExecute executes the request
//
// @return PaginatedApiVersions
func (a *OpenAPIApiService) GetApiVersionsExecute(r GetApiVersionsApiRequest) (*PaginatedApiVersions, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody any
formFiles []formFile
localVarReturnValue *PaginatedApiVersions
)

localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OpenAPIApiService.GetApiVersions")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}

localVarPath := localBasePath + "/api/atlas/v2/unauth/openapi/versions"

localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}

if r.itemsPerPage != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "itemsPerPage", r.itemsPerPage, "")
} else {
var defaultValue int = 100
r.itemsPerPage = &defaultValue
parameterAddToHeaderOrQuery(localVarQueryParams, "itemsPerPage", r.itemsPerPage, "")
}
if r.pageNum != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "pageNum", r.pageNum, "")
} else {
var defaultValue int = 1
r.pageNum = &defaultValue
parameterAddToHeaderOrQuery(localVarQueryParams, "pageNum", r.pageNum, "")
}
if r.env != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "env", r.env, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}

// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}

// to determine the Accept header (only first one)
localVarHTTPHeaderAccepts := []string{"application/vnd.atlas.2024-08-05+json"}

// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}

localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := a.client.makeApiError(localVarHTTPResponse, localVarHTTPMethod, localVarPath)
return localVarReturnValue, localVarHTTPResponse, newErr
}

err = a.client.decode(&localVarReturnValue, localVarHTTPResponse.Body, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
defer localVarHTTPResponse.Body.Close()
buf, readErr := io.ReadAll(localVarHTTPResponse.Body)
if readErr != nil {
err = readErr
}
newErr := &GenericOpenAPIError{
body: buf,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

return localVarReturnValue, localVarHTTPResponse, nil
}
Loading

0 comments on commit b6a5591

Please sign in to comment.