dockerhub

package
v0.0.0-...-dc57109 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCredential = errors.New("invalid Docker Hub credentials")
View Source
var ErrNoCredentials = errors.New("no Docker Hub credentials found in Docker config")
View Source
var IMG_RE = regexp.MustCompile(`^((?:((?:[0-9a-z](?:[0-9a-z-]{0,61}[0-9a-z])?\.)+[a-z]{2,63})\/)?(.{1,127}?))(?::(\w[\w.-]{0,127}))?(?:@(sha256:[0-9a-f]{64}))?$`)

Copied from defang-mvp/pulumi/shared/utils.ts

Functions

func GenerateNewPublicOnlyPAT

func GenerateNewPublicOnlyPAT(ctx context.Context, label string) (string, string, error)

func GetDockerHubCredentials

func GetDockerHubCredentials(ctx context.Context) (string, string, error)

func IsDockerHubImage

func IsDockerHubImage(image string) bool

func ValidateCredsWithRepo

func ValidateCredsWithRepo(ctx context.Context, user, pass string, repo string) error

Types

type CreateAccessTokenRequest

type CreateAccessTokenRequest struct {
	Identifier string `json:"identifier"`
	Secret     string `json:"secret"`
}

type CreateAccessTokenResponse

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

type CreatePATRequest

type CreatePATRequest struct {
	TokenLabel string   `json:"token_label"`
	Scopes     []string `json:"scopes,omitempty"`
	ExpiresAt  string   `json:"expires_at,omitempty"`
}

type CreatePATResponse

type CreatePATResponse struct {
	Token string `json:"token"` // this is the real PAT
	UUID  string `json:"uuid"`
}

type DockerHubClient

type DockerHubClient struct {
	PAT    string
	Client *http.Client
	// contains filtered or unexported fields
}

func (*DockerHubClient) CreatePAT

func (c *DockerHubClient) CreatePAT(ctx context.Context, label string, scopes []string) (string, error)

func (*DockerHubClient) Login

func (c *DockerHubClient) Login(ctx context.Context, username, password string) error

type Image

type Image struct {
	Image    string
	Registry string
	Repo     string
	Tag      string
	Digest   string
}

func ParseImage

func ParseImage(image string) (*Image, error)

func (Image) FullImage

func (i Image) FullImage() string

func (Image) String

func (i Image) String() string

Jump to

Keyboard shortcuts

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