Expand API with new Machine, Interface, and Tags interfaces#85
Expand API with new Machine, Interface, and Tags interfaces#85seanhoughton wants to merge 21 commits into
Conversation
Fix NodeStatus enum names
|
Can one of the admins verify this patch? |
1 similar comment
|
Can one of the admins verify this patch? |
|
Thanks, we'll see if we can get a look across things. !!build!! |
This handles more cases, including 504 and other timeouts
| if err != nil { | ||
| return nil, err | ||
| } | ||
| for retry := 0; retry < NumberOfRetries; retry++ { |
There was a problem hiding this comment.
Curious, what dies the hashicorp retryable client offer?
| httpClient := retryablehttp.NewClient() | ||
|
|
||
| // Need to re-sign the request before each retry | ||
| httpClient.RequestLogHook = func(logger retryablehttp.Logger, request *http.Request, count int) { |
There was a problem hiding this comment.
We'd need to adapt a github.com/juju/loggo logger as the log writer implementation
| return s.definition | ||
| } | ||
|
|
||
| func (s *tag) Machines() ([]Machine, error) { |
There was a problem hiding this comment.
Another way of doing this is to keep the tag object as a pure domain object and have the api to get machines for a given tag as a method on the controller (or even as a method on the machine). A tag is really just a snippet of domain information. Same with AddToMachine() etc; they perhaps are better done as AddTag() and RemoveTag() methods on the machine entity.
| @@ -0,0 +1,150 @@ | |||
| package gomaasapi | |||
| return result, nil | ||
| } | ||
|
|
||
| func (c *controller) GetMachine(systemID string) (Machine, error) { |
There was a problem hiding this comment.
public methods/structs etc should have a comment
This PR adds a bunch of functionality. I haven't spent any time adding unit tests for the new functions or learning how the unit testing framework is set up, but it would be great if you could take a look and offer any suggestions or critiques before I spend any time on that.
This PR also adds a go module setup.