api

package
v2.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// SettingsConfigMapName contains a name of config map, that stores settings.
	SettingsConfigMapName = "kubernetes-dashboard-settings"

	// ConfigMapKindName is a name of config map kind.
	ConfigMapKindName = "ConfigMap"

	// ConfigMapAPIVersion is a API version of config map.
	ConfigMapAPIVersion = "v1"

	// GlobalSettingsKey is a settings map key which maps to current global settings.
	GlobalSettingsKey = "_global"

	// PinnedResourcesKey is a settings map key which maps to current pinned resources.
	PinnedResourcesKey = "_pinnedCRD"

	// ConcurrentSettingsChangeError occurs during settings save if settings were modified concurrently.
	// Keep it in sync with CONCURRENT_CHANGE_ERROR constant from the frontend.
	ConcurrentSettingsChangeError = "settings changed since last reload"

	// PinnedResourceNotFoundError occurs while deleting pinned resource, if the resource wasn't already pinned.
	PinnedResourceNotFoundError = "pinned resource not found"

	// ResourceAlreadyPinnedError occurs while pinning a new resource, if it has been pinned before.
	ResourceAlreadyPinnedError = "resource already pinned"
)

Variables

This section is empty.

Functions

func GetDefaultSettingsConfigMap

func GetDefaultSettingsConfigMap(namespace string) *corev1.ConfigMap

GetDefaultSettingsConfigMap returns config map with default settings.

func MarshalPinnedResources

func MarshalPinnedResources(p []PinnedResource) string

MarshalPinnedResources pinned resource into JSON object.

func UnmarshalPinnedResources

func UnmarshalPinnedResources(data string) (*[]PinnedResource, error)

UnmarshalPinnedResources unmarshal pinned resource into object.

Types

type PinnedResource

type PinnedResource struct {
	Kind        string `json:"kind"`
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
	Namespace   string `json:"namespace,omitempty"`
	Namespaced  bool   `json:"namespaced"`
}

PinnedResource represents a pinned resource.

func (*PinnedResource) IsEqual

func (p *PinnedResource) IsEqual(other *PinnedResource) bool

type Settings

type Settings struct {
	ClusterName                      string   `json:"clusterName"`
	ItemsPerPage                     int      `json:"itemsPerPage"`
	LabelsLimit                      int      `json:"labelsLimit"`
	LogsAutoRefreshTimeInterval      int      `json:"logsAutoRefreshTimeInterval"`
	ResourceAutoRefreshTimeInterval  int      `json:"resourceAutoRefreshTimeInterval"`
	DisableAccessDeniedNotifications bool     `json:"disableAccessDeniedNotifications"`
	DefaultNamespace                 string   `json:"defaultNamespace"`
	NamespaceFallbackList            []string `json:"namespaceFallbackList"`
}

Settings is a single instance of settings without context.

func GetDefaultSettings

func GetDefaultSettings() Settings

GetDefaultSettings returns settings structure, that should be used if there are no global or local settings overriding them. It should not change during runtime.

func Unmarshal

func Unmarshal(data string) (*Settings, error)

Unmarshal settings from JSON string into object.

func (Settings) Marshal

func (s Settings) Marshal() string

Marshal settings into JSON object.

type SettingsManager

type SettingsManager interface {
	// GetGlobalSettings gets current global settings from config map.
	GetGlobalSettings(client kubernetes.Interface) (s Settings)
	// SaveGlobalSettings saves provided global settings in config map.
	SaveGlobalSettings(client kubernetes.Interface, s *Settings) error
	// GetPinnedResources gets the pinned resources from config map.
	GetPinnedResources(client kubernetes.Interface) (r []PinnedResource)
	// SavePinnedResource adds a new pinned resource to config map.
	SavePinnedResource(client kubernetes.Interface, r *PinnedResource) error
	// DeletePinnedResource removes a pinned resource from config map.
	DeletePinnedResource(client kubernetes.Interface, r *PinnedResource) error
}

SettingsManager is used for user settings management.

Jump to

Keyboard shortcuts

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