utils

package
v0.0.0-...-a0e73d3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const AUTH_METADATA = "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token"
View Source
const SCRIPT_PATH = "/host/etc/profile.d/gce-containers-welcome.sh"
View Source
const WELCOME_SCRIPT_ON_FAILURE = `` /* 546-byte string literal not displayed */
View Source
const WELCOME_SCRIPT_ON_SUCCESS = `` /* 457-byte string literal not displayed */

Variables

This section is empty.

Functions

func AssertEmpty

func AssertEmpty(t *testing.T, object interface{}, message string)

func AssertEqual

func AssertEqual(t *testing.T, a interface{}, b interface{}, message string)

func AssertError

func AssertError(t *testing.T, err error, expected string)

func AssertNoError

func AssertNoError(t *testing.T, err error)

func OpenIptables

func OpenIptables() error

func OpenIptablesForProtocol

func OpenIptablesForProtocol(protocol string) error

func UseGcpTokenForImage

func UseGcpTokenForImage(image string) bool

UseGcpTokenForImage returns true iff the provided image string points to a repository that uses a GCP token. Currently, that is:

  • gcr.io
  • pkg.dev

func WriteWelcomeScript

func WriteWelcomeScript(startupErr interface{}) error

Types

type AuthProvider

type AuthProvider interface {
	RetrieveAuthToken() (string, error)
}

type ConstantTokenProvider

type ConstantTokenProvider struct {
	Token string
}

func (ConstantTokenProvider) RetrieveAuthToken

func (provider ConstantTokenProvider) RetrieveAuthToken() (string, error)

type FileWriterInterface

type FileWriterInterface interface {
	WriteFile(filename string, data []byte, perm os.FileMode) error
}

type LoggerInterface

type LoggerInterface interface {
	Print(v ...interface{})
}

type RealFileWriter

type RealFileWriter struct{}

func (RealFileWriter) WriteFile

func (_ RealFileWriter) WriteFile(filename string, data []byte, perm os.FileMode) error

type RealLogger

type RealLogger struct{}

func (RealLogger) Print

func (_ RealLogger) Print(v ...interface{})

type ServiceAccountTokenProvider

type ServiceAccountTokenProvider struct {
}

func (ServiceAccountTokenProvider) RetrieveAuthToken

func (provider ServiceAccountTokenProvider) RetrieveAuthToken() (string, error)

type Token

type Token struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	TokenType   string `json:"token_type"`
}

Jump to

Keyboard shortcuts

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