|
| 1 | +package v1alpha4 |
| 2 | + |
| 3 | +import ( |
| 4 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 5 | +) |
| 6 | + |
| 7 | +// +genclient |
| 8 | +// +genclient:noStatus |
| 9 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 10 | + |
| 11 | +// HTTPRouteGroup is used to describe HTTP/1 and HTTP/2 traffic. |
| 12 | +// It enumerates the routes that can be served by an application. |
| 13 | +type HTTPRouteGroup struct { |
| 14 | + metav1.TypeMeta `json:",inline"` |
| 15 | + |
| 16 | + // Standard object's metadata. |
| 17 | + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata |
| 18 | + // +optional |
| 19 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 20 | + |
| 21 | + Spec HTTPRouteGroupSpec `json:"spec"` |
| 22 | +} |
| 23 | + |
| 24 | +// HTTPRouteGroupSpec is the specification for a HTTPRouteGroup |
| 25 | +type HTTPRouteGroupSpec struct { |
| 26 | + // Routes for inbound traffic |
| 27 | + Matches []HTTPMatch `json:"matches,omitempty"` |
| 28 | +} |
| 29 | + |
| 30 | +// HTTPMatch defines an individual route for HTTP traffic |
| 31 | +type HTTPMatch struct { |
| 32 | + // Name is the name of the match for referencing in a TrafficTarget |
| 33 | + Name string `json:"name,omitempty"` |
| 34 | + |
| 35 | + // Methods for inbound traffic as defined in RFC 7231 |
| 36 | + // https://tools.ietf.org/html/rfc7231#section-4 |
| 37 | + Methods []string `json:"methods,omitempty"` |
| 38 | + |
| 39 | + // PathRegex is a regular expression defining the route |
| 40 | + PathRegex string `json:"pathRegex,omitempty"` |
| 41 | + |
| 42 | + // Headers is a list of headers used to match HTTP traffic |
| 43 | + Headers httpHeaders `json:"headers,omitempty"` |
| 44 | +} |
| 45 | + |
| 46 | +// httpHeaders is a map of key/value pairs which match HTTP header name and value |
| 47 | +type httpHeaders map[string]string |
| 48 | + |
| 49 | +// HTTPRouteMethod are methods allowed by the route |
| 50 | +type HTTPRouteMethod string |
| 51 | + |
| 52 | +const ( |
| 53 | + // HTTPRouteMethodAll is a wildcard for all HTTP methods |
| 54 | + HTTPRouteMethodAll HTTPRouteMethod = "*" |
| 55 | + // HTTPRouteMethodGet HTTP GET method |
| 56 | + HTTPRouteMethodGet HTTPRouteMethod = "GET" |
| 57 | + // HTTPRouteMethodHead HTTP HEAD method |
| 58 | + HTTPRouteMethodHead HTTPRouteMethod = "HEAD" |
| 59 | + // HTTPRouteMethodPut HTTP PUT method |
| 60 | + HTTPRouteMethodPut HTTPRouteMethod = "PUT" |
| 61 | + // HTTPRouteMethodPost HTTP POST method |
| 62 | + HTTPRouteMethodPost HTTPRouteMethod = "POST" |
| 63 | + // HTTPRouteMethodDelete HTTP DELETE method |
| 64 | + HTTPRouteMethodDelete HTTPRouteMethod = "DELETE" |
| 65 | + // HTTPRouteMethodConnect HTTP CONNECT method |
| 66 | + HTTPRouteMethodConnect HTTPRouteMethod = "CONNECT" |
| 67 | + // HTTPRouteMethodOptions HTTP OPTIONS method |
| 68 | + HTTPRouteMethodOptions HTTPRouteMethod = "OPTIONS" |
| 69 | + // HTTPRouteMethodTrace HTTP TRACE method |
| 70 | + HTTPRouteMethodTrace HTTPRouteMethod = "TRACE" |
| 71 | + // HTTPRouteMethodPatch HTTP PATCH method |
| 72 | + HTTPRouteMethodPatch HTTPRouteMethod = "PATCH" |
| 73 | +) |
| 74 | + |
| 75 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 76 | + |
| 77 | +// HTTPRouteGroupList satisfy K8s code gen requirements |
| 78 | +type HTTPRouteGroupList struct { |
| 79 | + metav1.TypeMeta `json:",inline"` |
| 80 | + metav1.ListMeta `json:"metadata"` |
| 81 | + |
| 82 | + Items []HTTPRouteGroup `json:"items"` |
| 83 | +} |
0 commit comments