utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecTemplate

func ExecTemplate(tpl *template.Template, params map[string]interface{}) ([]byte, error)

func Exp2Regexp

func Exp2Regexp(expr []string) ([]*regexp.Regexp, error)

func Flag2Verbosity

func Flag2Verbosity(f *flag.Flag) int

Flag2Verbosity expects flag.Lookup("v") as a parameter and returns verbosity level

func GenerateNames

func GenerateNames(pattern string, n int, params map[string]interface{}) ([]string, error)

func GetK8sConfig

func GetK8sConfig(cfg *cfg.KubeConfig) (*rest.Config, error)

func IsSubset

func IsSubset(obj, subset map[string]interface{}) bool

func SetObjectID

func SetObjectID(val int64)

Types

type NameIterator

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

NameSelector represents an object for iterating over names generated by NameSelector

func (*NameIterator) GetNext

func (iter *NameIterator) GetNext() string

func (*NameIterator) HasNext

func (iter *NameIterator) HasNext() bool

type NameList

type NameList struct {
	Patterns []string               `yaml:"patterns"`
	Params   map[string]interface{} `yaml:"params,omitempty"`
}

NameList represents a list of names, where :

  • "Patterns" is an array of name templates,
  • "Params" is a key-value map of parameters for the templates.

type NameMatcher

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

NameMatcher represents an object for matching names represented by NameSelector

func (*NameMatcher) IsMatch

func (nm *NameMatcher) IsMatch(name string) bool

type NameRange

type NameRange struct {
	Pattern string                 `yaml:"pattern"`
	Ranges  []string               `yaml:"ranges"`
	Params  map[string]interface{} `yaml:"params,omitempty"`
}

NameRange represents a range of names, where :

  • "Pattern" is a name template. The reserved variable _INDEX_ represents a number from the range.
  • "Ranges" is an array os values formatted as 'm-n' or 'n'. Each range 'm-n' denotes a sequence from 'm' to 'n', inclusive.
  • "Params" is a key-value map of parameters for the template.

type NameSelector

type NameSelector struct {
	List   *NameList  `yaml:"list,omitempty"`
	Range  *NameRange `yaml:"range,omitempty"`
	Regexp string     `yaml:"regexp,omitempty"`
	// contains filtered or unexported fields
}

NameSelector represents an object for generating and matching a set of names

func (*NameSelector) Finalize

func (ns *NameSelector) Finalize() error

Finalize validates and finalizes instantiation of NameSelector

func (*NameSelector) Init

func (ns *NameSelector) Init()

func (*NameSelector) Iter

func (ns *NameSelector) Iter() *NameIterator

func (*NameSelector) Matcher

func (ns *NameSelector) Matcher() *NameMatcher

func (*NameSelector) Names

func (ns *NameSelector) Names() []string

type PatchData

type PatchData struct {
	Root   []byte
	Status []byte
}

PatchData contains patches for root and status subresources.

func NewPatchData

func NewPatchData(state map[string]interface{}) (*PatchData, error)

NewPatchData initializes PatchData object

type SyncMap

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

SyncMap implements a map with synchronous access

func NewSyncMap

func NewSyncMap() *SyncMap

NewSyncMap returns an empty SyncMap

func (*SyncMap) Delete

func (m *SyncMap) Delete(key interface{}) int

Delete deletes a map entry specified by key, and returns updated number of elements in the map

func (*SyncMap) Get

func (m *SyncMap) Get(key interface{}) (interface{}, bool)

Get return a value for a key (first returned argument) if found (second returned argument)

func (*SyncMap) Keys

func (m *SyncMap) Keys() []interface{}

Keys returns array of map keys

func (*SyncMap) Set

func (m *SyncMap) Set(key interface{}, val interface{}) int

Set sets a key:value pair

func (*SyncMap) Size

func (m *SyncMap) Size() int

Size returns number of elements in the map

func (*SyncMap) String

func (m *SyncMap) String() string

String prints the map

Jump to

Keyboard shortcuts

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