Skip to content

Unmarshal instance metadata JSON#40

Open
tianxiaoliang wants to merge 5 commits into
hudl:masterfrom
tianxiaoliang:master
Open

Unmarshal instance metadata JSON#40
tianxiaoliang wants to merge 5 commits into
hudl:masterfrom
tianxiaoliang:master

Conversation

@tianxiaoliang

Copy link
Copy Markdown

No description provided.

@tysonstewart

Copy link
Copy Markdown
Contributor

@tianxiaoliang Thanks for the contribution! I'm trying to find some time to test it out so I can get it merged.

Comment thread marshal.go Outdated
@@ -106,7 +106,13 @@ func parsePort(s string) int {
func (i *InstanceMetadata) UnmarshalJSON(b []byte) error {
i.Raw = b
// TODO(cq) could actually parse Raw here, and in a parallel UnmarshalXML as well.

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.

Update the comment to note the only outstanding proposal: unmarshal the XML. You took care of the first proposal here.

@tianxiaoliang

Copy link
Copy Markdown
Author

Done

Comment thread metadata.go
func (ins *Instance) SetMetadataString(key, value string) {
if ins.Metadata.parsed == nil {
ins.Metadata.parsed = map[string]interface{}{}
if ins.Metadata.Parsed == nil {

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.

Given that we can set entries in this field, "Parsed" doesn't match its use. "Parsed" implies that we only receive these values.

Again, consider renaming it to "Map", "Fields", "Values", or something similar.

@damtur

damtur commented Sep 27, 2016

Copy link
Copy Markdown
Contributor

@tianxiaoliang Would you like to address @seh comments here. I want this to be merged ;)

Please also make sure that tests are working after the change for JSON.
Unfortunately I'm afraid that those might not work on master. They do for XML.

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.

4 participants