|
| 1 | +syntax = "proto3"; |
| 2 | + |
| 3 | +package gitpod.experimental.v1; |
| 4 | + |
| 5 | +option go_package = "github.com/gitpod-io/gitpod/components/public-api/go/experimental/v1"; |
| 6 | + |
| 7 | +import "google/protobuf/timestamp.proto"; |
| 8 | +import "google/protobuf/field_mask.proto"; |
| 9 | + |
| 10 | +// PersonalAccessToken represents details of an access token for personal use. |
| 11 | +message PersonalAccessToken { |
| 12 | + // id is the unique identifier of this token |
| 13 | + // Read only. |
| 14 | + string id = 1; |
| 15 | + |
| 16 | + // value is the secret value of the token |
| 17 | + // The value property is only populated when the PersonalAccessToken is first created, and never again. |
| 18 | + // If you you want to compare your existing token, use the hash property |
| 19 | + // Read only. |
| 20 | + string value = 2; |
| 21 | + |
| 22 | + // hash is the SHA-512 hash of the token value |
| 23 | + // You can use the hash to compare a token you hold against the one we keep on record by doing `echo -n $TOKEN | sha256sum`. |
| 24 | + // Read only. |
| 25 | + string hash = 3; |
| 26 | + |
| 27 | + // name is the name of the token for humans, set by the user |
| 28 | + string name = 4; |
| 29 | + |
| 30 | + // description is the description of the token set by the user |
| 31 | + string description = 5; |
| 32 | + |
| 33 | + // expiration_time is the time when the token expires |
| 34 | + // Read only. |
| 35 | + google.protobuf.Timestamp expiration_time = 6; |
| 36 | + |
| 37 | + // scopes are the permission scopes attached to this token. |
| 38 | + // By default, no scopes are attached and therefore no access is granted to this token. |
| 39 | + // Specifying '*' grants all permissions the owner of the token has. |
| 40 | + repeated string scopes = 7; |
| 41 | + |
| 42 | + // created_time is the time when the token was first created. |
| 43 | + google.protobuf.Timestamp created_at = 8; |
| 44 | +} |
| 45 | + |
| 46 | +service TokensService { |
| 47 | + |
| 48 | + // CreatePersonalAccessTokenRequest creates a new token. |
| 49 | + rpc CreatePersonalAccessToken(CreatePersonalAccessTokenRequest) returns (CreatePersonalAccessTokenResponse) {} |
| 50 | + |
| 51 | + // ListPersonalAccessTokens returns token by ID. |
| 52 | + rpc GetPersonalAccessToken(GetPersonalAccessTokenRequest) returns (GetPersonalAccessTokenResponse) {} |
| 53 | + |
| 54 | + // ListPersonalAccessTokens returns a list of tokens. |
| 55 | + rpc ListPersonalAccessTokens(ListPersonalAccessTokensRequest) returns (ListPersonalAccessTokensResponse) {} |
| 56 | + |
| 57 | + // RegeneratePersonalAccessToken generates a new token and replaces the previous one. |
| 58 | + rpc RegeneratePersonalAccessToken(RegeneratePersonalAccessTokenRequest) returns (RegeneratePersonalAccessTokenResponse) {} |
| 59 | + |
| 60 | + // UpdatePersonalAccessToken updates writable properties of a PersonalAccessToken. |
| 61 | + rpc UpdatePersonalAccessToken(UpdatePersonalAccessTokenRequest) returns (UpdatePersonalAccessTokenResponse) {} |
| 62 | + |
| 63 | + // DeletePersonalAccessToken removes token by ID. |
| 64 | + rpc DeletePersonalAccessToken(DeletePersonalAccessTokenRequest) returns (DeletePersonalAccessTokenResponse) {} |
| 65 | +} |
| 66 | + |
| 67 | +message CreatePersonalAccessTokenRequest { |
| 68 | + PersonalAccessToken token = 1; |
| 69 | +} |
| 70 | + |
| 71 | +message CreatePersonalAccessTokenResponse { |
| 72 | + PersonalAccessToken token = 1; |
| 73 | +} |
| 74 | + |
| 75 | +message GetPersonalAccessTokenRequest { |
| 76 | + string id = 1; |
| 77 | +} |
| 78 | + |
| 79 | +message GetPersonalAccessTokenResponse { |
| 80 | + PersonalAccessToken token = 1; |
| 81 | +} |
| 82 | + |
| 83 | +message ListPersonalAccessTokensRequest { |
| 84 | +} |
| 85 | + |
| 86 | +message ListPersonalAccessTokensResponse { |
| 87 | + repeated PersonalAccessToken tokens = 1; |
| 88 | +} |
| 89 | + |
| 90 | +message RegeneratePersonalAccessTokenRequest { |
| 91 | + // expiration time is the time when the new token should expire |
| 92 | + google.protobuf.Timestamp expiration_time = 1; |
| 93 | +} |
| 94 | + |
| 95 | +message RegeneratePersonalAccessTokenResponse { |
| 96 | + PersonalAccessToken token = 1; |
| 97 | +} |
| 98 | + |
| 99 | +message UpdatePersonalAccessTokenRequest { |
| 100 | + PersonalAccessToken token = 1; |
| 101 | + google.protobuf.FieldMask update_mask = 2; |
| 102 | +} |
| 103 | + |
| 104 | +message UpdatePersonalAccessTokenResponse { |
| 105 | + PersonalAccessToken token = 1; |
| 106 | +} |
| 107 | + |
| 108 | +message DeletePersonalAccessTokenRequest { |
| 109 | + string id = 1; |
| 110 | +} |
| 111 | + |
| 112 | +message DeletePersonalAccessTokenResponse { |
| 113 | +} |
0 commit comments