// Copyright 2025 Envoy Project Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package envoy.service.extension.v3;

import "envoy/service/discovery/v3/discovery.proto";

import "google/api/annotations.proto";

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

option java_package = "io.envoyproxy.envoy.service.extension.v3";
option java_outer_classname = "ConfigDiscoveryProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/service/extension/v3;extensionv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Extension config discovery service (ECDS)]

// A service that supports dynamic configuration updates for a specific filter.
// Currently, ECDS is supported for network filters, HTTP filters, UDP session filters, and listener filters.
// Please check :ref:`Extension Config Discovery Service (ECDS) API <config_overview_extension_discovery>`.
//
// The overall extension config discovery service works as follows:
//
// #. A filter (:ref:`Downstream Network <envoy_v3_api_field_config.listener.v3.Filter.config_discovery>`,
//    :ref:`Upstream Network <envoy_v3_api_field_config.cluster.v3.Filter.config_discovery>`,
//    :ref:`Listener <envoy_v3_api_field_config.listener.v3.ListenerFilter.config_discovery>`,
//    :ref:`UDP Session <envoy_v3_api_field_extensions.filters.udp.udp_proxy.v3.UdpProxyConfig.SessionFilter.config_discovery>`,
//    or :ref:`HTTP <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpFilter.config_discovery>`)
//    contains a (:ref:`ExtensionConfigSource config discovery <envoy_v3_api_msg_config.core.v3.ExtensionConfigSource>`) configuration. This configuration
//    includes a :ref:`config_source <envoy_v3_api_field_config.core.v3.ExtensionConfigSource.config_source>`,
//    from which the filter configuration will be fetched.
// #. The client then registers for a resource using the filter name as the ``resource_name``.
// #. The xDS server sends back the filter's configuration.
// #. The client stores the configuration that will be used in the next instantiation of the filter chain,
//    i.e., for the next requests. Whenever an updated filter configuration arrives, it will be taken into
//    account in the following instantiation of the filter chain.
//
// .. note::
//   Filters that are configured using ECDS are warmed. For more details see
//   :ref:`ExtensionConfigSource <envoy_v3_api_msg_config.core.v3.ExtensionConfigSource>`.
//
// Return extension configurations.
service ExtensionConfigDiscoveryService {
  option (envoy.annotations.resource).type = "envoy.config.core.v3.TypedExtensionConfig";

  rpc StreamExtensionConfigs(stream discovery.v3.DiscoveryRequest)
      returns (stream discovery.v3.DiscoveryResponse) {
  }

  rpc DeltaExtensionConfigs(stream discovery.v3.DeltaDiscoveryRequest)
      returns (stream discovery.v3.DeltaDiscoveryResponse) {
  }

  rpc FetchExtensionConfigs(discovery.v3.DiscoveryRequest)
      returns (discovery.v3.DiscoveryResponse) {
    option (google.api.http).post = "/v3/discovery:extension_configs";
    option (google.api.http).body = "*";
  }
}

// [#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 EcdsDummy {
}
