// 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.extensions.filters.network.mongo_proxy.v3;

import "envoy/extensions/filters/common/fault/v3/fault.proto";

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

option java_package = "io.envoyproxy.envoy.extensions.filters.network.mongo_proxy.v3";
option java_outer_classname = "MongoProxyProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/mongo_proxy/v3;mongo_proxyv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Mongo proxy]
// MongoDB :ref:`configuration overview <config_network_filters_mongo_proxy>`.
// [#extension: envoy.filters.network.mongo_proxy]

// [#next-free-field: 6]
message MongoProxy {
  option (udpa.annotations.versioning).previous_message_type =
      "envoy.config.filter.network.mongo_proxy.v2.MongoProxy";

  // The human readable prefix to use when emitting :ref:`statistics
  // <config_network_filters_mongo_proxy_stats>`.
  string stat_prefix = 1 [(validate.rules).string = {min_len: 1}];

  // The optional path to use for writing Mongo access logs. If not access log
  // path is specified no access logs will be written. Note that access log is
  // also gated :ref:`runtime <config_network_filters_mongo_proxy_runtime>`.
  string access_log = 2;

  // Inject a fixed delay before proxying a Mongo operation. Delays are
  // applied to the following MongoDB operations: Query, Insert, GetMore,
  // and KillCursors. Once an active delay is in progress, all incoming
  // data up until the timer event fires will be a part of the delay.
  common.fault.v3.FaultDelay delay = 3;

  // Flag to specify whether :ref:`dynamic metadata
  // <config_network_filters_mongo_proxy_dynamic_metadata>` should be emitted. Defaults to false.
  bool emit_dynamic_metadata = 4;

  // List of commands to emit metrics for. Defaults to "delete", "insert", and "update".
  // Note that metrics will not be emitted for "find" commands, since those are considered
  // queries, and metrics for those are emitted under a dedicated "query" namespace.
  repeated string commands = 5;
}
