files

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceTypeProject  = "project"
	ResourceTypeWorkflow = "workflow"
	ResourceTypeJob      = "job"
	OperationPush        = "push"
	OperationPull        = "pull"
	OperationYank        = "yank"
)

Variables

This section is empty.

Functions

func IsFileSrc

func IsFileSrc(src string) (bool, error)

Checks if the given source exists and is a file.

func ToRelative

func ToRelative(filepath string) string

Removes all ./, ../ etc prefixes from the string.

Types

type PathResolver

type PathResolver struct {
	ResourceType       string
	ResourceTypePlural string
	ResourceIdentifier string
}

func NewPathResolver

func NewPathResolver(resourceType, resourceId string) (*PathResolver, error)

func (*PathResolver) PrefixedPath

func (r *PathResolver) PrefixedPath(filepath string) string

* Get resource-prefixed paths for paths in remote storage. * * For project: artifacts/projects/<SEMAPHORE_PROJECT_ID>/x.zip * For workflow: artifacts/workflows/<SEMAPHORE_WORKFLOW_ID>/x.zip * For job: artifacts/jobs/<SEMAPHORE_JOB_ID>/x.zip

func (*PathResolver) Pull

func (r *PathResolver) Pull(source, destinationOverride string) *ResolvedPath

func (*PathResolver) Push

func (r *PathResolver) Push(source, destinationOverride string) *ResolvedPath

func (*PathResolver) Resolve

func (r *PathResolver) Resolve(operation, source, destinationOverride string) (*ResolvedPath, error)

func (*PathResolver) Yank

func (r *PathResolver) Yank(file string) *ResolvedPath

type ResolvedPath

type ResolvedPath struct {
	Source      string
	Destination string
}

Jump to

Keyboard shortcuts

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