mirror of https://github.com/hashicorp/consul
APIGateway HTTPRoute scaffolding (#15859)
* Stub Config Entries for Consul Native API Gateway (#15644) * Add empty InlineCertificate struct and protobuf * apigateway stubs * new files * Stub HTTPRoute in api pkg * checkpoint * Stub HTTPRoute in structs pkg * Simplify api.APIGatewayConfigEntry to be consistent w/ other entries * Update makeConfigEntry switch, add docstring for HTTPRouteConfigEntry * Add TCPRoute to MakeConfigEntry, return unique Kind * proto generated files * Stub BoundAPIGatewayConfigEntry in agent Since this type is only written by a controller and read by xDS, it doesn't need to be defined in the `api` pkg * Add RaftIndex to APIGatewayConfigEntry stub * Add new config entry kinds to validation allow-list * Add RaftIndex to other added config entry stubs * fix panic * Update usage metrics assertions to include new cfg entries * Regenerate proto w/ Go 1.19 * Run buf formatter on config_entry.proto * Add Meta and acl.EnterpriseMeta to all new ConfigEntry types * Remove optional interface method Warnings() for now Will restore later if we wind up needing it * Remove unnecessary Services field from added config entry types * Implement GetMeta(), GetEnterpriseMeta() for added config entry types * Add meta field to proto, name consistently w/ existing config entries * Format config_entry.proto * Add initial implementation of CanRead + CanWrite for new config entry types * Add unit tests for decoding of new config entry types * Add unit tests for parsing of new config entry types * Add unit tests for API Gateway config entry ACLs * Return typed PermissionDeniedError on BoundAPIGateway CanWrite * Add unit tests for added config entry ACLs * Add BoundAPIGateway type to AllConfigEntryKinds * Return proper kind from BoundAPIGateway * Add docstrings for new config entry types * Add missing config entry kinds to proto def * Update usagemetrics_oss_test.go * Use utility func for returning PermissionDeniedError * Add BoundAPIGateway to proto def Co-authored-by: Sarah Alsmiller <sarah.alsmiller@hashicorp.com> Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com> * Add APIGateway validation * Fix comment * Add additional validations * Add cert ref validation * Add protobuf definitions * Tabs to spaces * Fix up field types * Add API structs * Move struct fields around a bit * EventPublisher subscriptions for Consul Native API Gateway (#15757) * Create new event topics in subscribe proto * Add tests for PBSubscribe func * Make configs singular, add all configs to PBToStreamSubscribeRequest * Add snapshot methods * Add config_entry_events tests * Add config entry kind to topic for new configs * Add unit tests for snapshot methods * Start adding integration test * Test using the new controller code * Update agent/consul/state/config_entry_events.go Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com> * Check value of error Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com> * Add controller stubs for API Gateway (#15837) * update initial stub implementation * move files, clean up mutex references * Remove embed, use idiomatic names for constructors * Remove stray file introduced in merge Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com> * Initial server-side and proto defs * drop trailing whitespace * Add APIGateway validation (#15847) * Add APIGateway validation * Fix comment * Add additional validations * Add cert ref validation * Add protobuf definitions * Tabs to spaces * Fix up field types * Add API structs * Move struct fields around a bit * APIGateway InlineCertificate validation (#15856) * Add APIGateway validation * Add additional validations * Add protobuf definitions * Tabs to spaces * Add API structs * Move struct fields around a bit * Add validation for InlineCertificate * Fix ACL test * APIGateway BoundAPIGateway validation (#15858) * Add APIGateway validation * Fix comment * Add additional validations * Add cert ref validation * Add protobuf definitions * Tabs to spaces * Fix up field types * Add API structs * Move struct fields around a bit * Add validation for BoundAPIGateway * drop trailing whitespace * APIGateway TCPRoute validation (#15855) * Add APIGateway validation * Fix comment * Add additional validations * Add cert ref validation * Add protobuf definitions * Tabs to spaces * Fix up field types * Add API structs * Move struct fields around a bit * Add TCPRoute normalization and validation * Address PR feedback * Add forgotten Status * Add some more field docs in api package * Fix test * Fix bad merge * Remove duplicate helpers * Fix up proto defs * Fix up stray changes * remove extra newline --------- Co-authored-by: Thomas Eckert <teckert@hashicorp.com> Co-authored-by: Sarah Alsmiller <sarah.alsmiller@hashicorp.com> Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com> Co-authored-by: sarahalsmiller <100602640+sarahalsmiller@users.noreply.github.com>pull/16116/head^2
parent
d53c331a37
commit
1fbfb5905b
|
@ -24,6 +24,14 @@ type HTTPRouteConfigEntry struct {
|
||||||
// of resources, which may include routers, splitters, filters, etc.
|
// of resources, which may include routers, splitters, filters, etc.
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
// Parents is a list of gateways that this route should be bound to
|
||||||
|
Parents []ResourceReference
|
||||||
|
// Rules are a list of HTTP-based routing rules that this route should
|
||||||
|
// use for constructing a routing table.
|
||||||
|
Rules []HTTPRouteRule
|
||||||
|
// Hostnames are the hostnames for which this HTTPRoute should respond to requests.
|
||||||
|
Hostnames []string
|
||||||
|
|
||||||
Meta map[string]string `json:",omitempty"`
|
Meta map[string]string `json:",omitempty"`
|
||||||
// Status is the asynchronous reconciliation status which an HTTPRoute propagates to the user.
|
// Status is the asynchronous reconciliation status which an HTTPRoute propagates to the user.
|
||||||
Status Status
|
Status Status
|
||||||
|
@ -95,6 +103,129 @@ func (e *HTTPRouteConfigEntry) GetRaftIndex() *RaftIndex {
|
||||||
return &e.RaftIndex
|
return &e.RaftIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HTTPMatch specifies the criteria that should be
|
||||||
|
// used in determining whether or not a request should
|
||||||
|
// be routed to a given set of services.
|
||||||
|
type HTTPMatch struct {
|
||||||
|
Headers []HTTPHeaderMatch
|
||||||
|
Method HTTPMatchMethod
|
||||||
|
Path HTTPPathMatch
|
||||||
|
Query []HTTPQueryMatch
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTPMatchMethod specifies which type of HTTP verb should
|
||||||
|
// be used for matching a given request.
|
||||||
|
type HTTPMatchMethod string
|
||||||
|
|
||||||
|
const (
|
||||||
|
HTTPMatchMethodAll HTTPMatchMethod = ""
|
||||||
|
HTTPMatchMethodConnect HTTPMatchMethod = "CONNECT"
|
||||||
|
HTTPMatchMethodDelete HTTPMatchMethod = "DELETE"
|
||||||
|
HTTPMatchMethodGet HTTPMatchMethod = "GET"
|
||||||
|
HTTPMatchMethodHead HTTPMatchMethod = "HEAD"
|
||||||
|
HTTPMatchMethodOptions HTTPMatchMethod = "OPTIONS"
|
||||||
|
HTTPMatchMethodPatch HTTPMatchMethod = "PATCH"
|
||||||
|
HTTPMatchMethodPost HTTPMatchMethod = "POST"
|
||||||
|
HTTPMatchMethodPut HTTPMatchMethod = "PUT"
|
||||||
|
HTTPMatchMethodTrace HTTPMatchMethod = "TRACE"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HTTPHeaderMatchType specifies how header matching criteria
|
||||||
|
// should be applied to a request.
|
||||||
|
type HTTPHeaderMatchType string
|
||||||
|
|
||||||
|
const (
|
||||||
|
HTTPHeaderMatchExact HTTPHeaderMatchType = "exact"
|
||||||
|
HTTPHeaderMatchPrefix HTTPHeaderMatchType = "prefix"
|
||||||
|
HTTPHeaderMatchPresent HTTPHeaderMatchType = "present"
|
||||||
|
HTTPHeaderMatchRegularExpression HTTPHeaderMatchType = "regex"
|
||||||
|
HTTPHeaderMatchSuffix HTTPHeaderMatchType = "suffix"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HTTPHeaderMatch specifies how a match should be done
|
||||||
|
// on a request's headers.
|
||||||
|
type HTTPHeaderMatch struct {
|
||||||
|
Match HTTPHeaderMatchType
|
||||||
|
Name string
|
||||||
|
Value string
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTPPathMatchType specifies how path matching criteria
|
||||||
|
// should be applied to a request.
|
||||||
|
type HTTPPathMatchType string
|
||||||
|
|
||||||
|
const (
|
||||||
|
HTTPPathMatchExact HTTPPathMatchType = "exact"
|
||||||
|
HTTPPathMatchPrefix HTTPPathMatchType = "prefix"
|
||||||
|
HTTPPathMatchRegularExpression HTTPPathMatchType = "regex"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HTTPPathMatch specifies how a match should be done
|
||||||
|
// on a request's path.
|
||||||
|
type HTTPPathMatch struct {
|
||||||
|
Match HTTPPathMatchType
|
||||||
|
Value string
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTPQueryMatchType specifies how querys matching criteria
|
||||||
|
// should be applied to a request.
|
||||||
|
type HTTPQueryMatchType string
|
||||||
|
|
||||||
|
const (
|
||||||
|
HTTPQueryMatchExact HTTPQueryMatchType = "exact"
|
||||||
|
HTTPQueryMatchPresent HTTPQueryMatchType = "present"
|
||||||
|
HTTPQueryMatchRegularExpression HTTPQueryMatchType = "regex"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HTTPQueryMatch specifies how a match should be done
|
||||||
|
// on a request's query parameters.
|
||||||
|
type HTTPQueryMatch struct {
|
||||||
|
Match HTTPQueryMatchType
|
||||||
|
Name string
|
||||||
|
Value string
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTPFilters specifies a list of filters used to modify a request
|
||||||
|
// before it is routed to an upstream.
|
||||||
|
type HTTPFilters struct {
|
||||||
|
Headers []HTTPHeaderFilter
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTPHeaderFilter specifies how HTTP headers should be modified.
|
||||||
|
type HTTPHeaderFilter struct {
|
||||||
|
Add map[string]string
|
||||||
|
Remove []string
|
||||||
|
Set map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTPRouteRule specifies the routing rules used to determine what upstream
|
||||||
|
// service an HTTP request is routed to.
|
||||||
|
type HTTPRouteRule struct {
|
||||||
|
// Filters is a list of HTTP-based filters used to modify a request prior
|
||||||
|
// to routing it to the upstream service
|
||||||
|
Filters HTTPFilters
|
||||||
|
// Matches specified the matching criteria used in the routing table. If a
|
||||||
|
// request matches the given HTTPMatch configuration, then traffic is routed
|
||||||
|
// to services specified in the Services field.
|
||||||
|
Matches []HTTPMatch
|
||||||
|
// Services is a list of HTTP-based services to route to if the request matches
|
||||||
|
// the rules specified in the Matches field.
|
||||||
|
Services []HTTPService
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTPService is a service reference for HTTP-based routing rules
|
||||||
|
type HTTPService struct {
|
||||||
|
Name string
|
||||||
|
// Weight is an arbitrary integer used in calculating how much
|
||||||
|
// traffic should be sent to the given service.
|
||||||
|
Weight int
|
||||||
|
// Filters is a list of HTTP-based filters used to modify a request prior
|
||||||
|
// to routing it to the upstream service
|
||||||
|
Filters HTTPFilters
|
||||||
|
|
||||||
|
acl.EnterpriseMeta
|
||||||
|
}
|
||||||
|
|
||||||
var _ ControlledConfigEntry = (*HTTPRouteConfigEntry)(nil)
|
var _ ControlledConfigEntry = (*HTTPRouteConfigEntry)(nil)
|
||||||
|
|
||||||
func (e *HTTPRouteConfigEntry) GetStatus() Status {
|
func (e *HTTPRouteConfigEntry) GetStatus() Status {
|
||||||
|
|
|
@ -366,6 +366,66 @@ func GatewayTLSSDSConfigFromStructs(t *structs.GatewayTLSSDSConfig, s *GatewayTL
|
||||||
s.ClusterName = t.ClusterName
|
s.ClusterName = t.ClusterName
|
||||||
s.CertResource = t.CertResource
|
s.CertResource = t.CertResource
|
||||||
}
|
}
|
||||||
|
func HTTPFiltersToStructs(s *HTTPFilters, t *structs.HTTPFilters) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
{
|
||||||
|
t.Headers = make([]structs.HTTPHeaderFilter, len(s.Headers))
|
||||||
|
for i := range s.Headers {
|
||||||
|
if s.Headers[i] != nil {
|
||||||
|
HTTPHeaderFilterToStructs(s.Headers[i], &t.Headers[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func HTTPFiltersFromStructs(t *structs.HTTPFilters, s *HTTPFilters) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
{
|
||||||
|
s.Headers = make([]*HTTPHeaderFilter, len(t.Headers))
|
||||||
|
for i := range t.Headers {
|
||||||
|
{
|
||||||
|
var x HTTPHeaderFilter
|
||||||
|
HTTPHeaderFilterFromStructs(&t.Headers[i], &x)
|
||||||
|
s.Headers[i] = &x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func HTTPHeaderFilterToStructs(s *HTTPHeaderFilter, t *structs.HTTPHeaderFilter) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Add = s.Add
|
||||||
|
t.Remove = s.Remove
|
||||||
|
t.Set = s.Set
|
||||||
|
}
|
||||||
|
func HTTPHeaderFilterFromStructs(t *structs.HTTPHeaderFilter, s *HTTPHeaderFilter) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.Add = t.Add
|
||||||
|
s.Remove = t.Remove
|
||||||
|
s.Set = t.Set
|
||||||
|
}
|
||||||
|
func HTTPHeaderMatchToStructs(s *HTTPHeaderMatch, t *structs.HTTPHeaderMatch) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Match = httpHeaderMatchToStructs(s.Match)
|
||||||
|
t.Name = s.Name
|
||||||
|
t.Value = s.Value
|
||||||
|
}
|
||||||
|
func HTTPHeaderMatchFromStructs(t *structs.HTTPHeaderMatch, s *HTTPHeaderMatch) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.Match = httpHeaderMatchFromStructs(t.Match)
|
||||||
|
s.Name = t.Name
|
||||||
|
s.Value = t.Value
|
||||||
|
}
|
||||||
func HTTPHeaderModifiersToStructs(s *HTTPHeaderModifiers, t *structs.HTTPHeaderModifiers) {
|
func HTTPHeaderModifiersToStructs(s *HTTPHeaderModifiers, t *structs.HTTPHeaderModifiers) {
|
||||||
if s == nil {
|
if s == nil {
|
||||||
return
|
return
|
||||||
|
@ -382,10 +442,113 @@ func HTTPHeaderModifiersFromStructs(t *structs.HTTPHeaderModifiers, s *HTTPHeade
|
||||||
s.Set = t.Set
|
s.Set = t.Set
|
||||||
s.Remove = t.Remove
|
s.Remove = t.Remove
|
||||||
}
|
}
|
||||||
|
func HTTPMatchToStructs(s *HTTPMatch, t *structs.HTTPMatch) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
{
|
||||||
|
t.Headers = make([]structs.HTTPHeaderMatch, len(s.Headers))
|
||||||
|
for i := range s.Headers {
|
||||||
|
if s.Headers[i] != nil {
|
||||||
|
HTTPHeaderMatchToStructs(s.Headers[i], &t.Headers[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.Method = httpMatchMethodToStructs(s.Method)
|
||||||
|
if s.Path != nil {
|
||||||
|
HTTPPathMatchToStructs(s.Path, &t.Path)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
t.Query = make([]structs.HTTPQueryMatch, len(s.Query))
|
||||||
|
for i := range s.Query {
|
||||||
|
if s.Query[i] != nil {
|
||||||
|
HTTPQueryMatchToStructs(s.Query[i], &t.Query[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func HTTPMatchFromStructs(t *structs.HTTPMatch, s *HTTPMatch) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
{
|
||||||
|
s.Headers = make([]*HTTPHeaderMatch, len(t.Headers))
|
||||||
|
for i := range t.Headers {
|
||||||
|
{
|
||||||
|
var x HTTPHeaderMatch
|
||||||
|
HTTPHeaderMatchFromStructs(&t.Headers[i], &x)
|
||||||
|
s.Headers[i] = &x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s.Method = httpMatchMethodFromStructs(t.Method)
|
||||||
|
{
|
||||||
|
var x HTTPPathMatch
|
||||||
|
HTTPPathMatchFromStructs(&t.Path, &x)
|
||||||
|
s.Path = &x
|
||||||
|
}
|
||||||
|
{
|
||||||
|
s.Query = make([]*HTTPQueryMatch, len(t.Query))
|
||||||
|
for i := range t.Query {
|
||||||
|
{
|
||||||
|
var x HTTPQueryMatch
|
||||||
|
HTTPQueryMatchFromStructs(&t.Query[i], &x)
|
||||||
|
s.Query[i] = &x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func HTTPPathMatchToStructs(s *HTTPPathMatch, t *structs.HTTPPathMatch) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Match = httpPathMatchToStructs(s.Match)
|
||||||
|
t.Value = s.Value
|
||||||
|
}
|
||||||
|
func HTTPPathMatchFromStructs(t *structs.HTTPPathMatch, s *HTTPPathMatch) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.Match = httpPathMatchFromStructs(t.Match)
|
||||||
|
s.Value = t.Value
|
||||||
|
}
|
||||||
|
func HTTPQueryMatchToStructs(s *HTTPQueryMatch, t *structs.HTTPQueryMatch) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Match = httpQueryMatchToStructs(s.Match)
|
||||||
|
t.Name = s.Name
|
||||||
|
t.Value = s.Value
|
||||||
|
}
|
||||||
|
func HTTPQueryMatchFromStructs(t *structs.HTTPQueryMatch, s *HTTPQueryMatch) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.Match = httpQueryMatchFromStructs(t.Match)
|
||||||
|
s.Name = t.Name
|
||||||
|
s.Value = t.Value
|
||||||
|
}
|
||||||
func HTTPRouteToStructs(s *HTTPRoute, t *structs.HTTPRouteConfigEntry) {
|
func HTTPRouteToStructs(s *HTTPRoute, t *structs.HTTPRouteConfigEntry) {
|
||||||
if s == nil {
|
if s == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
t.Parents = make([]structs.ResourceReference, len(s.Parents))
|
||||||
|
for i := range s.Parents {
|
||||||
|
if s.Parents[i] != nil {
|
||||||
|
ResourceReferenceToStructs(s.Parents[i], &t.Parents[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
t.Rules = make([]structs.HTTPRouteRule, len(s.Rules))
|
||||||
|
for i := range s.Rules {
|
||||||
|
if s.Rules[i] != nil {
|
||||||
|
HTTPRouteRuleToStructs(s.Rules[i], &t.Rules[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.Hostnames = s.Hostnames
|
||||||
t.Meta = s.Meta
|
t.Meta = s.Meta
|
||||||
if s.Status != nil {
|
if s.Status != nil {
|
||||||
StatusToStructs(s.Status, &t.Status)
|
StatusToStructs(s.Status, &t.Status)
|
||||||
|
@ -395,6 +558,27 @@ func HTTPRouteFromStructs(t *structs.HTTPRouteConfigEntry, s *HTTPRoute) {
|
||||||
if s == nil {
|
if s == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
s.Parents = make([]*ResourceReference, len(t.Parents))
|
||||||
|
for i := range t.Parents {
|
||||||
|
{
|
||||||
|
var x ResourceReference
|
||||||
|
ResourceReferenceFromStructs(&t.Parents[i], &x)
|
||||||
|
s.Parents[i] = &x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
s.Rules = make([]*HTTPRouteRule, len(t.Rules))
|
||||||
|
for i := range t.Rules {
|
||||||
|
{
|
||||||
|
var x HTTPRouteRule
|
||||||
|
HTTPRouteRuleFromStructs(&t.Rules[i], &x)
|
||||||
|
s.Rules[i] = &x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s.Hostnames = t.Hostnames
|
||||||
s.Meta = t.Meta
|
s.Meta = t.Meta
|
||||||
{
|
{
|
||||||
var x Status
|
var x Status
|
||||||
|
@ -402,6 +586,84 @@ func HTTPRouteFromStructs(t *structs.HTTPRouteConfigEntry, s *HTTPRoute) {
|
||||||
s.Status = &x
|
s.Status = &x
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func HTTPRouteRuleToStructs(s *HTTPRouteRule, t *structs.HTTPRouteRule) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if s.Filters != nil {
|
||||||
|
HTTPFiltersToStructs(s.Filters, &t.Filters)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
t.Matches = make([]structs.HTTPMatch, len(s.Matches))
|
||||||
|
for i := range s.Matches {
|
||||||
|
if s.Matches[i] != nil {
|
||||||
|
HTTPMatchToStructs(s.Matches[i], &t.Matches[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
t.Services = make([]structs.HTTPService, len(s.Services))
|
||||||
|
for i := range s.Services {
|
||||||
|
if s.Services[i] != nil {
|
||||||
|
HTTPServiceToStructs(s.Services[i], &t.Services[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func HTTPRouteRuleFromStructs(t *structs.HTTPRouteRule, s *HTTPRouteRule) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var x HTTPFilters
|
||||||
|
HTTPFiltersFromStructs(&t.Filters, &x)
|
||||||
|
s.Filters = &x
|
||||||
|
}
|
||||||
|
{
|
||||||
|
s.Matches = make([]*HTTPMatch, len(t.Matches))
|
||||||
|
for i := range t.Matches {
|
||||||
|
{
|
||||||
|
var x HTTPMatch
|
||||||
|
HTTPMatchFromStructs(&t.Matches[i], &x)
|
||||||
|
s.Matches[i] = &x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
s.Services = make([]*HTTPService, len(t.Services))
|
||||||
|
for i := range t.Services {
|
||||||
|
{
|
||||||
|
var x HTTPService
|
||||||
|
HTTPServiceFromStructs(&t.Services[i], &x)
|
||||||
|
s.Services[i] = &x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func HTTPServiceToStructs(s *HTTPService, t *structs.HTTPService) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Name = s.Name
|
||||||
|
t.Weight = int(s.Weight)
|
||||||
|
if s.Filters != nil {
|
||||||
|
HTTPFiltersToStructs(s.Filters, &t.Filters)
|
||||||
|
}
|
||||||
|
t.EnterpriseMeta = enterpriseMetaToStructs(s.EnterpriseMeta)
|
||||||
|
}
|
||||||
|
func HTTPServiceFromStructs(t *structs.HTTPService, s *HTTPService) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.Name = t.Name
|
||||||
|
s.Weight = int32(t.Weight)
|
||||||
|
{
|
||||||
|
var x HTTPFilters
|
||||||
|
HTTPFiltersFromStructs(&t.Filters, &x)
|
||||||
|
s.Filters = &x
|
||||||
|
}
|
||||||
|
s.EnterpriseMeta = enterpriseMetaFromStructs(t.EnterpriseMeta)
|
||||||
|
}
|
||||||
func HashPolicyToStructs(s *HashPolicy, t *structs.HashPolicy) {
|
func HashPolicyToStructs(s *HashPolicy, t *structs.HashPolicy) {
|
||||||
if s == nil {
|
if s == nil {
|
||||||
return
|
return
|
||||||
|
|
|
@ -267,6 +267,168 @@ func meshGatewayModeToStructs(a MeshGatewayMode) structs.MeshGatewayMode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func apiGatewayProtocolFromStructs(a structs.APIGatewayListenerProtocol) APIGatewayListenerProtocol {
|
||||||
|
switch a {
|
||||||
|
case structs.ListenerProtocolHTTP:
|
||||||
|
return APIGatewayListenerProtocol_ListenerProtocolHTTP
|
||||||
|
case structs.ListenerProtocolTCP:
|
||||||
|
return APIGatewayListenerProtocol_ListenerProtocolTCP
|
||||||
|
default:
|
||||||
|
return APIGatewayListenerProtocol_ListenerProtocolHTTP
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func apiGatewayProtocolToStructs(a APIGatewayListenerProtocol) structs.APIGatewayListenerProtocol {
|
||||||
|
switch a {
|
||||||
|
case APIGatewayListenerProtocol_ListenerProtocolHTTP:
|
||||||
|
return structs.ListenerProtocolHTTP
|
||||||
|
case APIGatewayListenerProtocol_ListenerProtocolTCP:
|
||||||
|
return structs.ListenerProtocolTCP
|
||||||
|
default:
|
||||||
|
return structs.ListenerProtocolHTTP
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func httpMatchMethodFromStructs(a structs.HTTPMatchMethod) HTTPMatchMethod {
|
||||||
|
switch a {
|
||||||
|
case structs.HTTPMatchMethodAll:
|
||||||
|
return HTTPMatchMethod_HTTPMatchMethodAll
|
||||||
|
case structs.HTTPMatchMethodConnect:
|
||||||
|
return HTTPMatchMethod_HTTPMatchMethodConnect
|
||||||
|
case structs.HTTPMatchMethodDelete:
|
||||||
|
return HTTPMatchMethod_HTTPMatchMethodDelete
|
||||||
|
case structs.HTTPMatchMethodGet:
|
||||||
|
return HTTPMatchMethod_HTTPMatchMethodGet
|
||||||
|
case structs.HTTPMatchMethodHead:
|
||||||
|
return HTTPMatchMethod_HTTPMatchMethodHead
|
||||||
|
case structs.HTTPMatchMethodOptions:
|
||||||
|
return HTTPMatchMethod_HTTPMatchMethodOptions
|
||||||
|
case structs.HTTPMatchMethodPatch:
|
||||||
|
return HTTPMatchMethod_HTTPMatchMethodPatch
|
||||||
|
case structs.HTTPMatchMethodPost:
|
||||||
|
return HTTPMatchMethod_HTTPMatchMethodPost
|
||||||
|
case structs.HTTPMatchMethodPut:
|
||||||
|
return HTTPMatchMethod_HTTPMatchMethodPut
|
||||||
|
case structs.HTTPMatchMethodTrace:
|
||||||
|
return HTTPMatchMethod_HTTPMatchMethodTrace
|
||||||
|
default:
|
||||||
|
return HTTPMatchMethod_HTTPMatchMethodAll
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func httpMatchMethodToStructs(a HTTPMatchMethod) structs.HTTPMatchMethod {
|
||||||
|
switch a {
|
||||||
|
case HTTPMatchMethod_HTTPMatchMethodAll:
|
||||||
|
return structs.HTTPMatchMethodAll
|
||||||
|
case HTTPMatchMethod_HTTPMatchMethodConnect:
|
||||||
|
return structs.HTTPMatchMethodConnect
|
||||||
|
case HTTPMatchMethod_HTTPMatchMethodDelete:
|
||||||
|
return structs.HTTPMatchMethodDelete
|
||||||
|
case HTTPMatchMethod_HTTPMatchMethodGet:
|
||||||
|
return structs.HTTPMatchMethodGet
|
||||||
|
case HTTPMatchMethod_HTTPMatchMethodHead:
|
||||||
|
return structs.HTTPMatchMethodHead
|
||||||
|
case HTTPMatchMethod_HTTPMatchMethodOptions:
|
||||||
|
return structs.HTTPMatchMethodOptions
|
||||||
|
case HTTPMatchMethod_HTTPMatchMethodPatch:
|
||||||
|
return structs.HTTPMatchMethodPatch
|
||||||
|
case HTTPMatchMethod_HTTPMatchMethodPost:
|
||||||
|
return structs.HTTPMatchMethodPost
|
||||||
|
case HTTPMatchMethod_HTTPMatchMethodPut:
|
||||||
|
return structs.HTTPMatchMethodPut
|
||||||
|
case HTTPMatchMethod_HTTPMatchMethodTrace:
|
||||||
|
return structs.HTTPMatchMethodTrace
|
||||||
|
default:
|
||||||
|
return structs.HTTPMatchMethodAll
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func httpHeaderMatchFromStructs(a structs.HTTPHeaderMatchType) HTTPHeaderMatchType {
|
||||||
|
switch a {
|
||||||
|
case structs.HTTPHeaderMatchExact:
|
||||||
|
return HTTPHeaderMatchType_HTTPHeaderMatchExact
|
||||||
|
case structs.HTTPHeaderMatchPrefix:
|
||||||
|
return HTTPHeaderMatchType_HTTPHeaderMatchPrefix
|
||||||
|
case structs.HTTPHeaderMatchPresent:
|
||||||
|
return HTTPHeaderMatchType_HTTPHeaderMatchPresent
|
||||||
|
case structs.HTTPHeaderMatchRegularExpression:
|
||||||
|
return HTTPHeaderMatchType_HTTPHeaderMatchRegularExpression
|
||||||
|
case structs.HTTPHeaderMatchSuffix:
|
||||||
|
return HTTPHeaderMatchType_HTTPHeaderMatchSuffix
|
||||||
|
default:
|
||||||
|
return HTTPHeaderMatchType_HTTPHeaderMatchExact
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func httpHeaderMatchToStructs(a HTTPHeaderMatchType) structs.HTTPHeaderMatchType {
|
||||||
|
switch a {
|
||||||
|
case HTTPHeaderMatchType_HTTPHeaderMatchExact:
|
||||||
|
return structs.HTTPHeaderMatchExact
|
||||||
|
case HTTPHeaderMatchType_HTTPHeaderMatchPrefix:
|
||||||
|
return structs.HTTPHeaderMatchPrefix
|
||||||
|
case HTTPHeaderMatchType_HTTPHeaderMatchPresent:
|
||||||
|
return structs.HTTPHeaderMatchPresent
|
||||||
|
case HTTPHeaderMatchType_HTTPHeaderMatchRegularExpression:
|
||||||
|
return structs.HTTPHeaderMatchRegularExpression
|
||||||
|
case HTTPHeaderMatchType_HTTPHeaderMatchSuffix:
|
||||||
|
return structs.HTTPHeaderMatchSuffix
|
||||||
|
default:
|
||||||
|
return structs.HTTPHeaderMatchExact
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func httpPathMatchFromStructs(a structs.HTTPPathMatchType) HTTPPathMatchType {
|
||||||
|
switch a {
|
||||||
|
case structs.HTTPPathMatchExact:
|
||||||
|
return HTTPPathMatchType_HTTPPathMatchExact
|
||||||
|
case structs.HTTPPathMatchPrefix:
|
||||||
|
return HTTPPathMatchType_HTTPPathMatchPrefix
|
||||||
|
case structs.HTTPPathMatchRegularExpression:
|
||||||
|
return HTTPPathMatchType_HTTPPathMatchRegularExpression
|
||||||
|
default:
|
||||||
|
return HTTPPathMatchType_HTTPPathMatchExact
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func httpPathMatchToStructs(a HTTPPathMatchType) structs.HTTPPathMatchType {
|
||||||
|
switch a {
|
||||||
|
case HTTPPathMatchType_HTTPPathMatchExact:
|
||||||
|
return structs.HTTPPathMatchExact
|
||||||
|
case HTTPPathMatchType_HTTPPathMatchPrefix:
|
||||||
|
return structs.HTTPPathMatchPrefix
|
||||||
|
case HTTPPathMatchType_HTTPPathMatchRegularExpression:
|
||||||
|
return structs.HTTPPathMatchRegularExpression
|
||||||
|
default:
|
||||||
|
return structs.HTTPPathMatchExact
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func httpQueryMatchFromStructs(a structs.HTTPQueryMatchType) HTTPQueryMatchType {
|
||||||
|
switch a {
|
||||||
|
case structs.HTTPQueryMatchExact:
|
||||||
|
return HTTPQueryMatchType_HTTPQueryMatchExact
|
||||||
|
case structs.HTTPQueryMatchPresent:
|
||||||
|
return HTTPQueryMatchType_HTTPQueryMatchPresent
|
||||||
|
case structs.HTTPQueryMatchRegularExpression:
|
||||||
|
return HTTPQueryMatchType_HTTPQueryMatchRegularExpression
|
||||||
|
default:
|
||||||
|
return HTTPQueryMatchType_HTTPQueryMatchExact
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func httpQueryMatchToStructs(a HTTPQueryMatchType) structs.HTTPQueryMatchType {
|
||||||
|
switch a {
|
||||||
|
case HTTPQueryMatchType_HTTPQueryMatchExact:
|
||||||
|
return structs.HTTPQueryMatchExact
|
||||||
|
case HTTPQueryMatchType_HTTPQueryMatchPresent:
|
||||||
|
return structs.HTTPQueryMatchPresent
|
||||||
|
case HTTPQueryMatchType_HTTPQueryMatchRegularExpression:
|
||||||
|
return structs.HTTPQueryMatchRegularExpression
|
||||||
|
default:
|
||||||
|
return structs.HTTPQueryMatchExact
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func EnvoyExtensionArgumentsToStructs(args *structpb.Value) map[string]interface{} {
|
func EnvoyExtensionArgumentsToStructs(args *structpb.Value) map[string]interface{} {
|
||||||
if args != nil {
|
if args != nil {
|
||||||
st := args.GetStructValue()
|
st := args.GetStructValue()
|
||||||
|
@ -314,25 +476,3 @@ func EnvoyExtensionsFromStructs(args []structs.EnvoyExtension) []*EnvoyExtension
|
||||||
|
|
||||||
return o
|
return o
|
||||||
}
|
}
|
||||||
|
|
||||||
func apiGatewayProtocolFromStructs(a structs.APIGatewayListenerProtocol) APIGatewayListenerProtocol {
|
|
||||||
switch a {
|
|
||||||
case structs.ListenerProtocolHTTP:
|
|
||||||
return APIGatewayListenerProtocol_ListenerProtocolHTTP
|
|
||||||
case structs.ListenerProtocolTCP:
|
|
||||||
return APIGatewayListenerProtocol_ListenerProtocolTCP
|
|
||||||
default:
|
|
||||||
return APIGatewayListenerProtocol_ListenerProtocolHTTP
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func apiGatewayProtocolToStructs(a APIGatewayListenerProtocol) structs.APIGatewayListenerProtocol {
|
|
||||||
switch a {
|
|
||||||
case APIGatewayListenerProtocol_ListenerProtocolHTTP:
|
|
||||||
return structs.ListenerProtocolHTTP
|
|
||||||
case APIGatewayListenerProtocol_ListenerProtocolTCP:
|
|
||||||
return structs.ListenerProtocolTCP
|
|
||||||
default:
|
|
||||||
return structs.ListenerProtocolHTTP
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -517,6 +517,86 @@ func (msg *HTTPRoute) UnmarshalBinary(b []byte) error {
|
||||||
return proto.Unmarshal(b, msg)
|
return proto.Unmarshal(b, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalBinary implements encoding.BinaryMarshaler
|
||||||
|
func (msg *HTTPRouteRule) MarshalBinary() ([]byte, error) {
|
||||||
|
return proto.Marshal(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||||
|
func (msg *HTTPRouteRule) UnmarshalBinary(b []byte) error {
|
||||||
|
return proto.Unmarshal(b, msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary implements encoding.BinaryMarshaler
|
||||||
|
func (msg *HTTPMatch) MarshalBinary() ([]byte, error) {
|
||||||
|
return proto.Marshal(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||||
|
func (msg *HTTPMatch) UnmarshalBinary(b []byte) error {
|
||||||
|
return proto.Unmarshal(b, msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary implements encoding.BinaryMarshaler
|
||||||
|
func (msg *HTTPHeaderMatch) MarshalBinary() ([]byte, error) {
|
||||||
|
return proto.Marshal(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||||
|
func (msg *HTTPHeaderMatch) UnmarshalBinary(b []byte) error {
|
||||||
|
return proto.Unmarshal(b, msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary implements encoding.BinaryMarshaler
|
||||||
|
func (msg *HTTPPathMatch) MarshalBinary() ([]byte, error) {
|
||||||
|
return proto.Marshal(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||||
|
func (msg *HTTPPathMatch) UnmarshalBinary(b []byte) error {
|
||||||
|
return proto.Unmarshal(b, msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary implements encoding.BinaryMarshaler
|
||||||
|
func (msg *HTTPQueryMatch) MarshalBinary() ([]byte, error) {
|
||||||
|
return proto.Marshal(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||||
|
func (msg *HTTPQueryMatch) UnmarshalBinary(b []byte) error {
|
||||||
|
return proto.Unmarshal(b, msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary implements encoding.BinaryMarshaler
|
||||||
|
func (msg *HTTPFilters) MarshalBinary() ([]byte, error) {
|
||||||
|
return proto.Marshal(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||||
|
func (msg *HTTPFilters) UnmarshalBinary(b []byte) error {
|
||||||
|
return proto.Unmarshal(b, msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary implements encoding.BinaryMarshaler
|
||||||
|
func (msg *HTTPHeaderFilter) MarshalBinary() ([]byte, error) {
|
||||||
|
return proto.Marshal(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||||
|
func (msg *HTTPHeaderFilter) UnmarshalBinary(b []byte) error {
|
||||||
|
return proto.Unmarshal(b, msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary implements encoding.BinaryMarshaler
|
||||||
|
func (msg *HTTPService) MarshalBinary() ([]byte, error) {
|
||||||
|
return proto.Marshal(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||||
|
func (msg *HTTPService) UnmarshalBinary(b []byte) error {
|
||||||
|
return proto.Unmarshal(b, msg)
|
||||||
|
}
|
||||||
|
|
||||||
// MarshalBinary implements encoding.BinaryMarshaler
|
// MarshalBinary implements encoding.BinaryMarshaler
|
||||||
func (msg *TCPRoute) MarshalBinary() ([]byte, error) {
|
func (msg *TCPRoute) MarshalBinary() ([]byte, error) {
|
||||||
return proto.Marshal(msg)
|
return proto.Marshal(msg)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -706,7 +706,136 @@ message InlineCertificate {
|
||||||
// ignore-fields=Kind,Name,RaftIndex,EnterpriseMeta
|
// ignore-fields=Kind,Name,RaftIndex,EnterpriseMeta
|
||||||
message HTTPRoute {
|
message HTTPRoute {
|
||||||
map<string, string> Meta = 1;
|
map<string, string> Meta = 1;
|
||||||
Status Status = 2;
|
repeated ResourceReference Parents = 2;
|
||||||
|
repeated HTTPRouteRule Rules = 3;
|
||||||
|
repeated string Hostnames = 4;
|
||||||
|
Status Status = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mog annotation:
|
||||||
|
//
|
||||||
|
// target=github.com/hashicorp/consul/agent/structs.HTTPRouteRule
|
||||||
|
// output=config_entry.gen.go
|
||||||
|
// name=Structs
|
||||||
|
message HTTPRouteRule {
|
||||||
|
HTTPFilters Filters = 1;
|
||||||
|
repeated HTTPMatch Matches = 2;
|
||||||
|
repeated HTTPService Services = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mog annotation:
|
||||||
|
//
|
||||||
|
// target=github.com/hashicorp/consul/agent/structs.HTTPMatch
|
||||||
|
// output=config_entry.gen.go
|
||||||
|
// name=Structs
|
||||||
|
message HTTPMatch {
|
||||||
|
repeated HTTPHeaderMatch Headers = 1;
|
||||||
|
// mog: func-to=httpMatchMethodToStructs func-from=httpMatchMethodFromStructs
|
||||||
|
HTTPMatchMethod Method = 2;
|
||||||
|
HTTPPathMatch Path = 3;
|
||||||
|
repeated HTTPQueryMatch Query = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum HTTPMatchMethod {
|
||||||
|
HTTPMatchMethodAll = 0;
|
||||||
|
HTTPMatchMethodConnect = 1;
|
||||||
|
HTTPMatchMethodDelete = 2;
|
||||||
|
HTTPMatchMethodGet = 3;
|
||||||
|
HTTPMatchMethodHead = 4;
|
||||||
|
HTTPMatchMethodOptions = 5;
|
||||||
|
HTTPMatchMethodPatch = 6;
|
||||||
|
HTTPMatchMethodPost = 7;
|
||||||
|
HTTPMatchMethodPut = 8;
|
||||||
|
HTTPMatchMethodTrace = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum HTTPHeaderMatchType {
|
||||||
|
HTTPHeaderMatchExact = 0;
|
||||||
|
HTTPHeaderMatchPrefix = 1;
|
||||||
|
HTTPHeaderMatchPresent = 2;
|
||||||
|
HTTPHeaderMatchRegularExpression = 3;
|
||||||
|
HTTPHeaderMatchSuffix = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mog annotation:
|
||||||
|
//
|
||||||
|
// target=github.com/hashicorp/consul/agent/structs.HTTPHeaderMatch
|
||||||
|
// output=config_entry.gen.go
|
||||||
|
// name=Structs
|
||||||
|
message HTTPHeaderMatch {
|
||||||
|
// mog: func-to=httpHeaderMatchToStructs func-from=httpHeaderMatchFromStructs
|
||||||
|
HTTPHeaderMatchType Match = 1;
|
||||||
|
string Name = 2;
|
||||||
|
string Value = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum HTTPPathMatchType {
|
||||||
|
HTTPPathMatchExact = 0;
|
||||||
|
HTTPPathMatchPrefix = 1;
|
||||||
|
HTTPPathMatchRegularExpression = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mog annotation:
|
||||||
|
//
|
||||||
|
// target=github.com/hashicorp/consul/agent/structs.HTTPPathMatch
|
||||||
|
// output=config_entry.gen.go
|
||||||
|
// name=Structs
|
||||||
|
message HTTPPathMatch {
|
||||||
|
// mog: func-to=httpPathMatchToStructs func-from=httpPathMatchFromStructs
|
||||||
|
HTTPPathMatchType Match = 1;
|
||||||
|
string Value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum HTTPQueryMatchType {
|
||||||
|
HTTPQueryMatchExact = 0;
|
||||||
|
HTTPQueryMatchPresent = 1;
|
||||||
|
HTTPQueryMatchRegularExpression = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mog annotation:
|
||||||
|
//
|
||||||
|
// target=github.com/hashicorp/consul/agent/structs.HTTPQueryMatch
|
||||||
|
// output=config_entry.gen.go
|
||||||
|
// name=Structs
|
||||||
|
message HTTPQueryMatch {
|
||||||
|
// mog: func-to=httpQueryMatchToStructs func-from=httpQueryMatchFromStructs
|
||||||
|
HTTPQueryMatchType Match = 1;
|
||||||
|
string Name = 2;
|
||||||
|
string Value = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mog annotation:
|
||||||
|
//
|
||||||
|
// target=github.com/hashicorp/consul/agent/structs.HTTPFilters
|
||||||
|
// output=config_entry.gen.go
|
||||||
|
// name=Structs
|
||||||
|
message HTTPFilters {
|
||||||
|
repeated HTTPHeaderFilter Headers = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mog annotation:
|
||||||
|
//
|
||||||
|
// target=github.com/hashicorp/consul/agent/structs.HTTPHeaderFilter
|
||||||
|
// output=config_entry.gen.go
|
||||||
|
// name=Structs
|
||||||
|
message HTTPHeaderFilter {
|
||||||
|
map<string, string> Add = 1;
|
||||||
|
repeated string Remove = 2;
|
||||||
|
map<string, string> Set = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mog annotation:
|
||||||
|
//
|
||||||
|
// target=github.com/hashicorp/consul/agent/structs.HTTPService
|
||||||
|
// output=config_entry.gen.go
|
||||||
|
// name=Structs
|
||||||
|
message HTTPService {
|
||||||
|
string Name = 1;
|
||||||
|
// mog: func-to=int func-from=int32
|
||||||
|
int32 Weight = 2;
|
||||||
|
HTTPFilters Filters = 3;
|
||||||
|
// mog: func-to=enterpriseMetaToStructs func-from=enterpriseMetaFromStructs
|
||||||
|
common.EnterpriseMeta EnterpriseMeta = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mog annotation:
|
// mog annotation:
|
||||||
|
|
Loading…
Reference in New Issue