From 84f47ecef2fa2ea3f31bb6519ce89e58250a6414 Mon Sep 17 00:00:00 2001 From: koushik-swaminathan <82563281+koushik-swaminathan@users.noreply.github.com> Date: Fri, 12 Jul 2024 14:35:37 +0530 Subject: [PATCH] Update Integration request to allow configuration access flag (#440) * Update Integration request to allow configuration access flag * Go version upgrade --- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 4 ++-- .goreleaser.yml | 4 ++-- go.mod | 4 ++-- go.sum | 4 ++-- opsgenie/resource_opsgenie_api_integration.go | 23 +++++++++++++------ .../opsgenie-go-sdk-v2/integration/request.go | 2 ++ .../opsgenie/opsgenie-go-sdk-v2/og/entity.go | 2 +- vendor/modules.txt | 4 ++-- 9 files changed, 31 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cdfbefae..ec69a512 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.18 + go-version: '1.20' - name: Import GPG key id: import_gpg @@ -33,7 +33,7 @@ jobs: uses: goreleaser/goreleaser-action@v2 with: version: latest - args: release --rm-dist + args: release --clean env: GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1261eb3..b6fa3734 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.18 + go-version: '1.20' - name: fmt check run: make fmtcheck @@ -28,4 +28,4 @@ jobs: uses: goreleaser/goreleaser-action@v2 with: version: latest - args: build --skip-validate --rm-dist + args: build --skip=validate --clean diff --git a/.goreleaser.yml b/.goreleaser.yml index a68fc57b..d02a0a0e 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,6 @@ # Visit https://goreleaser.com for documentation on how to customize this # behavior. +version: 2 before: hooks: # this is just an example and not a requirement for provider building/publishing @@ -58,6 +59,5 @@ signs: release: # Visit your project's GitHub Releases page to publish this release. draft: true - changelog: - skip: true + disable: true \ No newline at end of file diff --git a/go.mod b/go.mod index 760579fb..40aa6c79 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ module github.com/opsgenie/terraform-provider-opsgenie -go 1.18 +go 1.20 require ( github.com/hashicorp/go-retryablehttp v0.6.6 github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.0 - github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.22 + github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.23 github.com/pkg/errors v0.9.1 ) diff --git a/go.sum b/go.sum index 5add6153..189ecda0 100644 --- a/go.sum +++ b/go.sum @@ -279,8 +279,8 @@ github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce/go.mod h1:uFMI8w+ref4v2r9jz+c9i1IfIttS/OkmLfrk1jne5hs= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.22 h1:0h+YoXSyipf6XQGyIaDg6z5jwRik1JSm+sQetnD7vGY= -github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.22/go.mod h1:4OjcxgwdXzezqytxN534MooNmrxRD50geWZxTD7845s= +github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.23 h1:EFOD/cRfMeq+PCibHddoRTXu8CTN1m8Oj1Tk6eoz8Dw= +github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.23/go.mod h1:1BK0BG3Mz//zeujilvvu3GJ0jnyZwFdT9XjznoPv6kk= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/opsgenie/resource_opsgenie_api_integration.go b/opsgenie/resource_opsgenie_api_integration.go index da2eb293..1f6fba22 100644 --- a/opsgenie/resource_opsgenie_api_integration.go +++ b/opsgenie/resource_opsgenie_api_integration.go @@ -35,6 +35,11 @@ func resourceOpsgenieApiIntegration() *schema.Resource { Optional: true, Default: true, }, + "allow_configuration_access": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, "type": { Type: schema.TypeString, ForceNew: true, @@ -120,6 +125,7 @@ func createApiIntegration(d *schema.ResourceData, meta interface{}) error { } name := d.Get("name").(string) allowWriteAccess := d.Get("allow_write_access").(bool) + allowConfigurationAccess := d.Get("allow_configuration_access").(bool) ignoreRespondersFromPayload := d.Get("ignore_responders_from_payload").(bool) suppressNotifications := d.Get("suppress_notifications").(bool) ownerTeam := d.Get("owner_team_id").(string) @@ -134,6 +140,7 @@ func createApiIntegration(d *schema.ResourceData, meta interface{}) error { Name: name, Type: integrationType, AllowWriteAccess: &allowWriteAccess, + AllowConfigurationAccess: &allowConfigurationAccess, IgnoreRespondersFromPayload: &ignoreRespondersFromPayload, SuppressNotifications: &suppressNotifications, Responders: expandOpsgenieIntegrationResponders(d), @@ -180,6 +187,7 @@ func createWebhookIntegration(d *schema.ResourceData, meta interface{}) error { } name := d.Get("name").(string) allowWriteAccess := d.Get("allow_write_access").(bool) + allowConfigurationAccess := d.Get("allow_configuration_access").(bool) suppressNotifications := d.Get("suppress_notifications").(bool) ownerTeam := d.Get("owner_team_id").(string) integrationType := d.Get("type").(string) @@ -188,13 +196,14 @@ func createWebhookIntegration(d *schema.ResourceData, meta interface{}) error { headers := expandOpsGenieWebhookHeaders(d) createRequest := &integration.WebhookIntegrationRequest{ - Name: name, - Type: integrationType, - AllowWriteAccess: &allowWriteAccess, - SuppressNotifications: &suppressNotifications, - Responders: expandOpsgenieIntegrationResponders(d), - WebhookUrl: webhookUrl, - Headers: headers, + Name: name, + Type: integrationType, + AllowWriteAccess: &allowWriteAccess, + AllowConfigurationAccess: &allowConfigurationAccess, + SuppressNotifications: &suppressNotifications, + Responders: expandOpsgenieIntegrationResponders(d), + WebhookUrl: webhookUrl, + Headers: headers, } if ownerTeam != "" { diff --git a/vendor/github.com/opsgenie/opsgenie-go-sdk-v2/integration/request.go b/vendor/github.com/opsgenie/opsgenie-go-sdk-v2/integration/request.go index d52b4e18..3ba22faf 100644 --- a/vendor/github.com/opsgenie/opsgenie-go-sdk-v2/integration/request.go +++ b/vendor/github.com/opsgenie/opsgenie-go-sdk-v2/integration/request.go @@ -49,6 +49,7 @@ type APIBasedIntegrationRequest struct { Name string `json:"name"` Type string `json:"type"` AllowWriteAccess *bool `json:"allowWriteAccess"` + AllowConfigurationAccess *bool `json:"allowConfigurationAccess"` IgnoreRespondersFromPayload *bool `json:"ignoreRespondersFromPayload"` SuppressNotifications *bool `json:"suppressNotifications"` OwnerTeam *og.OwnerTeam `json:"ownerTeam,omitempty"` @@ -79,6 +80,7 @@ type WebhookIntegrationRequest struct { Name string `json:"name"` Type string `json:"type"` AllowWriteAccess *bool `json:"allowWriteAccess"` + AllowConfigurationAccess *bool `json:"allowConfigurationAccess"` SuppressNotifications *bool `json:"suppressNotifications"` OwnerTeam *og.OwnerTeam `json:"ownerTeam,omitempty"` Responders []Responder `json:"responders,omitempty"` diff --git a/vendor/github.com/opsgenie/opsgenie-go-sdk-v2/og/entity.go b/vendor/github.com/opsgenie/opsgenie-go-sdk-v2/og/entity.go index 2215d9a1..2882459e 100644 --- a/vendor/github.com/opsgenie/opsgenie-go-sdk-v2/og/entity.go +++ b/vendor/github.com/opsgenie/opsgenie-go-sdk-v2/og/entity.go @@ -346,7 +346,7 @@ const ( ) type SendAfter struct { - TimeAmount uint32 `json:"timeAmount,omitempty"` + TimeAmount uint32 `json:"timeAmount"` TimeUnit string `json:"timeUnit,omitempty"` } diff --git a/vendor/modules.txt b/vendor/modules.txt index bcbcaf82..55380159 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -173,8 +173,8 @@ github.com/mitchellh/reflectwalk # github.com/oklog/run v1.0.0 ## explicit github.com/oklog/run -# github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.22 -## explicit; go 1.12 +# github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.23 +## explicit; go 1.16 github.com/opsgenie/opsgenie-go-sdk-v2/alert github.com/opsgenie/opsgenie-go-sdk-v2/client github.com/opsgenie/opsgenie-go-sdk-v2/contact