util

package
v0.0.0-...-4f22f6d Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConfirmation

func CheckConfirmation(stdin io.Reader, stdout io.Writer, name string) (bool, error)

CheckConfirmation prompts the user for confirmation and returns true IFF the user responds with 'yes'

func DownloadBOSHCLI

func DownloadBOSHCLI(binaries map[string]BinaryPaths) (string, error)

DownloadBOSHCLI returns the path of the downloaded bosh-cli

func DownloadTerraformCLI

func DownloadTerraformCLI(binaries map[string]BinaryPaths) (string, error)

DownloadTerraformCLI returns the path of the downloaded terraform-cli

func EightRandomLetters

func EightRandomLetters() string

EightRandomLetters generates a random string

func FindUserIP

func FindUserIP() (string, error)

FindUserIP gets the user's public IP by querying whatismyip.akamai.com

func GeneratePasswordWithLength

func GeneratePasswordWithLength(length int) string

GeneratePasswordWithLength a random password with the given length

func GenerateSSHKeyPair

func GenerateSSHKeyPair() ([]byte, []byte, string, error)

GenerateSSHKeyPair generates a new ssh public key pair http://stackoverflow.com/questions/21151714/go-generate-an-ssh-public-key

func ParseVersionResources

func ParseVersionResources(versionFile []byte) map[string]Resource

func RenderTemplate

func RenderTemplate(name string, templateStr string, params interface{}) ([]byte, error)

RenderTemplate renders a template to a string

Types

type BinaryPaths

type BinaryPaths struct {
	Mac   string `json:"mac"`
	Linux string `json:"linux"`
}

type Resource

type Resource struct {
	URL     string `json:"url"`
	Version string `json:"version"`
	SHA1    string `json:"sha1"`
}

Resource safely exposes the json parameters of a resource

func GetResource

func GetResource(name string, resources map[string]Resource) Resource

type TempDir

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

TempDir represents a temporary directory to store files

func NewTempDir

func NewTempDir() (*TempDir, error)

NewTempDir returns a new temporary directory

func (*TempDir) Cleanup

func (tempDir *TempDir) Cleanup() error

Cleanup deletes the tempDir

func (*TempDir) Path

func (tempDir *TempDir) Path(filename string) string

Path returns a path for the given file into the tempDir

func (*TempDir) PushDir

func (tempDir *TempDir) PushDir(callback func() error) error

PushDir runs the function in the tempDir

func (*TempDir) Save

func (tempDir *TempDir) Save(filename string, contents []byte) (string, error)

Save writes the given file into the tempDir

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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