job

package
v1.0.1-0...-20e81f0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ActionDelete delete action
	ActionDelete = "delete"
	//ActionMove move action
	ActionMove = "move"
	//Action notify
	ActionNotify = "notify"
)
View Source
const DefaultRegion = "us-central1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Action      string            //empty Delete,Move
	URL         string            `json:",omitempty"`
	Message     string            `json:",omitempty"`
	Title       string            `json:",omitempty"`
	Body        interface{}       `json:",omitempty"`
	Channels    []string          `json:",omitempty"`
	Credentials *auth.Credentials `json:",omitempty"`
}

Action represents an action

func (Action) DestURL

func (a Action) DestURL(relativePath string) string

DestURL returns destination URL

func (Action) Do

func (a Action) Do(context *Context, service afs.Service, notify Notify, info *base.Info, response interface{}) (err error)

Do perform an action

func (Action) WriteError

func (a Action) WriteError(context *Context, service afs.Service) error

WriteError writes an error file if context has error

type Actions

type Actions struct {
	OnSuccess []*Action
	OnFailure []*Action
}

Actions represents a job completion

func (*Actions) Run

func (a *Actions) Run(context *Context, service afs.Service, notify Notify, info *base.Info, body interface{}) error

Run run completion

type Context

type Context struct {
	context.Context
	Error        error
	Name         string
	RelativePath string
	SourceURL    string
}

Context represents job context

func NewContext

func NewContext(ctx context.Context, err error, sourceURL, relativePath string) *Context

NewContext creates a context

type Notify

type Notify func(ctx context.Context, request *NotifyRequest) error

Notify represents notify function

type NotifyRequest

type NotifyRequest struct {
	Channels []string
	From     string
	Title    string
	Message  string
	Filename string
	Body     interface{}
	*auth.Credentials
	BodyType string
}

NotifyRequest represents a notify request

func (*NotifyRequest) Init

func (r *NotifyRequest) Init(location, projectID string) error

Load initializes request

func (*NotifyRequest) Validate

func (r *NotifyRequest) Validate() error

Validate checks if request is valid

Jump to

Keyboard shortcuts

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