gcp

package
v2.24.1 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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const GCP_TOKEN_URL = "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token"

GCP_TOKEN_URL is the default GCP metadata endpoint used for authentication.

Variables

This section is empty.

Functions

func ValidHost

func ValidHost(host string) bool

ValidHost returns if a given host is a valid GCR host.

Types

type Client

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

Client is a GCP GCR client which can log into the registry and return authorization information.

func NewClient

func NewClient() *Client

NewClient creates a new GCR client with default configurations.

func (*Client) Login

func (c *Client) Login(ctx context.Context, autoLogin bool, image string, ref name.Reference) (authn.Authenticator, error)

Login attempts to get the authentication material for GCR. The caller can ensure that the passed image is a valid GCR image using ValidHost().

func (*Client) OIDCLogin

func (c *Client) OIDCLogin(ctx context.Context) (authn.Authenticator, error)

OIDCLogin attempts to get the authentication material for GCR from the token url set in the client.

func (*Client) WithTokenURL

func (c *Client) WithTokenURL(url string) *Client

WithTokenURL sets the token URL used by the GCR client.

Jump to

Keyboard shortcuts

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