Help us shape the future of Go! Take the 2026 Go Developer Survey

http

package
v0.12.18 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 11 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 google_oauth2"`

	// 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, clientCreator HttpClientCreator, serviceName string) (*HTTPClient, error)

NewHTTPClient returns *iam.Client

func (*HTTPClient) GetClient added in v0.12.2

func (c *HTTPClient) GetClient() string

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"`
	Method     string            `mapstructure:"method,omitempty" json:"method,omitempty" yaml:"method,omitempty"`
	Body       string            `mapstructure:"body,omitempty" json:"body,omitempty" yaml:"body,omitempty"`
	HTTPClient *http.Client      `mapstructure:"-" json:"-" yaml:"-"`
	Validator  *validator.Validate
}

HTTPClientConfig is the configuration required by iam.Client

type HttpClientCreator added in v0.12.2

type HttpClientCreator interface {
	GetHttpClientForGoogleOAuth2(ctx context.Context, creds []byte) (*http.Client, error)
	GetHttpClientForGoogleIdToken(ctx context.Context, creds []byte, audience string) (*http.Client, error)
}

type HttpClientCreatorStruct added in v0.12.2

type HttpClientCreatorStruct struct {
}

func (*HttpClientCreatorStruct) GetHttpClientForGoogleIdToken added in v0.12.2

func (c *HttpClientCreatorStruct) GetHttpClientForGoogleIdToken(ctx context.Context, creds []byte, audience string) (*http.Client, error)

func (*HttpClientCreatorStruct) GetHttpClientForGoogleOAuth2 added in v0.12.2

func (c *HttpClientCreatorStruct) GetHttpClientForGoogleOAuth2(ctx context.Context, creds []byte) (*http.Client, error)

Jump to

Keyboard shortcuts

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