quay

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func IsRobotUsername added in v0.3.0

func IsRobotUsername(name string) bool

Types

type APIError

type APIError struct {
	Status       int    `json:"status"`
	ErrorMessage string `json:"error_message"`
	Title        string `json:"title"`
	ErrorType    string `json:"error_type"`
	Detail       string `json:"detail"`
	Type         string `json:"type"`

	// Message is only set in some error conditions, like when adding
	// a user to a team they are already a member of. This is not documented,
	// but reality nontheless.
	Message string `json:"message"`
}

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client struct {
	Token  string
	Client *http.Client
	Dry    bool
}

func NewClient

func NewClient(token string, timeout time.Duration, dryMode bool) (*Client, error)

func (*Client) AddUserToTeam

func (c *Client) AddUserToTeam(ctx context.Context, org string, team string, member string) error

func (*Client) ChangeRepositoryVisibility added in v0.2.0

func (c *Client) ChangeRepositoryVisibility(ctx context.Context, repo string, visibility RepositoryVisibility) error

func (*Client) CreateOrganizationRobot added in v0.1.1

func (c *Client) CreateOrganizationRobot(ctx context.Context, org string, shortName string, opt CreateOrganizationRobotOptions) error

func (*Client) CreateRepository added in v0.2.0

func (c *Client) CreateRepository(ctx context.Context, opt CreateRepositoryOptions) error

func (*Client) DeleteOrganizationRobot

func (c *Client) DeleteOrganizationRobot(ctx context.Context, org string, shortName string) error

func (*Client) DeleteRepository added in v0.2.0

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

func (*Client) DeleteTeam

func (c *Client) DeleteTeam(ctx context.Context, org string, team string) error

func (*Client) GetOrganization

func (c *Client) GetOrganization(ctx context.Context, name string) (*Organization, error)

func (*Client) GetOrganizationMembers

func (c *Client) GetOrganizationMembers(ctx context.Context, organization string) ([]OrganizationMember, error)

func (*Client) GetOrganizationRobot added in v0.4.0

func (c *Client) GetOrganizationRobot(ctx context.Context, org string, shortName string) (*Robot, error)

func (*Client) GetOrganizationRobots

func (c *Client) GetOrganizationRobots(ctx context.Context, org string, options GetOrganizationRobotsOptions) ([]Robot, error)

func (*Client) GetRepositories

func (c *Client) GetRepositories(ctx context.Context, options GetRepositoriesOptions) ([]Repository, error)

func (*Client) GetRepositoryTeamPermissions

func (c *Client) GetRepositoryTeamPermissions(ctx context.Context, repo string) (map[string]Permission, error)

func (*Client) GetRepositoryUserPermissions

func (c *Client) GetRepositoryUserPermissions(ctx context.Context, repo string) (map[string]Permission, error)

func (*Client) GetTeamMembers

func (c *Client) GetTeamMembers(ctx context.Context, org string, team string, opt GetTeamMembersOptions) ([]TeamMember, error)

func (*Client) GetUser added in v0.3.0

func (c *Client) GetUser(ctx context.Context, username string) (*User, error)

func (*Client) RemoveTeamFromRepository

func (c *Client) RemoveTeamFromRepository(ctx context.Context, repo string, team string) error

func (*Client) RemoveUserFromRepository

func (c *Client) RemoveUserFromRepository(ctx context.Context, repo string, user string) error

func (*Client) RemoveUserFromTeam

func (c *Client) RemoveUserFromTeam(ctx context.Context, org string, team string, member string) error

func (*Client) SetTeamRepositoryPermissions

func (c *Client) SetTeamRepositoryPermissions(ctx context.Context, repo string, team string, role RepositoryRole) error

func (*Client) SetUserRepositoryPermissions

func (c *Client) SetUserRepositoryPermissions(ctx context.Context, repo string, user string, role RepositoryRole) error

func (*Client) UpdateRepository added in v0.2.0

func (c *Client) UpdateRepository(ctx context.Context, repo string, opt UpdateRepositoryOptions) error

func (*Client) UpsertTeam

func (c *Client) UpsertTeam(ctx context.Context, org string, team string, opt UpsertTeamOptions) error

type CreateOrganizationRobotOptions added in v0.1.1

type CreateOrganizationRobotOptions struct {
	Description string `json:"description"`
}

type CreateRepositoryOptions added in v0.2.0

type CreateRepositoryOptions struct {
	Kind        RepositoryKind       `json:"kind"`
	Namespace   string               `json:"namespace"`
	Repository  string               `json:"repository"`
	Visibility  RepositoryVisibility `json:"visibility"`
	Description string               `json:"description"`
}

type GetOrganizationRobotsOptions

type GetOrganizationRobotsOptions struct {
	Token       *bool
	Permissions *bool
}

func (*GetOrganizationRobotsOptions) Apply

type GetRepositoriesOptions

type GetRepositoriesOptions struct {
	Namespace string
	Starred   *bool
	Public    *bool
}

func (*GetRepositoriesOptions) Apply

type GetTeamMembersOptions

type GetTeamMembersOptions struct {
	IncludePending *bool
}

func (*GetTeamMembersOptions) Apply

type Organization

type Organization struct {
	Name                string          `json:"name"`
	Email               string          `json:"email"`
	InvoiceEmail        bool            `json:"invoice_email"`
	InvoiceEmailAddress string          `json:"invoice_email_address"`
	IsMember            bool            `json:"is_member"`
	IsFreeAccount       bool            `json:"is_free_account"`
	IsAdmin             bool            `json:"is_admin"`
	Teams               map[string]Team `json:"teams"`
	OrderedTeams        []string        `json:"ordered_teams"`
}

type OrganizationMember

type OrganizationMember struct {
	Kind         string   `json:"kind"`
	Name         string   `json:"name"`
	Repositories []string `json:"repositories"`
	Teams        []struct {
		Name string `json:"name"`
	} `json:"teams"`
}

type Permission

type Permission struct {
	Role RepositoryRole `json:"role"`
	Name string         `json:"name"`

	// these are only set for user permissions
	IsOrgMember bool `json:"is_org_member"`
	IsRobot     bool `json:"is_robot"`
}

type RepoByName

type RepoByName []Repository

func (RepoByName) Len

func (a RepoByName) Len() int

func (RepoByName) Less

func (a RepoByName) Less(i, j int) bool

func (RepoByName) Swap

func (a RepoByName) Swap(i, j int)

type Repository

type Repository struct {
	Kind        string      `json:"kind"`
	Name        string      `json:"name"`
	Namespace   string      `json:"namespace"`
	State       interface{} `json:"state"`
	IsPublic    bool        `json:"is_public"`
	IsStarred   bool        `json:"is_starred"`
	Description string      `json:"description"`
}

func (*Repository) FullName

func (r *Repository) FullName() string

func (*Repository) Visibility added in v0.2.1

func (r *Repository) Visibility() RepositoryVisibility

type RepositoryKind added in v0.2.0

type RepositoryKind string
const (
	ImageRepository       RepositoryKind = "image"
	ApplicationRepository RepositoryKind = "application"
)

type RepositoryRole

type RepositoryRole string
const (
	// Can view and pull from the repository
	ReadRepositoryRole RepositoryRole = "read"
	// Can view, pull and push to the repository
	WriteRepositoryRole RepositoryRole = "write"
	// Full admin access, pull and push on the repository
	AdminRepositoryRole RepositoryRole = "admin"
)

type RepositoryVisibility added in v0.2.0

type RepositoryVisibility string
const (
	Public  RepositoryVisibility = "public"
	Private RepositoryVisibility = "private"
)

type Robot

type Robot struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Token       string `json:"token"`

	// Repositories is only set if the permissions option is set
	// when fetching robots.
	Repositories []string `json:"repositories"`

	// Teams is only set if the permissions option is set
	// when fetching robots.
	Teams []struct {
		Name string `json:"name"`
	} `json:"teams"`
}

func (*Robot) ShortName

func (r *Robot) ShortName() string

type RobotByName

type RobotByName []Robot

func (RobotByName) Len

func (a RobotByName) Len() int

func (RobotByName) Less

func (a RobotByName) Less(i, j int) bool

func (RobotByName) Swap

func (a RobotByName) Swap(i, j int)

type Team

type Team struct {
	Name        string   `json:"name"`
	Role        TeamRole `json:"role"`
	Description string   `json:"description"`
	IsSynced    bool     `json:"is_synced"`
	CanView     bool     `json:"can_view"`
	MemberCount int      `json:"member_count"`
	RepoCount   int      `json:"repo_count"`
}

type TeamMember

type TeamMember struct {
	Kind    TeamMembershipKind `json:"kind"`
	Name    string             `json:"name"`
	Invited bool               `json:"invited"`
	IsRobot bool               `json:"is_robot"`
}

type TeamMembershipKind

type TeamMembershipKind string
const (
	TeamMemberUser  TeamMembershipKind = "user"
	TeamMemberRobot TeamMembershipKind = "robot" // maybe?
)

type TeamRole

type TeamRole string
const (
	// Inherits all permissions of the team
	MemberTeamRole TeamRole = "member"
	// Member and can create new repositories
	CreatorTeamRole TeamRole = "creator"
	// Full admin access to the organization
	AdminTeamRole TeamRole = "admin"
)

type UpdateRepositoryOptions added in v0.2.0

type UpdateRepositoryOptions struct {
	Description string `json:"description"`
}

type UpsertTeamOptions

type UpsertTeamOptions struct {
	Role        TeamRole `json:"role"`
	Description string   `json:"description"`
}

type User added in v0.3.0

type User struct {
	Username string `json:"username"`
}

Jump to

Keyboard shortcuts

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