builtin

package
v0.0.0-...-cad01ba Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = types.APIVersion{
		Group:   "io.cattle.builtin",
		Version: "v3",
		Path:    "/v3",
	}

	Schema = types.Schema{
		ID:                "schema",
		Version:           Version,
		CollectionMethods: []string{"GET"},
		ResourceMethods:   []string{"GET"},
		ResourceFields: map[string]types.Field{
			"collectionActions": {Type: "map[json]"},
			"collectionFields":  {Type: "map[json]"},
			"collectionFitlers": {Type: "map[json]"},
			"collectionMethods": {Type: "array[string]"},
			"pluralName":        {Type: "string"},
			"resourceActions":   {Type: "map[json]"},
			"resourceFields":    {Type: "map[json]"},
			"resourceMethods":   {Type: "array[string]"},
			"version":           {Type: "map[json]"},
		},
		Formatter: SchemaFormatter,
		Store:     schema.NewSchemaStore(),
	}

	Error = types.Schema{
		ID:                "error",
		Version:           Version,
		ResourceMethods:   []string{},
		CollectionMethods: []string{},
		ResourceFields: map[string]types.Field{
			"code":    {Type: "string"},
			"detail":  {Type: "string"},
			"message": {Type: "string"},
			"status":  {Type: "int"},
		},
	}

	Collection = types.Schema{
		ID:                "error",
		Version:           Version,
		ResourceMethods:   []string{},
		CollectionMethods: []string{},
		ResourceFields: map[string]types.Field{
			"data":       {Type: "array[json]"},
			"pagination": {Type: "map[json]"},
			"sort":       {Type: "map[json]"},
			"filters":    {Type: "map[json]"},
		},
	}

	APIRoot = types.Schema{
		ID:                "apiRoot",
		Version:           Version,
		ResourceMethods:   []string{},
		CollectionMethods: []string{},
		ResourceFields: map[string]types.Field{
			"apiVersion": {Type: "map[json]"},
			"path":       {Type: "string"},
		},
		Formatter: APIRootFormatter,
		Store:     NewAPIRootStore(nil),
	}

	Schemas = types.NewSchemas().
			AddSchema(&Schema).
			AddSchema(&Error).
			AddSchema(&Collection).
			AddSchema(&APIRoot)
)

Functions

func APIRootFormatter

func APIRootFormatter(apiContext *types.APIContext, resource *types.RawResource)

func NewAPIRootStore

func NewAPIRootStore(roots []string) types.Store

func SchemaFormatter

func SchemaFormatter(apiContext *types.APIContext, resource *types.RawResource)

Types

type APIRootStore

type APIRootStore struct {
	empty.Store
	// contains filtered or unexported fields
}

func (*APIRootStore) ByID

func (a *APIRootStore) ByID(apiContext *types.APIContext, schema *types.Schema, id string) (map[string]interface{}, error)

func (*APIRootStore) List

func (a *APIRootStore) List(apiContext *types.APIContext, schema *types.Schema, opt *types.QueryOptions) ([]map[string]interface{}, error)

Jump to

Keyboard shortcuts

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