gcp

package
v4.0.0-pre-2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultEndpoint = "http://metadata.google.internal"

DefaultEndpoint is the DNS name for the default GCP compute instance metadata service.

Functions

This section is empty.

Types

type ClientOptions

type ClientOptions struct {
	Timeout time.Duration
}

ClientOptions contains various user-specifiable options for a MetaClient.

func GetClientOptions

func GetClientOptions() ClientOptions

GetClientOptions - Centralised reading of GCP_TIMEOUT ... but cannot use in vault/auth.go as different strconv.Atoi error handling

type MetaClient

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

MetaClient is used to access metadata accessible via the GCP compute instance metadata service version 1.

func NewMetaClient

func NewMetaClient(ctx context.Context, options ClientOptions) *MetaClient

NewMetaClient constructs a new MetaClient with the given ClientOptions. If the environment contains a variable named `GCP_META_ENDPOINT`, the client will address that, if not the value of `DefaultEndpoint` is used.

func (*MetaClient) Meta

func (c *MetaClient) Meta(key string, def ...string) (string, error)

Meta retrieves a value from the GCP Instance Metadata Service, returning the given default if the service is unavailable or the requested URL does not exist.

Jump to

Keyboard shortcuts

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