resources

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrCannotDeleteCollection

func ErrCannotDeleteCollection(name, reason string) error

func ErrCannotDeleteDomain

func ErrCannotDeleteDomain(name, reason string) error

func ErrCannotDeleteModule

func ErrCannotDeleteModule(name, reason string) error

func ErrCannotDeleteNamespace

func ErrCannotDeleteNamespace(name, reason string) error

func ErrCannotDeleteRoute

func ErrCannotDeleteRoute(name, reason string) error

func ErrCannotDeleteService

func ErrCannotDeleteService(name, reason string) error

func ErrCollectionNotFound

func ErrCollectionNotFound(name string) error

func ErrDomainNotFound

func ErrDomainNotFound(name string) error

func ErrModuleNotFound

func ErrModuleNotFound(name string) error

func ErrNamespaceNotFound

func ErrNamespaceNotFound(name string) error

func ErrRouteNotFound

func ErrRouteNotFound(name string) error

func ErrServiceNotFound

func ErrServiceNotFound(name string) error

Types

type DocumentManager

type DocumentManager interface {
	GetDocumentByID(namespace, collection, id string) (*spec.Document, error)
	GetDocuments(collection, namespace string, limit, offset int) ([]*spec.Document, error)
}

type Options

type Options func(*ResourceManager)

func WithDefaultNamespace

func WithDefaultNamespace(ns *spec.Namespace) Options

type ResourceManager

type ResourceManager struct {
	// contains filtered or unexported fields
}

ResourceManager is a struct that handles all resources and their links between each other

func NewManager

func NewManager(opts ...Options) *ResourceManager

func (*ResourceManager) AddCollection

func (rm *ResourceManager) AddCollection(collection *spec.Collection) (*spec.DGateCollection, error)

func (*ResourceManager) AddDomain

func (rm *ResourceManager) AddDomain(domain *spec.Domain) (*spec.DGateDomain, error)

func (*ResourceManager) AddModule

func (rm *ResourceManager) AddModule(module *spec.Module) (*spec.DGateModule, error)

func (*ResourceManager) AddNamespace

func (rm *ResourceManager) AddNamespace(ns *spec.Namespace) *spec.DGateNamespace

func (*ResourceManager) AddRoute

func (rm *ResourceManager) AddRoute(route *spec.Route) (rt *spec.DGateRoute, err error)

func (*ResourceManager) AddService

func (rm *ResourceManager) AddService(service *spec.Service) (*spec.DGateService, error)

func (*ResourceManager) Empty

func (rm *ResourceManager) Empty() bool

func (*ResourceManager) GetCollection

func (rm *ResourceManager) GetCollection(name, namespace string) (*spec.DGateCollection, bool)

func (*ResourceManager) GetCollections

func (rm *ResourceManager) GetCollections() []*spec.DGateCollection

GetCollections returns a list of all collections

func (*ResourceManager) GetCollectionsByNamespace

func (rm *ResourceManager) GetCollectionsByNamespace(namespace string) []*spec.DGateCollection

func (*ResourceManager) GetDomain

func (rm *ResourceManager) GetDomain(name, namespace string) (*spec.DGateDomain, bool)

func (*ResourceManager) GetDomains

func (rm *ResourceManager) GetDomains() []*spec.DGateDomain

GetDomains returns a list of all domains

func (*ResourceManager) GetDomainsByNamespace

func (rm *ResourceManager) GetDomainsByNamespace(namespace string) []*spec.DGateDomain

GetDomainsByNamespace returns a list of all domains in a namespace

func (*ResourceManager) GetModule

func (rm *ResourceManager) GetModule(name, namespace string) (*spec.DGateModule, bool)

func (*ResourceManager) GetModules

func (rm *ResourceManager) GetModules() []*spec.DGateModule

GetModules returns a list of all modules

func (*ResourceManager) GetModulesByNamespace

func (rm *ResourceManager) GetModulesByNamespace(namespace string) []*spec.DGateModule

GetModulesByNamespace returns a list of all modules in a namespace

func (*ResourceManager) GetNamespace

func (rm *ResourceManager) GetNamespace(namespace string) (*spec.DGateNamespace, bool)

func (*ResourceManager) GetNamespaces

func (rm *ResourceManager) GetNamespaces() []*spec.DGateNamespace

GetNamespaces returns a list of all namespaces

func (*ResourceManager) GetRoute

func (rm *ResourceManager) GetRoute(name, namespace string) (*spec.DGateRoute, bool)

Route functions

func (*ResourceManager) GetRouteModules

func (rm *ResourceManager) GetRouteModules(name, namespace string) ([]*spec.DGateModule, bool)

GetRouteModules returns a list of all modules in a route

func (*ResourceManager) GetRouteNamespaceMap

func (rm *ResourceManager) GetRouteNamespaceMap() map[string][]*spec.DGateRoute

GetRouteNamespaceMap returns a map of all routes and their namespaces as the key

func (*ResourceManager) GetRoutes

func (rm *ResourceManager) GetRoutes() []*spec.DGateRoute

GetRoutes returns a list of all routes

func (*ResourceManager) GetRoutesByNamespace

func (rm *ResourceManager) GetRoutesByNamespace(namespace string) []*spec.DGateRoute

GetRoutesByNamespace returns a list of all routes in a namespace

func (*ResourceManager) GetService

func (rm *ResourceManager) GetService(name, namespace string) (*spec.DGateService, bool)

func (*ResourceManager) GetServices

func (rm *ResourceManager) GetServices() []*spec.DGateService

GetServices returns a list of all services

func (*ResourceManager) GetServicesByNamespace

func (rm *ResourceManager) GetServicesByNamespace(namespace string) []*spec.DGateService

GetServicesByNamespace returns a list of all services in a namespace

func (*ResourceManager) MarshalJSON

func (rm *ResourceManager) MarshalJSON() ([]byte, error)

MarshalJSON marshals the resource manager to json

func (*ResourceManager) RemoveCollection

func (rm *ResourceManager) RemoveCollection(name, namespace string) error

func (*ResourceManager) RemoveDomain

func (rm *ResourceManager) RemoveDomain(name, namespace string) error

func (*ResourceManager) RemoveModule

func (rm *ResourceManager) RemoveModule(name, namespace string) error

func (*ResourceManager) RemoveNamespace

func (rm *ResourceManager) RemoveNamespace(namespace string) error

func (*ResourceManager) RemoveRoute

func (rm *ResourceManager) RemoveRoute(name, namespace string) error

RemoveRoute removes a route from the resource manager

func (*ResourceManager) RemoveService

func (rm *ResourceManager) RemoveService(name, namespace string) error

func (*ResourceManager) UnmarshalJSON

func (rm *ResourceManager) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the resource manager from json

Jump to

Keyboard shortcuts

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