httpclient

package
v0.98.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MPL-2.0 Imports: 9 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) (runtime *httptransport.Runtime, err error)

New creates a client with the right base path to connect to any HCP API

Types

type Config

type Config struct {
	// HCPConfig contains values that allow to interact with HCP APIs.
	config.HCPConfig

	// HostPath is the host name of the HCP API, without a scheme prefix.
	//
	// Deprecated: HCPConfig should be used instead
	HostPath string `json:"host_path"`

	// AuthURL is the URL of the authentication provider, inclusive of the 'https' scheme prefix.
	//
	// Deprecated: HCPConfig should be used instead
	AuthURL string `json:"auth_url"`

	// ClientID is the client ID of a Service Principal Key.
	//
	// Deprecated: HCPConfig should be used instead
	ClientID string `json:"client_id"`

	// ClientSecret is the client secret of a Service Principal Key, only provided on creation.
	//
	// Deprecated: HCPConfig should be used instead
	ClientSecret string `json:"client_secret"`

	// SourceChannel denotes the client (channel) that originiated the request.
	// This is synonymous to a user-agent.
	SourceChannel string `json:"source_channel"`

	// Client allows passing a custom http.Client to be used instead of the
	// cleanhttp default one for both Auth and API requests. This should be used only for testing
	// in testing to provide the httptest.Server's custom client that will trust
	// its TLS cert.
	//
	// Deprecated: HCPConfig should be used instead
	Client *http.Client
}

Config contains the client's configuration options

func (*Config) Canonicalize

func (c *Config) Canonicalize() error

Canonicalize populates default values for config fields that are otherwise unset.

type MiddlewareOption added in v0.30.0

type MiddlewareOption = func(req *http.Request) error

MiddlewareOption is a function that modifies an HTTP request.

Jump to

Keyboard shortcuts

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