dockerhub

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RepositoryUIPath

func RepositoryUIPath(image oci.Reference) string

RepositoryUIPath returns a URL to an image's repository page on Docker Hub.

Types

type Client

type Client struct {
	Client httputil.Requester
}

func (*Client) GetOrganizationOrUser

func (c *Client) GetOrganizationOrUser(ctx context.Context, organizationOrUser string) (*Entity, error)

GetOrganizationOrUser retrieves information about a Docker Hub user or organization by name.

func (*Client) GetRepository

func (c *Client) GetRepository(ctx context.Context, image oci.Reference) (*Repository, error)

func (*Client) GetVulnerabilities added in v0.20.0

func (c *Client) GetVulnerabilities(ctx context.Context, repo string, digest string) ([]osv.Vulnerability, error)

GetVulnerabilities retrieves a Docker Scout vulnerability report for a repository and image digest. Returns nil if the results are inconclusive or an SBOM was not found.

type Entity

type Entity struct {
	ID               string    `json:"id"`
	UUID             string    `json:"uuid,omitempty"`
	OrganizationName string    `json:"orgname"`
	Username         string    `json:"username,omitempty"`
	FullName         string    `json:"full_name"`
	Location         string    `json:"location"`
	Company          string    `json:"company"`
	ProfileURL       string    `json:"profile_url"`
	DateJoined       time.Time `json:"date_joined"`
	GravatarURL      string    `json:"gravatar_url"`
	GravatarEmail    string    `json:"gravatar_email"`
	Type             string    `json:"type"`
	Badge            string    `json:"badge,omitempty"`
}

type Image

type Image struct {
	Architecture string    `json:"architecture"`
	Features     string    `json:"features"`
	Variant      *string   `json:"variant"`
	Digest       string    `json:"digest"`
	OS           string    `json:"os"`
	OSFeatures   string    `json:"os_features"`
	OSVersion    *string   `json:"os_version"`
	Size         int       `json:"size"`
	Status       string    `json:"status"`
	LastPulled   time.Time `json:"last_pulled"`
	LastPushed   time.Time `json:"last_pushed"`
}

type Page

type Page[T any] struct {
	Count    int     `json:"count"`
	Next     *string `json:"next"`
	Previous *string `json:"previous"`
	Results  []T     `json:"results"`
}

type Repository

type Repository struct {
	User              string          `json:"user"`
	Name              string          `json:"name"`
	Namespace         string          `json:"namespace"`
	Type              string          `json:"repository_type"`
	Status            int             `json:"status"`
	StatusDescription string          `json:"status_description"`
	Description       string          `json:"description"`
	IsPrivate         bool            `json:"is_private"`
	IsAutomated       bool            `json:"is_automated"`
	StarCount         int             `json:"star_count"`
	PullCount         int             `json:"pull_count"`
	LastUpdated       time.Time       `json:"last_updated"`
	DateRegistered    time.Time       `json:"date_registered"`
	CollaboratorCount int             `json:"collaborator_count"`
	Affiliation       json.RawMessage `json:"affiliation"` // Unknown
	HubUser           string          `json:"hub_user"`
	HasStarred        bool            `json:"has_starred"`
	FullDescription   string          `json:"full_description"`
	Permissions       struct {
		Read  bool `json:"read"`
		Write bool `json:"write"`
		Admin bool `json:"admin"`
	} `json:"permissions"`
	MediaTypes   []string `json:"media_types"`
	ContentTypes []string `json:"content_types"`
	Categories   []struct {
		Name string `json:"name"`
		Slug string `json:"slug"`
	} `json:"categories"`
	ImmutableTags      bool   `json:"immutable_tags"`
	ImmutableTagsRules string `json:"immutable_tags_rules"`
}

type Tag

type Tag struct {
	Creator             int       `json:"creator"`
	ID                  int       `json:"id"`
	LastUpdated         time.Time `json:"last_updated"`
	LastUpdater         int       `json:"last_updater"`
	LastUpdaterUsername string    `json:"last_updater_username"`
	Name                string    `json:"name"`
	Repository          int       `json:"repository"`
	FullSize            int       `json:"full_size"`
	V2                  bool      `json:"v2"`
	TagStatus           string    `json:"tag_status"`
	TagLastPulled       time.Time `json:"tag_last_pulled"`
	TagLastPushed       time.Time `json:"tag_last_pushed"`
	MediaType           string    `json:"media_type"`
	ContentType         string    `json:"content_type"`
	Digest              string    `json:"digest"`
	Images              []Image   `json:"images"`
}

type Vulnerability added in v0.20.0

type Vulnerability struct {
	ID          string `json:"id"`
	Description string `json:"description,omitempty"`
	URL         string `json:"url,omitempty"`
	Severity    string `json:"severity,omitempty"`
}

Jump to

Keyboard shortcuts

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