@alicloud/esa20240910 2.28.0 → 2.29.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.
Files changed (49) hide show
  1. package/dist/client.d.ts +20 -0
  2. package/dist/client.js +297 -172
  3. package/dist/client.js.map +1 -1
  4. package/dist/models/CreateRoutineRouteRequest.d.ts +1 -0
  5. package/dist/models/CreateRoutineRouteRequest.js +2 -0
  6. package/dist/models/CreateRoutineRouteRequest.js.map +1 -1
  7. package/dist/models/DescribeUrlObservationDataRequest.d.ts +46 -0
  8. package/dist/models/DescribeUrlObservationDataRequest.js +68 -0
  9. package/dist/models/DescribeUrlObservationDataRequest.js.map +1 -0
  10. package/dist/models/DescribeUrlObservationDataResponse.d.ts +19 -0
  11. package/dist/models/DescribeUrlObservationDataResponse.js +69 -0
  12. package/dist/models/DescribeUrlObservationDataResponse.js.map +1 -0
  13. package/dist/models/DescribeUrlObservationDataResponseBody.d.ts +30 -0
  14. package/dist/models/DescribeUrlObservationDataResponseBody.js +68 -0
  15. package/dist/models/DescribeUrlObservationDataResponseBody.js.map +1 -0
  16. package/dist/models/DescribeUrlObservationDataResponseBodyUrlDetailData.d.ts +58 -0
  17. package/dist/models/DescribeUrlObservationDataResponseBodyUrlDetailData.js +74 -0
  18. package/dist/models/DescribeUrlObservationDataResponseBodyUrlDetailData.js.map +1 -0
  19. package/dist/models/GetEdgeContainerAppResourceStatusResponseBodyRegions.d.ts +2 -0
  20. package/dist/models/GetEdgeContainerAppResourceStatusResponseBodyRegions.js +4 -0
  21. package/dist/models/GetEdgeContainerAppResourceStatusResponseBodyRegions.js.map +1 -1
  22. package/dist/models/GetRoutineRouteResponseBody.d.ts +1 -0
  23. package/dist/models/GetRoutineRouteResponseBody.js +2 -0
  24. package/dist/models/GetRoutineRouteResponseBody.js.map +1 -1
  25. package/dist/models/ListRoutineRoutesResponseBodyConfigs.d.ts +1 -0
  26. package/dist/models/ListRoutineRoutesResponseBodyConfigs.js +2 -0
  27. package/dist/models/ListRoutineRoutesResponseBodyConfigs.js.map +1 -1
  28. package/dist/models/ListSiteRoutesResponseBodyConfigs.d.ts +1 -0
  29. package/dist/models/ListSiteRoutesResponseBodyConfigs.js +2 -0
  30. package/dist/models/ListSiteRoutesResponseBodyConfigs.js.map +1 -1
  31. package/dist/models/UpdateRoutineRouteRequest.d.ts +1 -0
  32. package/dist/models/UpdateRoutineRouteRequest.js +2 -0
  33. package/dist/models/UpdateRoutineRouteRequest.js.map +1 -1
  34. package/dist/models/model.d.ts +4 -0
  35. package/dist/models/model.js +34 -26
  36. package/dist/models/model.js.map +1 -1
  37. package/package.json +2 -5
  38. package/src/client.ts +315 -169
  39. package/src/models/CreateRoutineRouteRequest.ts +3 -0
  40. package/src/models/DescribeUrlObservationDataRequest.ts +69 -0
  41. package/src/models/DescribeUrlObservationDataResponse.ts +40 -0
  42. package/src/models/DescribeUrlObservationDataResponseBody.ts +52 -0
  43. package/src/models/DescribeUrlObservationDataResponseBodyUrlDetailData.ts +87 -0
  44. package/src/models/GetEdgeContainerAppResourceStatusResponseBodyRegions.ts +6 -0
  45. package/src/models/GetRoutineRouteResponseBody.ts +3 -0
  46. package/src/models/ListRoutineRoutesResponseBodyConfigs.ts +3 -0
  47. package/src/models/ListSiteRoutesResponseBodyConfigs.ts +3 -0
  48. package/src/models/UpdateRoutineRouteRequest.ts +3 -0
  49. 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
+ }): 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;
@@ -2013,6 +2018,21 @@ export default class Client extends OpenApi {
2013
2018
  * @returns DescribeSiteTopDataResponse
2014
2019
  */
2015
2020
  describeSiteTopData(request: $_model.DescribeSiteTopDataRequest): Promise<$_model.DescribeSiteTopDataResponse>;
2021
+ /**
2022
+ * 查询网页观测质量数据
2023
+ *
2024
+ * @param request - DescribeUrlObservationDataRequest
2025
+ * @param runtime - runtime options for this request RuntimeOptions
2026
+ * @returns DescribeUrlObservationDataResponse
2027
+ */
2028
+ describeUrlObservationDataWithOptions(request: $_model.DescribeUrlObservationDataRequest, runtime: $dara.RuntimeOptions): Promise<$_model.DescribeUrlObservationDataResponse>;
2029
+ /**
2030
+ * 查询网页观测质量数据
2031
+ *
2032
+ * @param request - DescribeUrlObservationDataRequest
2033
+ * @returns DescribeUrlObservationDataResponse
2034
+ */
2035
+ describeUrlObservationData(request: $_model.DescribeUrlObservationDataRequest): Promise<$_model.DescribeUrlObservationDataResponse>;
2016
2036
  /**
2017
2037
  * Disables a scenario-specific policy.
2018
2038
  *
package/dist/client.js CHANGED
@@ -35,17 +35,10 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
38
  Object.defineProperty(exports, "__esModule", { value: true });
42
39
  // This file is auto-generated, don't edit it
43
40
  const $dara = __importStar(require("@darabonba/typescript"));
44
- const oss_client_1 = __importStar(require("@alicloud/oss-client")), $OSS = oss_client_1;
45
- const openplatform20191219_1 = __importStar(require("@alicloud/openplatform20191219")), $OpenPlatform = openplatform20191219_1;
46
- const $OSSUtil = __importStar(require("@alicloud/oss-util"));
47
- const $FileForm = __importStar(require("@alicloud/tea-fileform"));
48
- const openapi_core_1 = __importDefault(require("@alicloud/openapi-core"));
41
+ const openapi_core_1 = __importStar(require("@alicloud/openapi-core")), $OpenApi = openapi_core_1;
49
42
  const openapi_core_2 = require("@alicloud/openapi-core");
50
43
  const $_model = __importStar(require("./models/model"));
51
44
  __exportStar(require("./models/model"), exports);
@@ -56,6 +49,38 @@ class Client extends openapi_core_1.default {
56
49
  this.checkConfig(config);
57
50
  this._endpoint = this.getEndpoint("esa", this._regionId, this._endpointRule, this._network, this._suffix, this._endpointMap, this._endpoint);
58
51
  }
52
+ async _postOSSObject(bucketName, form) {
53
+ let request_ = new $dara.Request();
54
+ let boundary = $dara.Form.getBoundary();
55
+ request_.protocol = "HTTPS";
56
+ request_.method = "POST";
57
+ request_.pathname = `/`;
58
+ request_.headers = {
59
+ host: String(form["host"]),
60
+ date: openapi_core_2.OpenApiUtil.getDateUTCString(),
61
+ 'user-agent': openapi_core_2.OpenApiUtil.getUserAgent(""),
62
+ };
63
+ request_.headers["content-type"] = `multipart/form-data; boundary=${boundary}`;
64
+ request_.body = $dara.Form.toFileForm(form, boundary);
65
+ let response_ = await $dara.doAction(request_);
66
+ let respMap = null;
67
+ let bodyStr = await $dara.Stream.readAsString(response_.body);
68
+ if ((response_.statusCode >= 400) && (response_.statusCode < 600)) {
69
+ respMap = $dara.XML.parseXml(bodyStr, null);
70
+ let err = respMap["Error"];
71
+ throw new $OpenApi.ClientError({
72
+ code: String(err["Code"]),
73
+ message: String(err["Message"]),
74
+ data: {
75
+ httpCode: response_.statusCode,
76
+ requestId: String(err["RequestId"]),
77
+ hostId: String(err["HostId"]),
78
+ },
79
+ });
80
+ }
81
+ respMap = $dara.XML.parseXml(bodyStr, null);
82
+ return Object.assign({}, respMap);
83
+ }
59
84
  getEndpoint(productId, regionId, endpointRule, network, suffix, endpointMap, endpoint) {
60
85
  if (!$dara.isNull(endpoint)) {
61
86
  return endpoint;
@@ -462,12 +487,19 @@ class Client extends openapi_core_1.default {
462
487
  }
463
488
  async batchDeleteKvWithHighCapacityAdvance(request, runtime) {
464
489
  // Step 0: init client
465
- let accessKeyId = await this._credential.getAccessKeyId();
466
- let accessKeySecret = await this._credential.getAccessKeySecret();
467
- let securityToken = await this._credential.getSecurityToken();
468
- let credentialType = this._credential.getType();
490
+ if ($dara.isNull(this._credential)) {
491
+ throw new $OpenApi.ClientError({
492
+ code: "InvalidCredentials",
493
+ 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.",
494
+ });
495
+ }
496
+ let credentialModel = await this._credential.getCredential();
497
+ let accessKeyId = credentialModel.accessKeyId;
498
+ let accessKeySecret = credentialModel.accessKeySecret;
499
+ let securityToken = credentialModel.securityToken;
500
+ let credentialType = credentialModel.type;
469
501
  let openPlatformEndpoint = this._openPlatformEndpoint;
470
- if ($dara.isNull(openPlatformEndpoint)) {
502
+ if ($dara.isNull(openPlatformEndpoint) || openPlatformEndpoint == "") {
471
503
  openPlatformEndpoint = "openplatform.aliyuncs.com";
472
504
  }
473
505
  if ($dara.isNull(credentialType)) {
@@ -482,51 +514,54 @@ class Client extends openapi_core_1.default {
482
514
  protocol: this._protocol,
483
515
  regionId: this._regionId,
484
516
  });
485
- let authClient = new openplatform20191219_1.default(authConfig);
486
- let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
487
- product: "ESA",
488
- regionId: this._regionId,
517
+ let authClient = new openapi_core_1.default(authConfig);
518
+ let authRequest = {
519
+ Product: "ESA",
520
+ RegionId: this._regionId,
521
+ };
522
+ let authReq = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
523
+ query: openapi_core_2.OpenApiUtil.query(authRequest),
489
524
  });
490
- let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({});
491
- let ossConfig = new $OSS.Config({
492
- accessKeyId: accessKeyId,
493
- accessKeySecret: accessKeySecret,
494
- type: "access_key",
495
- protocol: this._protocol,
496
- regionId: this._regionId,
525
+ let authParams = new openapi_core_2.$OpenApiUtil.Params({
526
+ action: "AuthorizeFileUpload",
527
+ version: "2019-12-19",
528
+ protocol: "HTTPS",
529
+ pathname: "/",
530
+ method: "GET",
531
+ authType: "AK",
532
+ style: "RPC",
533
+ reqBodyType: "formData",
534
+ bodyType: "json",
497
535
  });
498
- let ossClient = new oss_client_1.default(ossConfig);
499
- let fileObj = new $FileForm.FileField({});
500
- let ossHeader = new $OSS.PostObjectRequestHeader({});
501
- let uploadRequest = new $OSS.PostObjectRequest({});
502
- let ossRuntime = new $OSSUtil.RuntimeOptions({});
503
- openapi_core_2.OpenApiUtil.convert(runtime, ossRuntime);
536
+ let authResponse = {};
537
+ let fileObj = new $dara.FileField({});
538
+ let ossHeader = {};
539
+ let tmpBody = {};
540
+ let useAccelerate = false;
541
+ let authResponseBody = {};
504
542
  let batchDeleteKvWithHighCapacityReq = new $_model.BatchDeleteKvWithHighCapacityRequest({});
505
543
  openapi_core_2.OpenApiUtil.convert(request, batchDeleteKvWithHighCapacityReq);
506
544
  if (!$dara.isNull(request.urlObject)) {
507
- authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
508
- ossConfig.accessKeyId = authResponse.body.accessKeyId;
509
- ossConfig.endpoint = openapi_core_2.OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
510
- ossClient = new oss_client_1.default(ossConfig);
511
- fileObj = new $FileForm.FileField({
512
- filename: authResponse.body.objectKey,
545
+ authResponse = await authClient.callApi(authParams, authReq, runtime);
546
+ tmpBody = authResponse["body"];
547
+ useAccelerate = Boolean(tmpBody["UseAccelerate"]);
548
+ authResponseBody = openapi_core_2.OpenApiUtil.stringifyMapValue(tmpBody);
549
+ fileObj = new $dara.FileField({
550
+ filename: authResponseBody["ObjectKey"],
513
551
  content: request.urlObject,
514
552
  contentType: "",
515
553
  });
516
- ossHeader = new $OSS.PostObjectRequestHeader({
517
- accessKeyId: authResponse.body.accessKeyId,
518
- policy: authResponse.body.encodedPolicy,
519
- signature: authResponse.body.signature,
520
- key: authResponse.body.objectKey,
554
+ ossHeader = {
555
+ host: `${authResponseBody["Bucket"]}.${openapi_core_2.OpenApiUtil.getEndpoint(authResponseBody["Endpoint"], useAccelerate, this._endpointType)}`,
556
+ OSSAccessKeyId: authResponseBody["AccessKeyId"],
557
+ policy: authResponseBody["EncodedPolicy"],
558
+ Signature: authResponseBody["Signature"],
559
+ key: authResponseBody["ObjectKey"],
521
560
  file: fileObj,
522
- successActionStatus: "201",
523
- });
524
- uploadRequest = new $OSS.PostObjectRequest({
525
- bucketName: authResponse.body.bucket,
526
- header: ossHeader,
527
- });
528
- await ossClient.postObject(uploadRequest, ossRuntime);
529
- batchDeleteKvWithHighCapacityReq.url = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
561
+ success_action_status: "201",
562
+ };
563
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
564
+ batchDeleteKvWithHighCapacityReq.url = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
530
565
  }
531
566
  let batchDeleteKvWithHighCapacityResp = await this.batchDeleteKvWithHighCapacityWithOptions(batchDeleteKvWithHighCapacityReq, runtime);
532
567
  return batchDeleteKvWithHighCapacityResp;
@@ -766,12 +801,19 @@ class Client extends openapi_core_1.default {
766
801
  }
767
802
  async batchPutKvWithHighCapacityAdvance(request, runtime) {
768
803
  // Step 0: init client
769
- let accessKeyId = await this._credential.getAccessKeyId();
770
- let accessKeySecret = await this._credential.getAccessKeySecret();
771
- let securityToken = await this._credential.getSecurityToken();
772
- let credentialType = this._credential.getType();
804
+ if ($dara.isNull(this._credential)) {
805
+ throw new $OpenApi.ClientError({
806
+ code: "InvalidCredentials",
807
+ 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.",
808
+ });
809
+ }
810
+ let credentialModel = await this._credential.getCredential();
811
+ let accessKeyId = credentialModel.accessKeyId;
812
+ let accessKeySecret = credentialModel.accessKeySecret;
813
+ let securityToken = credentialModel.securityToken;
814
+ let credentialType = credentialModel.type;
773
815
  let openPlatformEndpoint = this._openPlatformEndpoint;
774
- if ($dara.isNull(openPlatformEndpoint)) {
816
+ if ($dara.isNull(openPlatformEndpoint) || openPlatformEndpoint == "") {
775
817
  openPlatformEndpoint = "openplatform.aliyuncs.com";
776
818
  }
777
819
  if ($dara.isNull(credentialType)) {
@@ -786,51 +828,54 @@ class Client extends openapi_core_1.default {
786
828
  protocol: this._protocol,
787
829
  regionId: this._regionId,
788
830
  });
789
- let authClient = new openplatform20191219_1.default(authConfig);
790
- let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
791
- product: "ESA",
792
- regionId: this._regionId,
831
+ let authClient = new openapi_core_1.default(authConfig);
832
+ let authRequest = {
833
+ Product: "ESA",
834
+ RegionId: this._regionId,
835
+ };
836
+ let authReq = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
837
+ query: openapi_core_2.OpenApiUtil.query(authRequest),
793
838
  });
794
- let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({});
795
- let ossConfig = new $OSS.Config({
796
- accessKeyId: accessKeyId,
797
- accessKeySecret: accessKeySecret,
798
- type: "access_key",
799
- protocol: this._protocol,
800
- regionId: this._regionId,
839
+ let authParams = new openapi_core_2.$OpenApiUtil.Params({
840
+ action: "AuthorizeFileUpload",
841
+ version: "2019-12-19",
842
+ protocol: "HTTPS",
843
+ pathname: "/",
844
+ method: "GET",
845
+ authType: "AK",
846
+ style: "RPC",
847
+ reqBodyType: "formData",
848
+ bodyType: "json",
801
849
  });
802
- let ossClient = new oss_client_1.default(ossConfig);
803
- let fileObj = new $FileForm.FileField({});
804
- let ossHeader = new $OSS.PostObjectRequestHeader({});
805
- let uploadRequest = new $OSS.PostObjectRequest({});
806
- let ossRuntime = new $OSSUtil.RuntimeOptions({});
807
- openapi_core_2.OpenApiUtil.convert(runtime, ossRuntime);
850
+ let authResponse = {};
851
+ let fileObj = new $dara.FileField({});
852
+ let ossHeader = {};
853
+ let tmpBody = {};
854
+ let useAccelerate = false;
855
+ let authResponseBody = {};
808
856
  let batchPutKvWithHighCapacityReq = new $_model.BatchPutKvWithHighCapacityRequest({});
809
857
  openapi_core_2.OpenApiUtil.convert(request, batchPutKvWithHighCapacityReq);
810
858
  if (!$dara.isNull(request.urlObject)) {
811
- authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
812
- ossConfig.accessKeyId = authResponse.body.accessKeyId;
813
- ossConfig.endpoint = openapi_core_2.OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
814
- ossClient = new oss_client_1.default(ossConfig);
815
- fileObj = new $FileForm.FileField({
816
- filename: authResponse.body.objectKey,
859
+ authResponse = await authClient.callApi(authParams, authReq, runtime);
860
+ tmpBody = authResponse["body"];
861
+ useAccelerate = Boolean(tmpBody["UseAccelerate"]);
862
+ authResponseBody = openapi_core_2.OpenApiUtil.stringifyMapValue(tmpBody);
863
+ fileObj = new $dara.FileField({
864
+ filename: authResponseBody["ObjectKey"],
817
865
  content: request.urlObject,
818
866
  contentType: "",
819
867
  });
820
- ossHeader = new $OSS.PostObjectRequestHeader({
821
- accessKeyId: authResponse.body.accessKeyId,
822
- policy: authResponse.body.encodedPolicy,
823
- signature: authResponse.body.signature,
824
- key: authResponse.body.objectKey,
868
+ ossHeader = {
869
+ host: `${authResponseBody["Bucket"]}.${openapi_core_2.OpenApiUtil.getEndpoint(authResponseBody["Endpoint"], useAccelerate, this._endpointType)}`,
870
+ OSSAccessKeyId: authResponseBody["AccessKeyId"],
871
+ policy: authResponseBody["EncodedPolicy"],
872
+ Signature: authResponseBody["Signature"],
873
+ key: authResponseBody["ObjectKey"],
825
874
  file: fileObj,
826
- successActionStatus: "201",
827
- });
828
- uploadRequest = new $OSS.PostObjectRequest({
829
- bucketName: authResponse.body.bucket,
830
- header: ossHeader,
831
- });
832
- await ossClient.postObject(uploadRequest, ossRuntime);
833
- batchPutKvWithHighCapacityReq.url = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
875
+ success_action_status: "201",
876
+ };
877
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
878
+ batchPutKvWithHighCapacityReq.url = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
834
879
  }
835
880
  let batchPutKvWithHighCapacityResp = await this.batchPutKvWithHighCapacityWithOptions(batchPutKvWithHighCapacityReq, runtime);
836
881
  return batchPutKvWithHighCapacityResp;
@@ -2775,6 +2820,9 @@ class Client extends openapi_core_1.default {
2775
2820
  if (!$dara.isNull(request.bypass)) {
2776
2821
  query["Bypass"] = request.bypass;
2777
2822
  }
2823
+ if (!$dara.isNull(request.fallback)) {
2824
+ query["Fallback"] = request.fallback;
2825
+ }
2778
2826
  if (!$dara.isNull(request.routeEnable)) {
2779
2827
  query["RouteEnable"] = request.routeEnable;
2780
2828
  }
@@ -6262,6 +6310,60 @@ class Client extends openapi_core_1.default {
6262
6310
  let runtime = new $dara.RuntimeOptions({});
6263
6311
  return await this.describeSiteTopDataWithOptions(request, runtime);
6264
6312
  }
6313
+ /**
6314
+ * 查询网页观测质量数据
6315
+ *
6316
+ * @param request - DescribeUrlObservationDataRequest
6317
+ * @param runtime - runtime options for this request RuntimeOptions
6318
+ * @returns DescribeUrlObservationDataResponse
6319
+ */
6320
+ async describeUrlObservationDataWithOptions(request, runtime) {
6321
+ request.validate();
6322
+ let query = {};
6323
+ if (!$dara.isNull(request.clientPlatform)) {
6324
+ query["ClientPlatform"] = request.clientPlatform;
6325
+ }
6326
+ if (!$dara.isNull(request.endTime)) {
6327
+ query["EndTime"] = request.endTime;
6328
+ }
6329
+ if (!$dara.isNull(request.metric)) {
6330
+ query["Metric"] = request.metric;
6331
+ }
6332
+ if (!$dara.isNull(request.siteId)) {
6333
+ query["SiteId"] = request.siteId;
6334
+ }
6335
+ if (!$dara.isNull(request.startTime)) {
6336
+ query["StartTime"] = request.startTime;
6337
+ }
6338
+ if (!$dara.isNull(request.url)) {
6339
+ query["Url"] = request.url;
6340
+ }
6341
+ let req = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
6342
+ query: openapi_core_2.OpenApiUtil.query(query),
6343
+ });
6344
+ let params = new openapi_core_2.$OpenApiUtil.Params({
6345
+ action: "DescribeUrlObservationData",
6346
+ version: "2024-09-10",
6347
+ protocol: "HTTPS",
6348
+ pathname: "/",
6349
+ method: "POST",
6350
+ authType: "AK",
6351
+ style: "RPC",
6352
+ reqBodyType: "formData",
6353
+ bodyType: "json",
6354
+ });
6355
+ return $dara.cast(await this.callApi(params, req, runtime), new $_model.DescribeUrlObservationDataResponse({}));
6356
+ }
6357
+ /**
6358
+ * 查询网页观测质量数据
6359
+ *
6360
+ * @param request - DescribeUrlObservationDataRequest
6361
+ * @returns DescribeUrlObservationDataResponse
6362
+ */
6363
+ async describeUrlObservationData(request) {
6364
+ let runtime = new $dara.RuntimeOptions({});
6365
+ return await this.describeUrlObservationDataWithOptions(request, runtime);
6366
+ }
6265
6367
  /**
6266
6368
  * Disables a scenario-specific policy.
6267
6369
  *
@@ -12325,12 +12427,19 @@ class Client extends openapi_core_1.default {
12325
12427
  }
12326
12428
  async putKvWithHighCapacityAdvance(request, runtime) {
12327
12429
  // Step 0: init client
12328
- let accessKeyId = await this._credential.getAccessKeyId();
12329
- let accessKeySecret = await this._credential.getAccessKeySecret();
12330
- let securityToken = await this._credential.getSecurityToken();
12331
- let credentialType = this._credential.getType();
12430
+ if ($dara.isNull(this._credential)) {
12431
+ throw new $OpenApi.ClientError({
12432
+ code: "InvalidCredentials",
12433
+ 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.",
12434
+ });
12435
+ }
12436
+ let credentialModel = await this._credential.getCredential();
12437
+ let accessKeyId = credentialModel.accessKeyId;
12438
+ let accessKeySecret = credentialModel.accessKeySecret;
12439
+ let securityToken = credentialModel.securityToken;
12440
+ let credentialType = credentialModel.type;
12332
12441
  let openPlatformEndpoint = this._openPlatformEndpoint;
12333
- if ($dara.isNull(openPlatformEndpoint)) {
12442
+ if ($dara.isNull(openPlatformEndpoint) || openPlatformEndpoint == "") {
12334
12443
  openPlatformEndpoint = "openplatform.aliyuncs.com";
12335
12444
  }
12336
12445
  if ($dara.isNull(credentialType)) {
@@ -12345,51 +12454,54 @@ class Client extends openapi_core_1.default {
12345
12454
  protocol: this._protocol,
12346
12455
  regionId: this._regionId,
12347
12456
  });
12348
- let authClient = new openplatform20191219_1.default(authConfig);
12349
- let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
12350
- product: "ESA",
12351
- regionId: this._regionId,
12457
+ let authClient = new openapi_core_1.default(authConfig);
12458
+ let authRequest = {
12459
+ Product: "ESA",
12460
+ RegionId: this._regionId,
12461
+ };
12462
+ let authReq = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
12463
+ query: openapi_core_2.OpenApiUtil.query(authRequest),
12352
12464
  });
12353
- let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({});
12354
- let ossConfig = new $OSS.Config({
12355
- accessKeyId: accessKeyId,
12356
- accessKeySecret: accessKeySecret,
12357
- type: "access_key",
12358
- protocol: this._protocol,
12359
- regionId: this._regionId,
12465
+ let authParams = new openapi_core_2.$OpenApiUtil.Params({
12466
+ action: "AuthorizeFileUpload",
12467
+ version: "2019-12-19",
12468
+ protocol: "HTTPS",
12469
+ pathname: "/",
12470
+ method: "GET",
12471
+ authType: "AK",
12472
+ style: "RPC",
12473
+ reqBodyType: "formData",
12474
+ bodyType: "json",
12360
12475
  });
12361
- let ossClient = new oss_client_1.default(ossConfig);
12362
- let fileObj = new $FileForm.FileField({});
12363
- let ossHeader = new $OSS.PostObjectRequestHeader({});
12364
- let uploadRequest = new $OSS.PostObjectRequest({});
12365
- let ossRuntime = new $OSSUtil.RuntimeOptions({});
12366
- openapi_core_2.OpenApiUtil.convert(runtime, ossRuntime);
12476
+ let authResponse = {};
12477
+ let fileObj = new $dara.FileField({});
12478
+ let ossHeader = {};
12479
+ let tmpBody = {};
12480
+ let useAccelerate = false;
12481
+ let authResponseBody = {};
12367
12482
  let putKvWithHighCapacityReq = new $_model.PutKvWithHighCapacityRequest({});
12368
12483
  openapi_core_2.OpenApiUtil.convert(request, putKvWithHighCapacityReq);
12369
12484
  if (!$dara.isNull(request.urlObject)) {
12370
- authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
12371
- ossConfig.accessKeyId = authResponse.body.accessKeyId;
12372
- ossConfig.endpoint = openapi_core_2.OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
12373
- ossClient = new oss_client_1.default(ossConfig);
12374
- fileObj = new $FileForm.FileField({
12375
- filename: authResponse.body.objectKey,
12485
+ authResponse = await authClient.callApi(authParams, authReq, runtime);
12486
+ tmpBody = authResponse["body"];
12487
+ useAccelerate = Boolean(tmpBody["UseAccelerate"]);
12488
+ authResponseBody = openapi_core_2.OpenApiUtil.stringifyMapValue(tmpBody);
12489
+ fileObj = new $dara.FileField({
12490
+ filename: authResponseBody["ObjectKey"],
12376
12491
  content: request.urlObject,
12377
12492
  contentType: "",
12378
12493
  });
12379
- ossHeader = new $OSS.PostObjectRequestHeader({
12380
- accessKeyId: authResponse.body.accessKeyId,
12381
- policy: authResponse.body.encodedPolicy,
12382
- signature: authResponse.body.signature,
12383
- key: authResponse.body.objectKey,
12494
+ ossHeader = {
12495
+ host: `${authResponseBody["Bucket"]}.${openapi_core_2.OpenApiUtil.getEndpoint(authResponseBody["Endpoint"], useAccelerate, this._endpointType)}`,
12496
+ OSSAccessKeyId: authResponseBody["AccessKeyId"],
12497
+ policy: authResponseBody["EncodedPolicy"],
12498
+ Signature: authResponseBody["Signature"],
12499
+ key: authResponseBody["ObjectKey"],
12384
12500
  file: fileObj,
12385
- successActionStatus: "201",
12386
- });
12387
- uploadRequest = new $OSS.PostObjectRequest({
12388
- bucketName: authResponse.body.bucket,
12389
- header: ossHeader,
12390
- });
12391
- await ossClient.postObject(uploadRequest, ossRuntime);
12392
- putKvWithHighCapacityReq.url = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
12501
+ success_action_status: "201",
12502
+ };
12503
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
12504
+ putKvWithHighCapacityReq.url = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
12393
12505
  }
12394
12506
  let putKvWithHighCapacityResp = await this.putKvWithHighCapacityWithOptions(putKvWithHighCapacityReq, runtime);
12395
12507
  return putKvWithHighCapacityResp;
@@ -14825,6 +14937,9 @@ class Client extends openapi_core_1.default {
14825
14937
  if (!$dara.isNull(request.configId)) {
14826
14938
  query["ConfigId"] = request.configId;
14827
14939
  }
14940
+ if (!$dara.isNull(request.fallback)) {
14941
+ query["Fallback"] = request.fallback;
14942
+ }
14828
14943
  if (!$dara.isNull(request.routeEnable)) {
14829
14944
  query["RouteEnable"] = request.routeEnable;
14830
14945
  }
@@ -16054,12 +16169,19 @@ class Client extends openapi_core_1.default {
16054
16169
  }
16055
16170
  async uploadFileAdvance(request, runtime) {
16056
16171
  // Step 0: init client
16057
- let accessKeyId = await this._credential.getAccessKeyId();
16058
- let accessKeySecret = await this._credential.getAccessKeySecret();
16059
- let securityToken = await this._credential.getSecurityToken();
16060
- let credentialType = this._credential.getType();
16172
+ if ($dara.isNull(this._credential)) {
16173
+ throw new $OpenApi.ClientError({
16174
+ code: "InvalidCredentials",
16175
+ 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.",
16176
+ });
16177
+ }
16178
+ let credentialModel = await this._credential.getCredential();
16179
+ let accessKeyId = credentialModel.accessKeyId;
16180
+ let accessKeySecret = credentialModel.accessKeySecret;
16181
+ let securityToken = credentialModel.securityToken;
16182
+ let credentialType = credentialModel.type;
16061
16183
  let openPlatformEndpoint = this._openPlatformEndpoint;
16062
- if ($dara.isNull(openPlatformEndpoint)) {
16184
+ if ($dara.isNull(openPlatformEndpoint) || openPlatformEndpoint == "") {
16063
16185
  openPlatformEndpoint = "openplatform.aliyuncs.com";
16064
16186
  }
16065
16187
  if ($dara.isNull(credentialType)) {
@@ -16074,51 +16196,54 @@ class Client extends openapi_core_1.default {
16074
16196
  protocol: this._protocol,
16075
16197
  regionId: this._regionId,
16076
16198
  });
16077
- let authClient = new openplatform20191219_1.default(authConfig);
16078
- let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
16079
- product: "ESA",
16080
- regionId: this._regionId,
16199
+ let authClient = new openapi_core_1.default(authConfig);
16200
+ let authRequest = {
16201
+ Product: "ESA",
16202
+ RegionId: this._regionId,
16203
+ };
16204
+ let authReq = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
16205
+ query: openapi_core_2.OpenApiUtil.query(authRequest),
16081
16206
  });
16082
- let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({});
16083
- let ossConfig = new $OSS.Config({
16084
- accessKeyId: accessKeyId,
16085
- accessKeySecret: accessKeySecret,
16086
- type: "access_key",
16087
- protocol: this._protocol,
16088
- regionId: this._regionId,
16207
+ let authParams = new openapi_core_2.$OpenApiUtil.Params({
16208
+ action: "AuthorizeFileUpload",
16209
+ version: "2019-12-19",
16210
+ protocol: "HTTPS",
16211
+ pathname: "/",
16212
+ method: "GET",
16213
+ authType: "AK",
16214
+ style: "RPC",
16215
+ reqBodyType: "formData",
16216
+ bodyType: "json",
16089
16217
  });
16090
- let ossClient = new oss_client_1.default(ossConfig);
16091
- let fileObj = new $FileForm.FileField({});
16092
- let ossHeader = new $OSS.PostObjectRequestHeader({});
16093
- let uploadRequest = new $OSS.PostObjectRequest({});
16094
- let ossRuntime = new $OSSUtil.RuntimeOptions({});
16095
- openapi_core_2.OpenApiUtil.convert(runtime, ossRuntime);
16218
+ let authResponse = {};
16219
+ let fileObj = new $dara.FileField({});
16220
+ let ossHeader = {};
16221
+ let tmpBody = {};
16222
+ let useAccelerate = false;
16223
+ let authResponseBody = {};
16096
16224
  let uploadFileReq = new $_model.UploadFileRequest({});
16097
16225
  openapi_core_2.OpenApiUtil.convert(request, uploadFileReq);
16098
16226
  if (!$dara.isNull(request.urlObject)) {
16099
- authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
16100
- ossConfig.accessKeyId = authResponse.body.accessKeyId;
16101
- ossConfig.endpoint = openapi_core_2.OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
16102
- ossClient = new oss_client_1.default(ossConfig);
16103
- fileObj = new $FileForm.FileField({
16104
- filename: authResponse.body.objectKey,
16227
+ authResponse = await authClient.callApi(authParams, authReq, runtime);
16228
+ tmpBody = authResponse["body"];
16229
+ useAccelerate = Boolean(tmpBody["UseAccelerate"]);
16230
+ authResponseBody = openapi_core_2.OpenApiUtil.stringifyMapValue(tmpBody);
16231
+ fileObj = new $dara.FileField({
16232
+ filename: authResponseBody["ObjectKey"],
16105
16233
  content: request.urlObject,
16106
16234
  contentType: "",
16107
16235
  });
16108
- ossHeader = new $OSS.PostObjectRequestHeader({
16109
- accessKeyId: authResponse.body.accessKeyId,
16110
- policy: authResponse.body.encodedPolicy,
16111
- signature: authResponse.body.signature,
16112
- key: authResponse.body.objectKey,
16236
+ ossHeader = {
16237
+ host: `${authResponseBody["Bucket"]}.${openapi_core_2.OpenApiUtil.getEndpoint(authResponseBody["Endpoint"], useAccelerate, this._endpointType)}`,
16238
+ OSSAccessKeyId: authResponseBody["AccessKeyId"],
16239
+ policy: authResponseBody["EncodedPolicy"],
16240
+ Signature: authResponseBody["Signature"],
16241
+ key: authResponseBody["ObjectKey"],
16113
16242
  file: fileObj,
16114
- successActionStatus: "201",
16115
- });
16116
- uploadRequest = new $OSS.PostObjectRequest({
16117
- bucketName: authResponse.body.bucket,
16118
- header: ossHeader,
16119
- });
16120
- await ossClient.postObject(uploadRequest, ossRuntime);
16121
- uploadFileReq.url = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
16243
+ success_action_status: "201",
16244
+ };
16245
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
16246
+ uploadFileReq.url = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
16122
16247
  }
16123
16248
  let uploadFileResp = await this.uploadFileWithOptions(uploadFileReq, runtime);
16124
16249
  return uploadFileResp;