syntax = "proto3";

package envoy.api.v2;

import "envoy/api/v2/discovery.proto";

import "google/api/annotations.proto";

import "envoy/annotations/resource.proto";
import "udpa/annotations/migrate.proto";
import "udpa/annotations/status.proto";

import public "envoy/api/v2/route.proto";

option java_package = "io.envoyproxy.envoy.api.v2";
option java_outer_classname = "RdsProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/api/v2;apiv2";
option (udpa.annotations.file_migrate).move_to_package = "envoy.service.route.v3";
option (udpa.annotations.file_status).package_version_status = FROZEN;

// [#protodoc-title: RDS]

// The resource_names field in DiscoveryRequest specifies a route configuration.
// This allows an Envoy configuration with multiple HTTP listeners (and
// associated HTTP connection manager filters) to use different route
// configurations. Each listener will bind its HTTP connection manager filter to
// a route table via this identifier.
service RouteDiscoveryService {
  option (envoy.annotations.resource).type = "envoy.api.v2.RouteConfiguration";

  rpc StreamRoutes(stream DiscoveryRequest) returns (stream DiscoveryResponse) {
  }

  rpc DeltaRoutes(stream DeltaDiscoveryRequest) returns (stream DeltaDiscoveryResponse) {
  }

  rpc FetchRoutes(DiscoveryRequest) returns (DiscoveryResponse) {
    option (google.api.http).post = "/v2/discovery:routes";
    option (google.api.http).body = "*";
  }
}

// Virtual Host Discovery Service (VHDS) is used to dynamically update the list of virtual hosts for
// a given RouteConfiguration. If VHDS is configured a virtual host list update will be triggered
// during the processing of an HTTP request if a route for the request cannot be resolved. The
// :ref:`resource_names_subscribe <envoy_api_field_DeltaDiscoveryRequest.resource_names_subscribe>`
// field contains a list of virtual host names or aliases to track. The contents of an alias would
// be the contents of a *host* or *authority* header used to make an http request. An xDS server
// will match an alias to a virtual host based on the content of :ref:`domains'
// <envoy_api_field_route.VirtualHost.domains>` field. The *resource_names_unsubscribe* field
// contains a list of virtual host names that have been :ref:`unsubscribed
// <xds_protocol_unsubscribe>` from the routing table associated with the RouteConfiguration.
service VirtualHostDiscoveryService {
  option (envoy.annotations.resource).type = "envoy.api.v2.route.VirtualHost";

  rpc DeltaVirtualHosts(stream DeltaDiscoveryRequest) returns (stream DeltaDiscoveryResponse) {
  }
}

// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing
// services: https://github.com/google/protobuf/issues/4221 and protoxform to upgrade the file.
message RdsDummy {
}
