v1

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOptions

type CreateOptions struct {
	TypeMeta `json:",inline"`

	// When present, indicates that modifications should not be
	// persisted. An invalid or unrecognized dryRun directive will
	// result in an error response and no further processing of the
	// request. Valid values are:
	// - All: all dry run stages will be processed
	// +optional
	DryRun []string `json:"dryRun,omitempty"`
}

CreateOptions may be provided when creating an API object.

type DeleteOptions

type DeleteOptions struct {
	TypeMeta `json:",inline"`

	// +optional
	Unscoped bool `json:"unscoped"`
}

DeleteOptions may be provided when deleting an API object.

type ExportOptions

type ExportOptions struct {
	TypeMeta `json:",inline"`

	// Should this value be exported.  Export strips fields that a user can not specify.
	// Deprecated. Planned for removal in 1.18.
	Export bool `json:"export"`
	// Should the export be exact.  Exact export maintains cluster-specific fields like 'Namespace'.
	// Deprecated. Planned for removal in 1.18.
	Exact bool `json:"exact"`
}

ExportOptions is the query options to the standard REST get call. Deprecated. Planned for removal in 1.18.

type Extend

type Extend map[string]interface{}

Extend defines a new type used to store extended fields.

func (Extend) Get added in v0.8.6

func (ext Extend) Get(field string) (value interface{})

func (Extend) Has added in v0.8.6

func (ext Extend) Has(field string) (exists bool)

func (Extend) Merge

func (ext Extend) Merge(extendShadow string) Extend

func (Extend) String

func (ext Extend) String(sensitiveKeys ...string) string

type GetOptions

type GetOptions struct {
	TypeMeta `json:",inline"`
}

GetOptions is the standard query options to the standard REST get call.

type ListInterface

type ListInterface interface {
	GetTotalCount() int64
	SetTotalCount(count int64)
}

ListInterface lets you work with list metadata from any of the versioned or internal API objects. Attempting to set or retrieve a field on an object that does not support that field will be a no-op and return a default value.

type ListMeta

type ListMeta struct {
	TotalCount int64 `json:"total,omitempty"`
}

ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.

func (*ListMeta) GetListMeta

func (obj *ListMeta) GetListMeta() ListInterface

func (*ListMeta) GetTotalCount

func (meta *ListMeta) GetTotalCount() int64

func (*ListMeta) SetTotalCount

func (meta *ListMeta) SetTotalCount(count int64)

type ListOptions

type ListOptions struct {
	TypeMeta `json:",inline"`

	// LabelSelector is used to find matching REST resources.
	LabelSelector string `json:"labelSelector,omitempty" form:"labelSelector"`

	// FieldSelector restricts the list of returned objects by their fields. Defaults to everything.
	FieldSelector string `json:"fieldSelector,omitempty" form:"fieldSelector"`

	// TimeoutSeconds specifies the seconds of ClientIP type session sticky time.
	TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"`

	// Offset specify the number of records to skip before starting to return the records.
	Offset *int64 `json:"offset,omitempty" form:"offset"`

	// Limit specify the number of records to be retrieved.
	Limit *int64 `json:"limit,omitempty" form:"limit"`

	// Page specify the current page, compatible fields.
	Page *int64 `json:"current,omitempty" form:"current"`

	// PageSize specify the size per page, compatible fields.
	PageSize *int64 `json:"pageSize,omitempty" form:"pageSize"`
}

ListOptions is the query options to a standard REST list call.

type Object

type Object interface {
	GetID() uint64
	SetID(id uint64)
	GetInstanceID() string
	SetInstanceID(instanceId string)
	GetName() string
	SetName(name string)
	GetCreatedAt() time.Time
	SetCreatedAt(createdAt time.Time)
	GetUpdatedAt() time.Time
	SetUpdatedAt(updatedAt time.Time)
}

Object lets you work with object metadata from any of the versioned or internal API objects. Attempting to set or retrieve a field on an object that does not support that field (Name, UID, Namespace on lists) will be a no-op and return a default value.

type ObjectMeta

type ObjectMeta struct {
	// ID is the unique in time and space value for this object. It is typically generated by
	// the storage on successful creation of a resource and is not allowed to change on PUT
	// operations.
	//
	// Populated by the system.
	// Read-only.
	ID uint64 `json:"-" gorm:"primary_key;AUTO_INCREMENT;column:id"`

	// InstanceID defines a string type resource identifier,
	// use prefixed to distinguish resource types, easy to remember, Url-friendly.
	InstanceID string `json:"instanceId,omitempty" gorm:"unique;column:instance_id;type:varchar(32);not null"`

	// Required: true
	// Name must be unique. Is required when creating resources.
	// Name is primarily intended for creation idempotence and configuration
	// definition.
	// It will be generated automated only if Name is not specified.
	// Cannot be updated.
	Name string `json:"name,omitempty" gorm:"column:name;unique;uniqueIndex;type:varchar(64);not null" validate:"name"`

	// Extend store the fields that need to be added, but do not want to add a new table column, will not be stored in
	// db.
	Extend Extend `json:"extend,omitempty" gorm:"-" validate:"omitempty"`

	// ExtendShadow is the shadow of Extend. DO NOT modify directly.
	ExtendShadow string `json:"-" gorm:"column:extend_shadow" validate:"omitempty"`

	// CreatedAt is a timestamp representing the server time when this object was
	// created. It is not guaranteed to be set in happens-before order across separate operations.
	// Clients may not set this value. It is represented in RFC3339 form and is in UTC.
	//
	// Populated by the system.
	// Read-only.
	// Null for lists.
	CreatedAt time.Time `json:"createdAt,omitempty" gorm:"column:created_at"`

	// UpdatedAt is a timestamp representing the server time when this object was updated.
	// Clients may not set this value. It is represented in RFC3339 form and is in UTC.
	//
	// Populated by the system.
	// Read-only.
	// Null for lists.
	UpdatedAt time.Time `json:"updatedAt,omitempty" gorm:"column:updated_at"`
}

ObjectMeta is metadata that all persisted resources must have, which includes all objects ObjectMeta is also used by gorm.

func (*ObjectMeta) AfterFind

func (obj *ObjectMeta) AfterFind(tx *gorm.DB) error

AfterFind run after find to unmarshal a extend shadown string into metav1.Config struct.

func (*ObjectMeta) BeforeCreate

func (obj *ObjectMeta) BeforeCreate(tx *gorm.DB) error

BeforeCreate run before create database record.

func (*ObjectMeta) BeforeUpdate

func (obj *ObjectMeta) BeforeUpdate(tx *gorm.DB) error

BeforeUpdate run before update database record.

func (*ObjectMeta) GetCreatedAt

func (meta *ObjectMeta) GetCreatedAt() time.Time

func (*ObjectMeta) GetID

func (meta *ObjectMeta) GetID() uint64

func (*ObjectMeta) GetInstanceID added in v0.8.4

func (meta *ObjectMeta) GetInstanceID() string

func (*ObjectMeta) GetName

func (meta *ObjectMeta) GetName() string

func (*ObjectMeta) GetObjectMeta

func (obj *ObjectMeta) GetObjectMeta() Object

func (*ObjectMeta) GetUpdatedAt

func (meta *ObjectMeta) GetUpdatedAt() time.Time

func (*ObjectMeta) SetCreatedAt

func (meta *ObjectMeta) SetCreatedAt(createdAt time.Time)

func (*ObjectMeta) SetID

func (meta *ObjectMeta) SetID(id uint64)

func (*ObjectMeta) SetInstanceID added in v0.8.4

func (meta *ObjectMeta) SetInstanceID(instanceId string)

func (*ObjectMeta) SetName

func (meta *ObjectMeta) SetName(name string)

func (*ObjectMeta) SetUpdatedAt

func (meta *ObjectMeta) SetUpdatedAt(updatedAt time.Time)

type ObjectMetaAccessor

type ObjectMetaAccessor interface {
	GetObjectMeta() Object
}

type PatchOptions

type PatchOptions struct {
	TypeMeta `json:",inline"`

	// When present, indicates that modifications should not be
	// persisted. An invalid or unrecognized dryRun directive will
	// result in an error response and no further processing of the
	// request. Valid values are:
	// - All: all dry run stages will be processed
	// +optional
	DryRun []string `json:"dryRun,omitempty"`

	// Force is going to "force" Apply requests. It means user will
	// re-acquire conflicting fields owned by other people. Force
	// flag must be unset for non-apply patch requests.
	// +optional
	Force bool `json:"force,omitempty"`
}

PatchOptions may be provided when patching an API object. PatchOptions is meant to be a superset of UpdateOptions.

type Type

type Type interface {
	GetAPIVersion() string
	SetAPIVersion(version string)
	GetKind() string
	SetKind(kind string)
}

Type exposes the type and APIVersion of versioned or internal API objects.

type TypeMeta

type TypeMeta struct {
	// Kind is a string value representing the REST resource this object represents.
	// Servers may infer this from the endpoint the client submits requests to.
	// Cannot be updated.
	// In CamelCase.
	// required: false
	Kind string `json:"kind,omitempty"`

	// APIVersion defines the versioned schema of this representation of an object.
	// Servers should convert recognized schemas to the latest internal value, and
	// may reject unrecognized values.
	APIVersion string `json:"apiVersion,omitempty"`
}

TypeMeta describes an individual object in an API response or request with strings representing the type of the object and its API schema version. Structures that are versioned or persisted should inline TypeMeta.

func (*TypeMeta) GetAPIVersion

func (meta *TypeMeta) GetAPIVersion() string

func (*TypeMeta) GetKind

func (meta *TypeMeta) GetKind() string

func (*TypeMeta) GetObjectKind

func (obj *TypeMeta) GetObjectKind() scheme.ObjectKind

func (*TypeMeta) GroupVersionKind

func (obj *TypeMeta) GroupVersionKind() scheme.GroupVersionKind

GroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta.

func (*TypeMeta) SetAPIVersion

func (meta *TypeMeta) SetAPIVersion(version string)

func (*TypeMeta) SetGroupVersionKind

func (obj *TypeMeta) SetGroupVersionKind(gvk scheme.GroupVersionKind)

SetGroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta.

func (*TypeMeta) SetKind

func (meta *TypeMeta) SetKind(kind string)

type UpdateOptions

type UpdateOptions struct {
	TypeMeta `json:",inline"`

	// When present, indicates that modifications should not be
	// persisted. An invalid or unrecognized dryRun directive will
	// result in an error response and no further processing of the
	// request. Valid values are:
	// - All: all dry run stages will be processed
	// +optional
	DryRun []string `json:"dryRun,omitempty"`
}

UpdateOptions may be provided when updating an API object. All fields in UpdateOptions should also be present in PatchOptions.

Jump to

Keyboard shortcuts

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