Documentation
¶
Overview ¶
Package httputil provides shared HTTP clients for cloud pricing ingestion.
The default net/http client has no timeout, so a hung or unreachable provider pricing endpoint can block pricing refresh indefinitely. These helpers return clients with sensible timeouts. They are shared and reused so a new connection pool is not created on every pricing fetch.
Index ¶
Constants ¶
const PricingTimeout = 30 * time.Second
PricingTimeout is applied to pricing HTTP requests. For the bounded client it caps the whole request; for the streaming client it caps the wait for response headers only (not the body read).
Variables ¶
This section is empty.
Functions ¶
func BoundedClient ¶
BoundedClient returns a shared http.Client with a total request timeout, suitable for small or bounded pricing API responses.
func StreamingClient ¶
StreamingClient returns a shared http.Client for large pricing downloads (for example the AWS pricing file or the Azure price sheet). It bounds the connect, TLS handshake, and response-header wait, but not the total body read, so a legitimately large or slow download is not truncated while a hung endpoint is still abandoned.
func StreamingGet ¶
StreamingGet issues a GET for a large download using the streaming client and the caller's context, so the request is cancelable. It centralizes the context-aware request construction shared by the large-download paths (the AWS pricing file and the Azure price sheet). Callers without a context of their own can pass context.Background().
Types ¶
This section is empty.