common

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: Apache-2.0 Imports: 14 Imported by: 44

Documentation

Index

Constants

View Source
const (
	APP            DataType = "APP"
	APP_INST                = "APP_INST"
	APP_STATS               = "APP_STATS"
	SPACE                   = "SPACE"
	ORG                     = "ORG"
	DOMAIN_PRIVATE          = "DOMAIN_PRIVATE"
	DOMAIN_SHARED           = "DOMAIN_SHARED"
	ISO_SEG                 = "ISO_SEG"
	ORG_QUOTA               = "ORG_QUOTA"
	SPACE_QUOTA             = "SPACE_QUOTA"
	ROUTE                   = "ROUTE"
	STACK                   = "STACK"
	EVENTS_CRASH            = "EVENTS_CRASH"
)
View Source
const ALL = "ALL"
View Source
const AUTH_ERROR = "Authentication has expired"
View Source
const DefaultMinimumReloadDuration = time.Millisecond * 10000
View Source
const DelayedRemovalFromCacheDuration = 15 * time.Second
View Source
const Infinity time.Duration = 1<<63 - 1
View Source
const MaxLoadAttempts = 5
View Source
const WaitToReloadOnErrorDuration = time.Second * 30

Variables

View Source
var DataTypeDisplay = map[DataType]string{
	APP:            "Application",
	APP_INST:       "Application Instance",
	APP_STATS:      "Application Stat",
	SPACE:          "Space",
	ORG:            "Organization",
	DOMAIN_PRIVATE: "Private Domain",
	DOMAIN_SHARED:  "Shared Domain",
	ISO_SEG:        "Isolation Segment",
	ORG_QUOTA:      "Organization Quota",
	SPACE_QUOTA:    "Space Quota",
	ROUTE:          "Route",
	STACK:          "Stack",
	EVENTS_CRASH:   "Event Crash",
}

Functions

func CallAPI

func CallAPI(cliConnection plugin.CliConnection, url string) (string, error)

func CallPagableAPI

func CallPagableAPI(cliConnection plugin.CliConnection, url string, handleResponse handleResponseFunc) error

func GetIntValueByFieldName added in v0.9.2

func GetIntValueByFieldName(n interface{}, field_name string) (int64, bool)

func GetObjectValueByFieldName added in v0.9.4

func GetObjectValueByFieldName(n interface{}, field_name string) (interface{}, bool)

func GetStringValueByFieldName

func GetStringValueByFieldName(n interface{}, field_name string) (string, bool)

func RegisterMetadataHandler added in v0.9.0

func RegisterMetadataHandler(dataType DataType, metadataHandler MetadataHandler)

Types

type APIVersion added in v0.9.4

type APIVersion int
const (
	API_V2 APIVersion = 2
	API_V3 APIVersion = 3
)

type CommonMetadataManager added in v0.9.0

type CommonMetadataManager struct {
	MetadataMapMutex sync.Mutex
	MetadataMap      map[string]IMetadata
	// contains filtered or unexported fields
}

func NewCommonMetadataManager added in v0.9.0

func NewCommonMetadataManager(
	mdGlobalManager MdGlobalManagerInterface,
	dataType DataType,
	url string,
	mm MetadataManager,
	minimumReloadDuration time.Duration) *CommonMetadataManager

func (*CommonMetadataManager) AddItem added in v0.9.0

func (commonMgr *CommonMetadataManager) AddItem(metadataItem IMetadata)

func (*CommonMetadataManager) CacheSize added in v0.9.0

func (commonMgr *CommonMetadataManager) CacheSize() int

func (*CommonMetadataManager) Clear added in v0.9.0

func (commonMgr *CommonMetadataManager) Clear()

func (*CommonMetadataManager) DelayedRemovalFromCache added in v0.9.0

func (commonMgr *CommonMetadataManager) DelayedRemovalFromCache(guid string, itemName string)

Called via a seperate thread - after a delay, remove the requested guid from cache

func (*CommonMetadataManager) DeleteItem added in v0.9.0

func (commonMgr *CommonMetadataManager) DeleteItem(guid string)

func (*CommonMetadataManager) FindItemInternal added in v0.9.0

func (commonMgr *CommonMetadataManager) FindItemInternal(guid string, requestLoadIfNotFound bool, createEmptyObjectIfNotFound bool) (IMetadata, bool)

func (*CommonMetadataManager) GetMdGlobalManager added in v0.9.0

func (commonMgr *CommonMetadataManager) GetMdGlobalManager() MdGlobalManagerInterface

func (*CommonMetadataManager) GetUrl added in v0.9.0

func (commonMgr *CommonMetadataManager) GetUrl() string

func (*CommonMetadataManager) IsDeletedFromCache added in v0.9.0

func (commonMgr *CommonMetadataManager) IsDeletedFromCache(guid string) bool

func (*CommonMetadataManager) IsPendingDeleteFromCache added in v0.9.0

func (commonMgr *CommonMetadataManager) IsPendingDeleteFromCache(guid string) bool

func (*CommonMetadataManager) LastLoadTime added in v0.9.0

func (commonMgr *CommonMetadataManager) LastLoadTime(dataKey string) *time.Time

Last time data was loaded or nil if never

func (*CommonMetadataManager) LoadItem added in v0.9.0

func (commonMgr *CommonMetadataManager) LoadItem(guid string) error

func (*CommonMetadataManager) MetadataLoadMethod added in v0.9.0

func (commonMgr *CommonMetadataManager) MetadataLoadMethod(guid string) error

func (*CommonMetadataManager) MinimumReloadDuration added in v0.9.0

func (commonMgr *CommonMetadataManager) MinimumReloadDuration() time.Duration

func (*CommonMetadataManager) PostProcessLoad added in v0.9.4

func (commonMgr *CommonMetadataManager) PostProcessLoad(metadataArray []IMetadata, err error)

type CommonV2ResponseManager added in v0.9.0

type CommonV2ResponseManager struct {
	*CommonMetadataManager
	// contains filtered or unexported fields
}

func NewCommonV2ResponseManager added in v0.9.0

func NewCommonV2ResponseManager(mdGlobalManager MdGlobalManagerInterface,
	dataType DataType,
	url string,
	mm V2MetadataManager,
	autoFullLoadIfNotFound bool) *CommonV2ResponseManager

func (*CommonV2ResponseManager) Count added in v0.9.4

func (commonV2ResponseMgr *CommonV2ResponseManager) Count(response IResponse) int

func (*CommonV2ResponseManager) FindItemInternal added in v0.9.0

func (commonV2ResponseMgr *CommonV2ResponseManager) FindItemInternal(guid string, requestLoadIfNotFound bool, createEmptyObjectIfNotFound bool) IMetadata

func (*CommonV2ResponseManager) GetMetadata added in v0.9.0

func (commonV2ResponseMgr *CommonV2ResponseManager) GetMetadata() ([]IMetadata, error)

func (*CommonV2ResponseManager) GetMetadataFromUrl added in v0.9.0

func (commonV2ResponseMgr *CommonV2ResponseManager) GetMetadataFromUrl(url string) ([]IMetadata, error)

func (*CommonV2ResponseManager) GetNextUrl added in v0.9.4

func (commonV2ResponseMgr *CommonV2ResponseManager) GetNextUrl(response IResponse) string

func (*CommonV2ResponseManager) LoadAllItems added in v0.9.0

func (commonV2ResponseMgr *CommonV2ResponseManager) LoadAllItems() error

func (*CommonV2ResponseManager) LoadAllItemsAysnc added in v0.9.0

func (commonV2ResponseMgr *CommonV2ResponseManager) LoadAllItemsAysnc()

func (*CommonV2ResponseManager) LoadAllItemsInternal added in v0.9.0

func (commonV2ResponseMgr *CommonV2ResponseManager) LoadAllItemsInternal() ([]IMetadata, error)

func (*CommonV2ResponseManager) LoadItemInternal added in v0.9.0

func (commonV2ResponseMgr *CommonV2ResponseManager) LoadItemInternal(guid string) (IMetadata, error)

func (*CommonV2ResponseManager) MetadataLoadMethod added in v0.9.0

func (commonV2ResponseMgr *CommonV2ResponseManager) MetadataLoadMethod(guid string) error

type DataType added in v0.9.0

type DataType string

type EntityCommon added in v0.8.0

type EntityCommon struct {
	Guid string `json:"guid"`
	IEntity
}

func (*EntityCommon) GetGuid added in v0.8.0

func (entity *EntityCommon) GetGuid() string

func (*EntityCommon) SetGuid added in v0.8.0

func (entity *EntityCommon) SetGuid(guid string)

type ICommonResponseManager added in v0.9.0

type ICommonResponseManager interface {
	GetMetadataFromUrl(url string) ([]IMetadata, error)
}

type IEntity added in v0.8.0

type IEntity interface {
	GetGuid() string
	SetGuid(string)
	GetName() string
}

type IMetadata added in v0.8.0

type IMetadata interface {
	IEntity
	SetCacheTime(*time.Time)
	GetCacheTime() *time.Time
}

type IResource added in v0.8.0

type IResource interface {
}

type IResourceMetadata added in v0.8.0

type IResourceMetadata interface {
}

type IResponse added in v0.8.0

type IResponse interface {
}

type IResponseV3 added in v0.9.0

type IResponseV3 interface {
	GetPagination() Pagination
}
type Link struct {
	Href string `json:"href"`
}

type LoadHandler added in v0.9.0

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

func NewLoadHandler added in v0.9.0

func NewLoadHandler(conn plugin.CliConnection) *LoadHandler

func (*LoadHandler) RequestLoad added in v0.9.0

func (lh *LoadHandler) RequestLoad(loadRequest *LoadRequest)

func (*LoadHandler) RequestLoadOfAll added in v0.9.0

func (lh *LoadHandler) RequestLoadOfAll(dataType DataType, delayBeforeLoad time.Duration)

func (*LoadHandler) RequestLoadOfItem added in v0.9.0

func (lh *LoadHandler) RequestLoadOfItem(dataType DataType, guid string, delayBeforeLoad time.Duration)

type LoadRequest added in v0.9.0

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

type MdGlobalManagerInterface added in v0.9.0

type MdGlobalManagerInterface interface {
	GetCliConnection() plugin.CliConnection
	GetAppMetadataFromUrl(url string) ([]IMetadata, error)
	SetStatus(status string)
}

type Meta

type Meta struct {
	Guid      string `json:"guid"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type MetaV3 added in v0.9.0

type MetaV3 struct {
	Guid string `json:"guid"`
}

type Metadata added in v0.8.0

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

func NewMetadata added in v0.9.0

func NewMetadata() *Metadata

func (*Metadata) GetCacheTime added in v0.8.0

func (md *Metadata) GetCacheTime() *time.Time

func (*Metadata) SetCacheTime added in v0.8.0

func (md *Metadata) SetCacheTime(time *time.Time)

type MetadataHandler added in v0.9.0

type MetadataHandler interface {
	MetadataLoadMethod(guid string) error
	MinimumReloadDuration() time.Duration
	LastLoadTime(dataKey string) *time.Time
}

type MetadataManager added in v0.9.0

type MetadataManager interface {
	NewItemById(guid string) IMetadata
	LoadItemInternal(guid string) (IMetadata, error)
}

type Pagination added in v0.9.0

type Pagination struct {
	Count int  `json:"total_results"`
	Pages int  `json:"total_pages"`
	Next  Link `json:"next"`
}

type ResponseError added in v0.9.2

type ResponseError struct {
	Code        int    `json:"code"`
	Description string `json:"description"`
	ErrorCode   string `json:"error_code"`
}

type V2MetadataManager added in v0.9.0

type V2MetadataManager interface {
	MetadataManager
	LoadAllItemsInternal() ([]IMetadata, error)

	CreateResponseObject() IResponse
	CreateResourceObject() IResource
	CreateMetadataEntityObject(guid string) IMetadata
	ProcessResponse(IResponse, []IMetadata) []IMetadata
	ProcessResource(resource IResource) IMetadata
	GetNextUrl(response IResponse) string
	Count(response IResponse) int
	PostProcessLoad([]IMetadata, error)
}

Jump to

Keyboard shortcuts

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