Skip to content

Commit ca781ca

Browse files
Arista Jenkinsubalogun-arista
authored andcommitted
update/serviceaccount.v1: added refreshing service account tokens
This change adds a new service for service accounts to be able to refresh their service account tokens. [GENERATED_COMMIT] Change-Id: Id991402a4dd8aea1351d3d72e5efc0dc54d67080
1 parent 0fbbe34 commit ca781ca

5 files changed

Lines changed: 549 additions & 40 deletions

File tree

arista/serviceaccount/v1/serviceaccount_pb2.py

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

arista/serviceaccount/v1/serviceaccount_pb2.pyi

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class AccountConfig(google.protobuf.message.Message):
7979
STATUS_FIELD_NUMBER: builtins.int
8080
DESCRIPTION_FIELD_NUMBER: builtins.int
8181
GROUPS_FIELD_NUMBER: builtins.int
82+
ALLOW_TOKEN_REFRESH_FIELD_NUMBER: builtins.int
8283
status: global___AccountStatus.ValueType
8384
"""status determines if the service account is enabled or disabled. New service accounts are
8485
enabled by default.
@@ -95,16 +96,23 @@ class AccountConfig(google.protobuf.message.Message):
9596
def groups(self) -> fmp.wrappers_pb2.RepeatedString:
9697
"""groups is a list of roles that the service account inherits permissions from."""
9798

99+
@property
100+
def allow_token_refresh(self) -> google.protobuf.wrappers_pb2.BoolValue:
101+
"""allow_token_refresh determines whether or not the service account can refresh
102+
any of its own active tokens, including preexisting ones.
103+
"""
104+
98105
def __init__(
99106
self,
100107
*,
101108
key: global___AccountKey | None = ...,
102109
status: global___AccountStatus.ValueType = ...,
103110
description: google.protobuf.wrappers_pb2.StringValue | None = ...,
104111
groups: fmp.wrappers_pb2.RepeatedString | None = ...,
112+
allow_token_refresh: google.protobuf.wrappers_pb2.BoolValue | None = ...,
105113
) -> None: ...
106-
def HasField(self, field_name: typing.Literal["description", b"description", "groups", b"groups", "key", b"key"]) -> builtins.bool: ...
107-
def ClearField(self, field_name: typing.Literal["description", b"description", "groups", b"groups", "key", b"key", "status", b"status"]) -> None: ...
114+
def HasField(self, field_name: typing.Literal["allow_token_refresh", b"allow_token_refresh", "description", b"description", "groups", b"groups", "key", b"key"]) -> builtins.bool: ...
115+
def ClearField(self, field_name: typing.Literal["allow_token_refresh", b"allow_token_refresh", "description", b"description", "groups", b"groups", "key", b"key", "status", b"status"]) -> None: ...
108116

109117
global___AccountConfig = AccountConfig
110118

@@ -120,6 +128,7 @@ class Account(google.protobuf.message.Message):
120128
GROUPS_FIELD_NUMBER: builtins.int
121129
CREATED_BY_FIELD_NUMBER: builtins.int
122130
LAST_ACCESS_FIELD_NUMBER: builtins.int
131+
ALLOW_TOKEN_REFRESH_FIELD_NUMBER: builtins.int
123132
status: global___AccountStatus.ValueType
124133
"""status determines whether the service account is enabled or disabled."""
125134
@property
@@ -142,6 +151,12 @@ class Account(google.protobuf.message.Message):
142151
def last_access(self) -> google.protobuf.timestamp_pb2.Timestamp:
143152
"""last_access is the time when the service account was last fetched."""
144153

154+
@property
155+
def allow_token_refresh(self) -> google.protobuf.wrappers_pb2.BoolValue:
156+
"""allow_token_refresh determines whether or not the service account can refresh
157+
any of its own active tokens, including preexisting ones.
158+
"""
159+
145160
def __init__(
146161
self,
147162
*,
@@ -151,9 +166,10 @@ class Account(google.protobuf.message.Message):
151166
groups: fmp.wrappers_pb2.RepeatedString | None = ...,
152167
created_by: google.protobuf.wrappers_pb2.StringValue | None = ...,
153168
last_access: google.protobuf.timestamp_pb2.Timestamp | None = ...,
169+
allow_token_refresh: google.protobuf.wrappers_pb2.BoolValue | None = ...,
154170
) -> None: ...
155-
def HasField(self, field_name: typing.Literal["created_by", b"created_by", "description", b"description", "groups", b"groups", "key", b"key", "last_access", b"last_access"]) -> builtins.bool: ...
156-
def ClearField(self, field_name: typing.Literal["created_by", b"created_by", "description", b"description", "groups", b"groups", "key", b"key", "last_access", b"last_access", "status", b"status"]) -> None: ...
171+
def HasField(self, field_name: typing.Literal["allow_token_refresh", b"allow_token_refresh", "created_by", b"created_by", "description", b"description", "groups", b"groups", "key", b"key", "last_access", b"last_access"]) -> builtins.bool: ...
172+
def ClearField(self, field_name: typing.Literal["allow_token_refresh", b"allow_token_refresh", "created_by", b"created_by", "description", b"description", "groups", b"groups", "key", b"key", "last_access", b"last_access", "status", b"status"]) -> None: ...
157173

158174
global___Account = Account
159175

@@ -209,7 +225,7 @@ class TokenConfig(google.protobuf.message.Message):
209225

210226
@property
211227
def token(self) -> google.protobuf.wrappers_pb2.StringValue:
212-
"""token is the JWT token generated for a service account token.
228+
"""token is the JWT generated for a service account token.
213229
It is only populated in Set response.
214230
"""
215231

@@ -239,6 +255,7 @@ class Token(google.protobuf.message.Message):
239255
VALID_UNTIL_FIELD_NUMBER: builtins.int
240256
CREATED_BY_FIELD_NUMBER: builtins.int
241257
LAST_USED_FIELD_NUMBER: builtins.int
258+
REPLACED_AT_FIELD_NUMBER: builtins.int
242259
@property
243260
def key(self) -> global___TokenKey:
244261
"""key uniquely identifies the service account token."""
@@ -263,6 +280,12 @@ class Token(google.protobuf.message.Message):
263280
def last_used(self) -> google.protobuf.timestamp_pb2.Timestamp:
264281
"""last_used is the time when the service account token was last used to authenticate."""
265282

283+
@property
284+
def replaced_at(self) -> google.protobuf.timestamp_pb2.Timestamp:
285+
"""replaced_at is the time which the token has been replaced.
286+
It is only populated when the token is refreshed.
287+
"""
288+
266289
def __init__(
267290
self,
268291
*,
@@ -272,8 +295,40 @@ class Token(google.protobuf.message.Message):
272295
valid_until: google.protobuf.timestamp_pb2.Timestamp | None = ...,
273296
created_by: google.protobuf.wrappers_pb2.StringValue | None = ...,
274297
last_used: google.protobuf.timestamp_pb2.Timestamp | None = ...,
298+
replaced_at: google.protobuf.timestamp_pb2.Timestamp | None = ...,
275299
) -> None: ...
276-
def HasField(self, field_name: typing.Literal["created_by", b"created_by", "description", b"description", "key", b"key", "last_used", b"last_used", "user", b"user", "valid_until", b"valid_until"]) -> builtins.bool: ...
277-
def ClearField(self, field_name: typing.Literal["created_by", b"created_by", "description", b"description", "key", b"key", "last_used", b"last_used", "user", b"user", "valid_until", b"valid_until"]) -> None: ...
300+
def HasField(self, field_name: typing.Literal["created_by", b"created_by", "description", b"description", "key", b"key", "last_used", b"last_used", "replaced_at", b"replaced_at", "user", b"user", "valid_until", b"valid_until"]) -> builtins.bool: ...
301+
def ClearField(self, field_name: typing.Literal["created_by", b"created_by", "description", b"description", "key", b"key", "last_used", b"last_used", "replaced_at", b"replaced_at", "user", b"user", "valid_until", b"valid_until"]) -> None: ...
278302

279303
global___Token = Token
304+
305+
@typing.final
306+
class TokenSelfRefreshConfig(google.protobuf.message.Message):
307+
"""TokenSelfRefreshConfig describes the response a service account gets when they refresh their token"""
308+
309+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
310+
311+
VALID_FOR_FIELD_NUMBER: builtins.int
312+
NEW_TOKEN_FIELD_NUMBER: builtins.int
313+
@property
314+
def valid_for(self) -> google.protobuf.duration_pb2.Duration:
315+
"""valid_for is the duration that the service account token will be valid for.
316+
Default value will be the original token duration.
317+
"""
318+
319+
@property
320+
def new_token(self) -> google.protobuf.wrappers_pb2.StringValue:
321+
"""new_token is the JWT token generated for a service account token.
322+
This is populated in the response of a Set() request.
323+
"""
324+
325+
def __init__(
326+
self,
327+
*,
328+
valid_for: google.protobuf.duration_pb2.Duration | None = ...,
329+
new_token: google.protobuf.wrappers_pb2.StringValue | None = ...,
330+
) -> None: ...
331+
def HasField(self, field_name: typing.Literal["new_token", b"new_token", "valid_for", b"valid_for"]) -> builtins.bool: ...
332+
def ClearField(self, field_name: typing.Literal["new_token", b"new_token", "valid_for", b"valid_for"]) -> None: ...
333+
334+
global___TokenSelfRefreshConfig = TokenSelfRefreshConfig

0 commit comments

Comments
 (0)