Skip to content

Commit 1355dd6

Browse files
authored
Token with labels, console token is user token now (#60)
1 parent 52c21e2 commit 1355dd6

File tree

7 files changed

+199
-130
lines changed

7 files changed

+199
-130
lines changed

doc/index.html

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12534,6 +12534,13 @@ <h3 id="metalstack.api.v2.Token">Token</h3>
1253412534
<td><p>User who created this token </p></td>
1253512535
</tr>
1253612536

12537+
<tr>
12538+
<td>meta</td>
12539+
<td><a href="#metalstack.api.v2.Meta">Meta</a></td>
12540+
<td></td>
12541+
<td><p>Meta for this token </p></td>
12542+
</tr>
12543+
1253712544
<tr>
1253812545
<td>description</td>
1253912546
<td><a href="#string">string</a></td>
@@ -12711,6 +12718,13 @@ <h3 id="metalstack.api.v2.TokenServiceCreateRequest">TokenServiceCreateRequest</
1271112718
<td><p>AdminRole defines the admin role of the token owner </p></td>
1271212719
</tr>
1271312720

12721+
<tr>
12722+
<td>labels</td>
12723+
<td><a href="#metalstack.api.v2.Labels">Labels</a></td>
12724+
<td></td>
12725+
<td><p>Labels on this token </p></td>
12726+
</tr>
12727+
1271412728
</tbody>
1271512729
</table>
1271612730

@@ -13019,6 +13033,13 @@ <h3 id="metalstack.api.v2.TokenServiceUpdateRequest">TokenServiceUpdateRequest</
1301913033
<td><p>AdminRole defines the admin role of the token owner </p></td>
1302013034
</tr>
1302113035

13036+
<tr>
13037+
<td>labels</td>
13038+
<td><a href="#metalstack.api.v2.UpdateLabels">UpdateLabels</a></td>
13039+
<td></td>
13040+
<td><p>Labels on this token </p></td>
13041+
</tr>
13042+
1302213043
</tbody>
1302313044
</table>
1302413045

@@ -13135,9 +13156,9 @@ <h3 id="metalstack.api.v2.TokenType">TokenType</h3>
1313513156
</tr>
1313613157

1313713158
<tr>
13138-
<td>TOKEN_TYPE_CONSOLE</td>
13159+
<td>TOKEN_TYPE_USER</td>
1313913160
<td>2</td>
13140-
<td><p>TOKEN_TYPE_CONSOLE is a token for console or web ui usage</p></td>
13161+
<td><p>TOKEN_TYPE_USER is a token to access the api with cli, a web application or other user induced actions.</p></td>
1314113162
</tr>
1314213163

1314313164
</tbody>

go/metalstack/api/v2/token.pb.go

Lines changed: 106 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
MAKEFLAGS += --no-print-directory
2-
BUF_VERSION := 1.57.2
2+
BUF_VERSION := 1.58.0
33

44
_buf:
55
docker run --rm \

proto/buf.gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ plugins:
1616
- remote: buf.build/protocolbuffers/go:v1.36.10
1717
out: ../go
1818
opt: paths=source_relative
19-
- remote: buf.build/connectrpc/go:v1.19.0
19+
- remote: buf.build/connectrpc/go:v1.19.1
2020
out: ../go
2121
opt: paths=source_relative
2222
# python

proto/metalstack/api/v2/token.proto

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ message Token {
4545
min_len: 2
4646
max_len: 512
4747
}];
48+
// Meta for this token
49+
Meta meta = 3;
4850
// Description is a user given description of this token.
49-
string description = 3 [(buf.validate.field).string.(metalstack.api.v2.is_description) = true];
51+
string description = 4 [(buf.validate.field).string.(metalstack.api.v2.is_description) = true];
5052
// Permissions is a list of service methods this token can be used for
51-
repeated MethodPermission permissions = 4 [(buf.validate.field).repeated.max_items = 500];
53+
repeated MethodPermission permissions = 5 [(buf.validate.field).repeated.max_items = 500];
5254
// Expires gives the date in the future after which this token can not be used anymore
5355
google.protobuf.Timestamp expires = 6;
5456
// IssuedAt gives the date when this token was created
@@ -69,8 +71,8 @@ enum TokenType {
6971
TOKEN_TYPE_UNSPECIFIED = 0;
7072
// TOKEN_TYPE_API is a token for api usage
7173
TOKEN_TYPE_API = 1;
72-
// TOKEN_TYPE_CONSOLE is a token for console or web ui usage
73-
TOKEN_TYPE_CONSOLE = 2;
74+
// TOKEN_TYPE_USER is a token to access the api with cli, a web application or other user induced actions.
75+
TOKEN_TYPE_USER = 2;
7476
}
7577

7678
// TokenServiceCreateRequest is the request payload to create a token
@@ -107,6 +109,8 @@ message TokenServiceCreateRequest {
107109
}];
108110
// AdminRole defines the admin role of the token owner
109111
optional AdminRole admin_role = 7 [(buf.validate.field).enum.defined_only = true];
112+
// Labels on this token
113+
Labels labels = 8;
110114
}
111115

112116
// MethodPermission is a mapping from a subject/project to a service method
@@ -181,6 +185,8 @@ message TokenServiceUpdateRequest {
181185
}];
182186
// AdminRole defines the admin role of the token owner
183187
optional AdminRole admin_role = 7 [(buf.validate.field).enum.defined_only = true];
188+
// Labels on this token
189+
UpdateLabels labels = 8;
184190
}
185191

186192
// TokenServiceUpdateResponse is the response payload of a token update request

0 commit comments

Comments
 (0)