syntax = "proto3";

package temporal.api.cloud.connectivityrule.v1;

option go_package = "go.temporal.io/api/cloud/connectivityrule/v1;connectivityrule";
option java_package = "io.temporal.api.cloud.connectivityrule.v1";
option java_multiple_files = true;
option java_outer_classname = "MessageProto";
option ruby_package = "Temporalio::Api::Cloud::ConnectivityRule::V1";
option csharp_namespace = "Temporalio.Api.Cloud.ConnectivityRule.V1";

import "temporal/api/cloud/resource/v1/message.proto";
import "google/protobuf/timestamp.proto";

message ConnectivityRule {
  reserved 3; // Removed endpoint field

  // The id of the private connectivity rule.
  string id = 1;

  // The connectivity rule specification.
  ConnectivityRuleSpec spec = 2;

  // The current version of the connectivity rule specification.
  // The next update operation will have to include this version.
  string resource_version = 4;

  temporal.api.cloud.resource.v1.ResourceState state = 5;

  // The id of the async operation that is creating/updating/deleting the connectivity rule, if any.
  string async_operation_id = 6;

  // The date and time when the connectivity rule was created.
  google.protobuf.Timestamp created_time = 7;
}

// The connectivity rule specification passed in on create/update operations.
message ConnectivityRuleSpec {
  oneof connection_type {
    // This allows access via public internet.
    PublicConnectivityRule public_rule = 1;
    // This allows access via specific private vpc.
    PrivateConnectivityRule private_rule = 2;
  }
}

// A public connectivity rule allows access to the namespace via the public internet.
message PublicConnectivityRule {}

// A private connectivity rule allows connections from a specific private vpc only.
message PrivateConnectivityRule {
  // Connection id provided to enforce the private connectivity. This is required both by AWS and GCP.
  string connection_id = 1;

  // For GCP private connectivity service, GCP needs both GCP project id and the Private Service Connect Connection IDs
  // AWS only needs the connection_id
  string gcp_project_id = 2;

  // The region of the connectivity rule. This should align with the namespace.
  // Example: "aws-us-west-2"
  string region = 3;

  reserved 4;
}