http

package
v0.10.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPAuthConfig

type HTTPAuthConfig struct {
	Type string `mapstructure:"type" json:"type" yaml:"type" validate:"required,oneof=basic api_key bearer google_idtoken"`

	// basic auth
	Username string `mapstructure:"username,omitempty" json:"username,omitempty" yaml:"username,omitempty" validate:"required_if=Type basic"`
	Password string `mapstructure:"password,omitempty" json:"password,omitempty" yaml:"password,omitempty" validate:"required_if=Type basic"`

	// api key
	In    string `` /* 132-byte string literal not displayed */
	Key   string `mapstructure:"key,omitempty" json:"key,omitempty" yaml:"key,omitempty" validate:"required_if=Type api_key"`
	Value string `mapstructure:"value,omitempty" json:"value,omitempty" yaml:"value,omitempty" validate:"required_if=Type api_key"`

	// bearer
	Token string `mapstructure:"token,omitempty" json:"token,omitempty" yaml:"token,omitempty" validate:"required_if=Type bearer"`

	// google_idtoken
	Audience string `` /* 128-byte string literal not displayed */
	// CredentialsJSONBase64 accept a base64 encoded JSON stringified credentials
	CredentialsJSONBase64 string `` /* 130-byte string literal not displayed */
}

type HTTPClient

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

HTTPClient wraps the http client for external approver resolver service

func NewHTTPClient

func NewHTTPClient(config *HTTPClientConfig) (*HTTPClient, error)

NewHTTPClient returns *iam.Client

func (*HTTPClient) MakeRequest

func (c *HTTPClient) MakeRequest(ctx context.Context) (*http.Response, error)

type HTTPClientConfig

type HTTPClientConfig struct {
	URL     string            `mapstructure:"url" json:"url" yaml:"url" validate:"required,url"`
	Headers map[string]string `mapstructure:"headers,omitempty" json:"headers,omitempty" yaml:"headers,omitempty"`
	Auth    *HTTPAuthConfig   `mapstructure:"auth,omitempty" json:"auth,omitempty" yaml:"auth,omitempty" validate:"omitempty,dive"`

	HTTPClient *http.Client `mapstructure:"-" json:"-" yaml:"-"`
	Validator  *validator.Validate
}

HTTPClientConfig is the configuration required by iam.Client

Jump to

Keyboard shortcuts

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