conditions

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: AGPL-3.0 Imports: 8 Imported by: 9

Documentation

Overview

Package conditions provides implementation of basic condition rules to enable building elaborated policies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DateAfterCondition

type DateAfterCondition struct {
	Matches string `json:"matches"`
}

DateAfterCondition is a condition which is fulfilled if the given time is after the time specified in DateAfter condition

func (*DateAfterCondition) Fulfills

func (c *DateAfterCondition) Fulfills(value interface{}, _ *ladon.Request) bool

Fulfills returns true if the given value is a correctly formatted iso8601 time string that represent a point in time after the specified time reference

func (*DateAfterCondition) GetName

func (c *DateAfterCondition) GetName() string

GetName returns the condition's name.

type DateWithinPeriodCondition

type DateWithinPeriodCondition struct {
	DateBegin string `json:"dateBegin"`
	DateEnd   string `json:"dateEnd"`
}

DateWithinPeriodCondition is a condition which is fulfilled if the server current date time between start date and end date

func (*DateWithinPeriodCondition) Fulfills

func (c *DateWithinPeriodCondition) Fulfills(value interface{}, _ *ladon.Request) bool

Fulfills returns true if the given value is a Time and is between start and end date. It expects a string formatted this way: "2006-01-02T15:04-0700"

func (*DateWithinPeriodCondition) GetName

func (c *DateWithinPeriodCondition) GetName() string

GetName returns the condition's name.

type OfficeHoursCondition

type OfficeHoursCondition struct {
	Matches string `json:"matches"`
}

OfficeHoursCondition is a condition which is fulfilled if the current time is within one of the week periods defined by the Matches string, for instance Monday-Friday/08:00/17:30

func (*OfficeHoursCondition) Fulfills

func (c *OfficeHoursCondition) Fulfills(value interface{}, _ *ladon.Request) bool

Fulfills returns true if the given value is a valid Time and is within one of the defined period. It expects a iso 8601 formatted string, e.g: "2006-01-02T15:04-0700"

func (*OfficeHoursCondition) GetName

func (c *OfficeHoursCondition) GetName() string

GetName returns the condition's name.

type StringNotMatchCondition

type StringNotMatchCondition struct {
	Matches string `json:"matches"`
}

StringNotMatchCondition is a condition which is fulfilled if the given string value does *NOT* match the regex pattern specified in StringNotMatchCondition

func (*StringNotMatchCondition) Fulfills

func (c *StringNotMatchCondition) Fulfills(value interface{}, _ *ladon.Request) bool

Fulfills returns true if the given value is a string and does *NOT* matches the regex pattern in StringNotMatchCondition

func (*StringNotMatchCondition) GetName

func (c *StringNotMatchCondition) GetName() string

GetName returns the condition's name.

type WithinPeriodCondition

type WithinPeriodCondition struct {
	Matches string `json:"matches"`
}

WithinPeriodCondition is a condition which is fulfilled if the server current date time is between start date and end date

func (*WithinPeriodCondition) Fulfills

func (c *WithinPeriodCondition) Fulfills(value interface{}, _ *ladon.Request) bool

Fulfills returns true if the given value is a Time and is between start and end date. It expects a iso 8601 formatted string, e.g: "2006-01-02T15:04-0700"

func (*WithinPeriodCondition) GetName

func (c *WithinPeriodCondition) GetName() string

GetName returns the condition's name.

Jump to

Keyboard shortcuts

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