Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/v20250312009/admin:
github.com/mongodb/atlas-sdk-go/admin:
config:
include-regex: ".*Api"
314 changes: 314 additions & 0 deletions admin/api_open_api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,314 @@
// Code based on the AtlasAPI V2 OpenAPI file

package admin

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

type OpenAPIApi interface {

/*
GetOpenapiInfo Return General Information on MongoDB Atlas Administration API OpenAPI Specification

This resource returns general information about the MongoDB Atlas Administration API OpenAPI Specification. Deprecated versions: v2-{2024-05-30}

@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return GetOpenapiInfoApiRequest
*/
GetOpenapiInfo(ctx context.Context) GetOpenapiInfoApiRequest
/*
GetOpenapiInfo Return General Information on MongoDB Atlas Administration API OpenAPI Specification


@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param GetOpenapiInfoApiParams - Parameters for the request
@return GetOpenapiInfoApiRequest
*/
GetOpenapiInfoWithParams(ctx context.Context, args *GetOpenapiInfoApiParams) GetOpenapiInfoApiRequest

// Method available only for mocking purposes
GetOpenapiInfoExecute(r GetOpenapiInfoApiRequest) (*OpenApiInfo, *http.Response, error)

/*
ListOpenapiVersions Return All Versions for One 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 ListOpenapiVersionsApiRequest
*/
ListOpenapiVersions(ctx context.Context) ListOpenapiVersionsApiRequest
/*
ListOpenapiVersions Return All Versions for One Environment


@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param ListOpenapiVersionsApiParams - Parameters for the request
@return ListOpenapiVersionsApiRequest
*/
ListOpenapiVersionsWithParams(ctx context.Context, args *ListOpenapiVersionsApiParams) ListOpenapiVersionsApiRequest

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

// OpenAPIApiService OpenAPIApi service
type OpenAPIApiService service

type GetOpenapiInfoApiRequest struct {
ctx context.Context
ApiService OpenAPIApi
}

type GetOpenapiInfoApiParams struct {
}

func (a *OpenAPIApiService) GetOpenapiInfoWithParams(ctx context.Context, args *GetOpenapiInfoApiParams) GetOpenapiInfoApiRequest {
return GetOpenapiInfoApiRequest{
ApiService: a,
ctx: ctx,
}
}

func (r GetOpenapiInfoApiRequest) Execute() (*OpenApiInfo, *http.Response, error) {
return r.ApiService.GetOpenapiInfoExecute(r)
}

/*
GetOpenapiInfo Return General Information on MongoDB Atlas Administration API OpenAPI Specification

This resource returns general information about the MongoDB Atlas Administration API OpenAPI Specification. Deprecated versions: v2-{2024-05-30}

@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return GetOpenapiInfoApiRequest
*/
func (a *OpenAPIApiService) GetOpenapiInfo(ctx context.Context) GetOpenapiInfoApiRequest {
return GetOpenapiInfoApiRequest{
ApiService: a,
ctx: ctx,
}
}

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

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

localVarPath := localBasePath + "/api/atlas/v2/openapi/info"

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

// 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
}

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

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

func (a *OpenAPIApiService) ListOpenapiVersionsWithParams(ctx context.Context, args *ListOpenapiVersionsApiParams) ListOpenapiVersionsApiRequest {
return ListOpenapiVersionsApiRequest{
ApiService: a,
ctx: ctx,
itemsPerPage: args.ItemsPerPage,
pageNum: args.PageNum,
env: args.Env,
}
}

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

// Number of the page that displays the current set of the total objects that the response returns.
func (r ListOpenapiVersionsApiRequest) PageNum(pageNum int) ListOpenapiVersionsApiRequest {
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 ListOpenapiVersionsApiRequest) Env(env string) ListOpenapiVersionsApiRequest {
r.env = &env
return r
}

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

/*
ListOpenapiVersions Return All Versions for One 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 ListOpenapiVersionsApiRequest
*/
func (a *OpenAPIApiService) ListOpenapiVersions(ctx context.Context) ListOpenapiVersionsApiRequest {
return ListOpenapiVersionsApiRequest{
ApiService: a,
ctx: ctx,
}
}

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

localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OpenAPIApiService.ListOpenapiVersions")
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
}
12 changes: 6 additions & 6 deletions admin/api_teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ import (
type TeamsApi interface {

/*
AddGroupTeams Add One Team to One Project
AddGroupTeams Add Multiple Teams to One Project

Adds one team to the specified project. All members of the team share the same project access. MongoDB Cloud limits the number of users to a maximum of 100 teams per project and a maximum of 250 teams per organization. To use this resource, the requesting Service Account or API Key must have the Project Owner role.
Adds multiple teams to the specified project. All members of a team share the same project access. MongoDB Cloud limits the number of users to a maximum of 100 teams per project and a maximum of 250 teams per organization. To use this resource, the requesting Service Account or API Key must have the Project Owner role.

@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param groupId Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
@param teamRole Team to add to the specified project.
@param teamRole Teams and their roles to be added to the specified project.
@return AddGroupTeamsApiRequest
*/
AddGroupTeams(ctx context.Context, groupId string, teamRole *[]TeamRole) AddGroupTeamsApiRequest
/*
AddGroupTeams Add One Team to One Project
AddGroupTeams Add Multiple Teams to One Project


@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
Expand Down Expand Up @@ -368,9 +368,9 @@ func (r AddGroupTeamsApiRequest) Execute() (*PaginatedTeamRole, *http.Response,
}

/*
AddGroupTeams Add One Team to One Project
AddGroupTeams Add Multiple Teams to One Project

Adds one team to the specified project. All members of the team share the same project access. MongoDB Cloud limits the number of users to a maximum of 100 teams per project and a maximum of 250 teams per organization. To use this resource, the requesting Service Account or API Key must have the Project Owner role.
Adds multiple teams to the specified project. All members of a team share the same project access. MongoDB Cloud limits the number of users to a maximum of 100 teams per project and a maximum of 250 teams per organization. To use this resource, the requesting Service Account or API Key must have the Project Owner role.

@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param groupId Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
Expand Down
8 changes: 4 additions & 4 deletions admin/api_third_party_integrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type ThirdPartyIntegrationsApi interface {
/*
GetGroupIntegration Return One Third-Party Service Integration

Returns the settings for configuring integration with one third-party service. These settings apply to all databases managed in one MongoDB Cloud project. To use this resource, the requesting Service Account or API Key must have the Organization Owner or Project Owner role. Viewing log export to S3, Splunk, and Datadog is currently in preview. Please contact your Customer Success Manager (CSM) for access.
Returns the settings for configuring integration with one third-party service. These settings apply to all databases managed in one MongoDB Cloud project. To use this resource, the requesting Service Account or API Key must have the Project Read Only role. Viewing log export to S3, Splunk, and Datadog is currently in preview. Please contact your Customer Success Manager (CSM) for access.

@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param groupId Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
Expand All @@ -88,7 +88,7 @@ type ThirdPartyIntegrationsApi interface {
/*
ListGroupIntegrations Return All Active Third-Party Service Integrations

Returns the settings that permit integrations with all configured third-party services. These settings apply to all databases managed in one MongoDB Cloud project. To use this resource, the requesting Service Account or API Key must have the Organization Owner or Project Owner role.
Returns the settings that permit integrations with all configured third-party services. These settings apply to all databases managed in one MongoDB Cloud project. To use this resource, the requesting Service Account or API Key must have the Project Read Only role.

@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param groupId Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
Expand Down Expand Up @@ -451,7 +451,7 @@ func (r GetGroupIntegrationApiRequest) Execute() (*ThirdPartyIntegration, *http.
/*
GetGroupIntegration Return One Third-Party Service Integration

Returns the settings for configuring integration with one third-party service. These settings apply to all databases managed in one MongoDB Cloud project. To use this resource, the requesting Service Account or API Key must have the Organization Owner or Project Owner role. Viewing log export to S3, Splunk, and Datadog is currently in preview. Please contact your Customer Success Manager (CSM) for access.
Returns the settings for configuring integration with one third-party service. These settings apply to all databases managed in one MongoDB Cloud project. To use this resource, the requesting Service Account or API Key must have the Project Read Only role. Viewing log export to S3, Splunk, and Datadog is currently in preview. Please contact your Customer Success Manager (CSM) for access.

@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param groupId Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
Expand Down Expand Up @@ -598,7 +598,7 @@ func (r ListGroupIntegrationsApiRequest) Execute() (*PaginatedIntegration, *http
/*
ListGroupIntegrations Return All Active Third-Party Service Integrations

Returns the settings that permit integrations with all configured third-party services. These settings apply to all databases managed in one MongoDB Cloud project. To use this resource, the requesting Service Account or API Key must have the Organization Owner or Project Owner role.
Returns the settings that permit integrations with all configured third-party services. These settings apply to all databases managed in one MongoDB Cloud project. To use this resource, the requesting Service Account or API Key must have the Project Read Only role.

@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param groupId Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
Expand Down
Loading