Documentation
¶
Index ¶
- Constants
- func APITokens(ctx context.Context, teamSlug slug.Slug) (int, error)
- func CPUUsage(ctx context.Context, teamSlug slug.Slug) (float64, error)
- func MemoryUsage(ctx context.Context, teamSlug slug.Slug) (float64, error)
- func NewLoaderContext(ctx context.Context, tenantName string, ...) context.Context
- func NewWatcher(ctx context.Context, mgr *watcher.Manager) *watcher.Watcher[*UnleashInstance]
- func Toggles(ctx context.Context, teamSlug slug.Slug) (int, error)
- type AllowTeamAccessToUnleashInput
- type AllowTeamAccessToUnleashPayload
- type BifrostClient
- type CreateUnleashForTeamInput
- type CreateUnleashForTeamPayload
- type DeleteUnleashInstanceInput
- type DeleteUnleashInstancePayload
- type FakeBifrostClient
- func (f *FakeBifrostClient) CreateInstance(ctx context.Context, req bifrostclient.UnleashConfigRequest) (*bifrostclient.CreateInstanceResponse, error)
- func (f *FakeBifrostClient) DeleteInstance(ctx context.Context, name string) (*bifrostclient.DeleteInstanceResponse, error)
- func (f *FakeBifrostClient) GetChannel(_ context.Context, name string) (*bifrostclient.GetChannelResponse, error)
- func (f *FakeBifrostClient) GetInstance(_ context.Context, name string) (*bifrostclient.GetInstanceResponse, error)
- func (f *FakeBifrostClient) ListChannels(_ context.Context) (*bifrostclient.ListChannelsResponse, error)
- func (f *FakeBifrostClient) ListInstances(_ context.Context) (*bifrostclient.ListInstancesResponse, error)
- func (f *FakeBifrostClient) UpdateInstance(ctx context.Context, name string, req bifrostclient.UnleashConfigRequest) (*bifrostclient.UpdateInstanceResponse, error)
- type FakePrometheusClient
- type Prometheus
- type RevokeTeamAccessToUnleashInput
- type RevokeTeamAccessToUnleashPayload
- type UnleashInstance
- func AllowTeamAccess(ctx context.Context, input AllowTeamAccessToUnleashInput) (*UnleashInstance, error)
- func Create(ctx context.Context, input *CreateUnleashForTeamInput) (*UnleashInstance, error)
- func ForTeam(ctx context.Context, teamSlug slug.Slug) (*UnleashInstance, error)
- func GetByIdent(ctx context.Context, id ident.Ident) (*UnleashInstance, error)
- func RevokeTeamAccess(ctx context.Context, input RevokeTeamAccessToUnleashInput) (*UnleashInstance, error)
- func UpdateInstance(ctx context.Context, input *UpdateUnleashInstanceInput) (*UnleashInstance, error)
- func (u *UnleashInstance) DeepCopyObject() runtime.Object
- func (u *UnleashInstance) GetLabels() map[string]string
- func (u *UnleashInstance) GetName() string
- func (u *UnleashInstance) GetNamespace() string
- func (u *UnleashInstance) GetObjectKind() schema.ObjectKind
- func (u UnleashInstance) ID() ident.Ident
- func (UnleashInstance) IsNode()
- func (u *UnleashInstance) ReleaseChannel(ctx context.Context) (*UnleashReleaseChannel, error)
- func (u *UnleashInstance) ReleaseChannelName() *string
- type UnleashInstanceCreatedActivityLogEntry
- type UnleashInstanceDeletedActivityLogEntry
- type UnleashInstanceMetrics
- type UnleashInstanceUpdatedActivityLogEntry
- type UnleashInstanceUpdatedActivityLogEntryData
- type UnleashReleaseChannel
- type UpdateUnleashInstanceInput
- type UpdateUnleashInstancePayload
Constants ¶
const (
FakeBifrostURL = "*fake*"
)
const (
ManagementClusterNamespace = "bifrost-unleash"
)
Variables ¶
This section is empty.
Functions ¶
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 NewWatcher ¶
Types ¶
type AllowTeamAccessToUnleashInput ¶
type AllowTeamAccessToUnleashPayload ¶
type AllowTeamAccessToUnleashPayload struct {
Unleash *UnleashInstance `json:"unleash,omitempty"`
}
type BifrostClient ¶
type BifrostClient interface {
CreateInstance(ctx context.Context, req bifrostclient.UnleashConfigRequest) (*bifrostclient.CreateInstanceResponse, error)
UpdateInstance(ctx context.Context, name string, req bifrostclient.UnleashConfigRequest) (*bifrostclient.UpdateInstanceResponse, error)
GetInstance(ctx context.Context, name string) (*bifrostclient.GetInstanceResponse, error)
DeleteInstance(ctx context.Context, name string) (*bifrostclient.DeleteInstanceResponse, error)
ListInstances(ctx context.Context) (*bifrostclient.ListInstancesResponse, error)
ListChannels(ctx context.Context) (*bifrostclient.ListChannelsResponse, error)
GetChannel(ctx context.Context, name string) (*bifrostclient.GetChannelResponse, error)
}
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 CreateUnleashForTeamPayload ¶
type CreateUnleashForTeamPayload struct {
Unleash *UnleashInstance `json:"unleash,omitempty"`
}
type DeleteUnleashInstancePayload ¶
type DeleteUnleashInstancePayload struct {
UnleashDeleted *bool `json:"unleashDeleted,omitempty"`
}
func Delete ¶
func Delete(ctx context.Context, input *DeleteUnleashInstanceInput) (*DeleteUnleashInstancePayload, error)
type FakeBifrostClient ¶
type FakeBifrostClient struct {
// contains filtered or unexported fields
}
func (*FakeBifrostClient) CreateInstance ¶
func (f *FakeBifrostClient) CreateInstance(ctx context.Context, req bifrostclient.UnleashConfigRequest) (*bifrostclient.CreateInstanceResponse, error)
func (*FakeBifrostClient) DeleteInstance ¶
func (f *FakeBifrostClient) DeleteInstance(ctx context.Context, name string) (*bifrostclient.DeleteInstanceResponse, error)
func (*FakeBifrostClient) GetChannel ¶
func (f *FakeBifrostClient) GetChannel(_ context.Context, name string) (*bifrostclient.GetChannelResponse, error)
func (*FakeBifrostClient) GetInstance ¶
func (f *FakeBifrostClient) GetInstance(_ context.Context, name string) (*bifrostclient.GetInstanceResponse, error)
func (*FakeBifrostClient) ListChannels ¶
func (f *FakeBifrostClient) ListChannels(_ context.Context) (*bifrostclient.ListChannelsResponse, error)
func (*FakeBifrostClient) ListInstances ¶
func (f *FakeBifrostClient) ListInstances(_ context.Context) (*bifrostclient.ListInstancesResponse, error)
func (*FakeBifrostClient) UpdateInstance ¶
func (f *FakeBifrostClient) UpdateInstance(ctx context.Context, name string, req bifrostclient.UnleashConfigRequest) (*bifrostclient.UpdateInstanceResponse, error)
type FakePrometheusClient ¶
type FakePrometheusClient struct{}
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 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 AllowTeamAccess ¶
func AllowTeamAccess(ctx context.Context, input AllowTeamAccessToUnleashInput) (*UnleashInstance, error)
func Create ¶
func Create(ctx context.Context, input *CreateUnleashForTeamInput) (*UnleashInstance, error)
func GetByIdent ¶
func RevokeTeamAccess ¶
func RevokeTeamAccess(ctx context.Context, input RevokeTeamAccessToUnleashInput) (*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 UnleashInstanceUpdatedActivityLogEntry ¶
type UnleashInstanceUpdatedActivityLogEntry struct {
activitylog.GenericActivityLogEntry
Data *UnleashInstanceUpdatedActivityLogEntryData `json:"data"`
}
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 UpdateUnleashInstancePayload ¶
type UpdateUnleashInstancePayload struct {
Unleash *UnleashInstance `json:"unleash,omitempty"`
}