unleash

package
v0.0.0-...-fed006a Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FakeBifrostURL = "*fake*"
)
View Source
const (
	ManagementClusterNamespace = "bifrost-unleash"
)

Variables

This section is empty.

Functions

func APITokens

func APITokens(ctx context.Context, teamSlug slug.Slug) (int, error)

func CPUUsage

func CPUUsage(ctx context.Context, teamSlug slug.Slug) (float64, error)

func MemoryUsage

func MemoryUsage(ctx context.Context, teamSlug slug.Slug) (float64, error)

func NewLoaderContext

func NewLoaderContext(ctx context.Context, tenantName string, appWatcher *watcher.Watcher[*UnleashInstance], bifrostAPIURL string, log logrus.FieldLogger) context.Context

NewLoaderContext creates a new context with a loaders value. If *fake* is provided as bifrostAPIURL, a fake client will be used.

func Toggles

func Toggles(ctx context.Context, teamSlug slug.Slug) (int, error)

Types

type AllowTeamAccessToUnleashInput

type AllowTeamAccessToUnleashInput struct {
	TeamSlug        slug.Slug `json:"team"`
	AllowedTeamSlug slug.Slug `json:"allowedTeam"`
}

func (*AllowTeamAccessToUnleashInput) Validate

type AllowTeamAccessToUnleashPayload

type AllowTeamAccessToUnleashPayload struct {
	Unleash *UnleashInstance `json:"unleash,omitempty"`
}

type BifrostClient

type BifrostClient interface {
	Post(ctx context.Context, path string, v any) (*http.Response, error)
	WithClient(client *http.Client)
}

func NewBifrostClient

func NewBifrostClient(url string, log logrus.FieldLogger) BifrostClient

func NewFakeBifrostClient

func NewFakeBifrostClient(wtchr *watcher.Watcher[*UnleashInstance]) BifrostClient

type CreateUnleashForTeamInput

type CreateUnleashForTeamInput struct {
	TeamSlug slug.Slug `json:"team"`
}

type CreateUnleashForTeamPayload

type CreateUnleashForTeamPayload struct {
	Unleash *UnleashInstance `json:"unleash,omitempty"`
}

type FakeBifrostClient

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

func (FakeBifrostClient) Post

func (f FakeBifrostClient) Post(ctx context.Context, path string, v any) (*http.Response, error)

func (FakeBifrostClient) WithClient

func (f FakeBifrostClient) WithClient(_ *http.Client)

type FakePrometheusClient

type FakePrometheusClient struct{}

func (FakePrometheusClient) Query

type Prometheus

type Prometheus interface {
	Query(ctx context.Context, query string, ts time.Time, opts ...prom.Option) (model.Value, prom.Warnings, error)
}

func NewFakePrometheusClient

func NewFakePrometheusClient() Prometheus

type RevokeTeamAccessToUnleashInput

type RevokeTeamAccessToUnleashInput struct {
	TeamSlug        slug.Slug `json:"team"`
	RevokedTeamSlug slug.Slug `json:"revokedTeam"`
}

type RevokeTeamAccessToUnleashPayload

type RevokeTeamAccessToUnleashPayload struct {
	Unleash *UnleashInstance `json:"unleash,omitempty"`
}

type UnleashInstance

type UnleashInstance struct {
	Name       string                  `json:"name"`
	Version    string                  `json:"version"`
	WebIngress string                  `json:"webIngress"`
	APIIngress string                  `json:"apiIngress"`
	Metrics    *UnleashInstanceMetrics `json:"metrics"`
	Ready      bool                    `json:"ready"`

	TeamSlug         slug.Slug   `json:"-"`
	AllowedTeamSlugs []slug.Slug `json:"-"`
}

func ForTeam

func ForTeam(ctx context.Context, teamSlug slug.Slug) (*UnleashInstance, error)

func GetByIdent

func GetByIdent(ctx context.Context, id ident.Ident) (*UnleashInstance, error)

func (*UnleashInstance) DeepCopyObject

func (u *UnleashInstance) DeepCopyObject() runtime.Object

func (*UnleashInstance) GetLabels

func (u *UnleashInstance) GetLabels() map[string]string

func (*UnleashInstance) GetName

func (u *UnleashInstance) GetName() string

func (*UnleashInstance) GetNamespace

func (u *UnleashInstance) GetNamespace() string

func (*UnleashInstance) GetObjectKind

func (u *UnleashInstance) GetObjectKind() schema.ObjectKind

func (UnleashInstance) ID

func (u UnleashInstance) ID() ident.Ident

func (UnleashInstance) IsNode

func (UnleashInstance) IsNode()

type UnleashInstanceCreatedActivityLogEntry

type UnleashInstanceCreatedActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
}

type UnleashInstanceMetrics

type UnleashInstanceMetrics struct {
	CPURequests    float64 `json:"cpuRequests"`
	MemoryRequests float64 `json:"memoryRequests"`

	TeamSlug slug.Slug `json:"-"`
}

type UnleashInstanceUpdatedActivityLogEntry

type UnleashInstanceUpdatedActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
	Data *UnleashInstanceUpdatedActivityLogEntryData `json:"data"`
}

type UnleashInstanceUpdatedActivityLogEntryData

type UnleashInstanceUpdatedActivityLogEntryData struct {
	RevokedTeamSlug *slug.Slug `json:"revokedTeamSlug"`
	AllowedTeamSlug *slug.Slug `json:"allowedTeamSlug"`
}

Jump to

Keyboard shortcuts

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