diff --git a/api/service_account.go b/api/service_account.go new file mode 100644 index 000000000..868f2af08 --- /dev/null +++ b/api/service_account.go @@ -0,0 +1,41 @@ +package api + +import ( + "time" + + "github.com/distr-sh/distr/internal/types" + "github.com/google/uuid" +) + +type ServiceAccountResponse struct { + ID uuid.UUID `json:"id"` + CreatedAt time.Time `json:"createdAt"` + Name string `json:"name"` + AccountRole types.AccountRole `json:"accountRole"` + CustomerOrganizationID *uuid.UUID `json:"customerOrganizationId,omitempty"` +} + +type CreateServiceAccountRequest struct { + Name string `json:"name"` + AccountRole types.AccountRole `json:"accountRole"` + CustomerOrganizationID *uuid.UUID `json:"customerOrganizationId,omitempty"` +} + +type PatchServiceAccountRequest struct { + Name *string `json:"name"` + AccountRole *types.AccountRole `json:"accountRole"` +} + +type ServiceAccountIDRequest struct { + ServiceAccountID string `json:"-" path:"serviceAccountId"` +} + +type ServiceAccountAccessTokenIDRequest struct { + ServiceAccountID string `json:"-" path:"serviceAccountId"` + TokenID string `json:"-" path:"tokenId"` +} + +type CreateServiceAccountAccessTokenRequest struct { + ExpiresAt *time.Time `json:"expiresAt"` + Label *string `json:"label"` +} diff --git a/frontend/ui/src/app/access-tokens/access-tokens-table.component.html b/frontend/ui/src/app/access-tokens/access-tokens-table.component.html new file mode 100644 index 000000000..809579414 --- /dev/null +++ b/frontend/ui/src/app/access-tokens/access-tokens-table.component.html @@ -0,0 +1,141 @@ +
+ {{ keyDisplayText() }}
+ {{ t.key }}
+
+ Important: + This is the only time you will be able to see this token, so please make sure to note it down before closing + this page. +
+| Label | +Creation Date | +Expires | +Last Used | ++ |
|---|---|---|---|---|
| {{ token.label }} | +{{ token.createdAt | date: 'medium' }} | ++ @if (token.expiresAt; as d) { + {{ d | date }} + @if (isExpired(token)) { + (expired) + } + } @else { + never + } + | ++ @if (token.lastUsedAt; as d) { + {{ d | relativeDate }} + } @else { + never + } + | ++ + | +
| No tokens yet. | +||||
+ Role: {{ sa.accountRole | titlecase }} +
+Created {{ sa.createdAt | date: 'medium' }}
+
- Your Personal Access Token:
- {{ t.key }}
-
- Important: - This is the only time you will be able to see this token, so please make sure to note it down before closing - this page. -
-| Label | -Creation Date | -Expires | -Last Used | +Name | +Role | +Created | |
|---|---|---|---|---|---|---|---|
| {{ token.label }} | -{{ token.createdAt | date: 'medium' }} | -- @if (token.expiresAt; as d) { - {{ d | date }} - @if (isExpired(token)) { - (expired) - } - } @else { - never - } - | -- @if (token.lastUsedAt; as d) { - {{ d | relativeDate }} - } @else { - never - } - | +{{ sa.name }} | +{{ sa.accountRole | titlecase }} | +{{ sa.createdAt | date: 'medium' }} |
+
+ |
| + No service accounts yet. + | +|||||||