Skip to content

APIBot: SDK update based on recent changes in Atlas API #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 28, 2024
Merged

Conversation

github-actions[bot]
Copy link
Contributor

Automatic update for MongoDB Atlas Go Client based on OpenAPI changes.
PR contains autogenerated changes for the MongoDB Atlas client.

Automated checks

  1. Compilation and unit tests
  2. Documentation style
  3. Transformation engine linting

NOTE: New automation PRs need to be closed and reopened to trigger builds

Important Details

  1. If the build is failing please check the logs and fix the issues in the OpenAPI file (openapi/atlas-api.yaml)
  2. Do not attempt to manually fix any issues in the Golang code as all changes are automatically generated.
    Fixes should be applied to the OpenAPI file (openapi/atlas-api.yaml) or ./tools engine in a separate PR.

Manual Review Procedure

  1. Review changes in the OpenAPI file (openapi/atlas-api.yaml)
  2. If PR contains breaking changes, review ./releaser/breaking_changes/{release_version}.md file
  3. Approve and merge PR into the main branch
  4. After the merge automated release process will be triggered.

Troubleshooting

To skip release process after merge please revert changes from version.go file.
Release can be triggered by restoring changes in version.go.

@github-actions github-actions bot requested review from a team as code owners June 28, 2024 12:42
ctx context.Context
ApiService CloudMigrationServiceApi
groupId string
liveMigrationRequest20240530 *LiveMigrationRequest20240530
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing impact of @blva changes! Thank you for the fix. I can confirm that we do have new fields right now

Comment on lines +8 to +34
- (\*DiskBackupExportJob).GetComponents: changed from func() []DiskBackupBaseRestoreMember to func() []DiskBackupExportMember
- (_DiskBackupExportJob).GetComponentsOk: changed from func() (_[]DiskBackupBaseRestoreMember, bool) to func() (\*[]DiskBackupExportMember, bool)
- (\*DiskBackupExportJob).SetComponents: changed from func([]DiskBackupBaseRestoreMember) to func([]DiskBackupExportMember)
- (*InvoicesApiService).ListInvoicesExecute: changed from func(ListInvoicesApiRequest) (*PaginatedApiInvoice, *net/http.Response, error) to func(ListInvoicesApiRequest) (*PaginatedApiInvoiceMetadata, \*net/http.Response, error)
- (\*LiveMigrationRequest).GetDropEnabled: removed
- (\*LiveMigrationRequest).GetDropEnabledOk: removed
- (\*LiveMigrationRequest).SetDropEnabled: removed
- AuthorizeCloudProviderAccessRoleApiParams.CloudProviderAccessAWSIAMRoleUpdateRequest: removed
- CloudProviderAccessAWSIAMRoleRequest: removed
- CloudProviderAccessAWSIAMRoleUpdateRequest: removed
- CreateCloudProviderAccessRoleApiParams.CloudProviderAccessAWSIAMRoleRequest: removed
- CreatePushMigrationApiParams.LiveMigrationRequest: removed
- DiskBackupBaseRestoreMember: removed
- DiskBackupExportJob.Components: changed from _[]DiskBackupBaseRestoreMember to _[]DiskBackupExportMember
- InvoicesApi.ListInvoicesExecute: changed from func(ListInvoicesApiRequest) (*PaginatedApiInvoice, *net/http.Response, error) to func(ListInvoicesApiRequest) (*PaginatedApiInvoiceMetadata, *net/http.Response, error)
- ListInvoicesApiRequest.Execute: changed from func() (*PaginatedApiInvoice, *net/http.Response, error) to func() (*PaginatedApiInvoiceMetadata, *net/http.Response, error)
- LiveMigrationRequest.DropEnabled: removed
- LiveMigrationRequest: removed
- NewCloudProviderAccessAWSIAMRoleRequest: removed
- NewCloudProviderAccessAWSIAMRoleRequestWithDefaults: removed
- NewCloudProviderAccessAWSIAMRoleUpdateRequest: removed
- NewCloudProviderAccessAWSIAMRoleUpdateRequestWithDefaults: removed
- NewDiskBackupBaseRestoreMember: removed
- NewDiskBackupBaseRestoreMemberWithDefaults: removed
- NewLiveMigrationRequest: removed
- NewLiveMigrationRequestWithDefaults: removed
- ValidateMigrationApiParams.LiveMigrationRequest: removed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be confirmed if changes do not affect Integrations.
There is a large amount of openapi corrections that remove field here.

CC @lantoli

Comment on lines +8 to +10
- (\*DiskBackupExportJob).GetComponents: changed from func() []DiskBackupBaseRestoreMember to func() []DiskBackupExportMember
- (_DiskBackupExportJob).GetComponentsOk: changed from func() (_[]DiskBackupBaseRestoreMember, bool) to func() (\*[]DiskBackupExportMember, bool)
- (\*DiskBackupExportJob).SetComponents: changed from func([]DiskBackupBaseRestoreMember) to func([]DiskBackupExportMember)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spec correction.

- (\*DiskBackupExportJob).GetComponents: changed from func() []DiskBackupBaseRestoreMember to func() []DiskBackupExportMember
- (_DiskBackupExportJob).GetComponentsOk: changed from func() (_[]DiskBackupBaseRestoreMember, bool) to func() (\*[]DiskBackupExportMember, bool)
- (\*DiskBackupExportJob).SetComponents: changed from func([]DiskBackupBaseRestoreMember) to func([]DiskBackupExportMember)
- (*InvoicesApiService).ListInvoicesExecute: changed from func(ListInvoicesApiRequest) (*PaginatedApiInvoice, *net/http.Response, error) to func(ListInvoicesApiRequest) (*PaginatedApiInvoiceMetadata, \*net/http.Response, error)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spec correction

Comment on lines +12 to +14
- (\*LiveMigrationRequest).GetDropEnabled: removed
- (\*LiveMigrationRequest).GetDropEnabledOk: removed
- (\*LiveMigrationRequest).SetDropEnabled: removed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual breaking change introduced in the new version.
No longer relevant.

Comment on lines +16 to +17
- CloudProviderAccessAWSIAMRoleRequest: removed
- CloudProviderAccessAWSIAMRoleUpdateRequest: removed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effects of revert when fix for the issue caused multiple fields to be brolen.
Original issue is still present. @AgustinBettati have reported it initially.

To be established if that is not a blocker for release.

Comment on lines +26 to +29
- NewCloudProviderAccessAWSIAMRoleRequest: removed
- NewCloudProviderAccessAWSIAMRoleRequestWithDefaults: removed
- NewCloudProviderAccessAWSIAMRoleUpdateRequest: removed
- NewCloudProviderAccessAWSIAMRoleUpdateRequestWithDefaults: removed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

- InvoicesApi.ListInvoicesExecute: changed from func(ListInvoicesApiRequest) (*PaginatedApiInvoice, *net/http.Response, error) to func(ListInvoicesApiRequest) (*PaginatedApiInvoiceMetadata, *net/http.Response, error)
- ListInvoicesApiRequest.Execute: changed from func() (*PaginatedApiInvoice, *net/http.Response, error) to func() (*PaginatedApiInvoiceMetadata, *net/http.Response, error)
- LiveMigrationRequest.DropEnabled: removed
- LiveMigrationRequest: removed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effects of model renames. Migration should be straightforward.

@wtrocki
Copy link
Member

wtrocki commented Jun 28, 2024

Generation process and new changes LGTM. I have flagged potential issues in breaking changes to validate in terraform.

@lantoli
Copy link
Member

lantoli commented Jun 28, 2024

Doing in TF repo:
gomajor get "go.mongodb.org/atlas-sdk/v20240530002@v20240530002.0.0-20240628124246-546063252169"

 make && golangci-lint run
==> Fixing source code with gofmt...
gofmt -s -w .
==> Checking that code complies with gofmt requirements...
go build -ldflags "-s -w -X 'github.com/mongodb/terraform-provider-mongodbatlas/version.ProviderVersion=1.17.3'" -o ./bin/terraform-provider-mongodbatlas
# github.com/mongodb/terraform-provider-mongodbatlas/internal/service/cloudbackupsnapshotexportbucket
internal/service/cloudbackupsnapshotexportbucket/data_source_cloud_backup_snapshot_export_buckets.go:86:37: undefined: admin.DiskBackupSnapshotAWSExportBucket
internal/service/cloudbackupsnapshotexportbucket/resource_cloud_backup_snapshot_export_bucket.go:75:20: undefined: admin.DiskBackupSnapshotAWSExportBucket
# github.com/mongodb/terraform-provider-mongodbatlas/internal/service/searchdeployment
internal/service/searchdeployment/resource_search_deployment.go:157:15: assignment mismatch: 2 variables but connV2.AtlasSearchApi.DeleteAtlasSearchDeployment(ctx, projectID, clusterName).Execute returns 3 values
# github.com/mongodb/terraform-provider-mongodbatlas/internal/service/searchindex
internal/service/searchindex/data_source_search_index.go:126:42: searchIndex.Analyzer undefined (type *admin.SearchIndexResponse has no field or method Analyzer)
internal/service/searchindex/data_source_search_index.go:130:30: searchIndex.GetAnalyzers undefined (type *admin.SearchIndexResponse has no field or method GetAnalyzers)
internal/service/searchindex/data_source_search_index.go:153:49: searchIndex.SearchAnalyzer undefined (type *admin.SearchIndexResponse has no field or method SearchAnalyzer)
internal/service/searchindex/data_source_search_index.go:157:69: searchIndex.GetSynonyms undefined (type *admin.SearchIndexResponse has no field or method GetSynonyms)
internal/service/searchindex/data_source_search_index.go:161:17: searchIndex.Mappings undefined (type *admin.SearchIndexResponse has no field or method Mappings)
internal/service/searchindex/data_source_search_index.go:162:51: searchIndex.Mappings undefined (type *admin.SearchIndexResponse has no field or method Mappings)
internal/service/searchindex/data_source_search_index.go:166:22: searchIndex.Mappings undefined (type *admin.SearchIndexResponse has no field or method Mappings)
internal/service/searchindex/data_source_search_index.go:167:68: searchIndex.Mappings undefined (type *admin.SearchIndexResponse has no field or method Mappings)
internal/service/searchindex/data_source_search_index.go:177:27: searchIndex.GetFields undefined (type *admin.SearchIndexResponse has no field or method GetFields)
internal/service/searchindex/data_source_search_indexes.go:65:52: cannot use searchIndexes (variable of type []admin.SearchIndexResponse) as []admin.ClusterSearchIndex value in argument to flattenSearchIndexes
internal/service/searchindex/data_source_search_indexes.go:65:52: too many errors

Still investigating if they are fixable

@lantoli
Copy link
Member

lantoli commented Jun 28, 2024

There are quite a big changes in the response for AtlasSearchApi.GetAtlasSearchIndex.Execute()

TF version, v20231115014:

// ClusterSearchIndex struct for ClusterSearchIndex
type ClusterSearchIndex struct {
	// Human-readable label that identifies the collection that contains one or more Atlas Search indexes.
	CollectionName string `json:"collectionName"`
	// Human-readable label that identifies the database that contains the collection with one or more Atlas Search indexes.
	Database string `json:"database"`
	// Unique 24-hexadecimal digit string that identifies this Atlas Search index.
	// Read only field.
	IndexID *string `json:"indexID,omitempty"`
	// Human-readable label that identifies this index. Within each namespace, names of all indexes in the namespace must be unique.
	Name string `json:"name"`
	// Condition of the search index when you made this request.  | Status | Index Condition |  |---|---|  | IN_PROGRESS | Atlas is building or re-building the index after an edit. |  | STEADY | You can use this search index. |  | FAILED | Atlas could not build the index. |  | MIGRATING | Atlas is upgrading the underlying cluster tier and migrating indexes. |  | PAUSED | The cluster is paused. |
	// Read only field.
	Status *string `json:"status,omitempty"`
	// Type of the index. Default type is search.
	Type *string `json:"type,omitempty"`
	// Specific pre-defined method chosen to convert database field text into searchable words. This conversion reduces the text of fields into the smallest units of text. These units are called a **term** or **token**. This process, known as tokenization, involves a variety of changes made to the text in fields:  - extracting words - removing punctuation - removing accents - changing to lowercase - removing common words - reducing words to their root form (stemming) - changing words to their base form (lemmatization)  MongoDB Cloud uses the selected process to build the Atlas Search index.
	Analyzer *string `json:"analyzer,omitempty"`
	// List of user-defined methods to convert database field text into searchable words.
	Analyzers *[]ApiAtlasFTSAnalyzers `json:"analyzers,omitempty"`
	Mappings  *ApiAtlasFTSMappings    `json:"mappings,omitempty"`
	// Method applied to identify words when searching this index.
	SearchAnalyzer *string `json:"searchAnalyzer,omitempty"`
	// Flag that indicates whether to store all fields (true) on Atlas Search. By default, Atlas doesn't store (false) the fields on Atlas Search.  Alternatively, you can specify an object that only contains the list of fields to store (include) or not store (exclude) on Atlas Search. To learn more, see documentation.
	StoredSource map[string]interface{} `json:"storedSource,omitempty"`
	// Rule sets that map words to their synonyms in this index.
	Synonyms *[]SearchSynonymMappingDefinition `json:"synonyms,omitempty"`
	// Settings that configure the fields, one per object, to index. You must define at least one \"vector\" type field. You can optionally define \"filter\" type fields also.
	Fields *[]map[string]interface{} `json:"fields,omitempty"`
}

This PR, v20240530002:

type SearchIndexResponse struct {
	// Label that identifies the collection that contains one or more Atlas Search indexes.
	CollectionName *string `json:"collectionName,omitempty"`
	// Label that identifies the database that contains the collection with one or more Atlas Search indexes.
	Database *string `json:"database,omitempty"`
	// Unique 24-hexadecimal digit string that identifies this Atlas Search index.
	IndexID                 *string                                  `json:"indexID,omitempty"`
	LatestDefinition        *BaseSearchIndexResponseLatestDefinition `json:"latestDefinition,omitempty"`
	LatestDefinitionVersion *SearchIndexDefinitionVersion            `json:"latestDefinitionVersion,omitempty"`
	// Label that identifies this index. Within each namespace, the names of all indexes must be unique.
	Name *string `json:"name,omitempty"`
	// Flag that indicates whether the index is queryable on all hosts.
	Queryable *bool `json:"queryable,omitempty"`
	// Condition of the search index when you made this request.   | Status | Index Condition |  |---|---|  | DELETING | The index is being deleted. |  | FAILED | The index build failed. Indexes can enter the FAILED state due to an invalid index definition. |  | STALE | The index is queryable but has stopped replicating data from the indexed collection. Searches on the index may return out-of-date data. |  | PENDING | Atlas has not yet started building the index. |  | BUILDING | Atlas is building or re-building the index after an edit. |  | READY | The index is ready and can support queries. |
	Status *string `json:"status,omitempty"`
	// List of documents detailing index status on each host.
	StatusDetail *[]VectorSearchHostStatusDetail `json:"statusDetail,omitempty"`
	// Type of the index. The default type is search.
	Type *string `json:"type,omitempty"`
	// Status that describes this index's synonym mappings. This status appears only if the index has synonyms defined.
	SynonymMappingStatus *string `json:"synonymMappingStatus,omitempty"`
	// A list of documents describing the status of the index's synonym mappings on each search host. Only appears if the index has synonyms defined.
	SynonymMappingStatusDetail *[]map[string]SynonymMappingStatusDetail `json:"synonymMappingStatusDetail,omitempty"`
}

@lantoli
Copy link
Member

lantoli commented Jun 28, 2024

it looks like many fields are in the new attribute LatestDefinition

Copy link
Member

@lantoli lantoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's ok for me to go on with this release, we'll probably create a ticket in our side to use this new search API. thx!

@wtrocki wtrocki closed this Jun 28, 2024
@wtrocki wtrocki reopened this Jun 28, 2024
@wtrocki wtrocki merged commit e7ba704 into main Jun 28, 2024
3 checks passed
@wtrocki wtrocki deleted the api-bot-update branch June 28, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants