-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add command for managing key value stores and links #162
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great!
src/commands/key_value.rs
Outdated
.get_key_value_stores(None) | ||
.await | ||
.with_context(|| format!("Error listing key value stores '{}'", self.name))?; | ||
let found = list.iter().find(|kv| kv.name == self.name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to eventually have an endpoint to find a store by name so that we don't have to fetch all stores?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Lets add this in a later iteration, though
r#"Database "{}" is now linked to app "{}" with the label "{}""#, | ||
self.database, self.app, self.label | ||
.map(|s| ResourceLinks::new(s.name, s.links)) | ||
.collect::<Vec<_>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: you can avoid collecting this into a Vec
if you change the link
function to take an impl Iterator<Item = ResourceLink>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i pass an iterator to link
the first search of any
will consume part of the iterator corrupting it for other analysis later in the function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use by_ref
on Iterator
to avoid this.
8ad5015
to
dab125f
Compare
5054756
to
82ba5b7
Compare
6533c2f
to
69d3b0b
Compare
Signed-off-by: Kate Goldenring <[email protected]>
69d3b0b
to
c4d0aec
Compare
DO NOT MERGE until changes are merged in fermyon/cloud-openapi#11
Aims to reuse as much logic and keep error formatting consistent via the
link_utils
module.