quay

package
v0.0.0-...-54d739a Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a client for the Quay REST API. Don't create instances of this type directly, use the NewClient function instead.

func (*Client) OrganizationCreate

func (c *Client) OrganizationCreate(ctx context.Context, request *OrganizationCreateRequest) error

OrganizationCreate sends a request o create an organization and waits for the response.

func (*Client) Token

func (c *Client) Token() string

Token returns the authentication token that the client is currently used. This will be the token set when the client was created or the token returned during user initialization. Note that it will be empty if no token was set during creation and user initialization hasn't been performed.

func (*Client) UserInitialize

func (c *Client) UserInitialize(ctx context.Context,
	request *UserInitializeRequest) (response *UserInitializeResponse, err error)

UserInitialize sends the request to initialize the administrator user of the registry. It returns the response and also saves the returned token if no token has been set when the client was created.

type ClientBuilder

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

ClientBuilder contains the data and logic needed to create a client for the Quay REST API. Don't create intances of this type directly, use the NewClient function instead.

func NewClient

func NewClient() *ClientBuilder

NewClient creates a builder that can then be used to configure and create a client for the Quay REST API.

func (*ClientBuilder) AddWrapper

func (b *ClientBuilder) AddWrapper(
	value func(http.RoundTripper) http.RoundTripper) *ClientBuilder

AddWrapper adds a function that will be called to wrap the HTTP transport. When multiple wrappers are added they will be called in the the reverse order, so that the request processing logic of those wrappers will be executed in the right order. For example, example if you want to add a wrapper that adds a `X-My` to the request header, and then another wrapper that reads that header you should add them in this order:

client, err := NewClient().
	SetLogger(logger).
	AddWrapper(addMyHeader).
	AddWrapper(readMyHeader).
	Build()
if err != nil {
	...
}

The opposite happens with response processing logic: it happens in the same order that the wrappers were added.

The logging wrapper should not be added with this method, but with the SetLoggingWrapper methods, otherwise a default logging wrapper will be automatically added.

func (*ClientBuilder) Build

func (b *ClientBuilder) Build() (result *Client, err error)

Build uses the data stored in the builder to create a new client for the Quay REST API.

func (*ClientBuilder) SetFlags

func (b *ClientBuilder) SetFlags(flags *pflag.FlagSet) *ClientBuilder

SetFlags sets the command line flags that should be used to configure the client. This is optional.

func (*ClientBuilder) SetInsecure

func (b *ClientBuilder) SetInsecure(value bool) *ClientBuilder

SetInsecure sets or clears the flag that allows connections to servers whose certificates can't be validated.

func (*ClientBuilder) SetLogger

func (b *ClientBuilder) SetLogger(value logr.Logger) *ClientBuilder

SetLogger sets the logger that the client will use to write to the log.

func (*ClientBuilder) SetLoggingWrapper

func (b *ClientBuilder) SetLoggingWrapper(
	value func(http.RoundTripper) http.RoundTripper) *ClientBuilder

SetLoggingWrapper sets the logging transport wrapper. If this isn't set then a default one will be created. Note that this wrapper, either the one explicitly set or the default, will always be the last to process requests and the first to process responses.

func (*ClientBuilder) SetToken

func (b *ClientBuilder) SetToken(value string) *ClientBuilder

SetToken sets the authentication token that the client will use to send requests.

func (*ClientBuilder) SetURL

func (b *ClientBuilder) SetURL(value string) *ClientBuilder

SetURL sets the base URL of the API server.

type Error

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

Error represents errors returned by the API.

func (*Error) Error

func (e *Error) Error() string

Error returns a string representing the error.

func (*Error) UnmarshalJSON

func (e *Error) UnmarshalJSON(data []byte) error

type OrganizationCreateRequest

type OrganizationCreateRequest struct {
	Name  string `json:"name,omitempty"`
	Email string `json:"email,omitempty"`
}

OrganizationCreateRequest contains the input parameters for the request to create an oraganization.

type UserInitializeRequest

type UserInitializeRequest struct {
	Username    string `json:"username,omitempty"`
	Password    string `json:"password,omitempty"`
	Email       string `json:"email,omitempty"`
	AccessToken bool   `json:"access_token,omitempty"`
}

UserInitializeRequest contains the input parameters for the request to initialize the administrator user.

type UserInitializeResponse

type UserInitializeResponse struct {
	AccessToken string `json:"access_token,omitempty"`
}

UserInitializeResponse contains the output parameters for the request to initialize the administrator user.

Jump to

Keyboard shortcuts

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