gcloud

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Overview

Package gcloud provides a set of helpers to interact with gcloud(Cloud SDK) binary

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivateCredsAndEnvVars

func ActivateCredsAndEnvVars(t testing.TB, creds string)

ActivateCredsAndEnvVars activates credentials and exports auth related envvars.

func Run

func Run(t testing.TB, cmd string, opts ...cmdOption) gjson.Result

Run executes a gcloud command and returns value as gjson.Result. It fails the test if there are any errors executing the gcloud command or parsing the output value.

func RunCmd

func RunCmd(t testing.TB, cmd string, opts ...cmdOption) string

RunCmd executes a gcloud command and fails test if there are any errors.

func RunCmdE added in v0.2.0

func RunCmdE(t testing.TB, cmd string, opts ...cmdOption) (string, error)

RunCmdE executes a gcloud command and return output.

func RunWithCmdOptsf

func RunWithCmdOptsf(t testing.TB, opts []cmdOption, cmd string, args ...interface{}) gjson.Result

RunWithCmdOptsf executes a gcloud command and returns value as gjson.Result.

RunWithCmdOptsf(t, ops.., "projects list --filter=%s", "projectId")

It fails the test if there are any errors executing the gcloud command or parsing the output value.

func Runf

func Runf(t testing.TB, cmd string, args ...interface{}) gjson.Result

Runf executes a gcloud command and returns value as gjson.Result.

Runf(t, "projects list --filter=%s", "projectId")

It fails the test if there are any errors executing the gcloud command or parsing the output value.

func TFVet added in v0.2.0

func TFVet(t testing.TB, planFilePath string, policyLibraryPath, terraformVetProject string) gjson.Result

TFVet executes gcloud beta terraform vet

func WithBinary

func WithBinary(gcloudBinary string) cmdOption

func WithCommonArgs

func WithCommonArgs(commonArgs []string) cmdOption

func WithLogger

func WithLogger(logger *logger.Logger) cmdOption

Types

type CmdCfg

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

Jump to

Keyboard shortcuts

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