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

syntax = "proto3";

package hashicorp.consul.catalog.v2beta1;

import "pbcatalog/v2beta1/health.proto";
import "pbcatalog/v2beta1/workload.proto";
import "pbresource/annotations.proto";
import "pbresource/resource.proto";

message ServiceEndpoints {
  option (hashicorp.consul.resource.spec) = {scope: SCOPE_NAMESPACE};

  repeated Endpoint endpoints = 1;
}

message Endpoint {
  // target_ref is the reference to the resource
  // for this endpoint endpoint. This currently must be a workload.
  hashicorp.consul.resource.ID target_ref = 1;

  // addresses is the list of addresses for this endpoint.
  // This has the same structure as the workload addresses.
  repeated WorkloadAddress addresses = 2;

  // ports is the map of ports for this endpoint.
  // This has the same structure as the workload ports but
  // will be filtered to just the ports selected by the service.
  map<string, WorkloadPort> ports = 3;

  // health_status is the aggregated health status of this endpoint.
  Health health_status = 4;

  // identity is the name of the workload identity for this endpoint.
  string identity = 5;

  // dns contains customizations like Weight that will be returned in DNS discovery requests.
  DNSPolicy dns = 6;
}
