model

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionConfig

type ActionConfig struct {
	Name ActionName
	Type ActionType
	HTTPRequestAction
	CloudPubSubAction
	CloudTasksAction
	Payload map[string]interface{}
}

ActionConfig is action configuration.

type ActionName

type ActionName string

ActionName represents action name.

type ActionType

type ActionType string

ActionType represents action type.

const (
	// ActionNone is uncategorized action type.
	ActionNone ActionType = ""
	// ActionHTTP is action type for HTTP action.
	ActionHTTP ActionType = "http"
	// ActionPubSub is action type for Cloud Pub/Sub action.
	ActionPubSub ActionType = "pubsub"
	// ActionTasks is action type for Cloud Tasks action.
	ActionTasks ActionType = "tasks"
)

type CloudPubSubAction

type CloudPubSubAction struct {
	Topic string
}

CloudPubSubAction is parameter of Cloud Pub/Sub action.

type CloudTasksAction

type CloudTasksAction struct {
	Location            string
	Queue               string
	TaskIDPrefix        string
	ServiceAccountEmail string
}

CloudTasksAction is parameter of Cloud Tasks action.

type EventType

type EventType int

EventType represents calendar event type.

const (
	// None is uncategorized event.
	None EventType = iota
	// Start is schedule started event.
	Start
	// End is schedule ended event.
	End
)

func (EventType) MarshalJSON

func (t EventType) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (EventType) String

func (i EventType) String() string

type HTTPRequestAction

type HTTPRequestAction struct {
	Method string
	Header http.Header
	URL    string
}

HTTPRequestAction is parameter of HTTP action.

type RunningMode

type RunningMode string

RunningMode represents running mode.

const (
	// ModeNone is uncategorized running mode.
	ModeNone RunningMode = ""
	// ModeResident is resident running mode.
	ModeResident RunningMode = "resident"
	// ModeOnDemand is on-demand running mode.
	ModeOnDemand RunningMode = "ondemand"
)

type Schedule

type Schedule struct {
	ID          string
	Summary     string
	Description string
	StartAt     time.Time
	EndAt       time.Time
}

Schedule is calendar schedule item.

func (*Schedule) EndEvent

func (s *Schedule) EndEvent() ScheduleEvent

EndEvent returnsend event of schedule.

func (*Schedule) Events

func (s *Schedule) Events(t time.Time) ScheduleEvents

Events returns schedule events from schedule.

func (*Schedule) StartEvent

func (s *Schedule) StartEvent() ScheduleEvent

StartEvent returns start event of schedule.

type ScheduleEvent

type ScheduleEvent struct {
	ScheduleID  string
	Summary     string
	Description string
	EventType   EventType
	ExecuteAt   time.Time
}

ScheduleEvent is (start or end) event of schedule.

func (*ScheduleEvent) ID

func (s *ScheduleEvent) ID(delimiter string) string

ID returns schedule event id.

func (*ScheduleEvent) ParseID

func (s *ScheduleEvent) ParseID(id, delimiter string) string

ParseID parses ID and returns ScheduleID.

type ScheduleEvents

type ScheduleEvents []ScheduleEvent

ScheduleEvents represents schedule event slice.

func (ScheduleEvents) SortByExecuteAtAsc

func (ss ScheduleEvents) SortByExecuteAtAsc()

SortByExecuteAtAsc sorts schedule events by ExecuteAt ascending.

func (ScheduleEvents) Sub

Sub returns schedule events ss-tt.

type Schedules

type Schedules []Schedule

Schedules represents schedule slice.

func (Schedules) Events

func (ss Schedules) Events(t time.Time) ScheduleEvents

Events returns schedule events from schedules.

Jump to

Keyboard shortcuts

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