Skip to content

Commit

Permalink
Add Cloud public API for multi region namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
yux0 committed Apr 2, 2024
1 parent 5452de3 commit d25da6b
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
47 changes: 47 additions & 0 deletions temporal/api/cloud/cloudservice/v1/request_response.proto
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,53 @@ message DeleteNamespaceResponse {
temporal.api.cloud.operation.v1.AsyncOperation async_operation = 1;
}

message FailoverNamespaceRequest {
// The namespace to failover.
string namespace = 1;
// The target region to failover.
temporal.api.cloud.region.v1.Region target_region = 2;
// The id to use for this async operation.
// Optional, if not provided a random id will be generated.
string async_operation_id = 3;
}

message FailoverNamespaceResponse {
// The async operation.
temporal.api.cloud.operation.v1.AsyncOperation async_operation = 1;
}

message GetNamespaceFailoverHistoryRequest {
// The requested size of the page to retrieve - optional.
// Cannot exceed 1000. Defaults to 100.
int32 page_size = 1;
// The page token if this is continuing from another response - optional.
string page_token = 2;
// The namespace to get failover history.
string namespace = 3;
}

message GetNamespaceFailoverHistoryResponse {
// The page token if this is continuing from another response
string page_token = 1;
// Namespace failover history
repeated temporal.api.cloud.namespace.v1.FailoverRecord failover_history = 2;
}

message AddNamespaceRegionRequest {
// The namespace to failover.
string namespace = 1;
// The new region to be added.
temporal.api.cloud.region.v1.Region new_region = 2;
// The id to use for this async operation.
// Optional, if not provided a random id will be generated.
string async_operation_id = 3;
}

message AddNamespaceRegionResponse {
// The async operation.
temporal.api.cloud.operation.v1.AsyncOperation async_operation = 1;
}

message GetRegionsRequest {
}

Expand Down
23 changes: 23 additions & 0 deletions temporal/api/cloud/cloudservice/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,29 @@ service CloudService {
};
}

// Failover a multi-region namespace
rpc FailoverNamespace (FailoverNamespaceRequest) returns (FailoverNamespaceResponse) {
option (google.api.http) = {
post: "/api/v1/namespaces/{namespace}/failover",
body: "*"
};
}

// Get failover history on a namespace
rpc GetNamespaceFailoverHistory (GetNamespaceFailoverHistoryRequest) returns (GetNamespaceFailoverHistoryResponse) {
option (google.api.http) = {
get: "/api/v1/namespaces/{namespace}/failover-history",
};
}

// Add a new region to a namespace
rpc AddNamespaceRegion (AddNamespaceRegionRequest) returns (AddNamespaceRegionResponse) {
option (google.api.http) = {
post: "/api/v1/namespaces/{namespace}/region",
body: "*"
};
}

// Get all regions
rpc GetRegions (GetRegionsRequest) returns (GetRegionsResponse) {
option (google.api.http) = {
Expand Down
23 changes: 23 additions & 0 deletions temporal/api/cloud/namespace/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package temporal.api.cloud.namespace.v1;
option go_package = "go.temporal.io/api/cloud/namespace/v1;namespace";

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

message CertificateFilterSpec {
// The common_name in the certificate.
Expand Down Expand Up @@ -124,3 +125,25 @@ message Namespace {
// Will not be set if the namespace has never been modified.
google.protobuf.Timestamp last_modified_time = 11;
}

enum FailoverType {
FAILOVER_TYPE_UNSPECIFIED = 0;
FAILOVER_TYPE_GRACEFUL = 1;
FAILOVER_TYPE_FORCEFUL = 2;
}

enum FailoverStatus {
FAILOVER_STATUS_UNSPECIFIED = 0;
FAILOVER_STATUS_SUCCEEDED = 1;
FAILOVER_STATUS_FAILED = 2;
}

message FailoverRecord {
FailoverType failover_type = 1;
temporal.api.cloud.region.v1.Region source_region = 2;
temporal.api.cloud.region.v1.Region target_region = 3;
google.protobuf.Timestamp start_time_utc = 4;
google.protobuf.Timestamp end_time_utc = 5;
FailoverStatus status = 6;
string operator = 7;
}

0 comments on commit d25da6b

Please sign in to comment.