v1

package
v0.0.0-release-12.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const FullValidConfigForTesting = `` /* 244-byte string literal not displayed */

FullValidConfigForTesting is a string representation of a JSON object that contains all fields supported by the notifier Config. It can be used without secrets.

View Source
const FullValidSecretsForTesting = `{
	"password": "test-password"
}`

FullValidSecretsForTesting is a string representation of JSON object that contains all fields that can be overridden from secrets

View Source
const (
	Version = schema.V1
)

The user can choose which API version to use when sending messages to Kafka. The default is v2. Details on how these versions differ can be found here: https://docs.confluent.io/platform/current/kafka-rest/api.html

Variables

View Source
var Schema = schema.IntegrationSchemaVersion{
	Version:   Version,
	CanCreate: true,
	Options: []schema.Field{
		{
			Label:        "Kafka REST Proxy",
			Element:      schema.ElementTypeInput,
			InputType:    schema.InputTypeText,
			Description:  "Hint: If you are directly using v3 APIs hosted on a Confluent Kafka Server, you must append /kafka to the URL here. Example: https://localhost:8082/kafka",
			Placeholder:  "http://localhost:8082",
			PropertyName: "kafkaRestProxy",
			Required:     true,
			Protected:    true,
		},
		{
			Label:        "Topic",
			Element:      schema.ElementTypeInput,
			InputType:    schema.InputTypeText,
			Placeholder:  "topic1",
			PropertyName: "kafkaTopic",
			Required:     true,
		},
		{
			Label:        "Username",
			Element:      schema.ElementTypeInput,
			InputType:    schema.InputTypeText,
			PropertyName: "username",
			Required:     false,
		},
		{
			Label:        "Password",
			Element:      schema.ElementTypeInput,
			InputType:    schema.InputTypePassword,
			Description:  "The password to use when making a call to the Kafka REST Proxy",
			PropertyName: "password",
			Required:     false,
			Secure:       true,
		},
		{
			Label:        "API version",
			Element:      schema.ElementTypeSelect,
			InputType:    schema.InputTypeText,
			Description:  "The API version to use when contacting the Kafka REST Server. By default v2 will be used.",
			PropertyName: "apiVersion",
			Required:     false,
			SelectOptions: []schema.SelectOption{
				{
					Value: apiVersionV2,
					Label: "v2",
				},
				{
					Value: apiVersionV3,
					Label: "v3",
				},
			},
		},
		{
			Label:        "Cluster ID",
			Element:      schema.ElementTypeInput,
			InputType:    schema.InputTypeText,
			Description:  "v3 APIs require a clusterID to be specified.",
			Placeholder:  "lkc-abcde",
			PropertyName: "kafkaClusterId",
			Required:     true,
			ShowWhen: schema.ShowWhen{
				Field: "apiVersion",
				Is:    apiVersionV3,
			},
		},
		{
			Label:        "Description",
			Element:      schema.ElementTypeTextArea,
			InputType:    schema.InputTypeText,
			Description:  "Templated description of the Kafka message",
			PropertyName: "description",
			Placeholder:  templates.DefaultMessageTitleEmbed,
		},
		{
			Label:        "Details",
			Element:      schema.ElementTypeTextArea,
			Description:  "Custom details to include with the message. You can use template variables.",
			PropertyName: "details",
			Placeholder:  templates.DefaultMessageEmbed,
		},
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint       string `json:"kafkaRestProxy,omitempty" yaml:"kafkaRestProxy,omitempty"`
	Topic          string `json:"kafkaTopic,omitempty" yaml:"kafkaTopic,omitempty"`
	Description    string `json:"description,omitempty" yaml:"description,omitempty"`
	Details        string `json:"details,omitempty" yaml:"details,omitempty"`
	Username       string `json:"username,omitempty" yaml:"username,omitempty"`
	Password       string `json:"password,omitempty" yaml:"password,omitempty"`
	APIVersion     string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
	KafkaClusterID string `json:"kafkaClusterId,omitempty" yaml:"kafkaClusterId,omitempty"`
}

func NewConfig

func NewConfig(jsonData json.RawMessage, decryptFn receivers.DecryptFunc) (Config, error)

type Notifier

type Notifier struct {
	*receivers.Base
	// contains filtered or unexported fields
}

Notifier is responsible for sending alert notifications to Kafka.

func New

func New(cfg Config, meta receivers.Metadata, template *templates.Template, sender receivers.WebhookSender, images images.Provider, logger log.Logger) *Notifier

func (*Notifier) Notify

func (kn *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)

Notify sends the alert notification.

func (*Notifier) SendResolved

func (kn *Notifier) SendResolved() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址