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

Impossible to define notification policy with a weekday-and-time-of-day restriction #52

Closed
tzaleski-vertexinc opened this issue May 23, 2022 · 3 comments
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@tzaleski-vertexinc
Copy link

What happened?

I'm trying to define notification policy with a weekday-and-time-of-day restriction and Pulumi reports problems with NotificationPolicy.TimeRestrictions[0].Restriction[0].EndDay and NotificationPolicy.TimeRestrictions[0].Restriction[0].StartDay.

Steps to reproduce

~/github/pulumi-test
❯ cat package.json
{
    "name": "notification-policy-bug",
    "version": "0.0.1",
    "devDependencies": {
      "@types/node": "16.0.0",
      "typescript": "^4.3.5"
    },
    "dependencies": {
        "@pulumi/opsgenie": "v1.1.5",
        "@pulumi/pulumi": "^3.30.0"
    }
  }

~/github/pulumi-test
❯ cat *.ts
import * as opsgenie from "@pulumi/opsgenie";

new opsgenie.NotificationPolicy("notification-policy-bug", {
    filters: [{
        conditions: [
            {
                expectedValue: "P4",
                field: "priority",
                operation: "equals",
                order: 0,
            },
        ],
        type: "match-all-conditions",
    }],
    teamId: "team",
    delayActions: [{
        delayOption: "next-time",
        untilHour: 9,
        untilMinute: 30
    }],
    policyDescription: "example desc",
    timeRestrictions: [{
        restrictions: [{
            endDay: "wednesday",
            endHour: 10,
            endMin: 10,
            startDay: "monday",
            startHour: 9,
            startMin: 9,
    }],
        type: "weekday-and-time-of-day",
    }],
})

❯ pulumi preview
Previewing update (opsgenie-notification-policy-bug)

     Type                                  Name                                                      Plan       Info
 +   pulumi:pulumi:Stack                   notification-policy-bug-opsgenie-notification-policy-bug  create     1 message
     └─ opsgenie:index:NotificationPolicy  notification-policy-bug                                              2 errors

Diagnostics:
  pulumi:pulumi:Stack (notification-policy-bug-opsgenie-notification-policy-bug):
    INFO[2022-05-23T13:33:25.857384+02:00] Client is configured with ApiUrl: api.opsgenie.com, LogLevel: info, RetryMaxCount: 10

  opsgenie:index:NotificationPolicy (notification-policy-bug):
    error: opsgenie:index/notificationPolicy:NotificationPolicy resource 'notification-policy-bug' has a problem: Invalid or unknown key. Examine values at 'NotificationPolicy.TimeRestrictions[0].Restriction[0].EndDay'.
    error: opsgenie:index/notificationPolicy:NotificationPolicy resource 'notification-policy-bug' has a problem: Invalid or unknown key. Examine values at 'NotificationPolicy.TimeRestrictions[0].Restriction[0].StartDay'.

Expected Behavior

Notification policy created with a time restriction set.

Actual Behavior

    error: opsgenie:index/notificationPolicy:NotificationPolicy resource 'notification-policy-bug' has a problem: Invalid or unknown key. Examine values at 'NotificationPolicy.TimeRestrictions[0].Restriction[0].EndDay'.
    error: opsgenie:index/notificationPolicy:NotificationPolicy resource 'notification-policy-bug' has a problem: Invalid or unknown key. Examine values at 'NotificationPolicy.TimeRestrictions[0].Restriction[0].StartDay'.
    ```

### Versions used

CLI
Version 3.33.1
Go Version go1.17.10
Go Compiler gc

Plugins
NAME VERSION
nodejs unknown
opsgenie 1.1.5

Host
OS darwin
Version 12.4
Arch arm64

This project is written in nodejs (/opt/homebrew/bin/node v18.0.0)

Current Stack: opsgenie-notification-policy-bug

Found no resources associated with opsgenie-notification-policy-bug

Found no pending operations associated with opsgenie-notification-policy-bug

NAME VERSION
@pulumi/opsgenie 1.1.5
@pulumi/pulumi 3.33.1
@types/node 16.0.0
typescript 4.6.4


### Additional context

Seems similar to:
- https://github.com/pulumi/pulumi-opsgenie/issues/17 
- https://github.com/pulumi/pulumi-opsgenie/issues/51

### Contributing

Vote on this issue by adding a 👍 reaction. 
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already). 
@tzaleski-vertexinc tzaleski-vertexinc added the kind/bug Some behavior is incorrect or out of spec label May 23, 2022
@guineveresaenger guineveresaenger self-assigned this May 24, 2022
@guineveresaenger
Copy link
Contributor

I think you're right that this is related to #51. Will add to #53.

@guineveresaenger
Copy link
Contributor

Fixed on master branch via #53

@fronti90
Copy link

Thank you for the quick fix and great support! Works as expected now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

3 participants