-
Notifications
You must be signed in to change notification settings - Fork 156
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
Add full param options for monitors #180
Conversation
Thanks @Seanstoppable ! If you pull 0a5d6ca your build should go green. I'll review when I've got some spare time. |
Add a more generic function that will let people mix and match Have existing functions wrap this better function Resolves the rest of state support in zorkian#164
90e89a6
to
b701c68
Compare
Great, thanks @ojongerius |
monitors.go
Outdated
// https://docs.datadoghq.com/api/?lang=bash#get-all-monitor-details | ||
type MonitorQueryOpts struct { | ||
GroupStates []string | ||
Name string |
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.
This should be a pointer, ie: *string
monitors.go
Outdated
query = append(query, value) | ||
} | ||
|
||
if opts.WithDowntimes != nil { |
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.
Up to you but you could use the generated GetWithDownTimesOk like so:
if v, ok := opts.GetWithDowntimesOk; ok {
query = append(query, fmt.Sprintf("name=%t", strings.Join(v, ",")))
}
monitors.go
Outdated
query = append(query, value) | ||
} | ||
|
||
if opts.Name != "" { |
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.
Works at the moment but needs to be changed either manually test if not nil if you refactor Name to be a pointer. Alternatively you can use the autogenereated getters and setters like so:
if v, ok := opts.GetNameOk; ok {
query = append(query, fmt.Sprintf("name=%v", strings.Join(v, ",")))
}
@ojongerius apologies for the delay. Updated with feedback, thanks! |
@Seanstoppable sorry I've been swamped with work, could you please resolve conflicts so I can merge this? |
Closing in favor of #199 |
Add a more generic function that will let people mix and match
Have existing functions wrap this better function
Resolves the rest of state support in #164