in alibabacloudservicemesh/v1/common_types.go [25:72]
func (r *RouteConfigurationMatch) ToIstioRouteMatch() *networking.EnvoyFilter_EnvoyConfigObjectMatch_RouteConfiguration {
routeMatch := &networking.EnvoyFilter_EnvoyConfigObjectMatch_RouteConfiguration{
RouteConfiguration: &networking.EnvoyFilter_RouteConfigurationMatch{},
}
if r.PortNumber != nil {
routeMatch.RouteConfiguration.PortNumber = *r.PortNumber
}
if r.PortName != nil {
routeMatch.RouteConfiguration.PortName = *r.PortName
}
if r.Gateway != nil {
routeMatch.RouteConfiguration.Gateway = *r.Gateway
}
if r.Vhost != nil {
routeMatch.RouteConfiguration.Vhost = &networking.EnvoyFilter_RouteConfigurationMatch_VirtualHostMatch{}
if r.Vhost.Name != nil {
routeMatch.RouteConfiguration.Vhost.Name = *r.Vhost.Name
}
if r.Vhost.Route != nil {
routeMatch.RouteConfiguration.Vhost.Route = &networking.EnvoyFilter_RouteConfigurationMatch_RouteMatch{}
if r.Vhost.Route.Name != nil {
routeMatch.RouteConfiguration.Vhost.Route.Name = *r.Vhost.Route.Name
}
if r.Vhost.Route.Action != nil {
switch *r.Vhost.Route.Action {
case "ROUTE":
{
routeMatch.RouteConfiguration.Vhost.Route.Action = networking.EnvoyFilter_RouteConfigurationMatch_RouteMatch_ROUTE
}
case "REDIRECT":
{
routeMatch.RouteConfiguration.Vhost.Route.Action = networking.EnvoyFilter_RouteConfigurationMatch_RouteMatch_REDIRECT
}
case "DIRECT_RESPONSE":
{
routeMatch.RouteConfiguration.Vhost.Route.Action = networking.EnvoyFilter_RouteConfigurationMatch_RouteMatch_REDIRECT
}
default:
{
routeMatch.RouteConfiguration.Vhost.Route.Action = networking.EnvoyFilter_RouteConfigurationMatch_RouteMatch_ANY
}
}
}
}
}
return routeMatch
}