models

package
v1.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context, s rest.StandardStorage, name string, resourceVersion string) (runtime.Object, error)

Deprecated

func GetV2

func GetV2(ctx context.Context, s rest.StandardStorage, name string, resourceVersion string, mutatingFunc MutatingFunc) (runtime.Object, error)

func ObjectMetaFilter

func ObjectMetaFilter(obj metav1.ObjectMeta, key, value string) bool

Types

type CompareFunc

type CompareFunc func(left runtime.Object, right runtime.Object, orderBy string) bool
var DefaultCompareFunc CompareFunc = func(left runtime.Object, right runtime.Object, _ string) bool {
	leftMeta, _ := meta.Accessor(left)
	rightMeta, _ := meta.Accessor(right)
	if leftMeta.GetCreationTimestamp().Time.Equal(rightMeta.GetCreationTimestamp().Time) {
		return leftMeta.GetName() > rightMeta.GetName()
	}
	return leftMeta.GetCreationTimestamp().Time.After(rightMeta.GetCreationTimestamp().Time)
}

type FilterFunc

type FilterFunc func(obj runtime.Object) bool

type ListToObjectSliceFunction

type ListToObjectSliceFunction func(runtime.Object, *query.Query) []runtime.Object

type MutatingFunc

type MutatingFunc func(obj runtime.Object) runtime.Object
var DefaultMutatingFunc MutatingFunc = func(obj runtime.Object) runtime.Object {
	return obj
}

type PageableResponse

type PageableResponse struct {
	Items      []interface{} `json:"items" description:"paging data"`
	TotalCount int           `json:"totalCount" description:"total count"`
}

func DefaultList added in v1.4.0

func DefaultList(object runtime.Object, q *query.Query, litToSliceFunc ListToObjectSliceFunction, compareFunc CompareFunc, mutatingFunc MutatingFunc) (*PageableResponse, error)

DefaultList a func to build a PageableResponse

func DefaultListMerge added in v1.4.0

func DefaultListMerge(objects []runtime.Object, litToSliceFunc ListToObjectSliceFunction, compareFunc CompareFunc, mutatingFunc MutatingFunc) (*PageableResponse, error)

DefaultListMerge a func to build a PageableResponse from many obj

func ListExV2

func ListExV2(ctx context.Context, s rest.StandardStorage, q *query.Query, litToSliceFunc ListToObjectSliceFunction, compareFunc CompareFunc, mutatingFunc MutatingFunc) (*PageableResponse, error)

Directories

Path Synopsis
mock
Package mock_cluster is a generated GoMock package.
Package mock_cluster is a generated GoMock package.
iam
mock
Package mock_iam is a generated GoMock package.
Package mock_iam is a generated GoMock package.
mock
Package mock_lease is a generated GoMock package.
Package mock_lease is a generated GoMock package.
mock
Package mock_operation is a generated GoMock package.
Package mock_operation is a generated GoMock package.
mock
Package mock_platform is a generated GoMock package.
Package mock_platform is a generated GoMock package.

Jump to

Keyboard shortcuts

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