@alicloud/iacservice20210806 2.4.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +59 -0
- package/dist/client.js +301 -4
- package/dist/client.js.map +1 -1
- package/dist/models/GetStackExecutionResultResponse.d.ts +19 -0
- package/dist/models/GetStackExecutionResultResponse.js +69 -0
- package/dist/models/GetStackExecutionResultResponse.js.map +1 -0
- package/dist/models/GetStackExecutionResultResponseBody.d.ts +92 -0
- package/dist/models/GetStackExecutionResultResponseBody.js +120 -0
- package/dist/models/GetStackExecutionResultResponseBody.js.map +1 -0
- package/dist/models/TriggerStackExecutionRequest.d.ts +47 -0
- package/dist/models/TriggerStackExecutionRequest.js +69 -0
- package/dist/models/TriggerStackExecutionRequest.js.map +1 -0
- package/dist/models/TriggerStackExecutionResponse.d.ts +19 -0
- package/dist/models/TriggerStackExecutionResponse.js +69 -0
- package/dist/models/TriggerStackExecutionResponse.js.map +1 -0
- package/dist/models/TriggerStackExecutionResponseBody.d.ts +26 -0
- package/dist/models/TriggerStackExecutionResponseBody.js +60 -0
- package/dist/models/TriggerStackExecutionResponseBody.js.map +1 -0
- package/dist/models/UploadModuleAdvanceRequest.d.ts +37 -0
- package/dist/models/UploadModuleAdvanceRequest.js +68 -0
- package/dist/models/UploadModuleAdvanceRequest.js.map +1 -0
- package/dist/models/UploadModuleRequest.d.ts +36 -0
- package/dist/models/UploadModuleRequest.js +69 -0
- package/dist/models/UploadModuleRequest.js.map +1 -0
- package/dist/models/UploadModuleResponse.d.ts +19 -0
- package/dist/models/UploadModuleResponse.js +69 -0
- package/dist/models/UploadModuleResponse.js.map +1 -0
- package/dist/models/UploadModuleResponseBody.d.ts +19 -0
- package/dist/models/UploadModuleResponseBody.js +60 -0
- package/dist/models/UploadModuleResponseBody.js.map +1 -0
- package/dist/models/model.d.ts +11 -0
- package/dist/models/model.js +29 -7
- package/dist/models/model.js.map +1 -1
- package/package.json +2 -1
- package/src/client.ts +328 -1
- package/src/models/GetStackExecutionResultResponse.ts +40 -0
- package/src/models/GetStackExecutionResultResponseBody.ts +149 -0
- package/src/models/TriggerStackExecutionRequest.ts +71 -0
- package/src/models/TriggerStackExecutionResponse.ts +40 -0
- package/src/models/TriggerStackExecutionResponseBody.ts +41 -0
- package/src/models/UploadModuleAdvanceRequest.ts +59 -0
- package/src/models/UploadModuleRequest.ts +58 -0
- package/src/models/UploadModuleResponse.ts +40 -0
- package/src/models/UploadModuleResponseBody.ts +34 -0
- package/src/models/model.ts +11 -0
package/dist/client.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ import * as $_model from './models/model';
|
|
|
5
5
|
export * from './models/model';
|
|
6
6
|
export default class Client extends OpenApi {
|
|
7
7
|
constructor(config: $OpenApiUtil.Config);
|
|
8
|
+
_postOSSObject(bucketName: string, form: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}, runtime: $dara.RuntimeOptions): Promise<{
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}>;
|
|
8
13
|
getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: {
|
|
9
14
|
[key: string]: string;
|
|
10
15
|
}, endpoint: string): string;
|
|
@@ -728,6 +733,21 @@ export default class Client extends OpenApi {
|
|
|
728
733
|
* @returns GetResourceTypeResponse
|
|
729
734
|
*/
|
|
730
735
|
getResourceType(resourceType: string, request: $_model.GetResourceTypeRequest): Promise<$_model.GetResourceTypeResponse>;
|
|
736
|
+
/**
|
|
737
|
+
* 获取资源栈部署结果
|
|
738
|
+
*
|
|
739
|
+
* @param headers - map
|
|
740
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
741
|
+
* @returns GetStackExecutionResultResponse
|
|
742
|
+
*/
|
|
743
|
+
getStackExecutionResultWithOptions(triggerId: string, headers: {
|
|
744
|
+
[key: string]: string;
|
|
745
|
+
}, runtime: $dara.RuntimeOptions): Promise<$_model.GetStackExecutionResultResponse>;
|
|
746
|
+
/**
|
|
747
|
+
* 获取资源栈部署结果
|
|
748
|
+
* @returns GetStackExecutionResultResponse
|
|
749
|
+
*/
|
|
750
|
+
getStackExecutionResult(triggerId: string): Promise<$_model.GetStackExecutionResultResponse>;
|
|
731
751
|
/**
|
|
732
752
|
* 查询任务详情
|
|
733
753
|
*
|
|
@@ -1175,6 +1195,24 @@ export default class Client extends OpenApi {
|
|
|
1175
1195
|
* @returns RemoveSharedAccountsResponse
|
|
1176
1196
|
*/
|
|
1177
1197
|
removeSharedAccounts(request: $_model.RemoveSharedAccountsRequest): Promise<$_model.RemoveSharedAccountsResponse>;
|
|
1198
|
+
/**
|
|
1199
|
+
* 触发资源栈部署
|
|
1200
|
+
*
|
|
1201
|
+
* @param request - TriggerStackExecutionRequest
|
|
1202
|
+
* @param headers - map
|
|
1203
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
1204
|
+
* @returns TriggerStackExecutionResponse
|
|
1205
|
+
*/
|
|
1206
|
+
triggerStackExecutionWithOptions(request: $_model.TriggerStackExecutionRequest, headers: {
|
|
1207
|
+
[key: string]: string;
|
|
1208
|
+
}, runtime: $dara.RuntimeOptions): Promise<$_model.TriggerStackExecutionResponse>;
|
|
1209
|
+
/**
|
|
1210
|
+
* 触发资源栈部署
|
|
1211
|
+
*
|
|
1212
|
+
* @param request - TriggerStackExecutionRequest
|
|
1213
|
+
* @returns TriggerStackExecutionResponse
|
|
1214
|
+
*/
|
|
1215
|
+
triggerStackExecution(request: $_model.TriggerStackExecutionRequest): Promise<$_model.TriggerStackExecutionResponse>;
|
|
1178
1216
|
/**
|
|
1179
1217
|
* 修改ExplorerModule
|
|
1180
1218
|
*
|
|
@@ -1337,6 +1375,27 @@ export default class Client extends OpenApi {
|
|
|
1337
1375
|
* @returns UpdateTaskAttributeResponse
|
|
1338
1376
|
*/
|
|
1339
1377
|
updateTaskAttribute(taskId: string, request: $_model.UpdateTaskAttributeRequest): Promise<$_model.UpdateTaskAttributeResponse>;
|
|
1378
|
+
/**
|
|
1379
|
+
* 模版上传
|
|
1380
|
+
*
|
|
1381
|
+
* @param request - UploadModuleRequest
|
|
1382
|
+
* @param headers - map
|
|
1383
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
1384
|
+
* @returns UploadModuleResponse
|
|
1385
|
+
*/
|
|
1386
|
+
uploadModuleWithOptions(resourceType: string, request: $_model.UploadModuleRequest, headers: {
|
|
1387
|
+
[key: string]: string;
|
|
1388
|
+
}, runtime: $dara.RuntimeOptions): Promise<$_model.UploadModuleResponse>;
|
|
1389
|
+
/**
|
|
1390
|
+
* 模版上传
|
|
1391
|
+
*
|
|
1392
|
+
* @param request - UploadModuleRequest
|
|
1393
|
+
* @returns UploadModuleResponse
|
|
1394
|
+
*/
|
|
1395
|
+
uploadModule(resourceType: string, request: $_model.UploadModuleRequest): Promise<$_model.UploadModuleResponse>;
|
|
1396
|
+
uploadModuleAdvance(resourceType: string, request: $_model.UploadModuleAdvanceRequest, headers: {
|
|
1397
|
+
[key: string]: string;
|
|
1398
|
+
}, runtime: $dara.RuntimeOptions): Promise<$_model.UploadModuleResponse>;
|
|
1340
1399
|
/**
|
|
1341
1400
|
* 模版预检
|
|
1342
1401
|
*
|
package/dist/client.js
CHANGED
|
@@ -55,13 +55,10 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
|
|
|
55
55
|
function reject(value) { resume("throw", value); }
|
|
56
56
|
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
57
57
|
};
|
|
58
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
|
-
};
|
|
61
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
59
|
// This file is auto-generated, don't edit it
|
|
63
60
|
const $dara = __importStar(require("@darabonba/typescript"));
|
|
64
|
-
const openapi_core_1 =
|
|
61
|
+
const openapi_core_1 = __importStar(require("@alicloud/openapi-core")), $OpenApi = openapi_core_1;
|
|
65
62
|
const openapi_core_2 = require("@alicloud/openapi-core");
|
|
66
63
|
const $_model = __importStar(require("./models/model"));
|
|
67
64
|
__exportStar(require("./models/model"), exports);
|
|
@@ -72,6 +69,82 @@ class Client extends openapi_core_1.default {
|
|
|
72
69
|
this.checkConfig(config);
|
|
73
70
|
this._endpoint = this.getEndpoint("iacservice", this._regionId, this._endpointRule, this._network, this._suffix, this._endpointMap, this._endpoint);
|
|
74
71
|
}
|
|
72
|
+
async _postOSSObject(bucketName, form, runtime) {
|
|
73
|
+
let _runtime = {
|
|
74
|
+
key: runtime.key || this._key,
|
|
75
|
+
cert: runtime.cert || this._cert,
|
|
76
|
+
ca: runtime.ca || this._ca,
|
|
77
|
+
readTimeout: runtime.readTimeout || this._readTimeout,
|
|
78
|
+
connectTimeout: runtime.connectTimeout || this._connectTimeout,
|
|
79
|
+
httpProxy: runtime.httpProxy || this._httpProxy,
|
|
80
|
+
httpsProxy: runtime.httpsProxy || this._httpsProxy,
|
|
81
|
+
noProxy: runtime.noProxy || this._noProxy,
|
|
82
|
+
socks5Proxy: runtime.socks5Proxy || this._socks5Proxy,
|
|
83
|
+
socks5NetWork: runtime.socks5NetWork || this._socks5NetWork,
|
|
84
|
+
maxIdleConns: runtime.maxIdleConns || this._maxIdleConns,
|
|
85
|
+
retryOptions: this._retryOptions,
|
|
86
|
+
ignoreSSL: runtime.ignoreSSL || false,
|
|
87
|
+
tlsMinVersion: this._tlsMinVersion,
|
|
88
|
+
};
|
|
89
|
+
let _retriesAttempted = 0;
|
|
90
|
+
let _lastRequest = null, _lastResponse = null;
|
|
91
|
+
let _context = new $dara.RetryPolicyContext({
|
|
92
|
+
retriesAttempted: _retriesAttempted,
|
|
93
|
+
});
|
|
94
|
+
while ($dara.shouldRetry(_runtime['retryOptions'], _context)) {
|
|
95
|
+
if (_retriesAttempted > 0) {
|
|
96
|
+
let _backoffTime = $dara.getBackoffDelay(_runtime['retryOptions'], _context);
|
|
97
|
+
if (_backoffTime > 0) {
|
|
98
|
+
await $dara.sleep(_backoffTime);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
_retriesAttempted = _retriesAttempted + 1;
|
|
102
|
+
try {
|
|
103
|
+
let request_ = new $dara.Request();
|
|
104
|
+
let boundary = $dara.Form.getBoundary();
|
|
105
|
+
request_.protocol = "HTTPS";
|
|
106
|
+
request_.method = "POST";
|
|
107
|
+
request_.pathname = `/`;
|
|
108
|
+
request_.headers = {
|
|
109
|
+
host: String(form["host"]),
|
|
110
|
+
date: openapi_core_2.OpenApiUtil.getDateUTCString(),
|
|
111
|
+
'user-agent': openapi_core_2.OpenApiUtil.getUserAgent(""),
|
|
112
|
+
};
|
|
113
|
+
request_.headers["content-type"] = `multipart/form-data; boundary=${boundary}`;
|
|
114
|
+
request_.body = $dara.Form.toFileForm(form, boundary);
|
|
115
|
+
_lastRequest = request_;
|
|
116
|
+
let response_ = await $dara.doAction(request_, _runtime);
|
|
117
|
+
_lastResponse = response_;
|
|
118
|
+
let respMap = null;
|
|
119
|
+
let bodyStr = await $dara.Stream.readAsString(response_.body);
|
|
120
|
+
if ((response_.statusCode >= 400) && (response_.statusCode < 600)) {
|
|
121
|
+
respMap = $dara.XML.parseXml(bodyStr, null);
|
|
122
|
+
let err = respMap["Error"];
|
|
123
|
+
throw new $OpenApi.ClientError({
|
|
124
|
+
code: String(err["Code"]),
|
|
125
|
+
message: String(err["Message"]),
|
|
126
|
+
data: {
|
|
127
|
+
httpCode: response_.statusCode,
|
|
128
|
+
requestId: String(err["RequestId"]),
|
|
129
|
+
hostId: String(err["HostId"]),
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
respMap = $dara.XML.parseXml(bodyStr, null);
|
|
134
|
+
return Object.assign({}, respMap);
|
|
135
|
+
}
|
|
136
|
+
catch (ex) {
|
|
137
|
+
_context = new $dara.RetryPolicyContext({
|
|
138
|
+
retriesAttempted: _retriesAttempted,
|
|
139
|
+
httpRequest: _lastRequest,
|
|
140
|
+
httpResponse: _lastResponse,
|
|
141
|
+
exception: ex,
|
|
142
|
+
});
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
throw $dara.newUnretryableError(_context);
|
|
147
|
+
}
|
|
75
148
|
getEndpoint(productId, regionId, endpointRule, network, suffix, endpointMap, endpoint) {
|
|
76
149
|
if (!$dara.isNull(endpoint)) {
|
|
77
150
|
return endpoint;
|
|
@@ -1998,6 +2071,39 @@ class Client extends openapi_core_1.default {
|
|
|
1998
2071
|
let headers = {};
|
|
1999
2072
|
return await this.getResourceTypeWithOptions(resourceType, request, headers, runtime);
|
|
2000
2073
|
}
|
|
2074
|
+
/**
|
|
2075
|
+
* 获取资源栈部署结果
|
|
2076
|
+
*
|
|
2077
|
+
* @param headers - map
|
|
2078
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
2079
|
+
* @returns GetStackExecutionResultResponse
|
|
2080
|
+
*/
|
|
2081
|
+
async getStackExecutionResultWithOptions(triggerId, headers, runtime) {
|
|
2082
|
+
let req = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
|
|
2083
|
+
headers: headers,
|
|
2084
|
+
});
|
|
2085
|
+
let params = new openapi_core_2.$OpenApiUtil.Params({
|
|
2086
|
+
action: "GetStackExecutionResult",
|
|
2087
|
+
version: "2021-08-06",
|
|
2088
|
+
protocol: "HTTPS",
|
|
2089
|
+
pathname: `/stacks/trigger/${$dara.URL.percentEncode(triggerId)}`,
|
|
2090
|
+
method: "GET",
|
|
2091
|
+
authType: "AK",
|
|
2092
|
+
style: "ROA",
|
|
2093
|
+
reqBodyType: "json",
|
|
2094
|
+
bodyType: "json",
|
|
2095
|
+
});
|
|
2096
|
+
return $dara.cast(await this.callApi(params, req, runtime), new $_model.GetStackExecutionResultResponse({}));
|
|
2097
|
+
}
|
|
2098
|
+
/**
|
|
2099
|
+
* 获取资源栈部署结果
|
|
2100
|
+
* @returns GetStackExecutionResultResponse
|
|
2101
|
+
*/
|
|
2102
|
+
async getStackExecutionResult(triggerId) {
|
|
2103
|
+
let runtime = new $dara.RuntimeOptions({});
|
|
2104
|
+
let headers = {};
|
|
2105
|
+
return await this.getStackExecutionResultWithOptions(triggerId, headers, runtime);
|
|
2106
|
+
}
|
|
2001
2107
|
/**
|
|
2002
2108
|
* 查询任务详情
|
|
2003
2109
|
*
|
|
@@ -3360,6 +3466,60 @@ class Client extends openapi_core_1.default {
|
|
|
3360
3466
|
let headers = {};
|
|
3361
3467
|
return await this.removeSharedAccountsWithOptions(request, headers, runtime);
|
|
3362
3468
|
}
|
|
3469
|
+
/**
|
|
3470
|
+
* 触发资源栈部署
|
|
3471
|
+
*
|
|
3472
|
+
* @param request - TriggerStackExecutionRequest
|
|
3473
|
+
* @param headers - map
|
|
3474
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
3475
|
+
* @returns TriggerStackExecutionResponse
|
|
3476
|
+
*/
|
|
3477
|
+
async triggerStackExecutionWithOptions(request, headers, runtime) {
|
|
3478
|
+
request.validate();
|
|
3479
|
+
let body = {};
|
|
3480
|
+
if (!$dara.isNull(request.action)) {
|
|
3481
|
+
body["action"] = request.action;
|
|
3482
|
+
}
|
|
3483
|
+
if (!$dara.isNull(request.changedFolders)) {
|
|
3484
|
+
body["changedFolders"] = request.changedFolders;
|
|
3485
|
+
}
|
|
3486
|
+
if (!$dara.isNull(request.clientToken)) {
|
|
3487
|
+
body["clientToken"] = request.clientToken;
|
|
3488
|
+
}
|
|
3489
|
+
if (!$dara.isNull(request.codePackagePath)) {
|
|
3490
|
+
body["codePackagePath"] = request.codePackagePath;
|
|
3491
|
+
}
|
|
3492
|
+
if (!$dara.isNull(request.codeVersionId)) {
|
|
3493
|
+
body["codeVersionId"] = request.codeVersionId;
|
|
3494
|
+
}
|
|
3495
|
+
let req = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
|
|
3496
|
+
headers: headers,
|
|
3497
|
+
body: openapi_core_2.OpenApiUtil.parseToMap(body),
|
|
3498
|
+
});
|
|
3499
|
+
let params = new openapi_core_2.$OpenApiUtil.Params({
|
|
3500
|
+
action: "TriggerStackExecution",
|
|
3501
|
+
version: "2021-08-06",
|
|
3502
|
+
protocol: "HTTPS",
|
|
3503
|
+
pathname: `/stacks/trigger`,
|
|
3504
|
+
method: "POST",
|
|
3505
|
+
authType: "AK",
|
|
3506
|
+
style: "ROA",
|
|
3507
|
+
reqBodyType: "json",
|
|
3508
|
+
bodyType: "json",
|
|
3509
|
+
});
|
|
3510
|
+
return $dara.cast(await this.callApi(params, req, runtime), new $_model.TriggerStackExecutionResponse({}));
|
|
3511
|
+
}
|
|
3512
|
+
/**
|
|
3513
|
+
* 触发资源栈部署
|
|
3514
|
+
*
|
|
3515
|
+
* @param request - TriggerStackExecutionRequest
|
|
3516
|
+
* @returns TriggerStackExecutionResponse
|
|
3517
|
+
*/
|
|
3518
|
+
async triggerStackExecution(request) {
|
|
3519
|
+
let runtime = new $dara.RuntimeOptions({});
|
|
3520
|
+
let headers = {};
|
|
3521
|
+
return await this.triggerStackExecutionWithOptions(request, headers, runtime);
|
|
3522
|
+
}
|
|
3363
3523
|
/**
|
|
3364
3524
|
* 修改ExplorerModule
|
|
3365
3525
|
*
|
|
@@ -3894,6 +4054,143 @@ class Client extends openapi_core_1.default {
|
|
|
3894
4054
|
let headers = {};
|
|
3895
4055
|
return await this.updateTaskAttributeWithOptions(taskId, request, headers, runtime);
|
|
3896
4056
|
}
|
|
4057
|
+
/**
|
|
4058
|
+
* 模版上传
|
|
4059
|
+
*
|
|
4060
|
+
* @param request - UploadModuleRequest
|
|
4061
|
+
* @param headers - map
|
|
4062
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
4063
|
+
* @returns UploadModuleResponse
|
|
4064
|
+
*/
|
|
4065
|
+
async uploadModuleWithOptions(resourceType, request, headers, runtime) {
|
|
4066
|
+
request.validate();
|
|
4067
|
+
let query = {};
|
|
4068
|
+
if (!$dara.isNull(request.moduleId)) {
|
|
4069
|
+
query["moduleId"] = request.moduleId;
|
|
4070
|
+
}
|
|
4071
|
+
if (!$dara.isNull(request.moduleName)) {
|
|
4072
|
+
query["moduleName"] = request.moduleName;
|
|
4073
|
+
}
|
|
4074
|
+
if (!$dara.isNull(request.namespaceName)) {
|
|
4075
|
+
query["namespaceName"] = request.namespaceName;
|
|
4076
|
+
}
|
|
4077
|
+
if (!$dara.isNull(request.url)) {
|
|
4078
|
+
query["url"] = request.url;
|
|
4079
|
+
}
|
|
4080
|
+
let body = {};
|
|
4081
|
+
if (!$dara.isNull(request.code)) {
|
|
4082
|
+
body["code"] = request.code;
|
|
4083
|
+
}
|
|
4084
|
+
let req = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
|
|
4085
|
+
headers: headers,
|
|
4086
|
+
query: openapi_core_2.OpenApiUtil.query(query),
|
|
4087
|
+
body: openapi_core_2.OpenApiUtil.parseToMap(body),
|
|
4088
|
+
});
|
|
4089
|
+
let params = new openapi_core_2.$OpenApiUtil.Params({
|
|
4090
|
+
action: "UploadModule",
|
|
4091
|
+
version: "2021-08-06",
|
|
4092
|
+
protocol: "HTTPS",
|
|
4093
|
+
pathname: `/modules/upload/${$dara.URL.percentEncode(resourceType)}`,
|
|
4094
|
+
method: "POST",
|
|
4095
|
+
authType: "AK",
|
|
4096
|
+
style: "ROA",
|
|
4097
|
+
reqBodyType: "json",
|
|
4098
|
+
bodyType: "json",
|
|
4099
|
+
});
|
|
4100
|
+
return $dara.cast(await this.callApi(params, req, runtime), new $_model.UploadModuleResponse({}));
|
|
4101
|
+
}
|
|
4102
|
+
/**
|
|
4103
|
+
* 模版上传
|
|
4104
|
+
*
|
|
4105
|
+
* @param request - UploadModuleRequest
|
|
4106
|
+
* @returns UploadModuleResponse
|
|
4107
|
+
*/
|
|
4108
|
+
async uploadModule(resourceType, request) {
|
|
4109
|
+
let runtime = new $dara.RuntimeOptions({});
|
|
4110
|
+
let headers = {};
|
|
4111
|
+
return await this.uploadModuleWithOptions(resourceType, request, headers, runtime);
|
|
4112
|
+
}
|
|
4113
|
+
async uploadModuleAdvance(resourceType, request, headers, runtime) {
|
|
4114
|
+
// Step 0: init client
|
|
4115
|
+
if ($dara.isNull(this._credential)) {
|
|
4116
|
+
throw new $OpenApi.ClientError({
|
|
4117
|
+
code: "InvalidCredentials",
|
|
4118
|
+
message: "Please set up the credentials correctly. If you are setting them through environment variables, please ensure that ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set correctly. See https://help.aliyun.com/zh/sdk/developer-reference/configure-the-alibaba-cloud-accesskey-environment-variable-on-linux-macos-and-windows-systems for more details.",
|
|
4119
|
+
});
|
|
4120
|
+
}
|
|
4121
|
+
let credentialModel = await this._credential.getCredential();
|
|
4122
|
+
let accessKeyId = credentialModel.accessKeyId;
|
|
4123
|
+
let accessKeySecret = credentialModel.accessKeySecret;
|
|
4124
|
+
let securityToken = credentialModel.securityToken;
|
|
4125
|
+
let credentialType = credentialModel.type;
|
|
4126
|
+
let openPlatformEndpoint = this._openPlatformEndpoint;
|
|
4127
|
+
if ($dara.isNull(openPlatformEndpoint) || openPlatformEndpoint == "") {
|
|
4128
|
+
openPlatformEndpoint = "openplatform.aliyuncs.com";
|
|
4129
|
+
}
|
|
4130
|
+
if ($dara.isNull(credentialType)) {
|
|
4131
|
+
credentialType = "access_key";
|
|
4132
|
+
}
|
|
4133
|
+
let authConfig = new openapi_core_2.$OpenApiUtil.Config({
|
|
4134
|
+
accessKeyId: accessKeyId,
|
|
4135
|
+
accessKeySecret: accessKeySecret,
|
|
4136
|
+
securityToken: securityToken,
|
|
4137
|
+
type: credentialType,
|
|
4138
|
+
endpoint: openPlatformEndpoint,
|
|
4139
|
+
protocol: this._protocol,
|
|
4140
|
+
regionId: this._regionId,
|
|
4141
|
+
});
|
|
4142
|
+
let authClient = new openapi_core_1.default(authConfig);
|
|
4143
|
+
let authRequest = {
|
|
4144
|
+
Product: "IaCService",
|
|
4145
|
+
RegionId: this._regionId,
|
|
4146
|
+
};
|
|
4147
|
+
let authReq = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
|
|
4148
|
+
query: openapi_core_2.OpenApiUtil.query(authRequest),
|
|
4149
|
+
});
|
|
4150
|
+
let authParams = new openapi_core_2.$OpenApiUtil.Params({
|
|
4151
|
+
action: "AuthorizeFileUpload",
|
|
4152
|
+
version: "2019-12-19",
|
|
4153
|
+
protocol: "HTTPS",
|
|
4154
|
+
pathname: "/",
|
|
4155
|
+
method: "GET",
|
|
4156
|
+
authType: "AK",
|
|
4157
|
+
style: "RPC",
|
|
4158
|
+
reqBodyType: "formData",
|
|
4159
|
+
bodyType: "json",
|
|
4160
|
+
});
|
|
4161
|
+
let authResponse = {};
|
|
4162
|
+
let fileObj = new $dara.FileField({});
|
|
4163
|
+
let ossHeader = {};
|
|
4164
|
+
let tmpBody = {};
|
|
4165
|
+
let useAccelerate = false;
|
|
4166
|
+
let authResponseBody = {};
|
|
4167
|
+
let uploadModuleReq = new $_model.UploadModuleRequest({});
|
|
4168
|
+
openapi_core_2.OpenApiUtil.convert(request, uploadModuleReq);
|
|
4169
|
+
if (!$dara.isNull(request.urlObject)) {
|
|
4170
|
+
authResponse = await authClient.callApi(authParams, authReq, runtime);
|
|
4171
|
+
tmpBody = authResponse["body"];
|
|
4172
|
+
useAccelerate = Boolean(tmpBody["UseAccelerate"]);
|
|
4173
|
+
authResponseBody = openapi_core_2.OpenApiUtil.stringifyMapValue(tmpBody);
|
|
4174
|
+
fileObj = new $dara.FileField({
|
|
4175
|
+
filename: authResponseBody["ObjectKey"],
|
|
4176
|
+
content: request.urlObject,
|
|
4177
|
+
contentType: "",
|
|
4178
|
+
});
|
|
4179
|
+
ossHeader = {
|
|
4180
|
+
host: `${authResponseBody["Bucket"]}.${openapi_core_2.OpenApiUtil.getEndpoint(authResponseBody["Endpoint"], useAccelerate, this._endpointType)}`,
|
|
4181
|
+
OSSAccessKeyId: authResponseBody["AccessKeyId"],
|
|
4182
|
+
policy: authResponseBody["EncodedPolicy"],
|
|
4183
|
+
Signature: authResponseBody["Signature"],
|
|
4184
|
+
key: authResponseBody["ObjectKey"],
|
|
4185
|
+
file: fileObj,
|
|
4186
|
+
success_action_status: "201",
|
|
4187
|
+
};
|
|
4188
|
+
await this._postOSSObject(authResponseBody["Bucket"], ossHeader, runtime);
|
|
4189
|
+
uploadModuleReq.url = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
|
|
4190
|
+
}
|
|
4191
|
+
let uploadModuleResp = await this.uploadModuleWithOptions(resourceType, uploadModuleReq, headers, runtime);
|
|
4192
|
+
return uploadModuleResp;
|
|
4193
|
+
}
|
|
3897
4194
|
/**
|
|
3898
4195
|
* 模版预检
|
|
3899
4196
|
*
|