meshdata

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 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 (
	// PropertyOperator identifies the operator property.
	PropertyOperator = "operator"
	// 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

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 {
	Operators    []*Operator
	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) AddOperator added in v0.0.14

func (meshData *MeshData) AddOperator(op *Operator)

AddOperator adds a new operator; if an operator with the same ID already exists, the existing one is overwritten.

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) 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) FindOperator added in v0.0.14

func (meshData *MeshData) FindOperator(id string) *Operator

FindOperator searches for an operator with the given ID.

func (*MeshData) FindServiceType

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

FindServiceType searches for a service type with the given name.

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) RemoveOperator added in v0.0.14

func (meshData *MeshData) RemoveOperator(op *Operator)

RemoveOperator removes the provided operator.

func (*MeshData) RemoveServiceType

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

RemoveServiceType removes the provided service type.

func (*MeshData) ToJSON

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

ToJSON converts the data to JSON.

func (*MeshData) Verify

func (meshData *MeshData) Verify() error

Verify checks if the mesh data is valid.

type Operator added in v0.0.14

type Operator struct {
	ID            string
	Name          string
	Homepage      string
	Email         string
	HelpdeskEmail string
	SecurityEmail string

	Sites      []*Site
	Properties map[string]string
}

Operator represents a complete operator including its sites managed by Mentix.

func (*Operator) AddSite added in v0.0.14

func (op *Operator) AddSite(site *Site)

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

func (*Operator) FindSite added in v0.0.14

func (op *Operator) FindSite(id string) *Site

FindSite searches for a site with the given ID.

func (*Operator) InferMissingData added in v0.0.14

func (op *Operator) InferMissingData()

InferMissingData infers missing data from other data where possible.

func (*Operator) RemoveSite added in v0.0.14

func (op *Operator) RemoveSite(id string)

RemoveSite removes the provided site.

func (*Operator) Verify added in v0.0.14

func (op *Operator) Verify() error

Verify checks if the operator 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 {
	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