-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Because - we want to manage users in an independent backend `mgmt-backend`. This commit - add proto file - add generated OpenAPI YAML file
- Loading branch information
1 parent
bc13658
commit 59f03aa
Showing
2 changed files
with
605 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
syntax = "proto3"; | ||
|
||
package instill.mgmt.v1alpha; | ||
|
||
// Protocol Buffers Well-known Types | ||
import "google/protobuf/field_mask.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
// Google API | ||
import "google/api/annotations.proto"; | ||
import "google/api/field_behavior.proto"; | ||
|
||
// HealthCheckRequest represents a request to health check a service | ||
message HealthCheckRequest { | ||
// Service name to check for its readiness status | ||
string service = 1; | ||
} | ||
|
||
// HealthCheckResponse represents a response for a service heath status | ||
message HealthCheckResponse { | ||
// ServingStatus enumerates the status of a queried service | ||
enum ServingStatus { | ||
// Serving status: UNSPECIFIED | ||
SERVING_STATUS_UNSPECIFIED = 0; | ||
// Serving status: SERVING | ||
SERVING_STATUS_SERVING = 1; | ||
// Serving status: NOT SERVING | ||
SERVING_STATUS_NOT_SERVING = 2; | ||
} | ||
|
||
// Status is the instance of the enum type ServingStatus | ||
ServingStatus status = 1 [ (google.api.field_behavior) = OUTPUT_ONLY ]; | ||
} | ||
|
||
// LivenessRequest represents a request to check a service liveness status | ||
message LivenessRequest { | ||
// HealthCheckRequest message | ||
HealthCheckRequest health_check_request = 1 [(google.api.field_behavior) = OPTIONAL]; | ||
} | ||
|
||
// LivenessResponse represents a response for a service liveness status | ||
message LivenessResponse { | ||
// HealthCheckResponse message | ||
HealthCheckResponse health_check_response = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; | ||
} | ||
|
||
// ReadinessRequest represents a request to check a service readiness status | ||
message ReadinessRequest { | ||
// HealthCheckRequest message | ||
HealthCheckRequest health_check_request = 1 [(google.api.field_behavior) = OPTIONAL]; | ||
} | ||
|
||
// ReadinessResponse represents a response for a service readiness status | ||
message ReadinessResponse { | ||
// HealthCheckResponse message | ||
HealthCheckResponse health_check_response = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; | ||
} | ||
|
||
// User represents the content of a user | ||
message User { | ||
// Resource name of the user. It must have the format of "users/*". | ||
// For example: "users/instill". | ||
string name = 1 [ (google.api.field_behavior) = OUTPUT_ONLY ] ; | ||
|
||
// User ID in UUIDv4 | ||
string id = 2 [ (google.api.field_behavior) = OUTPUT_ONLY ]; | ||
// User email | ||
optional string email = 3 [ (google.api.field_behavior) = OPTIONAL ]; | ||
// User login user name, which is also the resource ID (the last segment of the resource name) | ||
string login = 4 [ (google.api.field_behavior) = REQUIRED ]; | ||
// User company name | ||
optional string company_name = 5 [ (google.api.field_behavior) = OPTIONAL ]; | ||
// User role | ||
// Allowed roles: | ||
// [ "manager", "ai-researcher", "ai-engineer", "data-engineer", "data-scientist", | ||
// "analytics-engineer", "hobbyist"] | ||
optional string role = 6 [ (google.api.field_behavior) = OPTIONAL ]; | ||
// User usage data collection | ||
bool usage_data_collection = 7 [ (google.api.field_behavior) = REQUIRED ]; | ||
// User newsletter subscription | ||
bool newsletter_subscription = 8 [ (google.api.field_behavior) = REQUIRED ]; | ||
// User creation time | ||
google.protobuf.Timestamp created_at = 9 [ (google.api.field_behavior) = OUTPUT_ONLY ]; | ||
// User update time | ||
google.protobuf.Timestamp updated_at = 10 [ (google.api.field_behavior) = OUTPUT_ONLY ]; | ||
} | ||
|
||
// ListUserRequest represents a request to list all users | ||
message ListUserRequest { | ||
// Page size | ||
int32 page_size = 1 [ (google.api.field_behavior) = OPTIONAL ]; | ||
// Page cursor | ||
string page_cursor = 2 [ (google.api.field_behavior) = OPTIONAL ]; | ||
} | ||
|
||
// ListUserResponse represents a response for a list of user roles | ||
message ListUserResponse { | ||
// A list of users | ||
repeated User users = 1 [ (google.api.field_behavior) = OUTPUT_ONLY ]; | ||
// Next page cursor | ||
string next_page_cursor = 2 [ (google.api.field_behavior) = OUTPUT_ONLY ]; | ||
} | ||
|
||
// GetUserRequest represents a request to query a user | ||
message GetUserRequest { | ||
// Resource name of a user. For example: | ||
// "users/instill" | ||
string name = 1 [ (google.api.field_behavior) = REQUIRED ]; | ||
} | ||
|
||
// GetUserResponse represents a response for a user instance | ||
message GetUserResponse { | ||
// A user instance | ||
User user = 1 [ (google.api.field_behavior) = REQUIRED ]; | ||
} | ||
|
||
// UpdateUserRequest represents a request to update a user | ||
message UpdateUserRequest { | ||
// The user to update | ||
// | ||
// The user's `name` field is used to identify the user to update. | ||
// Format: users/{user} | ||
User user = 1 [ (google.api.field_behavior) = REQUIRED ]; | ||
// Update mask for a user instance | ||
google.protobuf.FieldMask field_mask = 2; | ||
} | ||
|
||
// UpdateUserResponse represents a response for a user instance | ||
message UpdateUserResponse { | ||
// A user instance | ||
User user = 1 [ (google.api.field_behavior) = REQUIRED ]; | ||
} | ||
|
||
|
||
// User service responds to incoming user requests. | ||
service UserService { | ||
|
||
// Liveness method receives a LivenessRequest message and returns a | ||
// LivenessResponse message. | ||
// See https://github.com/grpc/grpc/blob/master/doc/health-checking.md | ||
rpc Liveness(LivenessRequest) returns (LivenessResponse) { | ||
option (google.api.http) = { | ||
get : "/__liveness" | ||
additional_bindings : [ {get : "/health/mgmt"} ] | ||
}; | ||
} | ||
|
||
// Readiness method receives a ReadinessRequest message and returns a | ||
// ReadinessResponse message. | ||
// See https://github.com/grpc/grpc/blob/master/doc/health-checking.md | ||
rpc Readiness(ReadinessRequest) returns (ReadinessResponse) { | ||
option (google.api.http) = { | ||
get : "/__readiness" | ||
}; | ||
} | ||
|
||
// ListUser method receives a ListUserRequest message and returns a | ||
// ListUserResponse message. | ||
rpc ListUser(ListUserRequest) returns (ListUserResponse) { | ||
option (google.api.http) = { | ||
get : "/users" | ||
}; | ||
} | ||
|
||
// GetUser method receives a GetUserRequest message and returns | ||
// a GetUserResponse message. | ||
rpc GetUser(GetUserRequest) returns (GetUserResponse) { | ||
option (google.api.http) = { | ||
get : "/{name=users/*}" | ||
}; | ||
} | ||
|
||
// UpdateUser method receives a UpdateUserRequest message and returns | ||
// a UpdateUserResponse | ||
rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse) { | ||
option (google.api.http) = { | ||
patch : "/{user.name=users/*}" | ||
body : "user" | ||
}; | ||
} | ||
|
||
} |
Oops, something went wrong.