meta

package
v0.0.0-...-1b9e8c6 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnforcePtr

func EnforcePtr(obj interface{}) (reflect.Value, error)

EnforcePtr ensures that obj is a pointer of some sort. Returns a reflect.Value of the dereferenced pointer, ensuring that it is settable/addressable. Returns an error if this is not possible.

func ExtractList

func ExtractList(obj serializer.Object) ([]interface{}, error)

ExtractList returns obj's Items element as an array of serializer.Objects. Returns an error if obj is not a List type (does not have an Items member).

func FieldPtr

func FieldPtr(v reflect.Value, fieldName string, dest interface{}) error

FieldPtr is used to get type that base on filedName from v, return dest type.

func GetItemsPtr

func GetItemsPtr(list serializer.Object) (interface{}, error)

GetItemsPtr returns a pointer to the list object's Items member. If 'list' doesn't have an Items member, it's not really a list type and an error will be returned. This function will either return a pointer to a slice, or an error, but not both.

Types

type List

type List interface {
	GetResourceVersion() int64
	SetResourceVersion(version int64)
}

List represents list interface.

func ListAccessor

func ListAccessor(obj interface{}) (List, error)

ListAccessor is used to check obj types, is list type or not.

type ListMeta

type ListMeta struct {
	// An opaque value that represents the version of this resource. May be used for optimistic
	// concurrency, change detection, and the watch operation on a resource or set of resources.
	// Clients must treat these values as opaque and values may only be valid for a particular
	// resource or set of resources. Only servers will generate resource versions.
	ResourceVersion int64 `json:"ResourceVersion,omitempty"`
}

ListMeta represents list meta.

func ListMetaFor

func ListMetaFor(obj serializer.Object) (*ListMeta, error)

ListMetaFor is used to change obj to ListMeta and return it.

func (*ListMeta) GetListMeta

func (meta *ListMeta) GetListMeta() List

GetListMeta returns ListMeta instance.

func (*ListMeta) GetResourceVersion

func (meta *ListMeta) GetResourceVersion() int64

GetResourceVersion returns ListMeta's resource version.

func (*ListMeta) SetResourceVersion

func (meta *ListMeta) SetResourceVersion(version int64)

SetResourceVersion is used to set ListMeta's resource version.

type ListMetaAccessor

type ListMetaAccessor interface {
	GetListMeta() List
}

ListMetaAccessor represents list meta accessor interface.

type Object

type Object interface {
	GetUID() string
	SetUID(uid string)
	GetName() string
	SetName(name string)
	GetResourceVersion() int64
	SetResourceVersion(version int64)
}

Object represents meta's object interface.

func Accessor

func Accessor(obj interface{}) (Object, error)

Accessor is used to check obj types.

type ObjectMeta

type ObjectMeta struct {
	// Name is unique within a namespace.
	// Name is required when creating a object.
	// Name is primarily intended for creation idempotence and configuration definition.
	Name string `json:"Name,omitempty"`

	// Clainmer is user name string to indicate who create this object.
	Claimer string `json:"Claimer,omitempty"`

	// Namespace defines the space within which name must be unique.
	// An empty namespace is equivalent to the "default" namespace.
	// TODO: Implement admission for each user in each namespace.
	Namespace string `json:"Namespace,omitempty"`

	// UID is unique string of this object, generate automatically.
	// UID is typically generated by the server on successful creation of a resource.
	// UID is not allowed to change on update operations.
	UID string `json:"UID,omitempty"`

	// Generation is a string representing a specific generation of the desired state.
	// Generation is populated by Syreo system, it is Read-Only for client side.
	Generation ObjectPhase `json:"Generation,omitempty"`

	// Labels are key value pairs that may be used to scope and select individual resources.
	Labels labels.Set `json:"Labels,omitempty"`

	// Annotations are unstructured key value data stored with a resource that may be set by
	// external tooling. They are not queryable and should be preserved when modifying
	// objects.  Annotation keys have the same formatting restrictions as Label keys. See the
	// comments on Labels for details.
	Annotations fields.Set `json:"Annotations,omitempty"`

	// CreationTimestamp 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.
	CreationTimestamp *time.Time `json:"CreationTimestamp,omitempty"`

	// An opaque value that represents the version of this resource. May be used for optimistic
	// concurrency, change detection, and the watch operation on a resource or set of resources.
	// Clients must treat these values as opaque and values may only be valid for a particular
	// resource or set of resources. Only servers will generate resource versions.
	ResourceVersion int64 `json:"ResourceVersion,omitempty"`

	ModifyTimestamp *time.Time `json:"ModifyTimestamp,omitempty"`
}

ObjectMeta is metadata that all object must have.

func (*ObjectMeta) GetName

func (meta *ObjectMeta) GetName() string

GetName returns meta's name.

func (*ObjectMeta) GetResourceVersion

func (meta *ObjectMeta) GetResourceVersion() int64

GetResourceVersion returns meta's resource version.

func (*ObjectMeta) GetUID

func (meta *ObjectMeta) GetUID() string

GetUID returns meta's uid.

func (*ObjectMeta) SetName

func (meta *ObjectMeta) SetName(name string)

SetName is used to set meta's name.

func (*ObjectMeta) SetResourceVersion

func (meta *ObjectMeta) SetResourceVersion(version int64)

SetResourceVersion is used to set meta's resource version.

func (*ObjectMeta) SetUID

func (meta *ObjectMeta) SetUID(uid string)

SetUID is used to set meta's uid.

type ObjectMetaAccessor

type ObjectMetaAccessor interface {
	GetObjectMeta() Object
}

ObjectMetaAccessor represents object meta accessor interface.

type ObjectPhase

type ObjectPhase string

ObjectPhase is a int type, specific generation of an object state.

const (
	// ObjectPhasePreCreate is the phase that indicate object is pre-create.
	ObjectPhasePreCreate ObjectPhase = "PreCreate"

	// ObjectPhaseCreating is the phase that indicate object is creating.
	ObjectPhaseCreating ObjectPhase = "Creating"

	// ObjectPhaseCreated is the phase that indicate object is created
	ObjectPhaseCreated ObjectPhase = "Created"

	// ObjectPhasePreUpdate is the phase that indicate object is pre-update.
	ObjectPhasePreUpdate ObjectPhase = "PreUpdate"

	// ObjectPhaseUpdating is the phase that indicate object is updating.
	ObjectPhaseUpdating ObjectPhase = "Updating"

	// ObjectPhaseUpdated is the phase that indicate object is updated
	ObjectPhaseUpdated ObjectPhase = "Updated"

	// ObjectPhasePreDelete is the phase that indicate object is pre-delete.
	ObjectPhasePreDelete ObjectPhase = "PreDelete"

	// ObjectPhaseDeleting is the phase that indicate object is deleting.
	ObjectPhaseDeleting ObjectPhase = "Deleting"

	// ObjectPhaseDeleted is the phase that indicate object is deleted
	ObjectPhaseDeleted ObjectPhase = "Deleted"

	// ObjectPhasePreStart is the phase that indicate object is pre-start
	ObjectPhasePreStart ObjectPhase = "PreStart"

	// ObjectPhaseStarting is the phase that indicate object is starting
	ObjectPhaseStarting ObjectPhase = "Starting"

	// ObjectPhaseStarted is the phase that indicate object is started
	ObjectPhaseStarted ObjectPhase = "Started"

	// ObjectPhasePreStop is the phase that indicate object is pre-stop
	ObjectPhasePreStop ObjectPhase = "PreStop"

	// ObjectPhaseStopping is the phase that indicate object is stopping
	ObjectPhaseStopping ObjectPhase = "Stopping"

	// ObjectPhaseStopped is the phase that indicate object is stopped
	ObjectPhaseStopped ObjectPhase = "Stopped"

	// ObjectPhasePreRestart is the phase that indicate object is pre-restart
	ObjectPhasePreRestart ObjectPhase = "PreRestart"

	// ObjectPhaseRestarting is the phase that indicate object is restarting
	ObjectPhaseRestarting ObjectPhase = "Restarting"

	// ObjectPhaseRestarted is the phase that indicate object is restarted
	ObjectPhaseRestarted ObjectPhase = "Restarted"

	// ObjectPhasePreScale is the phase that indicate object is pre-scale
	ObjectPhasePreScale ObjectPhase = "PreScale"

	// ObjectPhaseScaling is the phase that indicate object is scaling
	ObjectPhaseScaling ObjectPhase = "Scaling"

	// ObjectPhaseScaled id the phase that indicate object is scaled
	ObjectPhaseScaled ObjectPhase = "Scaled"

	// ObjectPhasePreIncr is the phase than indicate object is pre-increment
	ObjectPhasePreIncr ObjectPhase = "PreIncr"

	// ObjectPhaseIncring is the phase that indicate object is incrementing
	ObjectPhaseIncring ObjectPhase = "Incring"

	// ObjectPhaseIncred is the phase that indicate object is incremented
	ObjectPhaseIncred ObjectPhase = "Incred"

	// ResourcePhaseScheduling is the phase that indicate resource is scheduling.
	ResourcePhaseScheduling ObjectPhase = "Scheduling"

	// ResourcePhaseScheduled is the phase that indicate resource is scheduled.
	ResourcePhaseScheduled ObjectPhase = "Scheduled"

	// ObjectPhaseFinish is the phase that indicate object's action is finish.
	ObjectPhaseFinish ObjectPhase = "Finish"
)

Jump to

Keyboard shortcuts

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