Skip to content

Conversation

@just-be-dev
Copy link
Contributor

This is an updated approach to #1957 that was spawned from feedback from @ahl. The main feedback here is that we'd like the CLI and API be consistent. In the cli we'll probably use --project and --organization not --project_id, --project_name. The over-specification of params and their types didn't actually make the resulting API any simpler... in fact, it introduced extra failure modes where you could have combinations of selectors for the same resource.

I'm putting this up as a separate PR to merge on the first just so folks can take a peek at it and voice any feedback/concerns before I merge them together.

Differences from #1957

  • Selectors (InstanceSelector, ProjectSelector) are structs now instead of enums.
  • Uses NameOrId for query parameters reducing project_id and project_name down to just project
  • DB newtype wrapper for NameOrId is no longer necessary

Copy link
Contributor

@karencfv karencfv left a comment

Choose a reason for hiding this comment

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

This is looking great! I like it, a lot of the complexity has been reduced

@just-be-dev just-be-dev requested a review from ahl November 30, 2022 05:05
@just-be-dev just-be-dev marked this pull request as ready for review November 30, 2022 05:05
params::InstanceSelector {
instance: NameOrId::Name(instance_name),
project: Some(NameOrId::Name(project_name)),
organization: Some(NameOrId::Id(organization_id)),
Copy link
Contributor

Choose a reason for hiding this comment

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

I see, tbe optional parent identifiers aren’t a problem because you were already doing this whole pattern match on the valid combinations anyway. So encoding them into the type was redundant and way harder for spec generation.

@david-crespo
Copy link
Contributor

Great improvement!

@just-be-dev just-be-dev merged commit 8c7ce21 into rfd-322-poc Nov 30, 2022
@just-be-dev just-be-dev deleted the rfd-322-poc-rev2 branch November 30, 2022 15:38
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