HTTPClient
Overview
HTTPClient
is a HTTP client resource.
This is used, for example, requesting proxy requests to upstresm services.
Config yaml format becomes like below. And the resource specific spec is defined in in the proto format shown in the Resource Definition.
apiVersion: core/v1
kind: HTTPClient
metadata:
name: "default"
namespace: "default"
spec: {}
Resource Definition
HTTPClient is defined in the proto/core/v1/httpclient.proto
1syntax = "proto3";
2package core.v1;
3
4import "buf/validate/validate.proto";
5import "core/v1/resilience.proto";
6import "kernel/network.proto";
7import "kernel/resource.proto";
8
9option go_package = "github.com/aileron-gateway/aileron-gateway/apis/core/v1";
10
11// HTTPClient resource definition.
12// apiVersion="core/v1", kind="HTTPClient".
13message HTTPClient {
14 string APIVersion = 1 [json_name = "apiVersion"];
15 string Kind = 2 [json_name = "kind"];
16 kernel.Metadata Metadata = 3 [json_name = "metadata"];
17 HTTPClientSpec Spec = 4 [json_name = "spec"];
18}
19
20// HTTPClientSpec is the specifications for the HTTPClient object.
21message HTTPClientSpec {
22 // [OPTIONAL]
23 // Tripperwares is the list of references to Tripperwares object.
24 // Referred object must implement Tripperware interface.
25 // Default is not set.
26 repeated kernel.Reference Tripperwares = 1 [json_name = "tripperwares"];
27
28 // [OPTIONAL]
29 // RetryConfig is the configuration for retrying.
30 // Retry tripperware will be appended to the last of
31 // all other tripperware specified in Tripperwares field.
32 RetryConfig RetryConfig = 2 [json_name = "retryConfig"];
33
34 oneof Transports {
35 // [OPTIONAL]
36 // HTTPTransportConfig is the configuration for a http round tripper.
37 // HTTP/1.1 or HTTP/2 can be used with this config.
38 // The configuration configures the Transport provided by http package.
39 // See https://pkg.go.dev/net/http#Transport.
40 // Default is not set.
41 kernel.HTTPTransportConfig HTTPTransportConfig = 3 [json_name = "httpTransportConfig"];
42
43 // [OPTIONAL]
44 // HTTP2TransportConfig is the configuration for a http2 roundTripper.
45 // The configuration configures the Transport provided by http2 package.
46 // See https://pkg.go.dev/golang.org/x/net/http2
47 // Default is not set.
48 kernel.HTTP2TransportConfig HTTP2TransportConfig = 4 [json_name = "http2TransportConfig"];
49
50 // [OPTIONAL]
51 // HTTP3TransportConfig is the configuration for a http3 roundTripper.
52 // The configuration configures the Transport provided by http3 package.
53 // See https://pkg.go.dev/github.com/quic-go/quic-go/http3#RoundTripper.
54 // Default is not set.
55 kernel.HTTP3TransportConfig HTTP3TransportConfig = 5 [json_name = "http3TransportConfig"];
56 }
57}
58
59// RetryConfig is the configuration for retry.
60message RetryConfig {
61 // [OPTIONAL]
62 // MaxRetry is the maximum count of retry to send a request.
63 // The initial request is not included in this count.
64 // It means the requests can be sent MaxRetry+1 times at the maximum.
65 // If not set, default value 1 will be used.
66 // Default is [1].
67 uint32 MaxRetry = 1 [json_name = "maxRetry", (buf.validate.field).uint32 = {lte : 100}];
68
69 // [OPTIONAL]
70 // Waiter is the specification of waiter object to determine the wait time until next request.
71 // ExponentialBackoffFullJitterWaiter is used by default.
72 core.v1.WaiterSpec Waiter = 2 [json_name = "waiter"];
73
74 // [OPTIONAL]
75 // MaxContentLength is the maximum content length in bytes that can be retried.
76 // Retry is not applied to the requests that exceed this content length.
77 // Because request bodies are temporarily kept on memory, do not set this too large.
78 // It may cause unexpected high memory consumption.
79 // Default is [1,048,576] bytes or 1MiB.
80 int32 MaxContentLength = 3 [json_name = "maxContentLength", (buf.validate.field).int32 = {gte : 0, lte : 16777216}];
81
82 // [OPTIONAL]
83 // RetryStatusCodes is the list of HTTP status codes that should be retried.
84 // Only networking layer errors are retried when this field is not set.
85 // Default is not set.
86 repeated int32 RetryStatusCodes = 4 [json_name = "retryStatusCodes", (buf.validate.field).repeated.unique = true];
87}
フィードバック
このページは役に立ちましたか?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.