Skip to content
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

chore: Generate Flex Cluster data source file and schemas #2725

Open
wants to merge 4 commits into
base: CLOUDP-262066-flex-cluster-dev
Choose a base branch
from

Conversation

cveticm
Copy link

@cveticm cveticm commented Oct 22, 2024

Description

Generate Flex Cluster data source file and schemas.

File data_source.go has been primarily commented out and will be properly implemented in a following ticket.

Link to any related issue(s): CLOUDP-278904

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR. A migration guide must be created or updated if the new feature will go in a major version.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR. A migration guide must be created or updated.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contributing guides
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals I have added appropriate changelog entries.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

@cveticm cveticm marked this pull request as ready for review October 22, 2024 15:07
@cveticm cveticm requested a review from a team as a code owner October 22, 2024 15:07
Comment on lines 18 to 20
"project_id": schema.StringAttribute{
Required: !isPlural,
Computed: isPlural,
Copy link
Collaborator

Choose a reason for hiding this comment

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

project_id will be required in both plural and singular data source. List operation endpoint needs project_id

Copy link
Author

Choose a reason for hiding this comment

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

Good catch, fixed!


func (d *ds) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
// TODO: Schema and model must be defined in data_source_schema.go. Details on scaffolding this file found in contributing/development-best-practices.md under "Scaffolding Schema and Model Definitions"
resp.Schema = DataSourceSchema(ctx)
Copy link
Collaborator

@oarbusi oarbusi Oct 22, 2024

Choose a reason for hiding this comment

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

you will need to add conversion.UpdateSchemaDescription(&resp.Schema) after this line to add the Description field to all attributes like in the resource

Copy link
Author

Choose a reason for hiding this comment

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

Noted! Since this PR is focused on implementing the schemas, I'll exclude this from this PR and include it in the data source implementation ticket 👍

Computed: true,
MarkdownDescription: "Unique 24-hexadecimal digit string that identifies the instance.",
},
"mongo_dbversion": schema.StringAttribute{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"mongo_dbversion": schema.StringAttribute{
"mongo_db_version": schema.StringAttribute{

for consistency throughout all resources

Copy link
Author

Choose a reason for hiding this comment

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

Fixed! 👍

Copy link
Collaborator

@oarbusi oarbusi left a comment

Choose a reason for hiding this comment

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

LGTM overall!

Copy link
Member

@AgustinBettati AgustinBettati left a comment

Choose a reason for hiding this comment

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

not blocking but curious to get other inputs

Required: true,
MarkdownDescription: "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.\n\n**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.",
},
"flex_clusters": schema.ListNestedAttribute{
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"flex_clusters": schema.ListNestedAttribute{
"results": schema.ListNestedAttribute{

Would prefer to have consistency with other plural data sources in our provider, flex_clusters might also be redundant under the context of using mongodbatlas_flex_clusters data source

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.

3 participants