meshdata

package
v2.24.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EndpointRevad identifies the main Reva Daemon endpoint
	EndpointRevad = "REVAD"

	// EndpointGateway identifies the Gateway endpoint
	EndpointGateway = "GATEWAY"
	// EndpointMetrics identifies the Metrics endpoint
	EndpointMetrics = "METRICS"
	// EndpointWebdav identifies the Webdav endpoint
	EndpointWebdav = "WEBDAV"
	// EndpointOCM identifies the OCM endpoint
	EndpointOCM = "OCM"
	// EndpointMeshDir identifies the Mesh Directory endpoint
	EndpointMeshDir = "MESHDIR"
)
View Source
const (
	// StatusDefault signals that this is just regular data.
	StatusDefault = iota

	// StatusObsolete flags the mesh data for removal.
	StatusObsolete
)
View Source
const (
	// PropertySiteID identifies the site ID property.
	PropertySiteID = "site_id"
	// PropertyOrganization identifies the organization property.
	PropertyOrganization = "organization"

	// PropertyAPIVersion identifies the API version property.
	PropertyAPIVersion = "api_version"
)

Variables

This section is empty.

Functions

func GetPropertyValue

func GetPropertyValue(props map[string]string, id string, defValue string) string

GetPropertyValue performs a case-insensitive search for the given property.

func GetServiceEndpoints added in v2.3.0

func GetServiceEndpoints() []string

GetServiceEndpoints returns an array of all service endpoint identifiers.

func SetPropertyValue

func SetPropertyValue(props *map[string]string, id string, value string)

SetPropertyValue sets a property value.

Types

type Downtime

type Downtime struct {
	StartDate        time.Time
	EndDate          time.Time
	AffectedServices []string
}

Downtime represents a single scheduled downtime.

func (*Downtime) InferMissingData

func (dt *Downtime) InferMissingData()

InferMissingData infers missing data from other data where possible.

func (*Downtime) IsActive

func (dt *Downtime) IsActive() bool

IsActive returns true if the downtime is currently active.

func (*Downtime) IsExpired

func (dt *Downtime) IsExpired() bool

IsExpired returns true of the downtime has expired (i.e., lies in the past).

func (*Downtime) IsPending

func (dt *Downtime) IsPending() bool

IsPending returns true if the downtime is yet to come.

func (*Downtime) Verify

func (dt *Downtime) Verify() error

Verify checks if the downtime data is valid.

type Downtimes

type Downtimes struct {
	Downtimes []*Downtime
}

Downtimes represents all scheduled downtimes of a site.

func (*Downtimes) Clear

func (dts *Downtimes) Clear()

Clear clears all downtimes.

func (*Downtimes) InferMissingData

func (dts *Downtimes) InferMissingData()

InferMissingData infers missing data from other data where possible.

func (*Downtimes) IsAnyActive

func (dts *Downtimes) IsAnyActive() bool

IsAnyActive returns true if any downtime is currently active.

func (*Downtimes) ScheduleDowntime

func (dts *Downtimes) ScheduleDowntime(start time.Time, end time.Time, affectedServices []string) (*Downtime, error)

ScheduleDowntime schedules a new downtime.

func (*Downtimes) Verify

func (dts *Downtimes) Verify() error

Verify checks if the downtimes data is valid.

type Map

type Map = map[string]*MeshData

Map represents a map of MeshData objects.

type MeshData

type MeshData struct {
	Sites        []*Site
	ServiceTypes []*ServiceType

	Status int `json:"-"`
}

MeshData holds the entire mesh data managed by Mentix.

func MergeMeshDataMap

func MergeMeshDataMap(meshDataSet Map) *MeshData

MergeMeshDataMap merges all mesh data objects within a map.

func New

func New() *MeshData

New returns a new (empty) MeshData object.

func (*MeshData) AddServiceType

func (meshData *MeshData) AddServiceType(serviceType *ServiceType)

AddServiceType adds a new service type; if a type with the same name already exists, the existing one is overwritten.

func (*MeshData) AddSite

func (meshData *MeshData) AddSite(site *Site)

AddSite adds a new site; if a site with the same ID already exists, the existing one is overwritten.

func (*MeshData) Clear

func (meshData *MeshData) Clear()

Clear removes all saved data, leaving an empty mesh.

func (*MeshData) Clone

func (meshData *MeshData) Clone() *MeshData

Clone creates an exact copy of the mesh data.

func (*MeshData) Compare

func (meshData *MeshData) Compare(other *MeshData) bool

Compare checks whether the stored data equals the data of another MeshData object.

func (*MeshData) FindServiceType

func (meshData *MeshData) FindServiceType(name string) *ServiceType

FindServiceType searches for a service type with the given name.

func (*MeshData) FindSite

func (meshData *MeshData) FindSite(id string) *Site

FindSite searches for a site with the given ID.

func (*MeshData) FromJSON

func (meshData *MeshData) FromJSON(data string) error

FromJSON converts JSON data to mesh data.

func (*MeshData) InferMissingData

func (meshData *MeshData) InferMissingData()

InferMissingData infers missing data from other data where possible.

func (*MeshData) Merge

func (meshData *MeshData) Merge(inData *MeshData)

Merge merges data from another MeshData instance into this one.

func (*MeshData) RemoveServiceType

func (meshData *MeshData) RemoveServiceType(serviceType *ServiceType)

RemoveServiceType removes the provided service type.

func (*MeshData) RemoveSite

func (meshData *MeshData) RemoveSite(site *Site)

RemoveSite removes the provided site.

func (*MeshData) ToJSON

func (meshData *MeshData) ToJSON() (string, error)

ToJSON converts the data to JSON.

func (*MeshData) Unmerge

func (meshData *MeshData) Unmerge(inData *MeshData)

Unmerge removes data from another MeshData instance from this one.

func (*MeshData) Verify

func (meshData *MeshData) Verify() error

Verify checks if the mesh data is valid.

type Service

type Service struct {
	*ServiceEndpoint

	Host                string
	AdditionalEndpoints []*ServiceEndpoint
}

Service represents a service managed by Mentix.

func (*Service) FindEndpoint

func (service *Service) FindEndpoint(name string) *ServiceEndpoint

FindEndpoint searches for an additional endpoint with the given name.

func (*Service) InferMissingData

func (service *Service) InferMissingData()

InferMissingData infers missing data from other data where possible.

func (*Service) Verify

func (service *Service) Verify() error

Verify checks if the service data is valid.

type ServiceEndpoint

type ServiceEndpoint struct {
	Type        *ServiceType
	Name        string
	RawURL      string
	URL         string
	IsMonitored bool
	Properties  map[string]string
}

ServiceEndpoint represents a service endpoint managed by Mentix.

func (*ServiceEndpoint) InferMissingData

func (serviceEndpoint *ServiceEndpoint) InferMissingData()

InferMissingData infers missing data from other data where possible.

func (*ServiceEndpoint) Verify

func (serviceEndpoint *ServiceEndpoint) Verify() error

Verify checks if the service endpoint data is valid.

type ServiceType

type ServiceType struct {
	Name        string
	Description string
}

ServiceType represents a service type managed by Mentix.

func (*ServiceType) InferMissingData

func (serviceType *ServiceType) InferMissingData()

InferMissingData infers missing data from other data where possible.

func (*ServiceType) Verify

func (serviceType *ServiceType) Verify() error

Verify checks if the service type data is valid.

type Site

type Site struct {
	// Internal settings
	ID           string
	Name         string
	FullName     string
	Organization string
	Domain       string
	Homepage     string
	Email        string
	Description  string
	Country      string
	CountryCode  string
	Location     string
	Latitude     float32
	Longitude    float32

	Services   []*Service
	Properties map[string]string

	Downtimes Downtimes `json:"-"`
}

Site represents a single site managed by Mentix.

func (*Site) AddService

func (site *Site) AddService(service *Service)

AddService adds a new service; if a service with the same name already exists, the existing one is overwritten.

func (*Site) FindService

func (site *Site) FindService(name string) *Service

FindService searches for a service with the given name.

func (*Site) InferMissingData

func (site *Site) InferMissingData()

InferMissingData infers missing data from other data where possible.

func (*Site) RemoveService

func (site *Site) RemoveService(name string)

RemoveService removes the provided service.

func (*Site) Verify

func (site *Site) Verify() error

Verify checks if the site data is valid.

type Vector

type Vector = []*MeshData

Vector represents a vector of MeshData objects.

Jump to

Keyboard shortcuts

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