approval

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Replay

func Replay(events []ddd.Event) ddd.Aggregate

Replay recreates the run from a series of events

Types

type Approval

type Approval struct {
	// contains filtered or unexported fields
}

Approval represents a manual signoff for a deployment

func Create

func Create(uuid, runID string, allowedUsers, allowedRoles []string) (*Approval, error)

Create handles create commands for approvals

func (*Approval) Approved

func (a *Approval) Approved() bool

Approved determines if this approval has been accepted

func (*Approval) Approver

func (a *Approval) Approver() (*auth.User, error)

Approver gets the user who approved

func (*Approval) Complete

func (a *Approval) Complete(approve, override bool, user *auth.User, timestamp int64) error

Complete handles approval/rejection commands for approvals

func (*Approval) Completed

func (a *Approval) Completed() bool

Completed determines if this approval has been approved or denied

func (*Approval) Destroy

func (a *Approval) Destroy() error

Destroy handles destruction commands for when the approval is finished

func (*Approval) Destroyed

func (a *Approval) Destroyed() bool

Destroyed determines if this approval has been destroyed

func (*Approval) Events

func (a *Approval) Events() []ddd.Event

Events gets the run's event history

func (*Approval) Overridden

func (a *Approval) Overridden() bool

Overridden determines if this approval has been overriden

func (*Approval) Roles

func (a *Approval) Roles() []string

Roles gets roles who can approve this approval

func (*Approval) RunUUID

func (a *Approval) RunUUID() string

RunUUID gets the approval's run id

func (*Approval) UUID

func (a *Approval) UUID() string

UUID gets the approval's uuid

func (*Approval) Users

func (a *Approval) Users() []string

Users gets users who can approve this approval

type ApproverError

type ApproverError struct {
	// contains filtered or unexported fields
}

ApproverError is an error related to approvers

func (ApproverError) Error

func (e ApproverError) Error() string

type Completed

type Completed struct {
	Approved   bool
	Overridden bool
	User       *auth.User
	Timestamp  int64
}

Completed is the event for when an approval is accepted

func (Completed) EventType

func (e Completed) EventType() string

EventType marks this as an event

type Created

type Created struct {
	UUID         string
	RunID        string
	AllowedUsers []string
	AllowedRoles []string
}

Created is the event for when an approval is created

func (Created) EventType

func (e Created) EventType() string

EventType marks this as an event

type Destroyed

type Destroyed struct{}

Destroyed is the event for when an approval is finalized

func (Destroyed) EventType

func (e Destroyed) EventType() string

EventType marks this as an event

type ReadRepository

type ReadRepository struct {
	// contains filtered or unexported fields
}

ReadRepository is the repository for dealing with Approval reads

func NewReadRepository

func NewReadRepository(s storage.Storage) *ReadRepository

NewReadRepository creates a repository with the given storage

func (*ReadRepository) All

func (rr *ReadRepository) All() ([]*Approval, error)

All gets all Approvals

func (*ReadRepository) Load

func (rr *ReadRepository) Load(uuid string) (*Approval, error)

Load gets one Approval

type WriteRepository

type WriteRepository struct {
	// contains filtered or unexported fields
}

WriteRepository for creating/updating approvals

func NewWriteRepository

func NewWriteRepository(s storage.Storage) *WriteRepository

NewWriteRepository builds the repository

func (*WriteRepository) Save

func (wr *WriteRepository) Save(a *Approval) error

Save persists new events for the Approval

Jump to

Keyboard shortcuts

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