Skip to content

Flavor Extra Specs Create #689

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

Flavor Extra Specs Create #689
jtopjian merged 1 commit intogophercloud:masterfrom
dklyle:create-flavor-extra-specs

Conversation

@coveralls
Copy link
Copy Markdown

coveralls commented Dec 21, 2017

Coverage Status

Coverage increased (+0.07%) to 72.895% when pulling f0059a6 on dklyle:create-flavor-extra-specs into cf81d92 on gophercloud:master.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Dec 21, 2017

@dklyle dklyle force-pushed the create-flavor-extra-specs branch from f0059a6 to 2e8433e Compare December 21, 2017 22:48
@coveralls
Copy link
Copy Markdown

coveralls commented Dec 21, 2017

Coverage Status

Coverage increased (+0.07%) to 72.921% when pulling 2e8433e on dklyle:create-flavor-extra-specs into 7b1b877 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.

@dklyle A few minor nits:

  • newlines in the docs
  • Making the IDFromName to be the bottom-most function (not that it's specifically about the IDFromName but more keeping all of the "core" types, interfaces, and methods in the same area of the file.

And some other changes:

Can you add a CreateExtraSpecsOptsBuilder interface. Update would have an UpdateExtraSpecsOptsBuilder and it's quite possible delete won't since it looks like the Delete call doesn't have a body?

Finally, could you add a GetExtraSpec to the acc test since it's now possible to retrieve a newly created spec?

Let me know if you have any questions.

panic(err)
}

Example to Create Extra Specs for a Flavor
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.

nit: Newline below this line.

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.


fmt.Printf("%+v", createdExtraSpecs)

Example to Get Extra Specs for a Flavor
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.

nit: Newline below this line.

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 dklyle force-pushed the create-flavor-extra-specs branch from 2e8433e to d2ff973 Compare December 22, 2017 00:36
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Dec 22, 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.

@dklyle
Copy link
Copy Markdown
Contributor Author

dklyle commented Dec 22, 2017

I made the suggested changes. The only one I find questionable is the CreateExtraSpecsOptsBuilder. Mainly because the json construct in ToExtraSpecsCreateMap is setting extra_specs. This particular API doesn't leave a higher level object to hang additional parameters off of. So the usage of CreateExtraSpecsOptsBuilder would be to put values into ExtraSpecOpts which is only a map[string]string. I imagine one could create some special values in the map to add extra parameters, but I'm not sure that would change the structure of the map. As such, I find this addition questionable. Maybe a more elaborate change is required around building the opts. Not sure.

@dklyle dklyle force-pushed the create-flavor-extra-specs branch from d2ff973 to be3fd78 Compare December 22, 2017 00:44
@coveralls
Copy link
Copy Markdown

coveralls commented Dec 22, 2017

Coverage Status

Coverage increased (+0.01%) to 72.921% when pulling be3fd78 on dklyle:create-flavor-extra-specs into c2cafb4 on gophercloud:master.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Dec 22, 2017

@jtopjian
Copy link
Copy Markdown
Contributor

jtopjian commented Dec 22, 2017

@dklyle Yeah, the standard comment we leave for the Builder interfaces doesn't make a lot of sense in this case. You're right - there's not much one can do in the way of adding additional parameters here when they can just pass them all in the original map.

The ToExtraSpecsCreateMap function can be used for other things beyond adding additional data, though. For example, it can validate the specs being requested so they adhere to in-house rules or something like that. In a way, the interface and function are more of a hook.

edit: Also, using interfaces here matches what's being done with the servers' Metadata.

More to that: the metadata ToMetadatumCreateMap has a built-in check to make sure only 1 metadata item is being passed. Perhaps some private cloud has the same requirement for ExtraSpecs, so they would implement this kind of check through the ToExtraSpecsCreateMap.

@dklyle
Copy link
Copy Markdown
Contributor Author

dklyle commented Dec 22, 2017

Fair enough. That's an explanation I can buy. I think the singular set of a specific key may need the same limit of only 1 item.

@jtopjian
Copy link
Copy Markdown
Contributor

I think the singular set of a specific key may need the same limit of only 1 item.

It looks like this might be required for the Update call, although it looks like the function will accept an arbitrary amount of specs and as long as the key in the URL matches at least one spec, everything else will pass. But I haven't tested that theory.

If that's true, though, I would side on passing the entire map to Nova and letting it do the validation.

This all looks good, though. Thank you for the updates and definitely thank you for pushing back on suggestions :)

@jtopjian jtopjian merged commit 05116c7 into gophercloud:master Dec 22, 2017
@jtopjian jtopjian mentioned this pull request Dec 22, 2017
5 tasks
@jtopjian
Copy link
Copy Markdown
Contributor

@dklyle Let's finish off ExtraSpecs before RemoveAccess - that should minimize the amount of toes being stepped on :)

No rush, though.

@dklyle dklyle mentioned this pull request Jan 10, 2018
@dklyle dklyle deleted the create-flavor-extra-specs branch January 11, 2018 05:08
cardoe pushed a commit to cardoe/gophercloud that referenced this pull request Aug 27, 2020
)

* Networking V2: Update port DHCP options in one API call

* Allow DHCP opts value update
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