common

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: AGPL-3.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const (
	GitWebhookTopicName              topicName = "events.webhooks.git"
	AuditEventLogTopicName           topicName = "events.audit.event-log"
	NotificationTopicName            topicName = "events.notification"
	ImageRegistryHookTopicName       topicName = "events.webhooks.image"
	ImageUpdateRegistryHookTopicName topicName = "events.webhooks.image-update"
)
View Source
const (
	EventErrorOnApply   platformEvent = "error-on-apply"
	EventResourceUpdate platformEvent = "resource-update"
)
View Source
const (
	CreatedByResourceSyncUsername  string = "created-by-resource-sync-user-name"
	CreatedByResourceSyncUserEmail string = "created-by-resource-sync-user-email"
	CreatedByResourceSyncUserId    string = "created-by-resource-sync-user-id"
)
View Source
const KloudliteBanner = `` /* 1845-byte string literal not displayed */
View Source
const KloudliteReadyBanner = `` /* 1897-byte string literal not displayed */

Variables

View Source
var BuiltAt string
View Source
var CreatedOrUpdatedByKloudlite = CreatedOrUpdatedBy{
	UserId:    repos.ID(""),
	UserName:  "kloudlite",
	UserEmail: "support@kloudlite.io",
}

Functions

func FindNamespaceForAccount

func FindNamespaceForAccount(ctx context.Context, k8sCli client.Client, accountName string) (*corev1.Namespace, error)

func PatchForErrorFromAgent

func PatchForErrorFromAgent(errMsg string, opts PatchOpts) repos.Document

func PatchForMarkDeletion

func PatchForMarkDeletion(opts ...PatchOpts) repos.Document

func PatchForSyncFromAgent

func PatchForSyncFromAgent(
	res ResourceForSyncFromAgent,
	recordVersion int,
	status types.ResourceStatus,
	opts PatchOpts,
) repos.Document

func PatchForUpdate

func PatchForUpdate(
	ctx ResourceUpdateContext,
	res ResourceForSync,
	opts ...PatchOpts,
) repos.Document

func PrintBuildInfo

func PrintBuildInfo()

func PrintKloudliteBanner

func PrintKloudliteBanner()

func PrintReadyBanner

func PrintReadyBanner()

func PrintReadyBanner2

func PrintReadyBanner2(readyIn time.Duration)

func ReceiveFromAgentSubjectName

func ReceiveFromAgentSubjectName(args ReceiveFromAgentArgs, receiver MessageReceiver, ev platformEvent) string

func ReceiveFromAgentSubjectPrefix

func ReceiveFromAgentSubjectPrefix(accountName string, clusterName string) string

func SendToAgentSubjectName

func SendToAgentSubjectName(accountName string, clusterName string, gvk string, namespace string, name string) string

func SendToAgentSubjectPrefix

func SendToAgentSubjectPrefix(accountName string, clusterName string) string

Types

type AuthSession

type AuthSession struct {
	repos.BaseEntity `json:",inline"`
	UserId           repos.ID `json:"user_id"`
	UserEmail        string   `json:"user_email"`
	UserName         string   `json:"user_name"`
	UserVerified     bool     `json:"user_verified"`
	LoginMethod      string   `json:"login_method"`
}

type CreatedOrUpdatedBy

type CreatedOrUpdatedBy struct {
	UserId    repos.ID `json:"userId"`
	UserName  string   `json:"userName"`
	UserEmail string   `json:"userEmail"`
}

type EncodedValue

type EncodedValue struct {
	Value    string `json:"value"`
	Encoding string `json:"encoding"`
}

type Json

type Json map[string]any

type MessageReceiver

type MessageReceiver string
const (
	ConsoleReceiver           MessageReceiver = "kloudlite-console"
	InfraReceiver             MessageReceiver = "kloudlite-infra"
	ContainerRegistryReceiver MessageReceiver = "kloudlite-cr"
)

type MetadataInResolver

type MetadataInResolver struct{}

func (*MetadataInResolver) Annotations

func (*MetadataInResolver) Annotations(ctx context.Context, obj *v1.ObjectMeta, data map[string]interface{}) error

func (*MetadataInResolver) Labels

func (*MetadataInResolver) Labels(ctx context.Context, obj *v1.ObjectMeta, data map[string]interface{}) error

type MetadataResolver

type MetadataResolver struct{}

func (*MetadataResolver) Annotations

func (*MetadataResolver) Annotations(ctx context.Context, obj *v1.ObjectMeta) (map[string]interface{}, error)

func (*MetadataResolver) CreationTimestamp

func (*MetadataResolver) CreationTimestamp(ctx context.Context, obj *v1.ObjectMeta) (string, error)

func (*MetadataResolver) DeletionTimestamp

func (*MetadataResolver) DeletionTimestamp(ctx context.Context, obj *v1.ObjectMeta) (*string, error)

func (*MetadataResolver) Labels

func (*MetadataResolver) Labels(ctx context.Context, obj *v1.ObjectMeta) (map[string]interface{}, error)

type PatchInResolver

type PatchInResolver struct{}

func (*PatchInResolver) Value

func (r *PatchInResolver) Value(ctx context.Context, obj *json_patch.PatchOperation, data interface{}) error

type PatchOpts

type PatchOpts struct {
	MessageTimestamp time.Time
	XPatch           repos.Document
}

type PatchResolver

type PatchResolver struct{}

func (*PatchResolver) Value

func (r *PatchResolver) Value(ctx context.Context, obj *json_patch.PatchOperation) (interface{}, error)

type ReceiveFromAgentArgs

type ReceiveFromAgentArgs struct {
	AccountName string
	ClusterName string

	GVK       string
	Namespace string
	Name      string
}

type ResourceForSync

type ResourceForSync interface {
	GetName() string
	GetNamespace() string
	GetCreationTimestamp() metav1.Time
	GetLabels() map[string]string
	GetDisplayName() string
	GetAnnotations() map[string]string
	GetGeneration() int64
	GetStatus() rApi.Status
	GetRecordVersion() int
}

type ResourceForSyncFromAgent

type ResourceForSyncFromAgent interface {
	GetName() string
	GetNamespace() string
	GetCreationTimestamp() metav1.Time
	GetLabels() map[string]string
	GetAnnotations() map[string]string
	GetGeneration() int64
	GetStatus() rApi.Status
}

type ResourceMetadata

type ResourceMetadata struct {
	DisplayName string `json:"displayName"`

	CreatedBy     CreatedOrUpdatedBy `json:"createdBy" graphql:"noinput"`
	LastUpdatedBy CreatedOrUpdatedBy `json:"lastUpdatedBy" graphql:"noinput"`
}

type ResourceUpdateContext

type ResourceUpdateContext interface {
	GetUserId() repos.ID
	GetUserEmail() string
	GetUserName() string
}

type StatusResolver

type StatusResolver struct{}

func (*StatusResolver) Checks

func (*StatusResolver) Checks(ctx context.Context, obj *operator.Status) (map[string]interface{}, error)

func (*StatusResolver) DisplayVars

func (*StatusResolver) DisplayVars(ctx context.Context, obj *operator.Status) (map[string]interface{}, error)

type SyncStatusResolver

type SyncStatusResolver struct{}

func (*SyncStatusResolver) Action

func (*SyncStatusResolver) LastSyncedAt

func (*SyncStatusResolver) LastSyncedAt(ctx context.Context, obj *t.SyncStatus) (*string, error)

func (*SyncStatusResolver) State

func (*SyncStatusResolver) SyncScheduledAt

func (*SyncStatusResolver) SyncScheduledAt(ctx context.Context, obj *t.SyncStatus) (string, error)

type ValidationError

type ValidationError struct {
	Label  string
	Errors []string
}

func (ValidationError) Error

func (v ValidationError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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