Skip to content

[public-api] define endpoints for ports and git token #15110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion components/public-api/gitpod/experimental/v1/user.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ service UserService {
// GetAuthenticatedUser gets the user info.
rpc GetAuthenticatedUser(GetAuthenticatedUserRequest) returns (GetAuthenticatedUserResponse) {};


// ListSSHKeys lists the public SSH keys.
rpc ListSSHKeys(ListSSHKeysRequest) returns (ListSSHKeysResponse) {};

Expand All @@ -50,6 +49,8 @@ service UserService {

// DeleteSSHKey removes a public SSH key.
rpc DeleteSSHKey(DeleteSSHKeyRequest) returns (DeleteSSHKeyResponse) {}

rpc GetGitToken(GetGitTokenRequest) returns (GetGitTokenResponse) {}
}

message GetAuthenticatedUserRequest {
Expand Down Expand Up @@ -96,3 +97,34 @@ message DeleteSSHKeyRequest {

message DeleteSSHKeyResponse {
}

message GetGitTokenRequest {
string host = 1;
}

message GetGitTokenResponse {
GitToken token = 1;
}

message GitToken {
// expiry_date is the date when the token will expire
string expiry_date = 1;

// id_token is the unique identifier for the token
string id_token = 2;

// refresh_token is the token used to refresh the git token
string refresh_token = 3;

// scopes is a list of permissions associated with the token
repeated string scopes = 4;

// update_date is the date when the token was last updated
string update_date = 5;

// username is the username associated with the token
string username = 6;

// value is the actual token value for the token
string value = 7;
}
42 changes: 42 additions & 0 deletions components/public-api/gitpod/experimental/v1/workspaces.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ service WorkspacesService {
// NOT_FOUND: the workspace_id is unkown
// FAILED_PRECONDITION: if there's no running instance
rpc StopWorkspace(StopWorkspaceRequest) returns (stream StopWorkspaceResponse) {}

rpc UpdatePort(UpdatePortRequest) returns (UpdatePortResponse) {}
}

message ListWorkspacesRequest {
Expand Down Expand Up @@ -249,12 +251,37 @@ message WorkspaceInstanceStatus {
// Admission describes who can access a workspace instance and its ports.
AdmissionLevel admission = 6;

// ports is the list of exposed ports in the workspace.
repeated Port ports = 7;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bit of an assymetry here.

ControlPort(ControlPortRequest) is identified by Workspace ID, but the resulting ports are shown on the Workspace Instance. What limits us from putting the Ports on the WorkspaceStatus rather than the WorkspaceInstanceStatus?


// repo details the Git working copy status of the workspace.
// Note: this is a best-effort field and more often than not will not be present. Its absence does not
// indicate the absence of a working copy.
// contentservice.GitStatus repo = 7;
}

// PortPolicy defines the accssbility policy of a workspace port is guarded by an authentication in the proxy
enum PortPolicy {
PORT_POLICY_UNSPECIFIED = 0;

// Private means the port is accessible by the workspace owner only using the workspace port URL
PORT_POLICY_PRIVATE = 1;

// Public means the port is accessible by everybody using the workspace port URL
PORT_POLICY_PUBLIC = 2;
}

message Port {
// port number
uint64 port = 1;

// policy of this port
PortPolicy policy = 2;

// url that can be used to access the port
string url = 3;
}

// Admission level describes who can access a workspace instance and its ports.
enum AdmissionLevel {
ADMISSION_LEVEL_UNSPECIFIED = 0;
Expand All @@ -270,3 +297,18 @@ enum AdmissionLevel {
message StartWorkspaceSpec {
// future per-workspace-start fields, e.g. region
}

message PortSpec {
// port number
uint64 port = 1;

// policy of this port
PortPolicy policy = 2;
}

message UpdatePortRequest {
string workspace_id = 1;
PortSpec port = 2;
}

message UpdatePortResponse {}
Loading