Skip to content

Commit

Permalink
APIBot: SDK update based on recent changes in Atlas API (#310)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: wtrocki <981838+wtrocki@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 18, 2024
1 parent 2f00f02 commit 38bfaed
Show file tree
Hide file tree
Showing 146 changed files with 1,847 additions and 1,226 deletions.
2 changes: 1 addition & 1 deletion .mockery.yaml
Expand Up @@ -6,6 +6,6 @@ filename: "{{ .InterfaceName | snakecase }}.go"
mockname: "{{.InterfaceName}}"

packages:
go.mongodb.org/atlas-sdk/v20231115008/admin:
go.mongodb.org/atlas-sdk/v20231115009/admin:
config:
include-regex: ".*Api"
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -12,7 +12,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/v20231115008
go get go.mongodb.org/atlas-sdk/v20231115009
```

### Using in the code
Expand All @@ -21,7 +21,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/v20231115008/admin"
import "go.mongodb.org/atlas-sdk/v20231115009/admin"

func example() {
ctx := context.Background()
Expand Down
12 changes: 6 additions & 6 deletions admin/api_federated_authentication.go
Expand Up @@ -191,7 +191,7 @@ type FederatedAuthenticationApi interface {
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param federationSettingsId Unique 24-hexadecimal digit string that identifies your federation.
@param identityProviderId Unique string that identifies the identity provider to connect. If using an API version before 11-15-2023, use the 20-hexadecimal digit oktaIdpId. For all other versions, use the 24-hexadecimal digit id.
@param identityProviderId Unique string that identifies the identity provider to connect. If using an API version before 11-15-2023, use the legacy 20-hexadecimal digit id. This id can be found within the Federation Management Console > Identity Providers tab by clicking the info icon in the IdP ID row of a configured identity provider. For all other versions, use the 24-hexadecimal digit id.
@return GetIdentityProviderApiRequest
*/
GetIdentityProvider(ctx context.Context, federationSettingsId string, identityProviderId string) GetIdentityProviderApiRequest
Expand All @@ -215,7 +215,7 @@ type FederatedAuthenticationApi interface {
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param federationSettingsId Unique 24-hexadecimal digit string that identifies your federation.
@param identityProviderId Unique 20-hexadecimal digit string that identifies the identity provider.
@param identityProviderId Legacy 20-hexadecimal digit string that identifies the identity provider. This id can be found within the Federation Management Console > Identity Providers tab by clicking the info icon in the IdP ID row of a configured identity provider.
@return GetIdentityProviderMetadataApiRequest
*/
GetIdentityProviderMetadata(ctx context.Context, federationSettingsId string, identityProviderId string) GetIdentityProviderMetadataApiRequest
Expand Down Expand Up @@ -418,7 +418,7 @@ type FederatedAuthenticationApi interface {
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param federationSettingsId Unique 24-hexadecimal digit string that identifies your federation.
@param identityProviderId Unique string that identifies the identity provider to connect. If using an API version before 11-15-2023, use the 20-hexadecimal digit oktaIdpId. For all other versions, use the 24-hexadecimal digit id.
@param identityProviderId Unique string that identifies the identity provider to connect. If using an API version before 11-15-2023, use the legacy 20-hexadecimal digit id. This id can be found within the Federation Management Console > Identity Providers tab by clicking the info icon in the IdP ID row of a configured identity provider. For all other versions, use the 24-hexadecimal digit id.
@return UpdateIdentityProviderApiRequest
*/
UpdateIdentityProvider(ctx context.Context, federationSettingsId string, identityProviderId string, federationIdentityProviderUpdate *FederationIdentityProviderUpdate) UpdateIdentityProviderApiRequest
Expand Down Expand Up @@ -1380,7 +1380,7 @@ GetIdentityProvider Return one identity provider from the specified federation b
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param federationSettingsId Unique 24-hexadecimal digit string that identifies your federation.
@param identityProviderId Unique string that identifies the identity provider to connect. If using an API version before 11-15-2023, use the 20-hexadecimal digit oktaIdpId. For all other versions, use the 24-hexadecimal digit id.
@param identityProviderId Unique string that identifies the identity provider to connect. If using an API version before 11-15-2023, use the legacy 20-hexadecimal digit id. This id can be found within the Federation Management Console > Identity Providers tab by clicking the info icon in the IdP ID row of a configured identity provider. For all other versions, use the 24-hexadecimal digit id.
@return GetIdentityProviderApiRequest
*/
func (a *FederatedAuthenticationApiService) GetIdentityProvider(ctx context.Context, federationSettingsId string, identityProviderId string) GetIdentityProviderApiRequest {
Expand Down Expand Up @@ -1510,7 +1510,7 @@ GetIdentityProviderMetadata Return the metadata of one identity provider in the
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param federationSettingsId Unique 24-hexadecimal digit string that identifies your federation.
@param identityProviderId Unique 20-hexadecimal digit string that identifies the identity provider.
@param identityProviderId Legacy 20-hexadecimal digit string that identifies the identity provider. This id can be found within the Federation Management Console > Identity Providers tab by clicking the info icon in the IdP ID row of a configured identity provider.
@return GetIdentityProviderMetadataApiRequest
*/
func (a *FederatedAuthenticationApiService) GetIdentityProviderMetadata(ctx context.Context, federationSettingsId string, identityProviderId string) GetIdentityProviderMetadataApiRequest {
Expand Down Expand Up @@ -2588,7 +2588,7 @@ UpdateIdentityProvider Update the identity provider.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param federationSettingsId Unique 24-hexadecimal digit string that identifies your federation.
@param identityProviderId Unique string that identifies the identity provider to connect. If using an API version before 11-15-2023, use the 20-hexadecimal digit oktaIdpId. For all other versions, use the 24-hexadecimal digit id.
@param identityProviderId Unique string that identifies the identity provider to connect. If using an API version before 11-15-2023, use the legacy 20-hexadecimal digit id. This id can be found within the Federation Management Console > Identity Providers tab by clicking the info icon in the IdP ID row of a configured identity provider. For all other versions, use the 24-hexadecimal digit id.
@return UpdateIdentityProviderApiRequest
*/
func (a *FederatedAuthenticationApiService) UpdateIdentityProvider(ctx context.Context, federationSettingsId string, identityProviderId string, federationIdentityProviderUpdate *FederationIdentityProviderUpdate) UpdateIdentityProviderApiRequest {
Expand Down
171 changes: 171 additions & 0 deletions admin/api_legacy_backup.go
Expand Up @@ -13,6 +13,34 @@ import (

type LegacyBackupApi interface {

/*
CreateLegacyBackupRestoreJob Create One Legacy Backup Restore Job
[experimental] Restores one legacy backup for one cluster in the specified project. To use this resource, the requesting API Key must have the Project Owner role. Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). This endpoint doesn't support creating checkpoint restore jobs for sharded clusters, or creating restore jobs for queryable backup snapshots. If you create an automated restore job by specifying `delivery.methodName` of `AUTOMATED_RESTORE` in your request body, MongoDB Cloud removes all existing data on the target cluster prior to the restore.
@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 clusterName Human-readable label that identifies the cluster with the snapshot you want to return.
@return CreateLegacyBackupRestoreJobApiRequest
Deprecated: this method has been deprecated. Please check the latest resource version for LegacyBackupApi
*/
CreateLegacyBackupRestoreJob(ctx context.Context, groupId string, clusterName string, backupRestoreJob *BackupRestoreJob) CreateLegacyBackupRestoreJobApiRequest
/*
CreateLegacyBackupRestoreJob Create One Legacy Backup Restore Job
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param CreateLegacyBackupRestoreJobApiParams - Parameters for the request
@return CreateLegacyBackupRestoreJobApiRequest
Deprecated: this method has been deprecated. Please check the latest resource version for LegacyBackupApi
*/
CreateLegacyBackupRestoreJobWithParams(ctx context.Context, args *CreateLegacyBackupRestoreJobApiParams) CreateLegacyBackupRestoreJobApiRequest

// Method available only for mocking purposes
CreateLegacyBackupRestoreJobExecute(r CreateLegacyBackupRestoreJobApiRequest) (*PaginatedRestoreJob, *http.Response, error)

/*
DeleteLegacySnapshot Remove One Legacy Backup Snapshot
Expand Down Expand Up @@ -310,6 +338,149 @@ type LegacyBackupApi interface {
// LegacyBackupApiService LegacyBackupApi service
type LegacyBackupApiService service

type CreateLegacyBackupRestoreJobApiRequest struct {
ctx context.Context
ApiService LegacyBackupApi
groupId string
clusterName string
backupRestoreJob *BackupRestoreJob
}

type CreateLegacyBackupRestoreJobApiParams struct {
GroupId string
ClusterName string
BackupRestoreJob *BackupRestoreJob
}

func (a *LegacyBackupApiService) CreateLegacyBackupRestoreJobWithParams(ctx context.Context, args *CreateLegacyBackupRestoreJobApiParams) CreateLegacyBackupRestoreJobApiRequest {
return CreateLegacyBackupRestoreJobApiRequest{
ApiService: a,
ctx: ctx,
groupId: args.GroupId,
clusterName: args.ClusterName,
backupRestoreJob: args.BackupRestoreJob,
}
}

func (r CreateLegacyBackupRestoreJobApiRequest) Execute() (*PaginatedRestoreJob, *http.Response, error) {
return r.ApiService.CreateLegacyBackupRestoreJobExecute(r)
}

/*
CreateLegacyBackupRestoreJob Create One Legacy Backup Restore Job
[experimental] Restores one legacy backup for one cluster in the specified project. To use this resource, the requesting API Key must have the Project Owner role. Effective 23 March 2020, all new clusters can use only Cloud Backups. When you upgrade to 4.2, your backup system upgrades to cloud backup if it is currently set to legacy backup. After this upgrade, all your existing legacy backup snapshots remain available. They expire over time in accordance with your retention policy. Your backup policy resets to the default schedule. If you had a custom backup policy in place with legacy backups, you must re-create it with the procedure outlined in the [Cloud Backup documentation](https://www.mongodb.com/docs/atlas/backup/cloud-backup/scheduling/#std-label-cloud-provider-backup-schedule). This endpoint doesn't support creating checkpoint restore jobs for sharded clusters, or creating restore jobs for queryable backup snapshots. If you create an automated restore job by specifying `delivery.methodName` of `AUTOMATED_RESTORE` in your request body, MongoDB Cloud removes all existing data on the target cluster prior to the restore.
@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 clusterName Human-readable label that identifies the cluster with the snapshot you want to return.
@return CreateLegacyBackupRestoreJobApiRequest
Deprecated
*/
func (a *LegacyBackupApiService) CreateLegacyBackupRestoreJob(ctx context.Context, groupId string, clusterName string, backupRestoreJob *BackupRestoreJob) CreateLegacyBackupRestoreJobApiRequest {
return CreateLegacyBackupRestoreJobApiRequest{
ApiService: a,
ctx: ctx,
groupId: groupId,
clusterName: clusterName,
backupRestoreJob: backupRestoreJob,
}
}

// Execute executes the request
//
// @return PaginatedRestoreJob
//
// Deprecated
func (a *LegacyBackupApiService) CreateLegacyBackupRestoreJobExecute(r CreateLegacyBackupRestoreJobApiRequest) (*PaginatedRestoreJob, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *PaginatedRestoreJob
)

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

localVarPath := localBasePath + "/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/restoreJobs"
localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(parameterValueToString(r.clusterName, "clusterName")), -1)

localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.backupRestoreJob == nil {
return localVarReturnValue, nil, reportError("backupRestoreJob is required and must be specified")
}

// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/vnd.atlas.2023-01-01+json"}

// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}

// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/vnd.atlas.2023-01-01+json", "application/json"}

// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.backupRestoreJob
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
}

type DeleteLegacySnapshotApiRequest struct {
ctx context.Context
ApiService LegacyBackupApi
Expand Down

0 comments on commit 38bfaed

Please sign in to comment.