v1

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 2 more Imports: 4 Imported by: 1

Documentation

Overview

Package v1 contains API types that are common to all versions.

The package contains two categories of types:

  • external (serialized) types that lack their own version (e.g TypeMeta)
  • internal (never-serialized) types that are needed by several different api groups, and so live here, to avoid duplication and/or import loops (e.g. LabelSelector).

In the future, we will probably move these categories of objects into separate packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizeOptions

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

AuthorizeOptions may be provided when authorize an API object.

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) Merge

func (ext Extend) Merge(extendShadow string) Extend

Merge merge extend fields from extendShadow.

func (Extend) String

func (ext Extend) String() string

String returns the string format of Extend.

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:"totalCount,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"`
}

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

type Object

type Object interface {
	GetID() uint64
	SetID(id uint64)
	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:"id,omitempty" 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:instanceID;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;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:extendShadow" 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:createdAt"`

	// 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:updatedAt"`
}

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.Extend 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) 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) 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 TableOptions

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

	// NoHeaders is only exposed for internal callers. It is not included in our OpenAPI definitions
	// and may be removed as a field in a future release.
	NoHeaders bool `json:"-"`
}

TableOptions are used when a Table is requested by the caller.

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