Skip to content

Commit

Permalink
APIBot: SDK update based on recent changes in Atlas API (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Jan 10, 2024
1 parent 176fd5e commit 459be4d
Show file tree
Hide file tree
Showing 122 changed files with 3,172 additions and 1,310 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Note that `atlas-sdk-go` only supports the two most recent major versions of Go.
### Adding Dependency

```terminal
go get go.mongodb.org/atlas-sdk/v20231115002
go get go.mongodb.org/atlas-sdk/v20231115003
```

### Using in the code
Expand All @@ -20,7 +20,7 @@ Construct a new Atlas SDK client, then use the various services on the client to
access different parts of the Atlas API. For example:

```go
import "go.mongodb.org/atlas-sdk/v20231115002/admin"
import "go.mongodb.org/atlas-sdk/v20231115003/admin"

func example() {
ctx := context.Background()
Expand Down
4 changes: 2 additions & 2 deletions admin/api_cloud_migration_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type CloudMigrationServiceApi interface {
You can use this API endpoint for push live migrations only. Your API Key must have the Organization Owner role to successfully call this resource.
**NOTE**: Migrating time-series collections is not yet supported on MongoDB v6.0 or higher. Migrations on MongoDB v6.0 or higher will skip any time-series collections on the source cluster.
**NOTE**: Migrating time-series collections is not yet supported on MongoDB 6.0 or higher. Migrations on MongoDB 6.0 or higher will skip any time-series collections on the source cluster.
@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 @@ -383,7 +383,7 @@ Migrate one cluster that Cloud or Ops Manager manages to MongoDB Atlas.
You can use this API endpoint for push live migrations only. Your API Key must have the Organization Owner role to successfully call this resource.
**NOTE**: Migrating time-series collections is not yet supported on MongoDB v6.0 or higher. Migrations on MongoDB v6.0 or higher will skip any time-series collections on the source cluster.
**NOTE**: Migrating time-series collections is not yet supported on MongoDB 6.0 or higher. Migrations on MongoDB 6.0 or higher will skip any time-series collections on the source cluster.
@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
157 changes: 157 additions & 0 deletions admin/api_default.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
// Code based on the AtlasAPI V2 OpenAPI file

package admin

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

type DefaultApi interface {

/*
ReturnAllControlPlaneIPAddresses Return All Control Plane IP Addresses
[experimental] Returns all control plane IP addresses.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ReturnAllControlPlaneIPAddressesApiRequest
*/
ReturnAllControlPlaneIPAddresses(ctx context.Context) ReturnAllControlPlaneIPAddressesApiRequest
/*
ReturnAllControlPlaneIPAddresses Return All Control Plane IP Addresses
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param ReturnAllControlPlaneIPAddressesApiParams - Parameters for the request
@return ReturnAllControlPlaneIPAddressesApiRequest
*/
ReturnAllControlPlaneIPAddressesWithParams(ctx context.Context, args *ReturnAllControlPlaneIPAddressesApiParams) ReturnAllControlPlaneIPAddressesApiRequest

// Interface only available internally
returnAllControlPlaneIPAddressesExecute(r ReturnAllControlPlaneIPAddressesApiRequest) (*ControlPlaneIPAddresses, *http.Response, error)
}

// DefaultApiService DefaultApi service
type DefaultApiService service

type ReturnAllControlPlaneIPAddressesApiRequest struct {
ctx context.Context
ApiService DefaultApi
}

type ReturnAllControlPlaneIPAddressesApiParams struct {
}

func (a *DefaultApiService) ReturnAllControlPlaneIPAddressesWithParams(ctx context.Context, args *ReturnAllControlPlaneIPAddressesApiParams) ReturnAllControlPlaneIPAddressesApiRequest {
return ReturnAllControlPlaneIPAddressesApiRequest{
ApiService: a,
ctx: ctx,
}
}

func (r ReturnAllControlPlaneIPAddressesApiRequest) Execute() (*ControlPlaneIPAddresses, *http.Response, error) {
return r.ApiService.returnAllControlPlaneIPAddressesExecute(r)
}

/*
ReturnAllControlPlaneIPAddresses Return All Control Plane IP Addresses
[experimental] Returns all control plane IP addresses.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ReturnAllControlPlaneIPAddressesApiRequest
*/
func (a *DefaultApiService) ReturnAllControlPlaneIPAddresses(ctx context.Context) ReturnAllControlPlaneIPAddressesApiRequest {
return ReturnAllControlPlaneIPAddressesApiRequest{
ApiService: a,
ctx: ctx,
}
}

// Execute executes the request
//
// @return ControlPlaneIPAddresses
func (a *DefaultApiService) returnAllControlPlaneIPAddressesExecute(r ReturnAllControlPlaneIPAddressesApiRequest) (*ControlPlaneIPAddresses, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ControlPlaneIPAddresses
)

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

localVarPath := localBasePath + "/api/atlas/v2/unauth/controlPlaneIPAddresses"

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
localVarHTTPHeaderAccepts := []string{"application/vnd.atlas.2023-11-15+json", "application/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
}

localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v ApiError
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, localVarHTTPMethod, localVarPath, v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}

err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

return localVarReturnValue, localVarHTTPResponse, nil
}
16 changes: 8 additions & 8 deletions admin/api_programmatic_api_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type ProgrammaticAPIKeysApi interface {
/*
AddProjectApiKey Assign One Organization API Key to One Project
[experimental] Assigns the specified organization API key to the specified project. Users with the Project Owner role in the project associated with the API key can then use the organization API key to access the resources. To use this resource, the requesting API Key must have the Project User Admin role.
[experimental] Assigns the specified organization API key to the specified project. Users with the Project Owner role in the project associated with the API key can then use the organization API key to access the resources. To use this resource, the requesting 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 Expand Up @@ -87,7 +87,7 @@ type ProgrammaticAPIKeysApi interface {
/*
CreateProjectApiKey Create and Assign One Organization API Key to One Project
Creates and assigns the specified organization API key to the specified project. Users with the Project Owner role in the project associated with the API key can use the organization API key to access the resources. To use this resource, the requesting API Key must have the Project User Admin role.
Creates and assigns the specified organization API key to the specified project. Users with the Project Owner role in the project associated with the API key can use the organization API key to access the resources. To use this resource, the requesting 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 Expand Up @@ -255,7 +255,7 @@ type ProgrammaticAPIKeysApi interface {
/*
ListProjectApiKeys Return All Organization API Keys Assigned to One Project
Returns all organization API keys that you assigned to the specified project. Users with the Project Owner role in the project associated with the API key can use the organization API key to access the resources. To use this resource, the requesting API Key must have the Project User Admin role.
Returns all organization API keys that you assigned to the specified project. Users with the Project Owner role in the project associated with the API key can use the organization API key to access the resources. To use this resource, the requesting 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 All @@ -278,7 +278,7 @@ type ProgrammaticAPIKeysApi interface {
/*
RemoveProjectApiKey Unassign One Organization API Key from One Project
Removes one organization API key from the specified project. To use this resource, the requesting API Key must have the Project User Admin role.
Removes one organization API key from the specified project. To use this resource, the requesting 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 Expand Up @@ -382,7 +382,7 @@ func (r AddProjectApiKeyApiRequest) Execute() (*ApiKeyUserDetails, *http.Respons
/*
AddProjectApiKey Assign One Organization API Key to One Project
[experimental] Assigns the specified organization API key to the specified project. Users with the Project Owner role in the project associated with the API key can then use the organization API key to access the resources. To use this resource, the requesting API Key must have the Project User Admin role.
[experimental] Assigns the specified organization API key to the specified project. Users with the Project Owner role in the project associated with the API key can then use the organization API key to access the resources. To use this resource, the requesting 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 Expand Up @@ -868,7 +868,7 @@ func (r CreateProjectApiKeyApiRequest) Execute() (*ApiKeyUserDetails, *http.Resp
/*
CreateProjectApiKey Create and Assign One Organization API Key to One Project
Creates and assigns the specified organization API key to the specified project. Users with the Project Owner role in the project associated with the API key can use the organization API key to access the resources. To use this resource, the requesting API Key must have the Project User Admin role.
Creates and assigns the specified organization API key to the specified project. Users with the Project Owner role in the project associated with the API key can use the organization API key to access the resources. To use this resource, the requesting 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 Expand Up @@ -1979,7 +1979,7 @@ func (r ListProjectApiKeysApiRequest) Execute() (*PaginatedApiApiUser, *http.Res
/*
ListProjectApiKeys Return All Organization API Keys Assigned to One Project
Returns all organization API keys that you assigned to the specified project. Users with the Project Owner role in the project associated with the API key can use the organization API key to access the resources. To use this resource, the requesting API Key must have the Project User Admin role.
Returns all organization API keys that you assigned to the specified project. Users with the Project Owner role in the project associated with the API key can use the organization API key to access the resources. To use this resource, the requesting 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 Expand Up @@ -2133,7 +2133,7 @@ func (r RemoveProjectApiKeyApiRequest) Execute() (map[string]interface{}, *http.
/*
RemoveProjectApiKey Unassign One Organization API Key from One Project
Removes one organization API key from the specified project. To use this resource, the requesting API Key must have the Project User Admin role.
Removes one organization API key from the specified project. To use this resource, the requesting 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
4 changes: 2 additions & 2 deletions admin/atlas_client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package admin // import "go.mongodb.org/atlas-sdk/v20231115002/admin"
package admin // import "go.mongodb.org/atlas-sdk/v20231115003/admin"

import (
"errors"
Expand All @@ -8,7 +8,7 @@ import (
"strings"

"github.com/mongodb-forks/digest"
"go.mongodb.org/atlas-sdk/v20231115002/internal/core"
"go.mongodb.org/atlas-sdk/v20231115003/internal/core"
)

const (
Expand Down
3 changes: 3 additions & 0 deletions admin/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ type APIClient struct {

DatabaseUsersApi DatabaseUsersApi

DefaultApi DefaultApi

EncryptionAtRestUsingCustomerKeyManagementApi EncryptionAtRestUsingCustomerKeyManagementApi

EventsApi EventsApi
Expand Down Expand Up @@ -162,6 +164,7 @@ func NewAPIClient(cfg *Configuration) *APIClient {
c.DataFederationApi = (*DataFederationApiService)(&c.common)
c.DataLakePipelinesApi = (*DataLakePipelinesApiService)(&c.common)
c.DatabaseUsersApi = (*DatabaseUsersApiService)(&c.common)
c.DefaultApi = (*DefaultApiService)(&c.common)
c.EncryptionAtRestUsingCustomerKeyManagementApi = (*EncryptionAtRestUsingCustomerKeyManagementApiService)(&c.common)
c.EventsApi = (*EventsApiService)(&c.common)
c.FederatedAuthenticationApi = (*FederatedAuthenticationApiService)(&c.common)
Expand Down
2 changes: 1 addition & 1 deletion admin/model_api_key_user_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"encoding/json"
)

// ApiKeyUserDetails struct for ApiKeyUserDetails
// ApiKeyUserDetails Details of the Programmatic API Keys.
type ApiKeyUserDetails struct {
// Purpose or explanation provided when someone created this organization API key.
Desc *string `json:"desc,omitempty"`
Expand Down
Loading

0 comments on commit 459be4d

Please sign in to comment.