-
Notifications
You must be signed in to change notification settings - Fork 19
/
main.tea
149 lines (132 loc) · 4.85 KB
/
main.tea
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/**
*
*/
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;
extends OpenApi;
init(config: OpenApi.Config){
super(config);
@endpointRule = '';
checkConfig(config);
@endpoint = getEndpoint('appstream-center', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}
function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
if (!Util.empty(endpoint)) {
return endpoint;
}
if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
return endpointMap[regionId];
}
return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model ExpireLoginTokenRequest {
endUserId?: string(name='EndUserId', example='testuser'),
loginToken?: string(name='LoginToken', example='v185fdd7f6d39fa7861981639366085772e150a390a5bb7b43c4e62440d94fc392b945770e1596cebe90085ce0af4d****'),
officeSiteId?: string(name='OfficeSiteId', example='cn-beijing+dir-172301****'),
sessionId?: string(name='SessionId', example='a863f4c3-2f1d-4971-8cf7-e2b92ae9****'),
}
model ExpireLoginTokenResponseBody = {
requestId?: string(name='RequestId', example='1CBAFFAB-B697-4049-A9B1-67E1FC5F****'),
}
model ExpireLoginTokenResponse = {
headers: map[string]string(name='headers'),
statusCode: int32(name='statusCode'),
body: ExpireLoginTokenResponseBody(name='body'),
}
async function expireLoginTokenWithOptions(request: ExpireLoginTokenRequest, runtime: Util.RuntimeOptions): ExpireLoginTokenResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.endUserId)) {
body['EndUserId'] = request.endUserId;
}
if (!Util.isUnset(request.loginToken)) {
body['LoginToken'] = request.loginToken;
}
if (!Util.isUnset(request.officeSiteId)) {
body['OfficeSiteId'] = request.officeSiteId;
}
if (!Util.isUnset(request.sessionId)) {
body['SessionId'] = request.sessionId;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'ExpireLoginToken',
version = '2021-02-18',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
return callApi(params, req, runtime);
}
async function expireLoginToken(request: ExpireLoginTokenRequest): ExpireLoginTokenResponse {
var runtime = new Util.RuntimeOptions{};
return expireLoginTokenWithOptions(request, runtime);
}
model GetAuthCodeRequest {
autoCreateUser?: boolean(name='AutoCreateUser'),
endUserId?: string(name='EndUserId', example='alice'),
externalUserId?: string(name='ExternalUserId', example='alice'),
policy?: string(name='Policy', example='{
"Version": "1",
"Resource": {
"Type": "AppInstanceGroup",
"Id": "aig-9ciijz60n4xsv****"
}
}'),
}
model GetAuthCodeResponseBody = {
authModel?: {
authCode?: string(name='AuthCode', example='acv2ZEq2TNSqOlX+DvyetHGRT08iPhbWg/os1W4HojpBxkMQZkAnbKSfz/wNvS0E149IQZ5TogvBUE8ghCSVV+QBnv48Y+sn4z9fY5ywZA1peI5s4TplQI0TADBhPZXEIzMOdmbNsDGGlGcKOAq8ixd1Epzdu9XfvRzdLOO6o3zQwTZxXsjOgGBW8JTcgCP9W9iYiIjHIdZ2VCAnmMzuyVkyED8gymEevH10QoclyH/O3s8Yq6VF34gMXihDQeiI8PyiAZrW0JWXSWpdy3n4yGtAqMAgv46FzTA+XJ6C********'),
endUserId?: string(name='EndUserId', example='alice'),
expireTime?: string(name='ExpireTime', example='2015-01-23T12:33:18Z'),
}(name='AuthModel'),
requestId?: string(name='RequestId', example='1CBAFFAB-B697-4049-A9B1-67E1FC5F****'),
}
model GetAuthCodeResponse = {
headers: map[string]string(name='headers'),
statusCode: int32(name='statusCode'),
body: GetAuthCodeResponseBody(name='body'),
}
async function getAuthCodeWithOptions(request: GetAuthCodeRequest, runtime: Util.RuntimeOptions): GetAuthCodeResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.autoCreateUser)) {
body['AutoCreateUser'] = request.autoCreateUser;
}
if (!Util.isUnset(request.endUserId)) {
body['EndUserId'] = request.endUserId;
}
if (!Util.isUnset(request.externalUserId)) {
body['ExternalUserId'] = request.externalUserId;
}
if (!Util.isUnset(request.policy)) {
body['Policy'] = request.policy;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'GetAuthCode',
version = '2021-02-18',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
return callApi(params, req, runtime);
}
async function getAuthCode(request: GetAuthCodeRequest): GetAuthCodeResponse {
var runtime = new Util.RuntimeOptions{};
return getAuthCodeWithOptions(request, runtime);
}