Skip to content

Commit 5cdb685

Browse files
APIBot: SDK update based on recent changes in Atlas API (#492)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 7a3496b commit 5cdb685

File tree

212 files changed

+5185
-1472
lines changed

Some content is hidden

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

212 files changed

+5185
-1472
lines changed

.mockery.yaml

Lines changed: 1 addition & 1 deletion
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/v20241113002/admin:
9+
go.mongodb.org/atlas-sdk/v20241113003/admin:
1010
config:
1111
include-regex: ".*Api"

README.md

Lines changed: 2 additions & 2 deletions
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/v20241113002
15+
go get go.mongodb.org/atlas-sdk/v20241113003
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/v20241113002/admin"
24+
import "go.mongodb.org/atlas-sdk/v20241113003/admin"
2525

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

admin/api_events.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ type EventsApi interface {
116116
/*
117117
ListProjectEvents Return All Events from One Project
118118
119-
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.
119+
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.
120120
121121
This resource remains under revision and may change.
122122
@@ -888,7 +888,7 @@ func (r ListProjectEventsApiRequest) Execute() (*GroupPaginatedEvent, *http.Resp
888888
/*
889889
ListProjectEvents Return All Events from One Project
890890
891-
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.
891+
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.
892892
893893
This resource remains under revision and may change.
894894

admin/api_organizations.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -303,28 +303,28 @@ type OrganizationsApi interface {
303303
RemoveOrganizationUserExecute(r RemoveOrganizationUserApiRequest) (any, *http.Response, error)
304304

305305
/*
306-
RenameOrganization Rename One Organization
306+
UpdateOrganization Update One Organization
307307
308-
Renames one organization. To use this resource, the requesting API Key must have the Organization Owner role.
308+
Updates one organization. To use this resource, the requesting API Key must have the Organization Owner role.
309309
310310
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
311311
@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.
312312
@param atlasOrganization Details to update on the specified organization.
313-
@return RenameOrganizationApiRequest
313+
@return UpdateOrganizationApiRequest
314314
*/
315-
RenameOrganization(ctx context.Context, orgId string, atlasOrganization *AtlasOrganization) RenameOrganizationApiRequest
315+
UpdateOrganization(ctx context.Context, orgId string, atlasOrganization *AtlasOrganization) UpdateOrganizationApiRequest
316316
/*
317-
RenameOrganization Rename One Organization
317+
UpdateOrganization Update One Organization
318318
319319
320320
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
321-
@param RenameOrganizationApiParams - Parameters for the request
322-
@return RenameOrganizationApiRequest
321+
@param UpdateOrganizationApiParams - Parameters for the request
322+
@return UpdateOrganizationApiRequest
323323
*/
324-
RenameOrganizationWithParams(ctx context.Context, args *RenameOrganizationApiParams) RenameOrganizationApiRequest
324+
UpdateOrganizationWithParams(ctx context.Context, args *UpdateOrganizationApiParams) UpdateOrganizationApiRequest
325325

326326
// Method available only for mocking purposes
327-
RenameOrganizationExecute(r RenameOrganizationApiRequest) (*AtlasOrganization, *http.Response, error)
327+
UpdateOrganizationExecute(r UpdateOrganizationApiRequest) (*AtlasOrganization, *http.Response, error)
328328

329329
/*
330330
UpdateOrganizationInvitation Update One Organization Invitation
@@ -1976,61 +1976,61 @@ func (a *OrganizationsApiService) RemoveOrganizationUserExecute(r RemoveOrganiza
19761976
return localVarReturnValue, localVarHTTPResponse, nil
19771977
}
19781978

1979-
type RenameOrganizationApiRequest struct {
1979+
type UpdateOrganizationApiRequest struct {
19801980
ctx context.Context
19811981
ApiService OrganizationsApi
19821982
orgId string
19831983
atlasOrganization *AtlasOrganization
19841984
}
19851985

1986-
type RenameOrganizationApiParams struct {
1986+
type UpdateOrganizationApiParams struct {
19871987
OrgId string
19881988
AtlasOrganization *AtlasOrganization
19891989
}
19901990

1991-
func (a *OrganizationsApiService) RenameOrganizationWithParams(ctx context.Context, args *RenameOrganizationApiParams) RenameOrganizationApiRequest {
1992-
return RenameOrganizationApiRequest{
1991+
func (a *OrganizationsApiService) UpdateOrganizationWithParams(ctx context.Context, args *UpdateOrganizationApiParams) UpdateOrganizationApiRequest {
1992+
return UpdateOrganizationApiRequest{
19931993
ApiService: a,
19941994
ctx: ctx,
19951995
orgId: args.OrgId,
19961996
atlasOrganization: args.AtlasOrganization,
19971997
}
19981998
}
19991999

2000-
func (r RenameOrganizationApiRequest) Execute() (*AtlasOrganization, *http.Response, error) {
2001-
return r.ApiService.RenameOrganizationExecute(r)
2000+
func (r UpdateOrganizationApiRequest) Execute() (*AtlasOrganization, *http.Response, error) {
2001+
return r.ApiService.UpdateOrganizationExecute(r)
20022002
}
20032003

20042004
/*
2005-
RenameOrganization Rename One Organization
2005+
UpdateOrganization Update One Organization
20062006
2007-
Renames one organization. To use this resource, the requesting API Key must have the Organization Owner role.
2007+
Updates one organization. To use this resource, the requesting API Key must have the Organization Owner role.
20082008
20092009
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
20102010
@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.
2011-
@return RenameOrganizationApiRequest
2011+
@return UpdateOrganizationApiRequest
20122012
*/
2013-
func (a *OrganizationsApiService) RenameOrganization(ctx context.Context, orgId string, atlasOrganization *AtlasOrganization) RenameOrganizationApiRequest {
2014-
return RenameOrganizationApiRequest{
2013+
func (a *OrganizationsApiService) UpdateOrganization(ctx context.Context, orgId string, atlasOrganization *AtlasOrganization) UpdateOrganizationApiRequest {
2014+
return UpdateOrganizationApiRequest{
20152015
ApiService: a,
20162016
ctx: ctx,
20172017
orgId: orgId,
20182018
atlasOrganization: atlasOrganization,
20192019
}
20202020
}
20212021

2022-
// RenameOrganizationExecute executes the request
2022+
// UpdateOrganizationExecute executes the request
20232023
//
20242024
// @return AtlasOrganization
2025-
func (a *OrganizationsApiService) RenameOrganizationExecute(r RenameOrganizationApiRequest) (*AtlasOrganization, *http.Response, error) {
2025+
func (a *OrganizationsApiService) UpdateOrganizationExecute(r UpdateOrganizationApiRequest) (*AtlasOrganization, *http.Response, error) {
20262026
var (
20272027
localVarHTTPMethod = http.MethodPatch
20282028
localVarPostBody any
20292029
formFiles []formFile
20302030
localVarReturnValue *AtlasOrganization
20312031
)
20322032

2033-
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.RenameOrganization")
2033+
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.UpdateOrganization")
20342034
if err != nil {
20352035
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
20362036
}

admin/api_performance_advisor.go

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,30 @@ type PerformanceAdvisorApi interface {
106106
// Method available only for mocking purposes
107107
GetServerlessAutoIndexingExecute(r GetServerlessAutoIndexingApiRequest) (bool, *http.Response, error)
108108

109+
/*
110+
ListClusterSuggestedIndexes Return Suggested Indexes
111+
112+
Returns the indexes that the Performance Advisor suggests. The Performance Advisor monitors queries that MongoDB considers slow and suggests new indexes to improve query performance. To use this resource, the requesting API Key must have the Project Read Only role.
113+
114+
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
115+
@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.
116+
@param clusterName Human-readable label that identifies the cluster.
117+
@return ListClusterSuggestedIndexesApiRequest
118+
*/
119+
ListClusterSuggestedIndexes(ctx context.Context, groupId string, clusterName string) ListClusterSuggestedIndexesApiRequest
120+
/*
121+
ListClusterSuggestedIndexes Return Suggested Indexes
122+
123+
124+
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
125+
@param ListClusterSuggestedIndexesApiParams - Parameters for the request
126+
@return ListClusterSuggestedIndexesApiRequest
127+
*/
128+
ListClusterSuggestedIndexesWithParams(ctx context.Context, args *ListClusterSuggestedIndexesApiParams) ListClusterSuggestedIndexesApiRequest
129+
130+
// Method available only for mocking purposes
131+
ListClusterSuggestedIndexesExecute(r ListClusterSuggestedIndexesApiRequest) (*PerformanceAdvisorResponse, *http.Response, error)
132+
109133
/*
110134
ListSlowQueries Return Slow Queries
111135
@@ -605,6 +629,179 @@ func (a *PerformanceAdvisorApiService) GetServerlessAutoIndexingExecute(r GetSer
605629
return localVarReturnValue, localVarHTTPResponse, nil
606630
}
607631

632+
type ListClusterSuggestedIndexesApiRequest struct {
633+
ctx context.Context
634+
ApiService PerformanceAdvisorApi
635+
groupId string
636+
clusterName string
637+
processIds *[]string
638+
namespaces *[]string
639+
since *int64
640+
until *int64
641+
}
642+
643+
type ListClusterSuggestedIndexesApiParams struct {
644+
GroupId string
645+
ClusterName string
646+
ProcessIds *[]string
647+
Namespaces *[]string
648+
Since *int64
649+
Until *int64
650+
}
651+
652+
func (a *PerformanceAdvisorApiService) ListClusterSuggestedIndexesWithParams(ctx context.Context, args *ListClusterSuggestedIndexesApiParams) ListClusterSuggestedIndexesApiRequest {
653+
return ListClusterSuggestedIndexesApiRequest{
654+
ApiService: a,
655+
ctx: ctx,
656+
groupId: args.GroupId,
657+
clusterName: args.ClusterName,
658+
processIds: args.ProcessIds,
659+
namespaces: args.Namespaces,
660+
since: args.Since,
661+
until: args.Until,
662+
}
663+
}
664+
665+
// ProcessIds from which to retrieve suggested indexes. A processId is a combination of host and port that serves the MongoDB process. The host must be the hostname, FQDN, IPv4 address, or IPv6 address of the host that runs the MongoDB process (&#x60;mongod&#x60; or &#x60;mongos&#x60;). The port must be the IANA port on which the MongoDB process listens for requests. To include multiple processIds, pass the parameter multiple times delimited with an ampersand (&#x60;&amp;&#x60;) between each processId.
666+
func (r ListClusterSuggestedIndexesApiRequest) ProcessIds(processIds []string) ListClusterSuggestedIndexesApiRequest {
667+
r.processIds = &processIds
668+
return r
669+
}
670+
671+
// Namespaces from which to retrieve suggested indexes. A namespace consists of one database and one collection resource written as &#x60;.&#x60;: &#x60;&lt;database&gt;.&lt;collection&gt;&#x60;. To include multiple namespaces, pass the parameter multiple times delimited with an ampersand (&#x60;&amp;&#x60;) between each namespace. Omit this parameter to return results for all namespaces.
672+
func (r ListClusterSuggestedIndexesApiRequest) Namespaces(namespaces []string) ListClusterSuggestedIndexesApiRequest {
673+
r.namespaces = &namespaces
674+
return r
675+
}
676+
677+
// Date and time from which the query retrieves the suggested indexes. This parameter expresses its value in the number of milliseconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you don&#39;t specify the **until** parameter, the endpoint returns data covering from the **since** value and the current time. - If you specify neither the **since** nor the **until** parameters, the endpoint returns data from the previous 24 hours.
678+
func (r ListClusterSuggestedIndexesApiRequest) Since(since int64) ListClusterSuggestedIndexesApiRequest {
679+
r.since = &since
680+
return r
681+
}
682+
683+
// Date and time up until which the query retrieves the suggested indexes. This parameter expresses its value in the number of milliseconds that have elapsed since the [UNIX epoch](https://en.wikipedia.org/wiki/Unix_time). - If you specify the **until** parameter, you must specify the **since** parameter. - If you specify neither the **since** nor the **until** parameters, the endpoint returns data from the previous 24 hours.
684+
func (r ListClusterSuggestedIndexesApiRequest) Until(until int64) ListClusterSuggestedIndexesApiRequest {
685+
r.until = &until
686+
return r
687+
}
688+
689+
func (r ListClusterSuggestedIndexesApiRequest) Execute() (*PerformanceAdvisorResponse, *http.Response, error) {
690+
return r.ApiService.ListClusterSuggestedIndexesExecute(r)
691+
}
692+
693+
/*
694+
ListClusterSuggestedIndexes Return Suggested Indexes
695+
696+
Returns the indexes that the Performance Advisor suggests. The Performance Advisor monitors queries that MongoDB considers slow and suggests new indexes to improve query performance. To use this resource, the requesting API Key must have the Project Read Only role.
697+
698+
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
699+
@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.
700+
@param clusterName Human-readable label that identifies the cluster.
701+
@return ListClusterSuggestedIndexesApiRequest
702+
*/
703+
func (a *PerformanceAdvisorApiService) ListClusterSuggestedIndexes(ctx context.Context, groupId string, clusterName string) ListClusterSuggestedIndexesApiRequest {
704+
return ListClusterSuggestedIndexesApiRequest{
705+
ApiService: a,
706+
ctx: ctx,
707+
groupId: groupId,
708+
clusterName: clusterName,
709+
}
710+
}
711+
712+
// ListClusterSuggestedIndexesExecute executes the request
713+
//
714+
// @return PerformanceAdvisorResponse
715+
func (a *PerformanceAdvisorApiService) ListClusterSuggestedIndexesExecute(r ListClusterSuggestedIndexesApiRequest) (*PerformanceAdvisorResponse, *http.Response, error) {
716+
var (
717+
localVarHTTPMethod = http.MethodGet
718+
localVarPostBody any
719+
formFiles []formFile
720+
localVarReturnValue *PerformanceAdvisorResponse
721+
)
722+
723+
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PerformanceAdvisorApiService.ListClusterSuggestedIndexes")
724+
if err != nil {
725+
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
726+
}
727+
728+
localVarPath := localBasePath + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/performanceAdvisor/suggestedIndexes"
729+
localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", url.PathEscape(r.groupId), -1)
730+
localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(r.clusterName), -1)
731+
732+
localVarHeaderParams := make(map[string]string)
733+
localVarQueryParams := url.Values{}
734+
localVarFormParams := url.Values{}
735+
736+
if r.processIds != nil {
737+
t := *r.processIds
738+
// Workaround for unused import
739+
_ = reflect.Append
740+
parameterAddToHeaderOrQuery(localVarQueryParams, "processIds", t, "multi")
741+
742+
}
743+
if r.namespaces != nil {
744+
t := *r.namespaces
745+
// Workaround for unused import
746+
_ = reflect.Append
747+
parameterAddToHeaderOrQuery(localVarQueryParams, "namespaces", t, "multi")
748+
749+
}
750+
if r.since != nil {
751+
parameterAddToHeaderOrQuery(localVarQueryParams, "since", r.since, "")
752+
}
753+
if r.until != nil {
754+
parameterAddToHeaderOrQuery(localVarQueryParams, "until", r.until, "")
755+
}
756+
// to determine the Content-Type header
757+
localVarHTTPContentTypes := []string{}
758+
759+
// set Content-Type header
760+
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
761+
if localVarHTTPContentType != "" {
762+
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
763+
}
764+
765+
// to determine the Accept header (only first one)
766+
localVarHTTPHeaderAccepts := []string{"application/vnd.atlas.2024-08-05+json"}
767+
768+
// set Accept header
769+
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
770+
if localVarHTTPHeaderAccept != "" {
771+
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
772+
}
773+
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
774+
if err != nil {
775+
return localVarReturnValue, nil, err
776+
}
777+
778+
localVarHTTPResponse, err := a.client.callAPI(req)
779+
if err != nil || localVarHTTPResponse == nil {
780+
return localVarReturnValue, localVarHTTPResponse, err
781+
}
782+
783+
if localVarHTTPResponse.StatusCode >= 300 {
784+
newErr := a.client.makeApiError(localVarHTTPResponse, localVarHTTPMethod, localVarPath)
785+
return localVarReturnValue, localVarHTTPResponse, newErr
786+
}
787+
788+
err = a.client.decode(&localVarReturnValue, localVarHTTPResponse.Body, localVarHTTPResponse.Header.Get("Content-Type"))
789+
if err != nil {
790+
defer localVarHTTPResponse.Body.Close()
791+
buf, readErr := io.ReadAll(localVarHTTPResponse.Body)
792+
if readErr != nil {
793+
err = readErr
794+
}
795+
newErr := &GenericOpenAPIError{
796+
body: buf,
797+
error: err.Error(),
798+
}
799+
return localVarReturnValue, localVarHTTPResponse, newErr
800+
}
801+
802+
return localVarReturnValue, localVarHTTPResponse, nil
803+
}
804+
608805
type ListSlowQueriesApiRequest struct {
609806
ctx context.Context
610807
ApiService PerformanceAdvisorApi

0 commit comments

Comments
 (0)