syntax = "proto3";

package yandex.cloud.apploadbalancer.v1;

import "google/protobuf/timestamp.proto";
import "yandex/cloud/validation.proto";

option go_package = "github.com/yandex-cloud/go-genproto/yandex/cloud/apploadbalancer/v1;apploadbalancer";
option java_package = "yandex.cloud.api.apploadbalancer.v1";

// A target group resource.
// For details about the concept, see [documentation](/docs/application-load-balancer/concepts/target-group).
message TargetGroup {
  // ID of the target group. Generated at creation time.
  string id = 1;

  // Name of the target group. The name is unique within the folder.
  string name = 2;

  // Description of the target group.
  string description = 3;

  // ID of the folder that the target group belongs to.
  string folder_id = 4;

  // Target group labels as `key:value` pairs.
  // For details about the concept, see [documentation](/docs/overview/concepts/services#labels).
  map<string, string> labels = 5;

  // List of targets in the target group.
  repeated Target targets = 6;

  // Creation timestamp.
  google.protobuf.Timestamp created_at = 7;
}

// A target resource.
// For details about the concept, see [documentation](/docs/application-load-balancer/concepts/target-group).
message Target {
  // Reference to the target. As of now, targets must only be referred to by their IP addresses.
  oneof address_type {
    option (exactly_one) = true;

    // IP address of the target.
    string ip_address = 1;
  }

  // ID of the subnet that the target is connected to.
  string subnet_id = 3;
}
