syntax = "proto3";

package envoy.extensions.filters.http.stateful_session.v3;

import "envoy/config/core/v3/extension.proto";

import "udpa/annotations/status.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.extensions.filters.http.stateful_session.v3";
option java_outer_classname = "StatefulSessionProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/stateful_session/v3;stateful_sessionv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Stateful session filter]
// Stateful session :ref:`configuration overview <config_http_filters_stateful_session>`.
// [#extension: envoy.filters.http.stateful_session]

message StatefulSession {
  // Specifies the implementation of session state. This session state is used to store and retrieve the address of the
  // upstream host assigned to the session.
  //
  // [#extension-category: envoy.http.stateful_session]
  config.core.v3.TypedExtensionConfig session_state = 1;

  // Determines whether the HTTP request must be strictly routed to the requested destination. When set to ``true``,
  // if the requested destination is unavailable, Envoy will return a 503 status code. The default value is ``false``,
  // which allows Envoy to fall back to its load balancing mechanism. In this case, if the requested destination is not
  // found, the request will be routed according to the load balancing algorithm.
  bool strict = 2;
}

message StatefulSessionPerRoute {
  oneof override {
    option (validate.required) = true;

    // Disable the stateful session filter for this particular vhost or route. If disabled is
    // specified in multiple per-filter-configs, the most specific one will be used.
    bool disabled = 1 [(validate.rules).bool = {const: true}];

    // Per-route stateful session configuration that can be served by RDS or static route table.
    StatefulSession stateful_session = 2;
  }
}
