Skip to content

Commit

Permalink
fix(alerts): avoid json unmarshal issue with channel payload and headers
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderblue committed Jan 18, 2020
1 parent b065cfc commit 19ef9b4
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions pkg/alerts/alerts_types.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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.
Expand Down

0 comments on commit 19ef9b4

Please sign in to comment.