-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat(database): add database user password update route #373
Conversation
7cacf91
to
6b3af9f
Compare
6b3af9f
to
56333a3
Compare
databases.go
Outdated
DatabaseUser DatabaseUpdateUserParam `json:"database_user"` | ||
} | ||
|
||
// DatabaseUpdateUser updates an user to the given database addon |
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.
typo: it's "a user" not "an user"
databases.go
Outdated
} | ||
|
||
// DatabaseUpdateUser updates an user to the given database addon | ||
func (c *Client) DatabaseUpdateUser(ctx context.Context, app, addonID, username string, user DatabaseUpdateUserParam) (DatabaseUser, error) { |
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.
suggestion: the "user" variable is misleading in this case. It could be better to name it like "databaseUserParams" WDYT?
databases.go
Outdated
} | ||
err := c.DBAPI(app, addonID).SubresourceUpdate(ctx, "databases", addonID, "users", username, payload, &res) | ||
if err != nil { | ||
return res.DatabaseUser, errors.Wrapf(ctx, err, "create a user on database %s", addonID) |
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.
issue: it should be "update a user" right?
56333a3
to
c2015d2
Compare
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.
It's not directly related but can you fix the typo here:
"esource" --> "resource"
Line 27 in 07661a2
SubresourceUpdate(rctx context.Context, esource, resourceID, subresource, id string, payload, data interface{}) error |
payload := databaseUpdateUserPayload{ | ||
DatabaseUser: databaseUserParams, | ||
} | ||
err := c.DBAPI(app, addonID).SubresourceUpdate(ctx, "databases", addonID, "users", username, payload, &res) |
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.
question: "databases" and "users" shouldn't be constants?
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 wonder, but IMO I prefer to see what is the route by seeing the string "databases".
But indeed it leaves room for potential manual errors.
However I think we should make this consistent with all other packages too.
It should be a dedicated issue I think.
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.
Yep, you are right it should be a dedicated issue.
Can you create one for that please 🙏
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.
Here: #375
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.
Thanks! ❤️
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.
"esource" --> "resource"
Nice catch ;)
payload := databaseUpdateUserPayload{ | ||
DatabaseUser: databaseUserParams, | ||
} | ||
err := c.DBAPI(app, addonID).SubresourceUpdate(ctx, "databases", addonID, "users", username, payload, &res) |
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 wonder, but IMO I prefer to see what is the route by seeing the string "databases".
But indeed it leaves room for potential manual errors.
However I think we should make this consistent with all other packages too.
It should be a dedicated issue I think.
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.
LGTM 👍
Related to Scalingo/cli#1034