client

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultUserAgent = "voucher-client/2"

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 Voucher API.

func NewAuthClient added in v2.7.0

func NewAuthClient(voucherURL string) (*Client, error)

NewAuthClient creates a new auth Client set to connect to the passed hostname using tokens. Deprecated: use NewClientContext and the WithIDTokenAuth option instead

func NewClient

func NewClient(voucherURL string) (*Client, error)

NewClient creates a new auth Client. Deprecated: use NewClientContext

func NewClientContext added in v2.7.0

func NewClientContext(ctx context.Context, voucherURL string, options ...Option) (*Client, error)

NewClientContext creates a new Client set to connect to the passed hostname.

func (*Client) Check

func (c *Client) Check(ctx context.Context, check string, image reference.Canonical) (voucher.Response, error)

Check executes a request to a Voucher server, to the appropriate check URI, and with the passed reference.Canonical. Returns a voucher.Response and an error.

func (*Client) CopyURL added in v2.6.1

func (c *Client) CopyURL() *url.URL

CopyURL returns a copy of this client's URL

func (*Client) SetBasicAuth

func (c *Client) SetBasicAuth(username, password string)

SetBasicAuth adds the username and password to the Client struct Deprecated: use the WithBasicAuth option instead

func (*Client) Verify

func (c *Client) Verify(ctx context.Context, check string, image reference.Canonical) (voucher.Response, error)

type Option added in v2.7.0

type Option func(context.Context, *Client) error

func WithBasicAuth added in v2.7.0

func WithBasicAuth(username, password string) Option

WithBasicAuth sets the username and password to use for the client.

func WithDefaultIDTokenAuth added in v2.7.0

func WithDefaultIDTokenAuth() Option

WithDefaultIDTokenAuth configures the client to use Google's default token.

func WithHTTPClient added in v2.7.0

func WithHTTPClient(httpClient *http.Client) Option

WithHTTPClient customizes the http.Client used by the client. Customize the client's Transport to do arbitrary authentication.

func WithIDTokenAuth added in v2.7.0

func WithIDTokenAuth() Option

WithIDTokenAuth configures the client to use an ID token.

func WithUserAgent added in v2.7.0

func WithUserAgent(userAgent string) Option

WithUserAgent sets the User-Agent header for the client.

Jump to

Keyboard shortcuts

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