Skip to content

Flavor Extra Specs: List / Get#686

Merged
jtopjian merged 1 commit intogophercloud:masterfrom
dklyle:get-flavor-extra-specs
Dec 21, 2017
Merged

Flavor Extra Specs: List / Get#686
jtopjian merged 1 commit intogophercloud:masterfrom
dklyle:get-flavor-extra-specs

Conversation

@coveralls
Copy link
Copy Markdown

coveralls commented Dec 20, 2017

Coverage Status

Coverage increased (+0.06%) to 72.865% when pulling 720e8c0 on dklyle:get-flavor-extra-specs into a999540 on gophercloud:master.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Dec 20, 2017

Copy link
Copy Markdown
Contributor

@jtopjian jtopjian left a comment

Choose a reason for hiding this comment

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

@dklyle Thank you for working on this!

This looks to be similar to the ListAccesses where I debated doing a plain "Get" or or a SinglePageResult because the request is "listing" things. We settled on the latter, so it's probably a good idea to also do the same here unless you see a reason not to?

The other idea I was kicking around was to make a dedicated type for ExtraSpecs. It's being done here (https://github.com/gophercloud/gophercloud/blob/master/openstack/sharedfilesystems/v2/sharetypes/results.go#L72-L74), but it's not being done for instance metadata, so I think it's fine to leave without a dedicated type.

// ExtraSpecsResult contains the result of a call for (potentially) multiple
// key-value pairs. Call its Extract method to interpret it as a
// map[string]interface.
type ExtraSpecsResult struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if ExtraSpecsResult will only be used internally as the basis of other types, let's rename it to extraSpecsResult.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

return
}

func GetExtraSpecs(client *gophercloud.ServiceClient, id string, key string) (r GetExtraSpecsResult) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe change id here to flavorID so it isn't confused with a supposed ExtraSpecID.

Copy link
Copy Markdown
Contributor

@jtopjian jtopjian Dec 21, 2017

Choose a reason for hiding this comment

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

Oh, also, should this be GetExtraSpec singular?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.


// ExtraSpecResult contains the result of a call for individual a single
// key-value pair.
type ExtraSpecResult struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same possible lower-casing here, too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@dklyle
Copy link
Copy Markdown
Contributor Author

dklyle commented Dec 21, 2017

Access returns a list of maps and extra-specs returns a single map. Not sure if that makes a difference, but thought I'd ask. I thought metadata looked like a closer match and tried mirroring that. But I'm certainly open to changing it.

@jtopjian
Copy link
Copy Markdown
Contributor

Access returns a list of maps and extra-specs returns a single map. Not sure if that makes a difference, but thought I'd ask. I thought metadata looked like a closer match and tried mirroring that. But I'm certainly open to changing it.

🤔

OK, good point. Let's keep it as-is then.

@dklyle dklyle force-pushed the get-flavor-extra-specs branch from 720e8c0 to 7d47410 Compare December 21, 2017 15:57
@coveralls
Copy link
Copy Markdown

coveralls commented Dec 21, 2017

Coverage Status

Coverage increased (+0.06%) to 72.884% when pulling 7d47410 on dklyle:get-flavor-extra-specs into cf81d92 on gophercloud:master.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Dec 21, 2017

Copy link
Copy Markdown
Contributor

@jtopjian jtopjian left a comment

Choose a reason for hiding this comment

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

Just one more thing to look at.

return
}

func GetExtraSpec(client *gophercloud.ServiceClient, flavorID string, key string) (r GetExtraSpecsResult) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for changing the function name to singular. I think the result type also be singular (It would have to be changed in other places, too) since the "internal" type is extraSpecResult?

@dklyle dklyle force-pushed the get-flavor-extra-specs branch from 7d47410 to 0eb6967 Compare December 21, 2017 22:24
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Dec 21, 2017

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

@jtopjian
Copy link
Copy Markdown
Contributor

@dklyle oops. The AddAccess PR which was just merged caused some file conflicts here. Sorry about that :(

@dklyle dklyle force-pushed the get-flavor-extra-specs branch from 0eb6967 to 4dbe114 Compare December 21, 2017 22:45
@coveralls
Copy link
Copy Markdown

coveralls commented Dec 21, 2017

Coverage Status

Coverage increased (+0.06%) to 72.91% when pulling 4dbe114 on dklyle:get-flavor-extra-specs into 7b1b877 on gophercloud:master.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Dec 21, 2017

@jtopjian
Copy link
Copy Markdown
Contributor

@dklyle This looks good - thank you for all of the changes.

One thing to change in #689 would be to make sure the IDFromName function is at the bottom of the requests.go file.

@jtopjian jtopjian merged commit c2cafb4 into gophercloud:master Dec 21, 2017
@jtopjian jtopjian mentioned this pull request Dec 21, 2017
5 tasks
@dklyle dklyle deleted the get-flavor-extra-specs branch January 11, 2018 05:09
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.

3 participants