kubernetesk8s.io/kubernetes/pkg/api/rest Index | Files | Directories

package rest

import "k8s.io/kubernetes/pkg/api/rest"

Package rest defines common logic around changes to Kubernetes resources.

Index

Functions

func BeforeCreate

func BeforeCreate(strategy RESTCreateStrategy, ctx api.Context, obj runtime.Object) error

BeforeCreate ensures that common operations for all resources are performed on creation. It only returns errors that can be converted to api.Status. It invokes ResetBeforeCreate, then GenerateName, then Validate. It returns nil if the object should be created.

func CheckGeneratedNameError

func CheckGeneratedNameError(strategy RESTCreateStrategy, err error, obj runtime.Object) error

CheckGeneratedNameError checks whether an error that occured creating a resource is due to generation being unable to pick a valid name.

Types

type RESTCreateStrategy

type RESTCreateStrategy interface {
	runtime.ObjectTyper
	// The name generate is used when the standard GenerateName field is set.
	// The NameGenerator will be invoked prior to validation.
	api.NameGenerator

	// NamespaceScoped returns true if the object must be within a namespace.
	NamespaceScoped() bool
	// ResetBeforeCreate is invoked on create before validation to remove any fields
	// that may not be persisted.
	ResetBeforeCreate(obj runtime.Object)
	// Validate is invoked after default fields in the object have been filled in before
	// the object is persisted.
	Validate(obj runtime.Object) errors.ValidationErrorList
}

RESTCreateStrategy defines the minimum validation, accepted input, and name generation behavior to create an object that follows Kubernetes API conventions.

var Nodes RESTCreateStrategy = nodeStrategy{api.Scheme, api.SimpleNameGenerator}

Nodes is the default logic that applies when creating and updating Node objects.

Pods is the default logic that applies when creating and updating Pod objects.

var ReplicationControllers RESTCreateStrategy = rcStrategy{api.Scheme, api.SimpleNameGenerator}

ReplicationControllers is the default logic that applies when creating and updating Replication Controller objects.

var Services RESTCreateStrategy = svcStrategy{api.Scheme, api.SimpleNameGenerator}

Services is the default logic that applies when creating and updating Service objects.

Source Files

create.go doc.go types.go

Directories

PathSynopsis
pkg/api/rest/resttest
Version
v0.10.0
Published
Feb 3, 2015
Platform
js/wasm
Imports
4 packages
Last checked
3 minutes ago

Tools for package owners.