dockerhub

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseDomain = "hub.docker.com"

	OrgsEndpoint      = "/v2/orgs"
	OrgDetailEndpoint = OrgsEndpoint + "/%s"
	UsersEndpoint     = OrgsEndpoint + "/%s/members"

	CurrentUserEndpoint = "/v2/user"
	UserEndpoint        = "/v2/users/%s"
	UserOrgsEndpoint    = UserEndpoint + "/orgs"

	TeamsEndpoint           = OrgsEndpoint + "/%s/groups"
	TeamDetailEndpoint      = TeamsEndpoint + "/%s"
	TeamMembersEndpoint     = TeamDetailEndpoint + "/members"
	TeamPermissionsEndpoint = TeamDetailEndpoint + "/repositories"

	RepositoriesEndpoint  = "/v2/repositories/%s"
	RepositoryPermissions = RepositoriesEndpoint + "/%s/groups"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseResource

type BaseResource struct {
	Id string `json:"id"`
}

type Client

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

func NewClient

func NewClient(ctx context.Context, httpClient *http.Client, username, password string) (*Client, error)

func (*Client) GetTeam

func (c *Client) GetTeam(ctx context.Context, orgSlug, teamId string) (*Team, error)

GetTeam return team details.

func (*Client) ListOrganizations

func (c *Client) ListOrganizations(ctx context.Context, pVars *PaginationVars) ([]Organization, string, error)

ListOrganizations return organizations for the current user.

func (*Client) ListRepositories

func (c *Client) ListRepositories(ctx context.Context, orgSlug string, pVars *PaginationVars) ([]Repository, string, error)

ListRepositories return repositories under the provided organization.

func (*Client) ListRepositoryPermissions

func (c *Client) ListRepositoryPermissions(ctx context.Context, orgSlug, repoSlug string, pVars *PaginationVars) ([]RepositoryPermission, string, error)

ListTeamPermissions return team permissions on provided repository.

func (*Client) ListTeamMembers

func (c *Client) ListTeamMembers(ctx context.Context, orgSlug, teamSlug string, pVars *PaginationVars) ([]User, string, error)

ListTeamMembers return team members.

func (*Client) ListTeams

func (c *Client) ListTeams(ctx context.Context, orgSlug string, pVars *PaginationVars) ([]Team, string, error)

ListTeams return teams under the provided organization.

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context, orgSlug string, pVars *PaginationVars) ([]User, string, error)

ListUsers return users under the provided organization.

func (*Client) SetCurrentUser

func (c *Client) SetCurrentUser(ctx context.Context) error

SetCurrentUser sets the current user for the client.

type ListResponse

type ListResponse[T any] struct {
	PaginationData
	Results []T `json:"results"`
}

type Organization

type Organization struct {
	BaseResource
	Name string `json:"orgname"`
}

type PaginationData

type PaginationData struct {
	Count int    `json:"count"`
	Next  string `json:"next"`
}

type PaginationVars

type PaginationVars struct {
	Size uint
	Page string
}

type Repository

type Repository struct {
	Name        string `json:"name"`
	NameSpace   string `json:"namespace"`
	Description string `json:"description"`
}

type RepositoryPermission

type RepositoryPermission struct {
	TeamId     int    `json:"group_id"`
	TeamName   string `json:"group_name"`
	Permission string `json:"permission"`
}

type Team

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

type User

type User struct {
	BaseResource
	FullName string `json:"full_name"`
	Username string `json:"username"`
	Email    string `json:"email"`
	Role     string `json:"role"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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