schedulev2

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: Apache-2.0, GPL-2.0 Imports: 2 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateScheduleOverrideRequest

type CreateScheduleOverrideRequest struct {
	*ScheduleIdentifier
	ApiKey    string
	Alias     string     `json:"alias"`
	User      User       `json:"user"`
	StartDate string     `json:"startDate"`
	EndDate   string     `json:"endDate"`
	Rotations []Rotation `json:"rotations"`
}

CreateScheduleOverrideRequest is a struct of request to crate new schedule.

func (*CreateScheduleOverrideRequest) GenerateUrl

func (r *CreateScheduleOverrideRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*CreateScheduleOverrideRequest) GetApiKey

func (r *CreateScheduleOverrideRequest) GetApiKey() string

GetApiKey returns api key.

type CreateScheduleOverrideResponse

type CreateScheduleOverrideResponse struct {
	ResponseMeta
	ScheduleOverride ScheduleOverride `json:"data"`
}

CreateScheduleOverrideResponse is a response of creating alert action.

type CreateScheduleRequest

type CreateScheduleRequest struct {
	ApiKey      string
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Timezone    string     `json:"timezone"`
	Enabled     bool       `json:"enabled"`
	OwnerTeam   OwnerTeam  `json:"ownerTeam"`
	Rotations   []Rotation `json:"rotations"`
}

CreateScheduleRequest is a struct of request to crate new schedule.

func (*CreateScheduleRequest) GenerateUrl

func (r *CreateScheduleRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*CreateScheduleRequest) GetApiKey

func (r *CreateScheduleRequest) GetApiKey() string

GetApiKey returns api key.

type CreateScheduleResponse

type CreateScheduleResponse struct {
	ResponseMeta
	Schedule Schedule `json:"data"`
}

CreateScheduleResponse is a response of creating alert action.

type CreateScheduleRotationRequest

type CreateScheduleRotationRequest struct {
	*ScheduleIdentifier
	ApiKey          string
	Name            string          `json:"name"`
	StartDate       string          `json:"startDate"`
	EndDate         string          `json:"endDate"`
	Type            Type            `json:"type"`
	Length          int             `json:"length"`
	Participants    []Participant   `json:"participants"`
	TimeRestriction TimeRestriction `json:"timeRestriction"`
}

CreateScheduleRotationRequest is a struct of request to crate new schedule.

func (*CreateScheduleRotationRequest) GenerateUrl

func (r *CreateScheduleRotationRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*CreateScheduleRotationRequest) GetApiKey

func (r *CreateScheduleRotationRequest) GetApiKey() string

GetApiKey returns api key.

type CreateScheduleRotationResponse

type CreateScheduleRotationResponse struct {
	ResponseMeta
	Schedule Schedule `json:"data"`
}

CreateScheduleRotationResponse is a response of creating alert action.

type Day

type Day string

Day is the text representation of day name of week.

const (
	// The list of week days. These strings are used for generate time restrictions.
	Monday    Day = "monday"
	Tuesday   Day = "tuesday"
	Wednesday Day = "wednesday"
	Thursday  Day = "thursday"
	Friday    Day = "friday"
	Saturday  Day = "saturday"
	Sunday    Day = "sunday"
)

type DeleteScheduleOverrideRequest

type DeleteScheduleOverrideRequest struct {
	*ScheduleIdentifier
	Alias  string
	ApiKey string
}

DeleteScheduleOverrideRequest is a struct of request to delete schedule.

func (*DeleteScheduleOverrideRequest) GenerateUrl

func (r *DeleteScheduleOverrideRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*DeleteScheduleOverrideRequest) GetApiKey

func (r *DeleteScheduleOverrideRequest) GetApiKey() string

GetApiKey returns api key.

type DeleteScheduleOverrideResponse

type DeleteScheduleOverrideResponse struct {
	ResponseMeta
}

DeleteScheduleOverrideResponse is a response of get alert action.

type DeleteScheduleRequest

type DeleteScheduleRequest struct {
	*Identifier
	ApiKey string
}

DeleteScheduleRequest is a struct of request to delete schedule.

func (*DeleteScheduleRequest) GenerateUrl

func (r *DeleteScheduleRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*DeleteScheduleRequest) GetApiKey

func (r *DeleteScheduleRequest) GetApiKey() string

GetApiKey returns api key.

type DeleteScheduleResponse

type DeleteScheduleResponse struct {
	ResponseMeta
}

DeleteScheduleResponse is a response of get alert action.

type DeleteScheduleRotationRequest

type DeleteScheduleRotationRequest struct {
	*ScheduleIdentifier
	ID     string
	ApiKey string
}

DeleteScheduleRotationRequest is a struct of request to delete schedule.

func (*DeleteScheduleRotationRequest) GenerateUrl

func (r *DeleteScheduleRotationRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*DeleteScheduleRotationRequest) GetApiKey

func (r *DeleteScheduleRotationRequest) GetApiKey() string

GetApiKey returns api key.

type DeleteScheduleRotationResponse

type DeleteScheduleRotationResponse struct {
	ResponseMeta
}

DeleteScheduleRotationResponse is a response of get alert action.

type GetScheduleOverrideRequest

type GetScheduleOverrideRequest struct {
	*ScheduleIdentifier
	ApiKey string
	Alias  string
}

GetScheduleOverrideRequest is a struct of request to crate new schedule.

func (*GetScheduleOverrideRequest) GenerateUrl

func (r *GetScheduleOverrideRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*GetScheduleOverrideRequest) GetApiKey

func (r *GetScheduleOverrideRequest) GetApiKey() string

GetApiKey returns api key.

type GetScheduleOverrideResponse

type GetScheduleOverrideResponse struct {
	ResponseMeta
	ScheduleOverride ScheduleOverride `json:"data"`
}

GetScheduleOverrideResponse is a response of get alert action.

type GetScheduleRequest

type GetScheduleRequest struct {
	*Identifier
	ApiKey string
}

GetScheduleRequest is a struct of request to crate new schedule.

func (*GetScheduleRequest) GenerateUrl

func (r *GetScheduleRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*GetScheduleRequest) GetApiKey

func (r *GetScheduleRequest) GetApiKey() string

GetApiKey returns api key.

type GetScheduleResponse

type GetScheduleResponse struct {
	ResponseMeta
	Schedule Schedule `json:"data"`
}

GetScheduleResponse is a response of get alert action.

type GetScheduleRotationRequest

type GetScheduleRotationRequest struct {
	*ScheduleIdentifier
	ApiKey string
	ID     string
}

GetScheduleRotationRequest is a struct of request to crate new schedule.

func (*GetScheduleRotationRequest) GenerateUrl

func (r *GetScheduleRotationRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*GetScheduleRotationRequest) GetApiKey

func (r *GetScheduleRotationRequest) GetApiKey() string

GetApiKey returns api key.

type GetScheduleRotationResponse

type GetScheduleRotationResponse struct {
	ResponseMeta
	Schedule Schedule `json:"data"`
}

GetScheduleRotationResponse is a response of get alert action.

type Identifier

type Identifier struct {
	ID   string
	Name string
}

func (*Identifier) GenerateUrl

func (request *Identifier) GenerateUrl() (string, url.Values, error)

type ListScheduleOverrideRequest

type ListScheduleOverrideRequest struct {
	*ScheduleIdentifier
	ApiKey string
}

ListScheduleOverrideRequest is a struct of request to crate new schedule.

func (*ListScheduleOverrideRequest) GenerateUrl

func (r *ListScheduleOverrideRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*ListScheduleOverrideRequest) GetApiKey

func (r *ListScheduleOverrideRequest) GetApiKey() string

GetApiKey returns api key.

type ListScheduleOverrideResponse

type ListScheduleOverrideResponse struct {
	ResponseMeta
	ScheduleOverrides []ScheduleOverride `json:"data"`
}

ListScheduleOverrideResponse is a response of get alert action.

type ListScheduleRequest

type ListScheduleRequest struct {
	ApiKey string
	Expand string
}

ListScheduleRequest is a struct of request to crate new schedule.

func (*ListScheduleRequest) GenerateUrl

func (r *ListScheduleRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*ListScheduleRequest) GetApiKey

func (r *ListScheduleRequest) GetApiKey() string

GetApiKey returns api key.

type ListScheduleResponse

type ListScheduleResponse struct {
	ResponseMeta
	Schedule []Schedule `json:"data"`
}

ListScheduleResponse is a response of get alert action.

type ListScheduleRotationRequest

type ListScheduleRotationRequest struct {
	*ScheduleIdentifier
	ApiKey string
}

ListScheduleRotationRequest is a struct of request to crate new schedule.

func (*ListScheduleRotationRequest) GenerateUrl

func (r *ListScheduleRotationRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*ListScheduleRotationRequest) GetApiKey

func (r *ListScheduleRotationRequest) GetApiKey() string

GetApiKey returns api key.

type ListScheduleRotationResponse

type ListScheduleRotationResponse struct {
	ResponseMeta
	Schedule []Schedule `json:"data"`
}

ListScheduleRotationResponse is a response of get alert action.

type OwnerTeam

type OwnerTeam struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type Parent

type Parent struct {
	ID      string `json:"id,omitempty"`
	Name    string `json:"name,omitempty"`
	Enabled bool   `json:"enabled,omitempty"`
}

type Participant

type Participant interface{}

func NewParticipant

func NewParticipant(participantType ParticipantType, ID string, name string, username string) (Participant, error)

** If participants' type is escalation or team, you can use name or id fields for referring. ** Otherwise (type is user), we use username or id for referencing

type ParticipantType

type ParticipantType string
const (
	UserParticipant       ParticipantType = "user"
	TeamParticipant       ParticipantType = "team"
	EscalationParticipant ParticipantType = "escalation"
	NoneParticipant       ParticipantType = "none"
)

type ResponseMeta

type ResponseMeta struct {
	RequestID      string
	ResponseTime   float32
	RateLimitState string
}

ResponseMeta contains meta data of response.

func (*ResponseMeta) SetRateLimitState

func (rm *ResponseMeta) SetRateLimitState(state string)

SetRateLimitState sets state of rate limit.

func (*ResponseMeta) SetRequestID

func (rm *ResponseMeta) SetRequestID(requestID string)

SetRequestID sets identifier of request.

func (*ResponseMeta) SetResponseTime

func (rm *ResponseMeta) SetResponseTime(responseTime float32)

SetResponseTime sets request execution time.

type Restriction

type Restriction struct {
	StartHour int `json:"startHour,omitempty"`
	StartMin  int `json:"startMin,omitempty"`
	StartDay  Day `json:"startDay,omitempty"`
	EndHour   int `json:"endHour,omitempty"`
	EndMin    int `json:"endMin,omitempty"`
	EndDay    Day `json:"endDay,omitempty"`
}

type RestrictionType

type RestrictionType string
const (
	DayRestrictionType     RestrictionType = "time-of-day"
	WeekDayRestrictionType RestrictionType = "weekday-and-time-of-day"
)

type Rotation

type Rotation struct {
	Name            string          `json:"name,omitempty"`
	StartDate       string          `json:"startDate,omitempty"`
	EndDate         string          `json:"endDate,omitempty"`
	Type            Type            `json:"type,omitempty"`
	Length          int             `json:"length,omitempty"`
	Participants    []Participant   `json:"participants,omitempty"`
	TimeRestriction TimeRestriction `json:"timeRestriction,omitempty"`
}

type Schedule

type Schedule struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	Description string     `json:"description,omitempty"`
	Timezone    string     `json:"timezone,omitempty"`
	Enabled     bool       `json:"enabled,omitempty"`
	OwnerTeam   OwnerTeam  `json:"ownerTeam,omitempty"`
	Rotations   []Rotation `json:"rotations,omitempty"`
}

type ScheduleIdentifier

type ScheduleIdentifier struct {
	ID   string
	Name string
}

func (*ScheduleIdentifier) GenerateUrl

func (request *ScheduleIdentifier) GenerateUrl() (string, url.Values, error)

type ScheduleOverride

type ScheduleOverride struct {
	Parent    Parent     `json:"_parent,omitempty"`
	Alias     string     `json:"alias,omitempty"`
	User      User       `json:"user,omitempty"`
	StartDate string     `json:"startDate,omitempty"`
	EndDate   string     `json:"endDate,omitempty"`
	Rotations []Rotation `json:"rotations,omitempty"`
}

type TimeRestriction

type TimeRestriction struct {
	Type         RestrictionType `json:"type"`
	Restriction  Restriction     `json:"restriction"`
	Restrictions []Restriction   `json:"restrictions"`
}

type Type

type Type string
const (
	DailyRotation  Type = "daily"
	WeeklyRotation Type = "weekly"
	HourlyRotation Type = "hourly"
)

type UpdateScheduleOverrideRequest

type UpdateScheduleOverrideRequest struct {
	*ScheduleIdentifier
	ApiKey    string
	Alias     string
	User      User       `json:"user"`
	StartDate string     `json:"startDate"`
	EndDate   string     `json:"endDate"`
	Rotations []Rotation `json:"rotations"`
}

UpdateScheduleOverrideRequest is a struct of request to update existing schedule.

func (*UpdateScheduleOverrideRequest) GenerateUrl

func (r *UpdateScheduleOverrideRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*UpdateScheduleOverrideRequest) GetApiKey

func (r *UpdateScheduleOverrideRequest) GetApiKey() string

GetApiKey returns api key.

type UpdateScheduleOverrideResponse

type UpdateScheduleOverrideResponse struct {
	ResponseMeta
	ScheduleOverride ScheduleOverride `json:"data"`
}

UpdateScheduleOverrideResponse is a response of get alert action.

type UpdateScheduleRequest

type UpdateScheduleRequest struct {
	*Identifier
	ApiKey      string
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Timezone    string     `json:"timezone"`
	Enabled     bool       `json:"enabled"`
	OwnerTeam   OwnerTeam  `json:"ownerTeam"`
	Rotations   []Rotation `json:"rotations"`
}

UpdateScheduleRequest is a struct of request to update existing schedule.

func (*UpdateScheduleRequest) GenerateUrl

func (r *UpdateScheduleRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*UpdateScheduleRequest) GetApiKey

func (r *UpdateScheduleRequest) GetApiKey() string

GetApiKey returns api key.

type UpdateScheduleResponse

type UpdateScheduleResponse struct {
	ResponseMeta
	Schedule Schedule `json:"data"`
}

UpdateScheduleResponse is a response of get alert action.

type UpdateScheduleRotationRequest

type UpdateScheduleRotationRequest struct {
	*ScheduleIdentifier
	ApiKey          string
	ID              string
	Name            string          `json:"name"`
	StartDate       string          `json:"startDate"`
	EndDate         string          `json:"endDate"`
	Type            Type            `json:"type"`
	Length          int             `json:"length"`
	Participants    []Participant   `json:"participants"`
	TimeRestriction TimeRestriction `json:"timeRestriction"`
}

UpdateScheduleRotationRequest is a struct of request to update existing schedule.

func (*UpdateScheduleRotationRequest) GenerateUrl

func (r *UpdateScheduleRotationRequest) GenerateUrl() (string, url.Values, error)

GenerateUrl generates url to API endpoint.

func (*UpdateScheduleRotationRequest) GetApiKey

func (r *UpdateScheduleRotationRequest) GetApiKey() string

GetApiKey returns api key.

type UpdateScheduleRotationResponse

type UpdateScheduleRotationResponse struct {
	ResponseMeta
	Schedule Schedule `json:"data"`
}

UpdateScheduleRotationResponse is a response of get alert action.

type User

type User struct {
	ID       string   `json:"id"`
	Username string   `json:"username"`
	Type     UserType `json:"type"`
}

type UserType

type UserType string
const (
	UserUserType UserType = "user"
	NoneUserType UserType = "none"
)

Jump to

Keyboard shortcuts

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