-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand API with new Machine, Interface, and Tags interfaces #85
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a copyright header
@@ -378,6 +439,19 @@ func (c *controller) Machines(args MachinesArgs) ([]Machine, error) { | |||
return result, nil | |||
} | |||
|
|||
func (c *controller) GetMachine(systemID string) (Machine, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.