generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 13
/
clienttypes.go
109 lines (90 loc) · 2.67 KB
/
clienttypes.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package btpcli
import (
"io"
)
/* Login */
// NewLoginRequest returns a new LoginRequest with `ldap` as default IdentityProvider set.
func NewLoginRequest(globalaccountSubdomain string, username string, password string) *LoginRequest {
return NewLoginRequestWithCustomIDP("", globalaccountSubdomain, username, password)
}
func NewLoginRequestWithCustomIDP(idp string, globalaccountSubdomain string, username string, password string) *LoginRequest {
return &LoginRequest{
IdentityProvider: idp,
GlobalAccountSubdomain: globalaccountSubdomain,
Username: username,
Password: password,
}
}
func NewIdTokenLoginRequest(globalaccountSubdomain string, idToken string) *IdTokenLoginRequest {
return &IdTokenLoginRequest{
GlobalAccountSubdomain: globalaccountSubdomain,
IdToken: idToken,
}
}
func NewBrowserLoginRequest(idp string, globalaccountSubdomain string) *BrowserLoginRequest {
return &BrowserLoginRequest{
CustomIdp: idp,
GlobalAccountSubdomain: globalaccountSubdomain,
}
}
type LoginRequest struct {
IdentityProvider string `json:"customIdp"`
GlobalAccountSubdomain string `json:"subdomain"`
Username string `json:"userName"`
Password string `json:"password"`
}
type IdTokenLoginRequest struct {
GlobalAccountSubdomain string `json:"subdomain"`
IdToken string `json:"idToken"`
}
type PasscodeLoginRequest struct {
GlobalAccountSubdomain string
IdentityProvider string
IdentityProviderURL string
Username string
PEMEncodedCACerts string
PEMEncodedPrivateKey string
PEMEncodedCertificate string
}
type BrowserLoginRequest struct {
CustomIdp string `json:"customIdp"`
GlobalAccountSubdomain string `json:"subdomain"`
}
type LoginResponse struct {
Username string `json:"user"`
Email string `json:"mail"`
Issuer string `json:"issuer"`
}
type BrowserLoginPostResponse struct {
Issuer string `json:"issuer"`
RefreshToken string `json:"refreshToken"`
Username string `json:"user"`
Email string `json:"mail"`
}
type BrowserResponse struct {
LoginID string `json:"loginId"`
SubdomainRequired bool `json:"subdomainRequired"`
}
/* Command */
func NewCommandRequest(action Action, command string, args any) *CommandRequest {
return &CommandRequest{
Action: action,
Command: command,
Args: args,
}
}
type CommandOptions struct {
GoodState int
KnownErrorStates map[int]string
}
type Action string
type CommandRequest struct {
Action Action
Command string
Args any
}
type CommandResponse struct {
StatusCode int
ContentType string
Body io.ReadCloser
}