Skip to content
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

Policy/request.go has faulty DelayAction struct. #29

Closed
jaceq opened this issue Jan 30, 2020 · 3 comments
Closed

Policy/request.go has faulty DelayAction struct. #29

jaceq opened this issue Jan 30, 2020 · 3 comments

Comments

@jaceq
Copy link

jaceq commented Jan 30, 2020

Here:

UntilMinute int `json:"untilMinute,omitempty"`

is a bug, following struct is configured:

type DelayAction struct {
        DelayOption DelayType `json:"delayOption,omitempty"`
        UntilMinute int       `json:"untilMinute,omitempty"`
        UntilHour   int       `json:"untilHour,omitempty"`
        Duration    *Duration `json:"duration,omitempty"`
}

Problem is that if UntilMinute and / or UntilHour is 0 then argument is omitted as it's seen as empty (which in this case is not the case).
Due to this issue it's not possible to set any of those to 0.
According to: https://www.sohamkamani.com/blog/golang/2018-07-19-golang-omitempty/

Solution would be to switch field to:

 *int 

So, struct would look like that:

type DelayAction struct {
        DelayOption DelayType `json:"delayOption,omitempty"`
        UntilMinute *int       `json:"untilMinute,omitempty"`
        UntilHour   *int       `json:"untilHour,omitempty"`
        Duration    *Duration `json:"duration,omitempty"`
}
@freeseacher
Copy link

any update on this ?

@jaceq
Copy link
Author

jaceq commented May 5, 2020

It seems someone did a PR which would solve this: #40

@MeralBusraTekinsen
Copy link
Contributor

We have released v1.1.1 for this fix. Thanks.

rudo-thomas added a commit to rudo-thomas/terraform-provider-opsgenie that referenced this issue Nov 30, 2020
rudo-thomas added a commit to rudo-thomas/terraform-provider-opsgenie that referenced this issue Nov 30, 2020
rudo-thomas added a commit to rudo-thomas/terraform-provider-opsgenie that referenced this issue Nov 30, 2020
rudo-thomas added a commit to rudo-thomas/terraform-provider-opsgenie that referenced this issue Mar 9, 2021
arjunrajpal pushed a commit to opsgenie/terraform-provider-opsgenie that referenced this issue Jun 12, 2023
frknyldz pushed a commit to opsgenie/terraform-provider-opsgenie that referenced this issue Jun 12, 2023
…ay_action. (#379)

The referenced issue
opsgenie/opsgenie-go-sdk-v2#29 has been fixed.

Co-authored-by: Rudolf Thomas <[email protected]>
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

No branches or pull requests

3 participants