From 828b46c68406410ff85e01ddb0bafd73953ab01e Mon Sep 17 00:00:00 2001 From: Koushik S Date: Fri, 12 Jul 2024 11:53:20 +0530 Subject: [PATCH] Update Integration request to allow configuration access flag --- go.mod | 2 +- go.sum | 2 ++ 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 ++-- 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 760579fb..49166945 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 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..f200ae64 100644 --- a/go.sum +++ b/go.sum @@ -281,6 +281,8 @@ 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