clustercache

package
v0.0.0-...-2caf503 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheIDs

func CacheIDs(endpoint string, c []string)

CacheIDs adds cluster IDs to a persistent cache, which can be used for decreasing timeout in getting cluster IDs, for commands that take both cluster names and IDs.

func GetID

func GetID(endpoint string, clusterNameOrID string, clientWrapper *client.Wrapper) (string, error)

GetID gets the cluster ID for a provided name/ID by checking in both the user cache and on the API.

func IsInCache

func IsInCache(endpoint string, ID string) bool

IsInCache checks if a cluster ID is present in the persistent cluster cache.

Types

type Cache

type Cache struct {
	Endpoints Endpoints `yaml:"endpoints"`
}

Cache is the file structure of the cluster cache file.

func New

func New() *Cache

New creates a new Cache object.

type EndpointCache

type EndpointCache struct {
	Expiry string   `yaml:"expiry"`
	IDs    []string `yaml:"ids"`
}

EndpointCache stores the IDs stored in an endpoint-specific cache, and also its expiry date.

type Endpoints

type Endpoints map[string]EndpointCache

Endpoints stores a map with the keys being API endpoints, and the values being caches.

Jump to

Keyboard shortcuts

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