From 19ef9b4e7f618ae251b3cec8c6db820ef1f5bd3c Mon Sep 17 00:00:00 2001 From: Sander Blue Date: Fri, 17 Jan 2020 16:06:32 -0800 Subject: [PATCH] fix(alerts): avoid json unmarshal issue with channel payload and headers --- pkg/alerts/alerts_types.go | 42 ++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/pkg/alerts/alerts_types.go b/pkg/alerts/alerts_types.go index c865efd84..2de1cf9fe 100644 --- a/pkg/alerts/alerts_types.go +++ b/pkg/alerts/alerts_types.go @@ -1,6 +1,8 @@ package alerts -import "github.com/newrelic/newrelic-client-go/internal/serialization" +import ( + "github.com/newrelic/newrelic-client-go/internal/serialization" +) // Channel represents a New Relic alert notification channel type Channel struct { @@ -18,25 +20,25 @@ type ChannelLinks struct { // ChannelConfiguration represents a Configuration type within Channels type ChannelConfiguration struct { - Recipients string `json:"recipients,omitempty"` - IncludeJSONAttachment string `json:"include_json_attachment,omitempty"` - AuthToken string `json:"auth_token,omitempty"` - APIKey string `json:"api_key,omitempty"` - Teams string `json:"teams,omitempty"` - Tags string `json:"tags,omitempty"` - URL string `json:"url,omitempty"` - Channel string `json:"channel,omitempty"` - Key string `json:"key,omitempty"` - RouteKey string `json:"route_key,omitempty"` - ServiceKey string `json:"service_key,omitempty"` - BaseURL string `json:"base_url,omitempty"` - AuthUsername string `json:"auth_username,omitempty"` - AuthPassword string `json:"auth_password,omitempty"` - PayloadType string `json:"payload_type,omitempty"` - Region string `json:"region,omitempty"` - UserID string `json:"user_id,omitempty"` - Payload map[string]string `json:"payload,omitempty"` - Headers map[string]string `json:"headers,omitempty"` + Recipients string `json:"recipients,omitempty"` + IncludeJSONAttachment string `json:"include_json_attachment,omitempty"` + AuthToken string `json:"auth_token,omitempty"` + APIKey string `json:"api_key,omitempty"` + Teams string `json:"teams,omitempty"` + Tags string `json:"tags,omitempty"` + URL string `json:"url,omitempty"` + Channel string `json:"channel,omitempty"` + Key string `json:"key,omitempty"` + RouteKey string `json:"route_key,omitempty"` + ServiceKey string `json:"service_key,omitempty"` + BaseURL string `json:"base_url,omitempty"` + AuthUsername string `json:"auth_username,omitempty"` + AuthPassword string `json:"auth_password,omitempty"` + PayloadType string `json:"payload_type,omitempty"` + Region string `json:"region,omitempty"` + UserID string `json:"user_id,omitempty"` + Payload interface{} `json:"payload,omitempty"` // Note: Can be either an empty string or an object (causes marshal issues) + Headers interface{} `json:"headers,omitempty"` // Note: Can be either an empty string or an object (causes marshal issues) } // Condition represents a New Relic alert condition.