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 Nov 11, 2024
1 parent 625dd5b commit 3754d2e
Show file tree
Hide file tree
Showing 123 changed files with 16,534 additions and 367 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/v20241023002/admin:
github.com/mongodb/atlas-sdk-go/admin:
config:
include-regex: ".*Api"
920 changes: 920 additions & 0 deletions admin/api_flex_clusters.go

Large diffs are not rendered by default.

505 changes: 505 additions & 0 deletions admin/api_flex_restore_jobs.go

Large diffs are not rendered by default.

505 changes: 505 additions & 0 deletions admin/api_flex_snapshots.go

Large diffs are not rendered by default.

1,274 changes: 1,176 additions & 98 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
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 3754d2e

Please sign in to comment.