proxy

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: 22 Imported by: 0

Documentation

Overview

Package proxy defines service to propagate event to trigger bucket

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	base.Config
	Dest   config.Resource
	Source config.Resource
	Move   bool
}

Config represents proxy config

func NewConfig

func NewConfig(ctx context.Context) (*Config, error)

NewConfig creates a config

func NewConfigFromEnv

func NewConfigFromEnv(ctx context.Context, key string) (*Config, error)

NewConfigFromEnv returns new config from env

func NewConfigFromJSON

func NewConfigFromJSON(ctx context.Context, payload string) (*Config, error)

NewConfigFromJSON creates a new config from env

func NewConfigFromURL

func NewConfigFromURL(ctx context.Context, URL string) (*Config, error)

NewConfigFromURL creates a new config from env

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if config is valid

type Request

type Request struct {
	Source *config.Resource
	Dest   *config.Resource
	Move   bool
	Stream bool
}

Request represents proxy

func (*Request) Validate

func (r *Request) Validate() error

Validate checks if request is valid

type Response

type Response struct {
	SourceURL string            `json:",omitempty"`
	Copied    map[string]string `json:",omitempty"`
	Moved     map[string]string `json:",omitempty"`
	Invoked   map[string]string `json:",omitempty"`
	Status    string            `json:",omitempty"`
	Error     string            `json:",omitempty"`
	// contains filtered or unexported fields
}

func NewResponse

func NewResponse() *Response

NewResponse create a response

func (*Response) AddCopied

func (r *Response) AddCopied(key, value string)

AddCopied adds to copied map

func (*Response) AddInvoked

func (r *Response) AddInvoked(key, value string)

AddCopied adds to move map

func (*Response) AddMoved

func (r *Response) AddMoved(key, value string)

AddCopied adds to move map

type Service

type Service interface {
	Proxy(ctx context.Context, request *Request) *Response
}

Service represents trigger service

func New

func New(fs afs.Service, config *Config, secret secret.Service) Service

New create trigger service

func Singleton

func Singleton(config *Config) Service

Singleton returns proxy singleton service

Jump to

Keyboard shortcuts

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