/
serviceaccounts.go
54 lines (49 loc) · 1.65 KB
/
serviceaccounts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package presenters
import (
"github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/internal/kafka/internal/api/public"
"github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/pkg/api"
)
func ConvertServiceAccountRequest(account public.ServiceAccountRequest) *api.ServiceAccountRequest {
return &api.ServiceAccountRequest{
Name: account.Name,
Description: account.Description,
}
}
func PresentServiceAccount(account *api.ServiceAccount) *public.ServiceAccount {
reference := PresentReference(account.ID, account)
return &public.ServiceAccount{
ClientId: account.ClientID,
ClientSecret: account.ClientSecret,
Name: account.Name,
Description: account.Description,
DeprecatedOwner: account.CreatedBy,
CreatedAt: account.CreatedAt,
CreatedBy: account.CreatedBy,
Id: reference.Id,
Kind: reference.Kind,
Href: reference.Href,
}
}
func PresentServiceAccountListItem(account *api.ServiceAccount) public.ServiceAccountListItem {
ref := PresentReference(account.ID, account)
return public.ServiceAccountListItem{
Id: ref.Id,
Kind: ref.Kind,
Href: ref.Href,
ClientId: account.ClientID,
Name: account.Name,
DeprecatedOwner: account.CreatedBy,
Description: account.Description,
CreatedAt: account.CreatedAt,
CreatedBy: account.CreatedBy,
}
}
func PresentSsoProvider(provider *api.SsoProvider) public.SsoProvider {
return public.SsoProvider{
Name: provider.Name,
Jwks: provider.Jwks,
BaseUrl: provider.BaseUrl,
TokenUrl: provider.TokenUrl,
ValidIssuer: provider.ValidIssuer,
}
}