http

package
v0.0.0-...-51bb0a0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BearerAuthTokenProvider

type BearerAuthTokenProvider interface {
	AuthToken(ctx context.Context) (string, error)
}

BearerAuthTokenProvider defines an interface for retrieving authentication tokens.

func NewBearerAuthTokenProvider

func NewBearerAuthTokenProvider(logger *zap.SugaredLogger, client *http.Client, url string, headers map[string]string, tokenPath string) BearerAuthTokenProvider

NewBearerAuthTokenProvider creates a new BearerAuthTokenProvider.

type BearerAuthTokenProviderMock

type BearerAuthTokenProviderMock struct {
	mock.Mock
}

BearerAuthTokenProviderMock is an autogenerated mock type for the BearerAuthTokenProvider type

func NewBearerAuthTokenProviderMock

func NewBearerAuthTokenProviderMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *BearerAuthTokenProviderMock

NewBearerAuthTokenProviderMock creates a new instance of BearerAuthTokenProviderMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*BearerAuthTokenProviderMock) AuthToken

func (_m *BearerAuthTokenProviderMock) AuthToken(ctx context.Context) (string, error)

AuthToken provides a mock function with given fields: ctx

func (*BearerAuthTokenProviderMock) EXPECT

type BearerAuthTokenProviderMock_AuthToken_Call

type BearerAuthTokenProviderMock_AuthToken_Call struct {
	*mock.Call
}

BearerAuthTokenProviderMock_AuthToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AuthToken'

func (*BearerAuthTokenProviderMock_AuthToken_Call) Return

func (*BearerAuthTokenProviderMock_AuthToken_Call) Run

func (*BearerAuthTokenProviderMock_AuthToken_Call) RunAndReturn

type BearerAuthTokenProviderMock_Expecter

type BearerAuthTokenProviderMock_Expecter struct {
	// contains filtered or unexported fields
}

func (*BearerAuthTokenProviderMock_Expecter) AuthToken

AuthToken is a helper method to define mock.On call

  • ctx context.Context

type Config

type Config struct {
	Headers         []string             `yaml:"headers"`
	HeadersFilepath string               `yaml:"headersFilepath"`
	AuthURL         string               `yaml:"authURL"`
	AuthHeaders     []string             `yaml:"authHeaders"`
	AuthTokenPath   string               `yaml:"authTokenPath"`
	Disruption      DisruptionConfig     `yaml:"disruption"`
	DisruptionCron  DisruptionCronConfig `yaml:"disruptioncron"`
}

func (Config) IsEnabled

func (c Config) IsEnabled() bool

type DisruptionConfig

type DisruptionConfig struct {
	Enabled bool   `yaml:"enabled"`
	URL     string `yaml:"url"`
}

type DisruptionCronConfig

type DisruptionCronConfig struct {
	Enabled bool   `yaml:"enabled"`
	URL     string `yaml:"url"`
}

type DisruptionCronEvent

type DisruptionCronEvent struct {
	NotifierEvent
	// Manifest is the JSON representation of the DisruptionCron object
	Manifest string `jsonapi:"attribute" json:"manifest"`
}

type DisruptionEvent

type DisruptionEvent struct {
	NotifierEvent
	// Manifest is the JSON representation of the Disruption object
	Manifest string `jsonapi:"attribute" json:"manifest"`
	// TargetsCount is the number of targets in the Disruption object
	TargetsCount int `jsonapi:"attribute" json:"targets_count"`
}

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

Notifier describes a HTTP notifier

func New

func New(commonConfig types.NotifiersCommonConfig, httpConfig Config, logger *zap.SugaredLogger) (*Notifier, error)

New HTTP Notifier

func (*Notifier) GetNotifierName

func (n *Notifier) GetNotifierName() string

GetNotifierName returns the driver's name

func (*Notifier) Notify

func (n *Notifier) Notify(obj client.Object, event corev1.Event, notifType types.NotificationType) error

Notify generates a notification for generic k8s Warning events

type NotifierEvent

type NotifierEvent struct {
	ID                 string                 `jsonapi:"primary,http_notifier_events"`
	Name               string                 `jsonapi:"attribute" json:"name"`
	NotificationTitle  string                 `jsonapi:"attribute" json:"notification_title"`
	NotificationType   types.NotificationType `jsonapi:"attribute" json:"notification_type"`
	EventReason        v1beta1.EventReason    `jsonapi:"attribute" json:"event_reason"`
	EventMessage       string                 `jsonapi:"attribute" json:"event_message"`
	InvolvedObjectKind string                 `jsonapi:"attribute" json:"involved_object_kind"`
	// Deprecated: DisruptionName exists for historical compatibility
	// and should not be used. Use Name instead.
	DisruptionName string `jsonapi:"attribute" json:"disruption_name"`
	// Deprecated: Disruption exists for historical compatibility
	// and should not be used. Use DisruptionEvent.Manifest or DisruptionCronEvent.Manifest instead.
	Disruption string `jsonapi:"attribute" json:"disruption"`
	// Deprecated: TargetsCount exists for historical compatibility
	// and should not be used. Use DisruptionEvent.TargetsCount instead.
	TargetsCount int    `jsonapi:"attribute" json:"targets_count"`
	Timestamp    int64  `jsonapi:"attribute" json:"timestamp"`
	Cluster      string `jsonapi:"attribute" json:"cluster"`
	Namespace    string `jsonapi:"attribute" json:"namespace"`
	Username     string `jsonapi:"attribute" json:"username,omitempty"`
	UserEmail    string `jsonapi:"attribute" json:"user_email,omitempty"`
	UserGroups   string `jsonapi:"attribute" json:"user_groups,omitempty"`
}

NotifierEvent represents a notification event

Jump to

Keyboard shortcuts

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