dockerhub

package module
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: MPL-2.0 Imports: 8 Imported by: 1

Documentation

Overview

API client for hub.docker.com

Index

Constants

View Source
const BaseURLV2 = "https://hub.docker.com/v2"

APIs default base URL.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type Client

type Client struct {
	BaseURL string

	HTTPClient *http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(username string, password string) *Client

Create the API client, providing the authentication.

func (*Client) CreateGroup added in v2.1.0

func (c *Client) CreateGroup(ctx context.Context, organisation string, createGroup Group) (Group, error)

Create a group / team in organization POST https://hub.docker.com/v2/orgs/organisation_name/groups/ BODY: {"name":"test"} RESPONSE: {"id":123,"name":"test","description":""}

func (*Client) CreatePersonalAccessToken

func (c *Client) CreatePersonalAccessToken(ctx context.Context, createPersonalAccessToken CreatePersonalAccessToken) (CreatePersonalAccessTokenResponse, error)

Personal Access Token ----------------------

func (*Client) CreateRepository

func (c *Client) CreateRepository(ctx context.Context, createRepository Repository) (Repository, error)

Repository -----------

func (*Client) CreateRepositoryGroup added in v2.1.0

func (c *Client) CreateRepositoryGroup(ctx context.Context, repository string, createRepositoryGroup RepositoryGroup) (RepositoryGroup, error)

Create a repository --> group association in organization POST https://hub.docker.com/v2/repositories/organisation_name/example-fixture-loader/groups/ BODY: {"group_id":123,"groupid":123,"group_name":"example","groupname":"example","permission":"write"} permission: "read" / "write" / "admin"

func (*Client) DeleteGroup added in v2.1.0

func (c *Client) DeleteGroup(ctx context.Context, organisation string, id string) error

Delete a group in organization DELETE /v2/orgs/organization_name/groups/group_name/

func (*Client) DeletePersonalAccessToken

func (c *Client) DeletePersonalAccessToken(ctx context.Context, uuid string) error

func (*Client) DeleteRepository

func (c *Client) DeleteRepository(ctx context.Context, id string) error

func (*Client) DeleteRepositoryGroup added in v2.1.0

func (c *Client) DeleteRepositoryGroup(ctx context.Context, repository string, id string) error

Delete a repository --> group association in organization DELETE /v2/repositories/organisation_name/example-fixture-loader/groups/123/

func (*Client) GetGroup added in v2.1.0

func (c *Client) GetGroup(ctx context.Context, organisation string, id string) (Group, error)

Read a group / team in organization GET /v2/orgs/organization_name/groups/group_name/ RESPONSE: {"id": 123, "name": "test", "description": "x"}

func (*Client) GetPersonalAccessToken added in v2.0.2

func (c *Client) GetPersonalAccessToken(ctx context.Context, uuid string) (CreatePersonalAccessTokenResponse, error)

Note: Returned token will always be blank.

func (*Client) GetRepository

func (c *Client) GetRepository(ctx context.Context, id string) (Repository, error)

func (*Client) GetRepositoryGroup added in v2.1.0

func (c *Client) GetRepositoryGroup(ctx context.Context, repository string, id string) (RepositoryGroup, error)

Get a repository --> group association in organization GET /v2/repositories/organisation_name/example-fixture-loader/groups/123/

func (*Client) UpdateGroup added in v2.1.0

func (c *Client) UpdateGroup(ctx context.Context, organisation string, id string, updateGroup Group) (Group, error)

Edit a group / team in organization PATCH /v2/orgs/organisation_name/groups/group_name/ BODY: {"name":"test","description":"x"} RESPONSE: {"id": 123, "name": "test", "description": "x"}

func (*Client) UpdateRepository

func (c *Client) UpdateRepository(ctx context.Context, id string, updateRepository Repository) error

func (*Client) UpdateRepositoryGroup added in v2.1.0

func (c *Client) UpdateRepositoryGroup(ctx context.Context, repository string, id string, updateRepositoryGroup RepositoryGroup) (RepositoryGroup, error)

Edit a repository --> group association in organization PATCH /v2/repositories/organisation_name/example-fixture-loader/groups/123/ BODY: {"group_id":123,"group_name":"example","groupname":"example","permission":"admin"}

type CreatePersonalAccessToken

type CreatePersonalAccessToken struct {
	TokenLabel string   `json:"token_label"`
	Scopes     []string `json:"scopes"`
}

type CreatePersonalAccessTokenResponse

type CreatePersonalAccessTokenResponse struct {
	UUID       string   `json:"uuid"`
	Token      string   `json:"token"`
	TokenLabel string   `json:"token_label"`
	Scopes     []string `json:"scopes"`
}

type Group added in v2.1.0

type Group struct {
	Id          int    `json:"id,omitempty"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type GroupMember added in v2.1.0

type GroupMember struct {
	Username string `json:"username"`
	FullName string `json:"full_name"`
}

type Repository

type Repository struct {
	User            string `json:"user,omitempty"`
	Name            string `json:"name"`
	Namespace       string `json:"namespace"`
	Description     string `json:"description"`
	Private         bool   `json:"is_private"`
	FullDescription string `json:"full_description,omitempty"`
}

type RepositoryGroup added in v2.1.0

type RepositoryGroup struct {
	GroupId    int    `json:"group_id"`
	GroupId2   int    `json:"groupid"`
	GroupName  string `json:"group_name"`
	GroupName2 string `json:"groupname"`
	Permission string `json:"permission"`
}

type Token

type Token struct {
	Token string `json:"token"`
}

Directories

Path Synopsis
cmd
get_repository
Example of reading a repository
Example of reading a repository

Jump to

Keyboard shortcuts

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