Skip to content

Commit

Permalink
temp: client update
Browse files Browse the repository at this point in the history
wtrocki authored and github-actions[bot] committed Nov 25, 2024
1 parent 74bb991 commit b62d352
Showing 113 changed files with 9,794 additions and 639 deletions.
2 changes: 1 addition & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
@@ -6,6 +6,6 @@ filename: "{{ .InterfaceName | snakecase }}.go"
mockname: "{{.InterfaceName}}"

packages:
go.mongodb.org/atlas-sdk/v20241113001/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
@@ -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.
@@ -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.
1,582 changes: 1,485 additions & 97 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
}
22 changes: 11 additions & 11 deletions admin/api_organizations.go
Original file line number Diff line number Diff line change
@@ -236,7 +236,7 @@ type OrganizationsApi interface {
/*
ListOrganizationUsers Return All MongoDB Cloud Users in One Organization
Returns details about the MongoDB Cloud users associated with the specified organization. Each MongoDB Cloud user returned must belong to the specified organization or to a project within the specified organization. To use this resource, the requesting API Key must have the Organization Member role.
Returns details about the MongoDB Cloud users associated with the specified organization. Each MongoDB Cloud user returned must belong to the specified organization or to a project within the specified organization. To use this resource, the requesting API Key must have the Organization Member role. Deprecated versions: v2-{2023-01-01}
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@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.
@@ -254,7 +254,7 @@ type OrganizationsApi interface {
ListOrganizationUsersWithParams(ctx context.Context, args *ListOrganizationUsersApiParams) ListOrganizationUsersApiRequest

// Method available only for mocking purposes
ListOrganizationUsersExecute(r ListOrganizationUsersApiRequest) (*PaginatedAppUser, *http.Response, error)
ListOrganizationUsersExecute(r ListOrganizationUsersApiRequest) (*PaginatedOrgUser, *http.Response, error)

/*
ListOrganizations Return All Organizations
@@ -281,7 +281,7 @@ type OrganizationsApi interface {
/*
RemoveOrganizationUser Remove One MongoDB Cloud User From One Organization
Removes one MongoDB Cloud user from the specified organization. To use this resource, the requesting API Key must have the Organization User Admin role.
Removes one MongoDB Cloud user from the specified organization. To use this resource, the requesting API Key must have the Organization User Admin role. Deprecated versions: v2-{2023-01-01}
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@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.
@@ -1580,14 +1580,14 @@ func (r ListOrganizationUsersApiRequest) PageNum(pageNum int) ListOrganizationUs
return r
}

func (r ListOrganizationUsersApiRequest) Execute() (*PaginatedAppUser, *http.Response, error) {
func (r ListOrganizationUsersApiRequest) Execute() (*PaginatedOrgUser, *http.Response, error) {
return r.ApiService.ListOrganizationUsersExecute(r)
}

/*
ListOrganizationUsers Return All MongoDB Cloud Users in One Organization
Returns details about the MongoDB Cloud users associated with the specified organization. Each MongoDB Cloud user returned must belong to the specified organization or to a project within the specified organization. To use this resource, the requesting API Key must have the Organization Member role.
Returns details about the MongoDB Cloud users associated with the specified organization. Each MongoDB Cloud user returned must belong to the specified organization or to a project within the specified organization. To use this resource, the requesting API Key must have the Organization Member role. Deprecated versions: v2-{2023-01-01}
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@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.
@@ -1603,13 +1603,13 @@ func (a *OrganizationsApiService) ListOrganizationUsers(ctx context.Context, org

// ListOrganizationUsersExecute executes the request
//
// @return PaginatedAppUser
func (a *OrganizationsApiService) ListOrganizationUsersExecute(r ListOrganizationUsersApiRequest) (*PaginatedAppUser, *http.Response, error) {
// @return PaginatedOrgUser
func (a *OrganizationsApiService) ListOrganizationUsersExecute(r ListOrganizationUsersApiRequest) (*PaginatedOrgUser, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody any
formFiles []formFile
localVarReturnValue *PaginatedAppUser
localVarReturnValue *PaginatedOrgUser
)

localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.ListOrganizationUsers")
@@ -1655,7 +1655,7 @@ func (a *OrganizationsApiService) ListOrganizationUsersExecute(r ListOrganizatio
}

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

// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
@@ -1887,7 +1887,7 @@ func (r RemoveOrganizationUserApiRequest) Execute() (any, *http.Response, error)
/*
RemoveOrganizationUser Remove One MongoDB Cloud User From One Organization
Removes one MongoDB Cloud user from the specified organization. To use this resource, the requesting API Key must have the Organization User Admin role.
Removes one MongoDB Cloud user from the specified organization. To use this resource, the requesting API Key must have the Organization User Admin role. Deprecated versions: v2-{2023-01-01}
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@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.
@@ -1937,7 +1937,7 @@ func (a *OrganizationsApiService) RemoveOrganizationUserExecute(r RemoveOrganiza
}

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

// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
Loading

0 comments on commit b62d352

Please sign in to comment.