Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Integration request to allow configuration access flag
Browse files Browse the repository at this point in the history
koushik-swaminathan committed Jul 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 1fe1e11 commit 828b46c
Showing 6 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -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
)

2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
23 changes: 16 additions & 7 deletions opsgenie/resource_opsgenie_api_integration.go
Original file line number Diff line number Diff line change
@@ -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 != "" {

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/opsgenie/opsgenie-go-sdk-v2/og/entity.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 828b46c

Please sign in to comment.