From 82dfc8466c4593d79b4aa8c4de789de17b16cb64 Mon Sep 17 00:00:00 2001 From: Abhinav Nekkanti <10552725+anekkanti@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:15:39 -0800 Subject: [PATCH 1/4] account get/udpate apis --- temporal/api/cloud/account/v1/message.proto | 38 +++++++++++++ .../cloudservice/v1/request_response.proto | 26 +++++++++ .../api/cloud/cloudservice/v1/service.proto | 57 ++++++++++++------- 3 files changed, 100 insertions(+), 21 deletions(-) create mode 100644 temporal/api/cloud/account/v1/message.proto diff --git a/temporal/api/cloud/account/v1/message.proto b/temporal/api/cloud/account/v1/message.proto new file mode 100644 index 0000000..c7b52cd --- /dev/null +++ b/temporal/api/cloud/account/v1/message.proto @@ -0,0 +1,38 @@ +syntax = "proto3"; + +package temporal.api.cloud.account.v1; + +option go_package = "go.temporal.io/api/cloud/account/v1;account"; + +message MetricsSpec { + // Enables the endpoint from which clients can scrape all their namespace metrics. + bool enabled = 1; + // The base64 encoded ca cert(s) in PEM format that clients connecting to the metrics endpoint can use for authentication. + // This must only be one value, but the CA can have a chain. + string accepted_client_ca = 2; +} + +message AccountSpec { + // The metrics specification for this account. + MetricsSpec metrics = 1; +} + +message Metrics { + // The prometheus metrics endpoint uri. + // This is only populated when the metrics is enabled in the metrics specification. + string uri = 1; +} + +message Account { + // The current version of the account specification. + // The next update operation will have to include this version. + string resource_version = 1; + // The account specification + AccountSpec spec = 2; + // The current state of the account. + string state = 3; + // The id of the async operation that is updating the account, if any. + string async_operation_id = 4; + // Information related to metrics. + Metrics metrics = 5; +} diff --git a/temporal/api/cloud/cloudservice/v1/request_response.proto b/temporal/api/cloud/cloudservice/v1/request_response.proto index 3cb31d3..3317aac 100644 --- a/temporal/api/cloud/cloudservice/v1/request_response.proto +++ b/temporal/api/cloud/cloudservice/v1/request_response.proto @@ -8,6 +8,7 @@ import "temporal/api/cloud/operation/v1/message.proto"; import "temporal/api/cloud/identity/v1/message.proto"; import "temporal/api/cloud/namespace/v1/message.proto"; import "temporal/api/cloud/region/v1/message.proto"; +import "temporal/api/cloud/account/v1/message.proto"; message GetUsersRequest { // The requested size of the page to retrieve - optional. @@ -229,3 +230,28 @@ message GetRegionResponse { // The temporal cloud region. temporal.api.cloud.region.v1.Region region = 1; } + +message GetAccountRequest { +} + +message GetAccountResponse { + // The account. + temporal.api.cloud.account.v1.Account account = 1; +} + +message UpdateAccountRequest { + // The updated account specification to apply. + temporal.api.cloud.account.v1.AccountSpec spec = 1; + // The version of the account for which this update is intended for. + // The latest version can be found in the GetAccount operation response. + string resource_version = 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 UpdateAccountResponse { + // The async operation. + temporal.api.cloud.operation.v1.AsyncOperation async_operation = 1; +} + diff --git a/temporal/api/cloud/cloudservice/v1/service.proto b/temporal/api/cloud/cloudservice/v1/service.proto index 00f1815..0bcfbaf 100644 --- a/temporal/api/cloud/cloudservice/v1/service.proto +++ b/temporal/api/cloud/cloudservice/v1/service.proto @@ -10,14 +10,14 @@ import "google/api/annotations.proto"; service CloudService { // Gets all known users rpc GetUsers(GetUsersRequest) returns (GetUsersResponse) { - option (google.api.http) = { + option (google.api.http) = { get: "/api/v1/users", }; } // Get a user rpc GetUser(GetUserRequest) returns (GetUserResponse) { - option (google.api.http) = { + option (google.api.http) = { get: "/api/v1/users/{user_id}", }; } @@ -26,30 +26,30 @@ service CloudService { rpc CreateUser(CreateUserRequest) returns (CreateUserResponse) { option (google.api.http) = { post: "/api/v1/users", - body: "*" + body: "*" }; } // Update a user rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse) { - option (google.api.http) = { + option (google.api.http) = { post: "/api/v1/users/{user_id}", - body: "*" + body: "*" }; } // Delete a user rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse) { - option (google.api.http) = { + option (google.api.http) = { delete: "/api/v1/users/{user_id}", }; } // Set a user's access to a namespace rpc SetUserNamespaceAccess(SetUserNamespaceAccessRequest) returns (SetUserNamespaceAccessResponse) { - option (google.api.http) = { + option (google.api.http) = { post: "/api/v1/namespaces/{namespace}/users/{user_id}/access", - body: "*" + body: "*" }; } @@ -62,60 +62,75 @@ service CloudService { // Create a new namespace rpc CreateNamespace (CreateNamespaceRequest) returns (CreateNamespaceResponse) { - option (google.api.http) = { + option (google.api.http) = { post: "/api/v1/namespaces", - body: "*" + body: "*" }; } - + // Get all namespaces rpc GetNamespaces (GetNamespacesRequest) returns (GetNamespacesResponse) { - option (google.api.http) = { + option (google.api.http) = { get: "/api/v1/namespaces", }; } // Get a namespace rpc GetNamespace (GetNamespaceRequest) returns (GetNamespaceResponse) { - option (google.api.http) = { + option (google.api.http) = { get: "/api/v1/namespaces/{namespace}", }; } // Update a namespace rpc UpdateNamespace (UpdateNamespaceRequest) returns (UpdateNamespaceResponse) { - option (google.api.http) = { + option (google.api.http) = { post: "/api/v1/namespaces/{namespace}", - body: "*" + body: "*" }; } // Rename an existing customer search attribute rpc RenameCustomSearchAttribute (RenameCustomSearchAttributeRequest) returns (RenameCustomSearchAttributeResponse) { - option (google.api.http) = { + option (google.api.http) = { post: "/api/v1/namespaces/{namespace}/rename-custom-search-attribute", - body: "*" + body: "*" }; } // Delete a namespace rpc DeleteNamespace (DeleteNamespaceRequest) returns (DeleteNamespaceResponse) { - option (google.api.http) = { + option (google.api.http) = { delete: "/api/v1/namespaces/{namespace}", }; } // Get all regions rpc GetRegions (GetRegionsRequest) returns (GetRegionsResponse) { - option (google.api.http) = { + option (google.api.http) = { get: "/api/v1/regions", }; } // Get a region rpc GetRegion (GetRegionRequest) returns (GetRegionResponse) { - option (google.api.http) = { - get: "/api/v1/regions/{region}", + option (google.api.http) = { + get: "/api/v1/{region}", + }; + } + + // Get account information + rpc GetAccount (GetAccountRequest) returns (GetAccountResponse) { + option (google.api.http) = { + get: "/api/v1/account", + }; + } + + // Update account information + rpc UpdateAccount (UpdateAccountRequest) returns (UpdateAccountResponse) { + option (google.api.http) = { + post: "/api/v1/account", + body: "*" }; } } From 6336346ecb17361de0f5d143419d483584f0f612 Mon Sep 17 00:00:00 2001 From: Abhinav Nekkanti <10552725+anekkanti@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:56:00 -0800 Subject: [PATCH 2/4] address review comments --- temporal/api/cloud/account/v1/message.proto | 6 +++--- temporal/api/cloud/cloudservice/v1/service.proto | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/temporal/api/cloud/account/v1/message.proto b/temporal/api/cloud/account/v1/message.proto index c7b52cd..24d111b 100644 --- a/temporal/api/cloud/account/v1/message.proto +++ b/temporal/api/cloud/account/v1/message.proto @@ -24,11 +24,11 @@ message Metrics { } message Account { + // The account specification + AccountSpec spec = 1; // The current version of the account specification. // The next update operation will have to include this version. - string resource_version = 1; - // The account specification - AccountSpec spec = 2; + string resource_version = 2; // The current state of the account. string state = 3; // The id of the async operation that is updating the account, if any. diff --git a/temporal/api/cloud/cloudservice/v1/service.proto b/temporal/api/cloud/cloudservice/v1/service.proto index 0bcfbaf..7fbfea9 100644 --- a/temporal/api/cloud/cloudservice/v1/service.proto +++ b/temporal/api/cloud/cloudservice/v1/service.proto @@ -115,20 +115,20 @@ service CloudService { // Get a region rpc GetRegion (GetRegionRequest) returns (GetRegionResponse) { option (google.api.http) = { - get: "/api/v1/{region}", + get: "/api/v1/regions/{region}", }; } // Get account information rpc GetAccount (GetAccountRequest) returns (GetAccountResponse) { - option (google.api.http) = { + option (google.api.http) = { get: "/api/v1/account", }; } // Update account information rpc UpdateAccount (UpdateAccountRequest) returns (UpdateAccountResponse) { - option (google.api.http) = { + option (google.api.http) = { post: "/api/v1/account", body: "*" }; From bdc5c853392bdab6464dc53d81c31e008dc6fb55 Mon Sep 17 00:00:00 2001 From: Abhinav Nekkanti <10552725+anekkanti@users.noreply.github.com> Date: Mon, 4 Dec 2023 15:03:06 -0800 Subject: [PATCH 3/4] address review comments --- temporal/api/cloud/account/v1/message.proto | 2 ++ temporal/api/cloud/identity/v1/message.proto | 2 ++ temporal/api/cloud/namespace/v1/message.proto | 2 ++ 3 files changed, 6 insertions(+) diff --git a/temporal/api/cloud/account/v1/message.proto b/temporal/api/cloud/account/v1/message.proto index 24d111b..aaffe17 100644 --- a/temporal/api/cloud/account/v1/message.proto +++ b/temporal/api/cloud/account/v1/message.proto @@ -30,6 +30,8 @@ message Account { // The next update operation will have to include this version. string resource_version = 2; // The current state of the account. + // Possible values: activating, activationfailed, active, updating, updatefailed, deleting, deletefailed, deleted, suspending, suspendfailed, suspended + // For any failed state, reach out to Temporal Cloud support for remediation. string state = 3; // The id of the async operation that is updating the account, if any. string async_operation_id = 4; diff --git a/temporal/api/cloud/identity/v1/message.proto b/temporal/api/cloud/identity/v1/message.proto index 3009f7e..0b7904a 100644 --- a/temporal/api/cloud/identity/v1/message.proto +++ b/temporal/api/cloud/identity/v1/message.proto @@ -53,6 +53,8 @@ message User { // The user specification UserSpec spec = 3; // The current state of the user + // Possible values: activating, activationfailed, active, updating, updatefailed, deleting, deletefailed, deleted, suspending, suspendfailed, suspended + // For any failed state, reach out to Temporal Cloud support for remediation. string state = 4; // The id of the async operation that is creating/updating/deleting the user, if any string async_operation_id = 5; diff --git a/temporal/api/cloud/namespace/v1/message.proto b/temporal/api/cloud/namespace/v1/message.proto index 9c8db23..343ea57 100644 --- a/temporal/api/cloud/namespace/v1/message.proto +++ b/temporal/api/cloud/namespace/v1/message.proto @@ -107,6 +107,8 @@ message Namespace { // The namespace specification. NamespaceSpec spec = 3; // The current state of the namespace. + // Possible values: activating, activationfailed, active, updating, updatefailed, deleting, deletefailed, deleted, suspending, suspendfailed, suspended. + // For any failed state, reach out to Temporal Cloud support for remediation. string state = 4; // The id of the async operation that is creating/updating/deleting the namespace, if any. string async_operation_id = 5; From ae200d89b3a8c2dfa0221686ad744d5ee8434530 Mon Sep 17 00:00:00 2001 From: Abhinav Nekkanti <10552725+anekkanti@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:32:42 -0800 Subject: [PATCH 4/4] address review comments --- temporal/api/cloud/account/v1/message.proto | 4 ++-- temporal/api/cloud/identity/v1/message.proto | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/temporal/api/cloud/account/v1/message.proto b/temporal/api/cloud/account/v1/message.proto index aaffe17..0b89dfc 100644 --- a/temporal/api/cloud/account/v1/message.proto +++ b/temporal/api/cloud/account/v1/message.proto @@ -24,13 +24,13 @@ message Metrics { } message Account { - // The account specification + // The account specification. AccountSpec spec = 1; // The current version of the account specification. // The next update operation will have to include this version. string resource_version = 2; // The current state of the account. - // Possible values: activating, activationfailed, active, updating, updatefailed, deleting, deletefailed, deleted, suspending, suspendfailed, suspended + // Possible values: activating, activationfailed, active, updating, updatefailed, deleting, deletefailed, deleted, suspending, suspendfailed, suspended. // For any failed state, reach out to Temporal Cloud support for remediation. string state = 3; // The id of the async operation that is updating the account, if any. diff --git a/temporal/api/cloud/identity/v1/message.proto b/temporal/api/cloud/identity/v1/message.proto index 0b7904a..0cfb14b 100644 --- a/temporal/api/cloud/identity/v1/message.proto +++ b/temporal/api/cloud/identity/v1/message.proto @@ -53,7 +53,7 @@ message User { // The user specification UserSpec spec = 3; // The current state of the user - // Possible values: activating, activationfailed, active, updating, updatefailed, deleting, deletefailed, deleted, suspending, suspendfailed, suspended + // Possible values: activating, activationfailed, active, updating, updatefailed, deleting, deletefailed, deleted, suspending, suspendfailed, suspended. // For any failed state, reach out to Temporal Cloud support for remediation. string state = 4; // The id of the async operation that is creating/updating/deleting the user, if any