stctl

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package stctl implements storage tranfer actions used by the stctl CLI tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Client              TransferJob
	Project             string
	SourceBucket        string
	TargetBucket        string
	Prefixes            []string
	StartTime           flagx.Time
	Interval            string
	AfterDate           time.Time
	MinFileAge          time.Duration
	MaxFileAge          time.Duration
	DeleteAfterTransfer bool
	Output              io.Writer
}

Command executes stctl actions.

func (*Command) Create

func (c *Command) Create(ctx context.Context) (*storagetransfer.TransferJob, error)

Create creates a new storage transfer job.

func (*Command) Disable

func (c *Command) Disable(ctx context.Context, name string) (*storagetransfer.TransferJob, error)

Disable marks the job status as 'DISABLED'.

func (*Command) ListJobs

func (c *Command) ListJobs(ctx context.Context) error

ListJobs lists enabled transfer jobs.

func (*Command) ListOperations

func (c *Command) ListOperations(ctx context.Context, name string) error

ListOperations lists past operations for the named job that started after c.AfterDate.

func (*Command) Sync

func (c *Command) Sync(ctx context.Context) (*storagetransfer.TransferJob, error)

Sync guarantees that a job exists matching the current command parameters. If a job with matching command parameters already exists, no action is taken. If a matching description is found with different values for IncludePrefixes or StartTimeOfDay, then the original job is disabled and a new job created. In either case, the found or newly created job is returned on success.

type TransferJob

type TransferJob interface {
	Jobs(ctx context.Context, visit func(resp *storagetransfer.ListTransferJobsResponse) error) error
	Create(ctx context.Context, create *storagetransfer.TransferJob) (*storagetransfer.TransferJob, error)
	Get(ctx context.Context, name string) (*storagetransfer.TransferJob, error)
	Update(ctx context.Context, name string, update *storagetransfer.UpdateTransferJobRequest) (*storagetransfer.TransferJob, error)
	Operations(ctx context.Context, name string, visit func(r *storagetransfer.ListOperationsResponse) error) error
}

TransferJob captures the interface required by Command implementations.

Jump to

Keyboard shortcuts

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