http

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeTLSConfigs added in v1.0.12

func MergeTLSConfigs(resourceTLS *common.TLSConfig, providerTLS *common.TLSConfig) *common.TLSConfig

MergeTLSConfigs merges resource-level TLS config with provider-level TLS config Resource-level config takes precedence over provider-level config

Types

type Client

type Client interface {
	SendRequest(ctx context.Context, method string, url string, body Data, headers Data, tlsConfig *TLSConfigData) (resp HttpDetails, err error)
}

Client is the interface to interact with Http

func NewClient

func NewClient(log logging.Logger, timeout time.Duration, authorizationToken string) (Client, error)

NewClient returns a new Http Client

type Data added in v1.0.0

type Data struct {
	Encrypted interface{} // Data containing encrypted data -> to be shown at the status
	Decrypted interface{} // Data containing sensitive data -> to be sent
}

type HttpDetails

type HttpDetails struct {
	HttpResponse HttpResponse
	HttpRequest  HttpRequest
}

type HttpRequest

type HttpRequest struct {
	Method  string              `json:"method"`
	Body    string              `json:"body,omitempty"`
	URL     string              `json:"url"`
	Headers map[string][]string `json:"headers,omitempty"`
}

type HttpResponse

type HttpResponse struct {
	Body       string              `json:"body"`
	Headers    map[string][]string `json:"headers"`
	StatusCode int                 `json:"statusCode"`
}

func (*HttpResponse) GetBody added in v1.0.12

func (r *HttpResponse) GetBody() string

GetBody returns the response body.

func (*HttpResponse) GetHeaders added in v1.0.12

func (r *HttpResponse) GetHeaders() map[string][]string

GetHeaders returns the response headers.

func (*HttpResponse) GetStatusCode added in v1.0.12

func (r *HttpResponse) GetStatusCode() int

GetStatusCode returns the HTTP status code.

type TLSConfigData added in v1.0.12

type TLSConfigData struct {
	// CABundle contains PEM encoded CA certificates
	CABundle []byte
	// ClientCert contains PEM encoded client certificate
	ClientCert []byte
	// ClientKey contains PEM encoded client private key
	ClientKey []byte
	// InsecureSkipVerify controls whether to skip TLS verification
	InsecureSkipVerify bool
}

TLSConfigData contains the TLS configuration data loaded from secrets or inline.

func LoadTLSConfig added in v1.0.12

func LoadTLSConfig(ctx context.Context, kubeClient kube.Client, tlsConfig *common.TLSConfig) (*TLSConfigData, error)

LoadTLSConfig loads TLS configuration from secrets and returns TLSConfigData

Jump to

Keyboard shortcuts

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