bcat

package module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2019 License: MIT Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

license go version

Black Cat

This tool is a Golang tool that uploads compressed data to s3.

Help

$ bcat --help
Usage:
  bcat [OPTIONS] <command>

Application Options:
  -l, --localstack  Use LocalStack
  -e, --endpoint=   Localstack endpoint (default: http://localhost:4572)

Help Options:
  -h, --help        Show this help message

Available commands:
  deploy    Deploy Command
  download  Download Command
  upload    Upload Command
  version   Version Command

Todo

  • bcat_info.jsonを追加する。(メタデータ管理)
  • シンボリックリンクに対応する。
  • package aws 作成(package bcat と分ける)
  • uploadコマンドでsession情報が正しくない時にエラーが返るよう修正(現在はCompressで固まってしまう)
  • testコードのリファクタリング

Documentation

Index

Constants

View Source
const (
	BCATFILE      = "bcat.tar.zst"
	METADATA_FILE = "bcat_info.json"
)

Variables

This section is empty.

Functions

func Compress

func Compress(writer *io.PipeWriter, targetPath string, errChan chan error)

Compress compress the file with the specified path.

func CreateSession

func CreateSession(region string) *session.Session

CreateSession Create a session for aws s3.

func CreateSessionForLocalstack

func CreateSessionForLocalstack(region string, endpoint string) *session.Session

CreateSessionForLocalstack Create a session for localstack

func CreateSessionWithRole added in v0.8.3

func CreateSessionWithRole(rolearn string, region string) *session.Session

CreateSessionWithRole Create a session for aws s3 with role.

func Decompress

func Decompress(dest string, reader *io.PipeReader) error

Decompress output the extracted files to the specified directory

Types

type Artifact

type Artifact struct {
	Name string `yaml:"name"`
	Path string `yaml:"path"`
	Dest string `yaml:"dest"`
}

Artifact used in Deploy-Cmd

type DeployConfig

type DeployConfig struct {
	Artifacts []Artifact `yaml:"artifacts"`
}

DeployConfig Deploy-Cmd configuration struct

func Parse

func Parse(configFilePath string) (DeployConfig, error)

Parse bcat-deploy parse

type DeployManager

type DeployManager struct {
	Downloader Downloader
	Config     DeployConfig
}

DeployManager manage deploy struct

func (*DeployManager) Deploy

func (dm *DeployManager) Deploy() error

Deploy download multiple objects from s3 based on DeployConfig values.

type Downloader

type Downloader struct {
	S3Manager S3Manager
}

Downloader download struct

func (*Downloader) Download

func (downloader *Downloader) Download(destPath string, downloadPath string) error

Download decompress object of s3 (downloadPath) and download it to destPath

type MetaData added in v0.9.0

type MetaData struct {
	BcatVersion string `json:"version"`
	TargetPath  string `json:"target_path"`
}

MetaData this is a struct that manages metadata of upload

type S3Manager

type S3Manager struct {
	Session *session.Session
	Bucket  string
}

S3Manager A struct with the session and target bucket name. Data is transferred to s3 via this.

func (*S3Manager) GetS3ObjectBody added in v0.8.3

func (manager *S3Manager) GetS3ObjectBody(downloadPath string) (io.ReadCloser, error)

GetS3ObjectBody returns the object body of s3 as io.ReadCloser

func (*S3Manager) UploadMetaData added in v0.9.0

func (manager *S3Manager) UploadMetaData(metaData MetaData, uploadPath string) error

UploadMetaData methed

func (*S3Manager) UploadS3

func (manager *S3Manager) UploadS3(reader *io.PipeReader, uploadPath string, outputChan chan *s3manager.UploadOutput, errChan chan error)

UploadS3 Upload the file to s3 based on the [] byte passed as an argument.

type Uploader

type Uploader struct {
	S3Manager S3Manager
	MetaData  MetaData
}

Uploader upload struct

func (*Uploader) Upload

func (uploader *Uploader) Upload(targetPath string, uploadPath string) error

Upload compress targetPath-files and upload it to s3 (uploadPath).

type Walker

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

Walker hold tar writer

func (*Walker) WriteWithWalk

func (w *Walker) WriteWithWalk(file string, fi os.FileInfo, err error) error

WriteWithWalk write the contents of the specified file

Directories

Path Synopsis
cmd
bcat command

Jump to

Keyboard shortcuts

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