unleash

package
v0.0.0-...-9250c3b Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 28 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, allowedClusters []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

BifrostClient provides a high-level interface for interacting with the Bifrost API. It wraps the generated OpenAPI client and provides error handling and logging.

func NewBifrostClient

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

NewBifrostClient creates a new BifrostClient with the given base URL and logger. The client uses OpenTelemetry-instrumented HTTP transport for tracing.

func NewBifrostClientWithInterface

func NewBifrostClientWithInterface(client bifrostclient.ClientWithResponsesInterface, log logrus.FieldLogger) BifrostClient

NewBifrostClientWithInterface creates a new BifrostClient using a provided ClientWithResponsesInterface. This is useful for testing with mock clients.

func NewFakeBifrostClient

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

type CreateUnleashForTeamInput

type CreateUnleashForTeamInput struct {
	TeamSlug       slug.Slug `json:"team"`
	ReleaseChannel *string   `json:"releaseChannel,omitempty"`
}

type CreateUnleashForTeamPayload

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

type DeleteUnleashInstanceInput

type DeleteUnleashInstanceInput struct {
	TeamSlug slug.Slug `json:"teamSlug"`
}

func (*DeleteUnleashInstanceInput) Validate

type DeleteUnleashInstancePayload

type DeleteUnleashInstancePayload struct {
	UnleashDeleted *bool `json:"unleashDeleted,omitempty"`
}

type FakeBifrostClient

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

func (*FakeBifrostClient) DeleteInstance

func (*FakeBifrostClient) GetChannel

func (*FakeBifrostClient) GetInstance

func (*FakeBifrostClient) ListChannels

func (*FakeBifrostClient) ListInstances

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:"-"`
	// contains filtered or unexported fields
}

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 UpdateInstance

func UpdateInstance(ctx context.Context, input *UpdateUnleashInstanceInput) (*UnleashInstance, error)

UpdateInstance updates an Unleash instance's version configuration

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()

func (*UnleashInstance) ReleaseChannel

func (u *UnleashInstance) ReleaseChannel(ctx context.Context) (*UnleashReleaseChannel, error)

ReleaseChannel returns the full release channel object by looking up the channel name from bifrost

func (*UnleashInstance) ReleaseChannelName

func (u *UnleashInstance) ReleaseChannelName() *string

ReleaseChannelName returns the name of the release channel (for GraphQL field)

type UnleashInstanceCreatedActivityLogEntry

type UnleashInstanceCreatedActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
}

type UnleashInstanceDeletedActivityLogEntry

type UnleashInstanceDeletedActivityLogEntry 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"`
	UpdatedReleaseChannel *string    `json:"updatedReleaseChannel,omitempty"`
}

type UnleashReleaseChannel

type UnleashReleaseChannel struct {
	Name           string     `json:"name"`
	CurrentVersion string     `json:"currentVersion"`
	Type           string     `json:"type"`
	LastUpdated    *time.Time `json:"lastUpdated,omitempty"`
}

UnleashReleaseChannel represents an available release channel from bifrost

func GetReleaseChannels

func GetReleaseChannels(ctx context.Context) ([]*UnleashReleaseChannel, error)

GetReleaseChannels fetches available release channels from bifrost

type UpdateUnleashInstanceInput

type UpdateUnleashInstanceInput struct {
	TeamSlug       slug.Slug `json:"teamSlug"`
	ReleaseChannel *string   `json:"releaseChannel"`
}

func (*UpdateUnleashInstanceInput) Validate

type UpdateUnleashInstancePayload

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

Jump to

Keyboard shortcuts

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