utils

package
v2.311.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2020 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout  = time.Minute
	DefaultInterval = time.Second
)
View Source
const DefaultNatsTimeout = time.Second * 15
View Source
const DefaultTaskTimeout = time.Second * 30

Variables

This section is empty.

Functions

func GenerateKeyPair

func GenerateKeyPair() (publicKey []byte, privateAuthMethod ssh.AuthMethod, err error)

func TarballDirectory

func TarballDirectory(dirname, rootdir, tarname string) (string, error)

TarballDirectory - rootdir is equivalent to tar -C 'rootdir'

Types

type BlobClient

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

func NewBlobstore

func NewBlobstore(uri string) BlobClient

func (BlobClient) Create

func (b BlobClient) Create(filepath string) (string, error)

func (BlobClient) Get

func (b BlobClient) Get(uuid string, destinationPath string) error

type CompileTemplate

type CompileTemplate struct {
	BlobstoreID  string
	SHA1         string
	Name         string
	Version      string
	Dependencies map[string]MarshalableBlobRef
}

func (CompileTemplate) Arguments

func (c CompileTemplate) Arguments() []interface{}

type MarshalableBlobRef

type MarshalableBlobRef struct {
	Name        string
	Version     string
	BlobstoreID string `json:"blobstore_id"`
	SHA1        string
}

type NatCommand

type NatCommand struct {
	Protocol  int           `json:"protocol"`
	Method    string        `json:"method"`
	Arguments []interface{} `json:"arguments"`
	ReplyTo   string        `json:"reply_to"`
}

func (NatCommand) Marshal

func (n NatCommand) Marshal() (string, error)

type NatsClient

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

func NewNatsClient

func NewNatsClient(
	compressor boshfileutil.Compressor,
	blobstoreClient BlobClient,
	natsIP string,
) *NatsClient

func (*NatsClient) CheckErrandResultStatus

func (n *NatsClient) CheckErrandResultStatus(taskID string) func() (action.ErrandResult, error)

func (*NatsClient) Cleanup

func (n *NatsClient) Cleanup()

func (*NatsClient) CleanupSSH

func (n *NatsClient) CleanupSSH(username string, senderID string) (action.SSHResult, error)

func (*NatsClient) CompilePackage

func (n *NatsClient) CompilePackage(packageName string) (*MarshalableBlobRef, error)

func (*NatsClient) CompilePackageWithDeps

func (n *NatsClient) CompilePackageWithDeps(packageName string, deps map[string]MarshalableBlobRef) (*MarshalableBlobRef, error)

func (*NatsClient) FetchLogs

func (n *NatsClient) FetchLogs(destinationDir string)

func (*NatsClient) GetNextAlert

func (n *NatsClient) GetNextAlert(timeout time.Duration) (*boshalert.Alert, error)

func (*NatsClient) GetState

func (n *NatsClient) GetState() action.GetStateV1ApplySpec

func (*NatsClient) GetTask

func (n *NatsClient) GetTask(id string) (*http.TaskResponse, error)

func (*NatsClient) PrepareJob

func (n *NatsClient) PrepareJob(jobName string)

func (*NatsClient) RunDrain

func (n *NatsClient) RunDrain() error

func (*NatsClient) RunErrand

func (n *NatsClient) RunErrand() (map[string]map[string]string, error)

func (*NatsClient) RunScript

func (n *NatsClient) RunScript(scriptName string) error

func (*NatsClient) RunStart

func (n *NatsClient) RunStart() (map[string]string, error)

func (*NatsClient) RunStop

func (n *NatsClient) RunStop() error

func (*NatsClient) SendMessage

func (n *NatsClient) SendMessage(message string) (map[string]map[string]string, error)

func (*NatsClient) SendRawMessage

func (n *NatsClient) SendRawMessage(message string) ([]byte, error)

func (*NatsClient) SendRawMessageWithTimeout

func (n *NatsClient) SendRawMessageWithTimeout(message string, timeout time.Duration) ([]byte, error)

func (*NatsClient) Setup

func (n *NatsClient) Setup() error

func (*NatsClient) SetupSSH

func (n *NatsClient) SetupSSH(username string, senderID string) (action.SSHResult, *ssh.ClientConfig, error)

func (*NatsClient) WaitForTask

func (n *NatsClient) WaitForTask(id string, timeout time.Duration) (*http.TaskResponse, error)

type PrepareTemplateConfig

type PrepareTemplateConfig struct {
	JobName                             string
	TemplateBlobstoreID                 string
	RenderedTemplatesArchiveBlobstoreID string
	RenderedTemplatesArchiveSHA1        string
	ReplyTo                             string
}

type TarWalker

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

func (*TarWalker) Walk

func (t *TarWalker) Walk(path string, fi os.FileInfo, err error) error

Jump to

Keyboard shortcuts

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