Skip to content

Commit

Permalink
fix:Add issue grouping field to cloudwatch alert channel data (#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
vatasha authored Oct 1, 2021
1 parent d0c9be7 commit 1e93e91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion api/alert_channels_aws_cloudwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ func (svc *AlertChannelsService) UpdateCloudwatchEb(data AlertChannel) (response
}

type CloudwatchEbDataV2 struct {
EventBusArn string `json:"eventBusArn"`
EventBusArn string `json:"eventBusArn"`
IssueGrouping string `json:"issueGrouping,omitempty"`
}

type CloudwatchEbAlertChannelV2 struct {
Expand Down
14 changes: 9 additions & 5 deletions api/alert_channels_aws_cloudwatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ import (

func TestAlertChannelsService_GetCloudwatchEb(t *testing.T) {
var (
intgGUID = intgguid.New()
apiPath = fmt.Sprintf("AlertChannels/%s", intgGUID)
fakeServer = lacework.MockServer()
intgGUID = intgguid.New()
apiPath = fmt.Sprintf("AlertChannels/%s", intgGUID)
fakeServer = lacework.MockServer()
eventBusArn = "arn:aws:events:YourRegion:YourAccountID:event-bus/default"
)
fakeServer.UseApiV2()
fakeServer.MockToken("TOKEN")
Expand All @@ -58,7 +59,8 @@ func TestAlertChannelsService_GetCloudwatchEb(t *testing.T) {
assert.Equal(t, intgGUID, response.Data.IntgGuid)
assert.Equal(t, "integration_name", response.Data.Name)
assert.True(t, response.Data.State.Ok)
assert.Equal(t, response.Data.Data.EventBusArn, "arn:aws:events:YourRegion:YourAccountID:event-bus/default")
assert.Equal(t, eventBusArn, response.Data.Data.EventBusArn)
assert.Equal(t, "Events", response.Data.Data.IssueGrouping)
}

func TestAlertChannelsService_UpdateCloudwatchEb(t *testing.T) {
Expand Down Expand Up @@ -109,6 +111,7 @@ func TestAlertChannelsService_UpdateCloudwatchEb(t *testing.T) {
assert.Equal(t, intgGUID, response.Data.IntgGuid)
assert.True(t, response.Data.State.Ok)
assert.Equal(t, eventBusArn, response.Data.Data.EventBusArn)
assert.Equal(t, "Events", response.Data.Data.IssueGrouping)
}

func singleAWSCloudwatchAlertChannel(id string) string {
Expand All @@ -117,7 +120,8 @@ func singleAWSCloudwatchAlertChannel(id string) string {
"createdOrUpdatedBy": "[email protected]",
"createdOrUpdatedTime": "2021-09-29T117:55:47.277316",
"data": {
"eventBusArn": "arn:aws:events:YourRegion:YourAccountID:event-bus/default"
"eventBusArn": "arn:aws:events:YourRegion:YourAccountID:event-bus/default",
"issueGrouping": "Events"
},
"enabled": 1,
"intgGuid": %q,
Expand Down

0 comments on commit 1e93e91

Please sign in to comment.