rest

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var From = &from{}

Functions

func UnmarshallToCore

func UnmarshallToCore(bytes []byte) (model.Resource, error)

Types

type Api

type Api interface {
	GetResourceApi(model.ResourceType) (ResourceApi, error)
}

type ApiDescriptor

type ApiDescriptor struct {
	Resources map[model.ResourceType]ResourceApi
}

func (*ApiDescriptor) GetResourceApi

func (m *ApiDescriptor) GetResourceApi(typ model.ResourceType) (ResourceApi, error)

type ByMeta

type ByMeta []*Resource

func (ByMeta) Len

func (a ByMeta) Len() int

func (ByMeta) Less

func (a ByMeta) Less(i, j int) bool

func (ByMeta) Swap

func (a ByMeta) Swap(i, j int)

type Resource

type Resource struct {
	Meta ResourceMeta
	Spec model.ResourceSpec
}

func NewFromModel added in v1.8.1

func NewFromModel(m model.Resource) *Resource

NewFromModel create a REST Resource from the given model Resource.

func Unmarshall

func Unmarshall(bytes []byte) (*Resource, error)

func (*Resource) MarshalJSON

func (r *Resource) MarshalJSON() ([]byte, error)

func (*Resource) ToCore

func (r *Resource) ToCore() (model.Resource, error)

func (*Resource) UnmarshalJSON

func (r *Resource) UnmarshalJSON(data []byte) error

type ResourceApi

type ResourceApi interface {
	List(mesh string) string
	Item(mesh string, name string) string
}

func NewResourceApi

func NewResourceApi(scope model.ResourceScope, path string) ResourceApi

type ResourceList

type ResourceList struct {
	Total uint32      `json:"total"`
	Items []*Resource `json:"items"`
	Next  *string     `json:"next"`
}

type ResourceListReceiver

type ResourceListReceiver struct {
	ResourceList
	NewResource func() model.Resource
}

func (*ResourceListReceiver) UnmarshalJSON

func (rec *ResourceListReceiver) UnmarshalJSON(data []byte) error

type ResourceMeta

type ResourceMeta struct {
	Type             string    `json:"type"`
	Mesh             string    `json:"mesh,omitempty"`
	Name             string    `json:"name"`
	CreationTime     time.Time `json:"creationTime"`
	ModificationTime time.Time `json:"modificationTime"`
}

func (*ResourceMeta) GetCreationTime

func (r *ResourceMeta) GetCreationTime() time.Time

func (*ResourceMeta) GetMesh

func (r *ResourceMeta) GetMesh() string

func (*ResourceMeta) GetModificationTime

func (r *ResourceMeta) GetModificationTime() time.Time

func (*ResourceMeta) GetName

func (r *ResourceMeta) GetName() string

func (*ResourceMeta) GetNameExtensions

func (r *ResourceMeta) GetNameExtensions() model.ResourceNameExtensions

func (*ResourceMeta) GetVersion

func (r *ResourceMeta) GetVersion() string

Jump to

Keyboard shortcuts

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