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

Cleanup list uninitialized sled API #4698

Merged
merged 3 commits into from
Dec 18, 2023
Merged

Cleanup list uninitialized sled API #4698

merged 3 commits into from
Dec 18, 2023

Conversation

andrewjstone
Copy link
Contributor

  • Rename uninitialized_sled_list to sled_list_uninitialized
  • Add fake pagination to this API endpoint

Fixes part of #4607

* Rename `uninitialized_sled_list` to `sled_list_uninitialized`
* Add fake pagination to this API endpoint

Fixes part of #4607
@andrewjstone
Copy link
Contributor Author

Gentle ping @ahl @david-crespo @zephraph

@@ -125,12 +125,12 @@ rack_list GET /v1/system/hardware/racks
rack_view GET /v1/system/hardware/racks/{rack_id}
sled_instance_list GET /v1/system/hardware/sleds/{sled_id}/instances
sled_list GET /v1/system/hardware/sleds
sled_list_uninitialized GET /v1/system/hardware/uninitialized-sleds
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we changed the endpoint to be /v1/system/hardware/sleds-uninitialized? This follows a similar pattern where in cases we may have wanted the API to be /sleds/uninitialized but can't because of naming conflicts, we use - instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If that's the consensus, I can go ahead and make this change.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Justin. This pattern is not obvious in the API because where it really shows up is the console, e.g., /projects vs. /projects-new.

There are a few endpoints in the API that are similar, like /v1/system/silo-quotas and /v1/vpc-subnets, but both of those are hierarchical noun-noun (parent-child) pairs so not quite the same thing. But yes, the basic principle is to line up the names so they're obviously related:

/sleds
/sleds-uninitialized

Copy link
Contributor

@david-crespo david-crespo left a comment

Choose a reason for hiding this comment

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

Looks good pending the discussed change to the path.

@andrewjstone
Copy link
Contributor Author

Thanks for the review and tips @zephraph @david-crespo! This was my first new nexus endpoint, so I'm not surprised I ran into something like this.

@andrewjstone andrewjstone enabled auto-merge (squash) December 18, 2023 18:56
@andrewjstone andrewjstone enabled auto-merge (squash) December 18, 2023 18:57
@andrewjstone andrewjstone merged commit 8ad838e into main Dec 18, 2023
20 of 21 checks passed
@andrewjstone andrewjstone deleted the fix-4607-part-1 branch December 18, 2023 21:20
tags = ["system/hardware"]
}]
async fn uninitialized_sled_list(
async fn sled_list_uninitialized(
rqctx: RequestContext<Arc<ServerContext>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

this is insufficient to make this into a paginated endpoint. We also need the Query<..> even though we'll ignore it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that and thanks for the tip! I will update it in a follow up.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sorry I didn't get this comment in in time!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in #4720

"5XX": {
"$ref": "#/components/responses/Error"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

we'd expect to see "x-dropshot-paginated" in here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

x-dropshot-pagination shows up as of #4720

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.

4 participants