@alicloud/iacservice20210806 2.4.0 → 2.5.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 +26 -0
- package/dist/client.js +214 -4
- package/dist/client.js.map +1 -1
- 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 +18 -0
- package/dist/models/UploadModuleResponseBody.js +58 -0
- package/dist/models/UploadModuleResponseBody.js.map +1 -0
- package/dist/models/model.d.ts +4 -0
- package/dist/models/model.js +9 -1
- package/dist/models/model.js.map +1 -1
- package/package.json +2 -1
- package/src/client.ts +232 -1
- 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 +31 -0
- package/src/models/model.ts +4 -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;
|
|
@@ -1337,6 +1342,27 @@ export default class Client extends OpenApi {
|
|
|
1337
1342
|
* @returns UpdateTaskAttributeResponse
|
|
1338
1343
|
*/
|
|
1339
1344
|
updateTaskAttribute(taskId: string, request: $_model.UpdateTaskAttributeRequest): Promise<$_model.UpdateTaskAttributeResponse>;
|
|
1345
|
+
/**
|
|
1346
|
+
* 模版上传
|
|
1347
|
+
*
|
|
1348
|
+
* @param request - UploadModuleRequest
|
|
1349
|
+
* @param headers - map
|
|
1350
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
1351
|
+
* @returns UploadModuleResponse
|
|
1352
|
+
*/
|
|
1353
|
+
uploadModuleWithOptions(resourceType: string, request: $_model.UploadModuleRequest, headers: {
|
|
1354
|
+
[key: string]: string;
|
|
1355
|
+
}, runtime: $dara.RuntimeOptions): Promise<$_model.UploadModuleResponse>;
|
|
1356
|
+
/**
|
|
1357
|
+
* 模版上传
|
|
1358
|
+
*
|
|
1359
|
+
* @param request - UploadModuleRequest
|
|
1360
|
+
* @returns UploadModuleResponse
|
|
1361
|
+
*/
|
|
1362
|
+
uploadModule(resourceType: string, request: $_model.UploadModuleRequest): Promise<$_model.UploadModuleResponse>;
|
|
1363
|
+
uploadModuleAdvance(resourceType: string, request: $_model.UploadModuleAdvanceRequest, headers: {
|
|
1364
|
+
[key: string]: string;
|
|
1365
|
+
}, runtime: $dara.RuntimeOptions): Promise<$_model.UploadModuleResponse>;
|
|
1340
1366
|
/**
|
|
1341
1367
|
* 模版预检
|
|
1342
1368
|
*
|
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;
|
|
@@ -3894,6 +3967,143 @@ class Client extends openapi_core_1.default {
|
|
|
3894
3967
|
let headers = {};
|
|
3895
3968
|
return await this.updateTaskAttributeWithOptions(taskId, request, headers, runtime);
|
|
3896
3969
|
}
|
|
3970
|
+
/**
|
|
3971
|
+
* 模版上传
|
|
3972
|
+
*
|
|
3973
|
+
* @param request - UploadModuleRequest
|
|
3974
|
+
* @param headers - map
|
|
3975
|
+
* @param runtime - runtime options for this request RuntimeOptions
|
|
3976
|
+
* @returns UploadModuleResponse
|
|
3977
|
+
*/
|
|
3978
|
+
async uploadModuleWithOptions(resourceType, request, headers, runtime) {
|
|
3979
|
+
request.validate();
|
|
3980
|
+
let query = {};
|
|
3981
|
+
if (!$dara.isNull(request.moduleId)) {
|
|
3982
|
+
query["moduleId"] = request.moduleId;
|
|
3983
|
+
}
|
|
3984
|
+
if (!$dara.isNull(request.moduleName)) {
|
|
3985
|
+
query["moduleName"] = request.moduleName;
|
|
3986
|
+
}
|
|
3987
|
+
if (!$dara.isNull(request.namespaceName)) {
|
|
3988
|
+
query["namespaceName"] = request.namespaceName;
|
|
3989
|
+
}
|
|
3990
|
+
if (!$dara.isNull(request.url)) {
|
|
3991
|
+
query["url"] = request.url;
|
|
3992
|
+
}
|
|
3993
|
+
let body = {};
|
|
3994
|
+
if (!$dara.isNull(request.code)) {
|
|
3995
|
+
body["code"] = request.code;
|
|
3996
|
+
}
|
|
3997
|
+
let req = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
|
|
3998
|
+
headers: headers,
|
|
3999
|
+
query: openapi_core_2.OpenApiUtil.query(query),
|
|
4000
|
+
body: openapi_core_2.OpenApiUtil.parseToMap(body),
|
|
4001
|
+
});
|
|
4002
|
+
let params = new openapi_core_2.$OpenApiUtil.Params({
|
|
4003
|
+
action: "UploadModule",
|
|
4004
|
+
version: "2021-08-06",
|
|
4005
|
+
protocol: "HTTPS",
|
|
4006
|
+
pathname: `/modules/upload/${$dara.URL.percentEncode(resourceType)}`,
|
|
4007
|
+
method: "POST",
|
|
4008
|
+
authType: "AK",
|
|
4009
|
+
style: "ROA",
|
|
4010
|
+
reqBodyType: "json",
|
|
4011
|
+
bodyType: "json",
|
|
4012
|
+
});
|
|
4013
|
+
return $dara.cast(await this.callApi(params, req, runtime), new $_model.UploadModuleResponse({}));
|
|
4014
|
+
}
|
|
4015
|
+
/**
|
|
4016
|
+
* 模版上传
|
|
4017
|
+
*
|
|
4018
|
+
* @param request - UploadModuleRequest
|
|
4019
|
+
* @returns UploadModuleResponse
|
|
4020
|
+
*/
|
|
4021
|
+
async uploadModule(resourceType, request) {
|
|
4022
|
+
let runtime = new $dara.RuntimeOptions({});
|
|
4023
|
+
let headers = {};
|
|
4024
|
+
return await this.uploadModuleWithOptions(resourceType, request, headers, runtime);
|
|
4025
|
+
}
|
|
4026
|
+
async uploadModuleAdvance(resourceType, request, headers, runtime) {
|
|
4027
|
+
// Step 0: init client
|
|
4028
|
+
if ($dara.isNull(this._credential)) {
|
|
4029
|
+
throw new $OpenApi.ClientError({
|
|
4030
|
+
code: "InvalidCredentials",
|
|
4031
|
+
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.",
|
|
4032
|
+
});
|
|
4033
|
+
}
|
|
4034
|
+
let credentialModel = await this._credential.getCredential();
|
|
4035
|
+
let accessKeyId = credentialModel.accessKeyId;
|
|
4036
|
+
let accessKeySecret = credentialModel.accessKeySecret;
|
|
4037
|
+
let securityToken = credentialModel.securityToken;
|
|
4038
|
+
let credentialType = credentialModel.type;
|
|
4039
|
+
let openPlatformEndpoint = this._openPlatformEndpoint;
|
|
4040
|
+
if ($dara.isNull(openPlatformEndpoint) || openPlatformEndpoint == "") {
|
|
4041
|
+
openPlatformEndpoint = "openplatform.aliyuncs.com";
|
|
4042
|
+
}
|
|
4043
|
+
if ($dara.isNull(credentialType)) {
|
|
4044
|
+
credentialType = "access_key";
|
|
4045
|
+
}
|
|
4046
|
+
let authConfig = new openapi_core_2.$OpenApiUtil.Config({
|
|
4047
|
+
accessKeyId: accessKeyId,
|
|
4048
|
+
accessKeySecret: accessKeySecret,
|
|
4049
|
+
securityToken: securityToken,
|
|
4050
|
+
type: credentialType,
|
|
4051
|
+
endpoint: openPlatformEndpoint,
|
|
4052
|
+
protocol: this._protocol,
|
|
4053
|
+
regionId: this._regionId,
|
|
4054
|
+
});
|
|
4055
|
+
let authClient = new openapi_core_1.default(authConfig);
|
|
4056
|
+
let authRequest = {
|
|
4057
|
+
Product: "IaCService",
|
|
4058
|
+
RegionId: this._regionId,
|
|
4059
|
+
};
|
|
4060
|
+
let authReq = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
|
|
4061
|
+
query: openapi_core_2.OpenApiUtil.query(authRequest),
|
|
4062
|
+
});
|
|
4063
|
+
let authParams = new openapi_core_2.$OpenApiUtil.Params({
|
|
4064
|
+
action: "AuthorizeFileUpload",
|
|
4065
|
+
version: "2019-12-19",
|
|
4066
|
+
protocol: "HTTPS",
|
|
4067
|
+
pathname: "/",
|
|
4068
|
+
method: "GET",
|
|
4069
|
+
authType: "AK",
|
|
4070
|
+
style: "RPC",
|
|
4071
|
+
reqBodyType: "formData",
|
|
4072
|
+
bodyType: "json",
|
|
4073
|
+
});
|
|
4074
|
+
let authResponse = {};
|
|
4075
|
+
let fileObj = new $dara.FileField({});
|
|
4076
|
+
let ossHeader = {};
|
|
4077
|
+
let tmpBody = {};
|
|
4078
|
+
let useAccelerate = false;
|
|
4079
|
+
let authResponseBody = {};
|
|
4080
|
+
let uploadModuleReq = new $_model.UploadModuleRequest({});
|
|
4081
|
+
openapi_core_2.OpenApiUtil.convert(request, uploadModuleReq);
|
|
4082
|
+
if (!$dara.isNull(request.urlObject)) {
|
|
4083
|
+
authResponse = await authClient.callApi(authParams, authReq, runtime);
|
|
4084
|
+
tmpBody = authResponse["body"];
|
|
4085
|
+
useAccelerate = Boolean(tmpBody["UseAccelerate"]);
|
|
4086
|
+
authResponseBody = openapi_core_2.OpenApiUtil.stringifyMapValue(tmpBody);
|
|
4087
|
+
fileObj = new $dara.FileField({
|
|
4088
|
+
filename: authResponseBody["ObjectKey"],
|
|
4089
|
+
content: request.urlObject,
|
|
4090
|
+
contentType: "",
|
|
4091
|
+
});
|
|
4092
|
+
ossHeader = {
|
|
4093
|
+
host: `${authResponseBody["Bucket"]}.${openapi_core_2.OpenApiUtil.getEndpoint(authResponseBody["Endpoint"], useAccelerate, this._endpointType)}`,
|
|
4094
|
+
OSSAccessKeyId: authResponseBody["AccessKeyId"],
|
|
4095
|
+
policy: authResponseBody["EncodedPolicy"],
|
|
4096
|
+
Signature: authResponseBody["Signature"],
|
|
4097
|
+
key: authResponseBody["ObjectKey"],
|
|
4098
|
+
file: fileObj,
|
|
4099
|
+
success_action_status: "201",
|
|
4100
|
+
};
|
|
4101
|
+
await this._postOSSObject(authResponseBody["Bucket"], ossHeader, runtime);
|
|
4102
|
+
uploadModuleReq.url = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
|
|
4103
|
+
}
|
|
4104
|
+
let uploadModuleResp = await this.uploadModuleWithOptions(resourceType, uploadModuleReq, headers, runtime);
|
|
4105
|
+
return uploadModuleResp;
|
|
4106
|
+
}
|
|
3897
4107
|
/**
|
|
3898
4108
|
* 模版预检
|
|
3899
4109
|
*
|