resourcemgr

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2017 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package resourcemgr implements generic resource handling methods. This includes:

  • a mechanism for creating specific resources from a JSON or YAML input.
  • an untyped resource management interface for each resource type
  • table template data for each resource type

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateResourcesFromFile

func CreateResourcesFromFile(f string) ([]unversioned.Resource, error)

Create the Resource from the specified file f.

  • The file format may be JSON or YAML encoding of either a single resource or list of resources as defined by the API objects in /api.
  • A filename of "-" means "Read from stdin".

The returned Resource will either be a single Resource or a List containing zero or more Resources. If the file does not contain any valid Resources this function returns an error.

Types

type ResourceActionCommand

type ResourceActionCommand func(*client.Client, unversioned.Resource) (unversioned.Resource, error)

type ResourceManager

type ResourceManager interface {
	GetTableDefaultHeadings(wide bool) []string
	GetTableTemplate(columns []string) (string, error)
	Apply(client *client.Client, resource unversioned.Resource) (unversioned.Resource, error)
	Create(client *client.Client, resource unversioned.Resource) (unversioned.Resource, error)
	Update(client *client.Client, resource unversioned.Resource) (unversioned.Resource, error)
	Delete(client *client.Client, resource unversioned.Resource) (unversioned.Resource, error)
	List(client *client.Client, resource unversioned.Resource) (unversioned.Resource, error)
}

The ResourceManager interface provides useful function for each resource type. This includes:

  • Commands to assist with generation of table output format of resources
  • Commands to manage resource instances through an un-typed interface.

func GetResourceManager

func GetResourceManager(resource unversioned.Resource) ResourceManager

Return the Resource Manager for a particular resource type.

Jump to

Keyboard shortcuts

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