dockerhub

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package docker provides a client using the Docker API. Lookup of the latest image borrows from Renovate. SEE: https://github.com/renovatebot/renovate/tree/main/lib/modules/datasource/docker SEE: https://github.com/renovatebot/renovate/tree/main/lib/modules/versioning/docker

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RepositoryUIPath

func RepositoryUIPath(image oci.Reference) string

func TagUIPath

func TagUIPath(image oci.Reference, digest string) string

Types

type Client

type Client struct {
	Client *httputil.Client
}

func (*Client) AuthorizeOCIRequest

func (c *Client) AuthorizeOCIRequest(ctx context.Context, image oci.Reference, req *http.Request) error

func (*Client) GetOrganizationOrUser

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

func (*Client) GetRegistryToken

func (c *Client) GetRegistryToken(ctx context.Context, image oci.Reference) (string, error)

func (*Client) GetRepository

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

func (*Client) GetVulnerabilityReport

func (c *Client) GetVulnerabilityReport(ctx context.Context, repo string, digest string) (*VulnerabilityReport, error)

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 VulnerabilityReport

type VulnerabilityReport struct {
	Critical    int `json:"critical"`
	High        int `json:"high"`
	Medium      int `json:"medium"`
	Low         int `json:"low"`
	Unspecified int `json:"unspecified"`
	Total       int `json:"total"`
}

Jump to

Keyboard shortcuts

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