httpclient

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: MPL-2.0 Imports: 12 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 {
	// HostPath is the host name of the HCP API, without a scheme prefix.
	HostPath string `json:"host_path"`

	// AuthURL is the URL of the authentication provider, inclusive of the 'https' scheme prefix.
	AuthURL string `json:"auth_url"`

	// ClientID is the client ID of a Service Principal Key.
	ClientID string `json:"client_id"`

	// ClientSecret is the client secret of a Service Principal Key, only provided on creation.
	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"`
}

Config contains the client's configuration options

func (*Config) Canonicalize

func (c *Config) Canonicalize()

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

func (*Config) Validate

func (c *Config) Validate() error

Validate ensures the http client configuration is valid.

Jump to

Keyboard shortcuts

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