// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

syntax = "proto3";

package hashicorp.consul.mesh.v2beta1;

import "pbcatalog/v2beta1/selector.proto";
import "pbresource/annotations.proto";

message MeshGateway {
  option (hashicorp.consul.resource.spec) = {scope: SCOPE_PARTITION};

  // GatewayClassName is the name of the GatewayClass used by the MeshGateway
  string gateway_class_name = 1;

  // +kubebuilder:validation:MinItems=1
  repeated MeshGatewayListener listeners = 2;

  // Selection of workloads to be configured as mesh gateways
  hashicorp.consul.catalog.v2beta1.WorkloadSelector workloads = 3;
}

message MeshGatewayListener {
  string name = 1;
  // +kubebuilder:validation:Maximum=65535
  // +kubebuilder:validation:Minimum=0
  uint32 port = 2;
  // +kubebuilder:validation:Enum=TCP
  string protocol = 3;
}
