Add UPDATE support in V3 volume types#656
Conversation
|
Build succeeded.
|
84acc44 to
e2bd2e9
Compare
|
Build succeeded.
|
e2bd2e9 to
862dab9
Compare
|
Build succeeded.
|
|
Need to merge delete branch #655 first. |
Add Create/Delete/List/Update/Get support for volume type in volume V3.
862dab9 to
92fb710
Compare
|
Build succeeded.
|
|
@TommyLike Looks like there's a https://travis-ci.org/gophercloud/gophercloud/jobs/319561696#L885-L886 I'm not sure what editor you use, but it might be helpful to add some type of Go plugin that will automatically call Otherwise, manually running |
92fb710 to
3f3a24e
Compare
|
@jtopjian Thanks I use GoLand as my personal IDE, looks like I need to find a way to execute the go fmt command automatically before pushing the changes:) |
|
Build succeeded.
|
|
@TommyLike Can you link to the Cinder code for this? |
|
@jtopjian oops, done@ |
jtopjian
left a comment
There was a problem hiding this comment.
@TommyLike Overall, this looks good. Just one requested change.
| type UpdateOpts struct { | ||
| Name string `json:"name,omitempty"` | ||
| Description string `json:"description,omitempty"` | ||
| IsPublic bool `json:"is_public"` |
There was a problem hiding this comment.
This should be *bool and the json tag should be json:"is_public,omitempty"
bools are tricky to work with. Let's say someone wants to update the name of a public volume type, so they do:
updateOpts := volumetypes.UpdateOpts{
Name: "new name",
}But the request that would be sent to Cinder would be:
{
"volume_type": {
"name": "new name",
"is_public": false
}
}You could use omitempty, but that means no one could ever change a volume type from public to private because false would always be omitted.
Therefore, using *bool allows for three values: true, false, and nil. omitempty prevents an empty/null field from being sent to Cinder when the value is nil.
Search the Gophercloud repo for iTrue to see how passing values to bool-pointers is usually handled.
Add Update support in V3 volume type
3f3a24e to
b7a71c0
Compare
|
Build succeeded.
|
|
@TommyLike This looks good - thank you. I'm going to follow-up with a PR to make a change to the Create options: renaming Thank you for your work on this! |
Add Update support for volume type in volume V3.
For #649
Volume type update in V3
Volume type update Code