Documentation ¶
Index ¶
- type Consumer
- type ErrMultiLambdaFailure
- type Function
- type Lambda
- func (lambda *Lambda) Add(producer Producer) *Lambda
- func (lambda *Lambda) Any(predicate Predicate) (bool, error)
- func (lambda *Lambda) Collect() *Lambda
- func (lambda *Lambda) Create() (allCreated bool, err error)
- func (lambda *Lambda) CreateIfNotExist() (success bool, err error)
- func (lambda *Lambda) Delete() (deleted bool, err error)
- func (lambda *Lambda) DeleteIfExist() (deleted bool, err error)
- func (lambda *Lambda) Dummy() *Lambda
- func (lambda *Lambda) Each(function Function) error
- func (lambda *Lambda) Every(predicate Predicate) (bool, error)
- func (lambda *Lambda) First(predicate Predicate) *Lambda
- func (lambda *Lambda) Grep(predicate Predicate) *Lambda
- func (lambda *Lambda) HasAnnotation(key, value string) *Lambda
- func (lambda *Lambda) HasAnnotationKey(key string) *Lambda
- func (lambda *Lambda) HasLabel(key, value string) *Lambda
- func (lambda *Lambda) HasLabelKey(key string) *Lambda
- func (lambda *Lambda) Iter(function Function) *Lambda
- func (lambda *Lambda) Map(consumer Consumer) *Lambda
- func (lambda *Lambda) MustNoError() *Lambda
- func (lambda *Lambda) NameEqual(name string) *Lambda
- func (lambda *Lambda) NamePrefix(prefix string) *Lambda
- func (lambda *Lambda) NameRegex(regex string) *Lambda
- func (lambda *Lambda) NoError() bool
- func (lambda *Lambda) NotEmpty() (bool, error)
- func (lambda *Lambda) Update() (updated bool, err error)
- func (lambda *Lambda) UpdateIfExist() (updated bool, err error)
- func (lambda *Lambda) UpdateOrCreate() (success bool, err error)
- type ListPageFunc
- type ListPager
- type Predicate
- type Producer
- type Resource
- func (rs Resource) GeResourcetName() string
- func (rs Resource) GetObject() runtime.Object
- func (rs Resource) InCluster() *kubernetesExecutable
- func (rs Resource) Mock() *kubernetesExecutable
- func (rs Resource) OutOfCluster(config *rest.Config) *kubernetesExecutable
- func (rs Resource) ResetMock()
- func (rs Resource) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumer ¶
type Consumer interface{}
Consumer is a function has one parameter and returns one value. Nil is not allowed to be used as parameter or return value, or panic will occur. Consumer is always used to apply some transformation to elements.
type ErrMultiLambdaFailure ¶
type ErrMultiLambdaFailure struct {
// contains filtered or unexported fields
}
ErrMultiLambdaFailure contains one or more error occured from lambda invocation chain
func (ErrMultiLambdaFailure) Error ¶
func (e ErrMultiLambdaFailure) Error() string
type Function ¶
type Function interface{}
Function is a function has one parameter and has no return value. The parameter must not be a nil
type Lambda ¶
type Lambda struct { Errors []error // contains filtered or unexported fields }
Lambda is a basic and core type of KCL. It holds a channel for receiving elements from previous lambda or kubernetes resource fetcher. Error is assigned if any error occured during lambda pipelining. The error will be recorded but the lambda pipelining will continue on, and forcing it fail-hard needs call MustNoError method. The error can be also be returned at the end of a pipeline via lambda operation method which is defined in lambda_operation.go
func (*Lambda) Create ¶
Create creates every element remains in lambda collection Returns true if every element is successfully created and lambda error chain Fails if any element already exists
func (*Lambda) CreateIfNotExist ¶
CreateIfNotExist creates element in the lambda collection Will not return false if any element fails to be created
func (*Lambda) DeleteIfExist ¶
DeleteIfExist delete elements in the lambda collection if it exists
func (*Lambda) HasAnnotation ¶
HasAnnotation filter the elements out if it doesn't have the arugument annotation
func (*Lambda) HasAnnotationKey ¶
HasAnnotationKey filter the elements out if it doesn't have the arugument annotation key
func (*Lambda) HasLabelKey ¶
HasLabelKey filter the elements out if it doesn't have the arugument label key
func (*Lambda) Iter ¶
Iter iterates the elements and apply function to them Note that modifying is not recommened in Iter, use Map to modify elements instead
func (*Lambda) MustNoError ¶
MustNoError panics if any error occured
func (*Lambda) NameEqual ¶
NameEqual filter the elements out if its name mismatches with the argument name
func (*Lambda) NamePrefix ¶
NamePrefix filter the elements out if its name doesn't have the prefix
func (*Lambda) NameRegex ¶
NameRegex filter the elements out if its name fails to matches the regexp
func (*Lambda) NotEmpty ¶
NotEmpty checks if any element remains Returns true if the lambda collection is not empty and error if upstream lambda fails
func (*Lambda) UpdateIfExist ¶
UpdateIfExist checks if the element exists and update it value
func (*Lambda) UpdateOrCreate ¶ added in v1.0.0
Sync automatically decides to create / update a resource If the resource doesn't exist,
type ListPageFunc ¶
type ListPageFunc interface{}
type ListPager ¶
type ListPager struct { PageSize int64 PageFn ListPageFunc }
type Predicate ¶
type Predicate interface{}
Predicate is a function has only one parameter and return boolean. When return value type is not boolean, panic will occur. The parameter can be of any type but nil and predicates is always used to test an element.
type Producer ¶
type Producer interface{}
Producer is a function takes no parameter and returns a value. Producer is recommeneded to be a closure so that the returning value can be controlled outside lambda.
type Resource ¶
type Resource string
const ( Namespace Resource = "Namespace" Node Resource = "Node" StorageClass Resource = "StorageClass" Pod Resource = "Pod" ReplicaSet Resource = "ReplicaSet" ReplicationController Resource = "ReplicationController" Deployment Resource = "Deployment" ConfigMap Resource = "ConfigMap" Ingress Resource = "Ingress" Service Resource = "Service" Endpoint Resource = "Endpoint" Secret Resource = "Secret" DaemonSet Resource = "DaemonSet" StatefulSet Resource = "StatefulSet" )
func (Resource) GeResourcetName ¶
func (Resource) Mock ¶
func (rs Resource) Mock() *kubernetesExecutable
Mock return a mock interface of lambda KubernetesClient the mock KubernetesClient is statusful and if you want to reset its status then use MockReset