gcpcredential

package
v0.29.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

	// DockerConfigKey is the URL of the dockercfg metadata key used by DockerConfigKeyProvider.
	DockerConfigKey = metadataAttributes + "google-dockercfg"
	// DockerConfigURLKey is the URL of the dockercfg metadata key used by DockerConfigURLKeyProvider.
	DockerConfigURLKey = metadataAttributes + "google-dockercfg-url"

	// StorageScopePrefix is the prefix checked by ContainerRegistryProvider.Enabled.
	StorageScopePrefix = "https://www.googleapis.com/auth/devstorage"
)

Variables

View Source
var GCEProductNameFile = "/sys/class/dmi/id/product_name"

GCEProductNameFile is the product file path that contains the cloud service name. This is a variable instead of a const to enable testing.

Functions

func ProvideConfigKey

func ProvideConfigKey(client *http.Client, image string) credentialconfig.RegistryConfig

ProvideConfigKey implements a dockercfg-based authentication flow.

func ProvideContainerRegistry

func ProvideContainerRegistry(client *http.Client, image string) credentialconfig.RegistryConfig

ProvideContainerRegistry implements a gcr.io-based authentication flow.

func ProvideURLKey

func ProvideURLKey(client *http.Client, image string) credentialconfig.RegistryConfig

ProvideURLKey implements a dockercfg-url-based authentication flow.

func ReadDockerConfigFileFromBytes

func ReadDockerConfigFileFromBytes(contents []byte) (cfg credentialconfig.RegistryConfig, err error)

ReadDockerConfigFileFromBytes read a docker config file from the given bytes

func ReadDockerConfigFileFromURL

func ReadDockerConfigFileFromURL(url string, client *http.Client, header *http.Header) (cfg credentialconfig.RegistryConfig, err error)

ReadDockerConfigFileFromURL read a docker config file from the given url

func ReadURL

func ReadURL(url string, client *http.Client, header *http.Header) (body []byte, err error)

ReadURL read contents from given url

Types

type HTTPError

type HTTPError struct {
	StatusCode int
	URL        string
}

HTTPError wraps a non-StatusOK error code as an error.

func (*HTTPError) Error

func (he *HTTPError) Error() string

Error implements error

type RegistryConfigEntry

type RegistryConfigEntry struct {
	credentialconfig.RegistryConfigEntry
}

RegistryConfigEntry is a serializable wrapper around credentialconfig.RegistryConfigEntry.

func (RegistryConfigEntry) MarshalJSON

func (ident RegistryConfigEntry) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*RegistryConfigEntry) UnmarshalJSON

func (ident *RegistryConfigEntry) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type TokenBlob

type TokenBlob struct {
	AccessToken string `json:"access_token"`
}

TokenBlob is used to decode the JSON blob containing an access token that is returned by GCE metadata.

Jump to

Keyboard shortcuts

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