@alicloud/dataworks-public20240518 7.2.3 → 7.2.4

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 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;
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);
@@ -82,6 +75,38 @@ class Client extends openapi_core_1.default {
82
75
  this.checkConfig(config);
83
76
  this._endpoint = this.getEndpoint("dataworks-public", this._regionId, this._endpointRule, this._network, this._suffix, this._endpointMap, this._endpoint);
84
77
  }
78
+ async _postOSSObject(bucketName, form) {
79
+ let request_ = new $dara.Request();
80
+ let boundary = $dara.Form.getBoundary();
81
+ request_.protocol = "HTTPS";
82
+ request_.method = "POST";
83
+ request_.pathname = `/`;
84
+ request_.headers = {
85
+ host: String(form["host"]),
86
+ date: openapi_core_2.OpenApiUtil.getDateUTCString(),
87
+ 'user-agent': openapi_core_2.OpenApiUtil.getUserAgent(""),
88
+ };
89
+ request_.headers["content-type"] = `multipart/form-data; boundary=${boundary}`;
90
+ request_.body = $dara.Form.toFileForm(form, boundary);
91
+ let response_ = await $dara.doAction(request_);
92
+ let respMap = null;
93
+ let bodyStr = await $dara.Stream.readAsString(response_.body);
94
+ if ((response_.statusCode >= 400) && (response_.statusCode < 600)) {
95
+ respMap = $dara.XML.parseXml(bodyStr, null);
96
+ let err = respMap["Error"];
97
+ throw new $OpenApi.ClientError({
98
+ code: String(err["Code"]),
99
+ message: String(err["Message"]),
100
+ data: {
101
+ httpCode: response_.statusCode,
102
+ requestId: String(err["RequestId"]),
103
+ hostId: String(err["HostId"]),
104
+ },
105
+ });
106
+ }
107
+ respMap = $dara.XML.parseXml(bodyStr, null);
108
+ return Object.assign({}, respMap);
109
+ }
85
110
  getEndpoint(productId, regionId, endpointRule, network, suffix, endpointMap, endpoint) {
86
111
  if (!$dara.isNull(endpoint)) {
87
112
  return endpoint;
@@ -571,33 +596,37 @@ class Client extends openapi_core_1.default {
571
596
  if (!$dara.isNull(tmpReq.transformationRules)) {
572
597
  request.transformationRulesShrink = openapi_core_2.OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.transformationRules, "TransformationRules", "json");
573
598
  }
574
- let body = {};
575
- if (!$dara.isNull(request.description)) {
576
- body["Description"] = request.description;
577
- }
578
- if (!$dara.isNull(request.destinationDataSourceSettingsShrink)) {
579
- body["DestinationDataSourceSettings"] = request.destinationDataSourceSettingsShrink;
580
- }
599
+ let query = {};
581
600
  if (!$dara.isNull(request.destinationDataSourceType)) {
582
- body["DestinationDataSourceType"] = request.destinationDataSourceType;
601
+ query["DestinationDataSourceType"] = request.destinationDataSourceType;
583
602
  }
584
603
  if (!$dara.isNull(request.jobName)) {
585
- body["JobName"] = request.jobName;
586
- }
587
- if (!$dara.isNull(request.jobSettingsShrink)) {
588
- body["JobSettings"] = request.jobSettingsShrink;
604
+ query["JobName"] = request.jobName;
589
605
  }
590
606
  if (!$dara.isNull(request.jobType)) {
591
- body["JobType"] = request.jobType;
607
+ query["JobType"] = request.jobType;
592
608
  }
593
609
  if (!$dara.isNull(request.migrationType)) {
594
- body["MigrationType"] = request.migrationType;
610
+ query["MigrationType"] = request.migrationType;
595
611
  }
596
612
  if (!$dara.isNull(request.name)) {
597
- body["Name"] = request.name;
613
+ query["Name"] = request.name;
598
614
  }
599
615
  if (!$dara.isNull(request.projectId)) {
600
- body["ProjectId"] = request.projectId;
616
+ query["ProjectId"] = request.projectId;
617
+ }
618
+ if (!$dara.isNull(request.sourceDataSourceType)) {
619
+ query["SourceDataSourceType"] = request.sourceDataSourceType;
620
+ }
621
+ let body = {};
622
+ if (!$dara.isNull(request.description)) {
623
+ body["Description"] = request.description;
624
+ }
625
+ if (!$dara.isNull(request.destinationDataSourceSettingsShrink)) {
626
+ body["DestinationDataSourceSettings"] = request.destinationDataSourceSettingsShrink;
627
+ }
628
+ if (!$dara.isNull(request.jobSettingsShrink)) {
629
+ body["JobSettings"] = request.jobSettingsShrink;
601
630
  }
602
631
  if (!$dara.isNull(request.resourceSettingsShrink)) {
603
632
  body["ResourceSettings"] = request.resourceSettingsShrink;
@@ -605,9 +634,6 @@ class Client extends openapi_core_1.default {
605
634
  if (!$dara.isNull(request.sourceDataSourceSettingsShrink)) {
606
635
  body["SourceDataSourceSettings"] = request.sourceDataSourceSettingsShrink;
607
636
  }
608
- if (!$dara.isNull(request.sourceDataSourceType)) {
609
- body["SourceDataSourceType"] = request.sourceDataSourceType;
610
- }
611
637
  if (!$dara.isNull(request.tableMappingsShrink)) {
612
638
  body["TableMappings"] = request.tableMappingsShrink;
613
639
  }
@@ -615,6 +641,7 @@ class Client extends openapi_core_1.default {
615
641
  body["TransformationRules"] = request.transformationRulesShrink;
616
642
  }
617
643
  let req = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
644
+ query: openapi_core_2.OpenApiUtil.query(query),
618
645
  body: openapi_core_2.OpenApiUtil.parseToMap(body),
619
646
  });
620
647
  let params = new openapi_core_2.$OpenApiUtil.Params({
@@ -1783,12 +1810,19 @@ class Client extends openapi_core_1.default {
1783
1810
  }
1784
1811
  async createResourceAdvance(request, runtime) {
1785
1812
  // Step 0: init client
1786
- let accessKeyId = await this._credential.getAccessKeyId();
1787
- let accessKeySecret = await this._credential.getAccessKeySecret();
1788
- let securityToken = await this._credential.getSecurityToken();
1789
- let credentialType = this._credential.getType();
1813
+ if ($dara.isNull(this._credential)) {
1814
+ throw new $OpenApi.ClientError({
1815
+ code: "InvalidCredentials",
1816
+ 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.",
1817
+ });
1818
+ }
1819
+ let credentialModel = await this._credential.getCredential();
1820
+ let accessKeyId = credentialModel.accessKeyId;
1821
+ let accessKeySecret = credentialModel.accessKeySecret;
1822
+ let securityToken = credentialModel.securityToken;
1823
+ let credentialType = credentialModel.type;
1790
1824
  let openPlatformEndpoint = this._openPlatformEndpoint;
1791
- if ($dara.isNull(openPlatformEndpoint)) {
1825
+ if ($dara.isNull(openPlatformEndpoint) || openPlatformEndpoint == "") {
1792
1826
  openPlatformEndpoint = "openplatform.aliyuncs.com";
1793
1827
  }
1794
1828
  if ($dara.isNull(credentialType)) {
@@ -1803,51 +1837,54 @@ class Client extends openapi_core_1.default {
1803
1837
  protocol: this._protocol,
1804
1838
  regionId: this._regionId,
1805
1839
  });
1806
- let authClient = new openplatform20191219_1.default(authConfig);
1807
- let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
1808
- product: "dataworks-public",
1809
- regionId: this._regionId,
1840
+ let authClient = new openapi_core_1.default(authConfig);
1841
+ let authRequest = {
1842
+ Product: "dataworks-public",
1843
+ RegionId: this._regionId,
1844
+ };
1845
+ let authReq = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
1846
+ query: openapi_core_2.OpenApiUtil.query(authRequest),
1810
1847
  });
1811
- let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({});
1812
- let ossConfig = new $OSS.Config({
1813
- accessKeyId: accessKeyId,
1814
- accessKeySecret: accessKeySecret,
1815
- type: "access_key",
1816
- protocol: this._protocol,
1817
- regionId: this._regionId,
1848
+ let authParams = new openapi_core_2.$OpenApiUtil.Params({
1849
+ action: "AuthorizeFileUpload",
1850
+ version: "2019-12-19",
1851
+ protocol: "HTTPS",
1852
+ pathname: "/",
1853
+ method: "GET",
1854
+ authType: "AK",
1855
+ style: "RPC",
1856
+ reqBodyType: "formData",
1857
+ bodyType: "json",
1818
1858
  });
1819
- let ossClient = new oss_client_1.default(ossConfig);
1820
- let fileObj = new $FileForm.FileField({});
1821
- let ossHeader = new $OSS.PostObjectRequestHeader({});
1822
- let uploadRequest = new $OSS.PostObjectRequest({});
1823
- let ossRuntime = new $OSSUtil.RuntimeOptions({});
1824
- openapi_core_2.OpenApiUtil.convert(runtime, ossRuntime);
1859
+ let authResponse = {};
1860
+ let fileObj = new $dara.FileField({});
1861
+ let ossHeader = {};
1862
+ let tmpBody = {};
1863
+ let useAccelerate = false;
1864
+ let authResponseBody = {};
1825
1865
  let createResourceReq = new $_model.CreateResourceRequest({});
1826
1866
  openapi_core_2.OpenApiUtil.convert(request, createResourceReq);
1827
1867
  if (!$dara.isNull(request.resourceFileObject)) {
1828
- authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
1829
- ossConfig.accessKeyId = authResponse.body.accessKeyId;
1830
- ossConfig.endpoint = openapi_core_2.OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
1831
- ossClient = new oss_client_1.default(ossConfig);
1832
- fileObj = new $FileForm.FileField({
1833
- filename: authResponse.body.objectKey,
1868
+ authResponse = await authClient.callApi(authParams, authReq, runtime);
1869
+ tmpBody = authResponse["body"];
1870
+ useAccelerate = Boolean(tmpBody["UseAccelerate"]);
1871
+ authResponseBody = openapi_core_2.OpenApiUtil.stringifyMapValue(tmpBody);
1872
+ fileObj = new $dara.FileField({
1873
+ filename: authResponseBody["ObjectKey"],
1834
1874
  content: request.resourceFileObject,
1835
1875
  contentType: "",
1836
1876
  });
1837
- ossHeader = new $OSS.PostObjectRequestHeader({
1838
- accessKeyId: authResponse.body.accessKeyId,
1839
- policy: authResponse.body.encodedPolicy,
1840
- signature: authResponse.body.signature,
1841
- key: authResponse.body.objectKey,
1877
+ ossHeader = {
1878
+ host: `${authResponseBody["Bucket"]}.${openapi_core_2.OpenApiUtil.getEndpoint(authResponseBody["Endpoint"], useAccelerate, this._endpointType)}`,
1879
+ OSSAccessKeyId: authResponseBody["AccessKeyId"],
1880
+ policy: authResponseBody["EncodedPolicy"],
1881
+ Signature: authResponseBody["Signature"],
1882
+ key: authResponseBody["ObjectKey"],
1842
1883
  file: fileObj,
1843
- successActionStatus: "201",
1844
- });
1845
- uploadRequest = new $OSS.PostObjectRequest({
1846
- bucketName: authResponse.body.bucket,
1847
- header: ossHeader,
1848
- });
1849
- await ossClient.postObject(uploadRequest, ossRuntime);
1850
- createResourceReq.resourceFile = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
1884
+ success_action_status: "201",
1885
+ };
1886
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
1887
+ createResourceReq.resourceFile = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
1851
1888
  }
1852
1889
  let createResourceResp = await this.createResourceWithOptions(createResourceReq, runtime);
1853
1890
  return createResourceResp;
@@ -1926,12 +1963,19 @@ class Client extends openapi_core_1.default {
1926
1963
  }
1927
1964
  async createResourceFileAdvance(request, runtime) {
1928
1965
  // Step 0: init client
1929
- let accessKeyId = await this._credential.getAccessKeyId();
1930
- let accessKeySecret = await this._credential.getAccessKeySecret();
1931
- let securityToken = await this._credential.getSecurityToken();
1932
- let credentialType = this._credential.getType();
1966
+ if ($dara.isNull(this._credential)) {
1967
+ throw new $OpenApi.ClientError({
1968
+ code: "InvalidCredentials",
1969
+ 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.",
1970
+ });
1971
+ }
1972
+ let credentialModel = await this._credential.getCredential();
1973
+ let accessKeyId = credentialModel.accessKeyId;
1974
+ let accessKeySecret = credentialModel.accessKeySecret;
1975
+ let securityToken = credentialModel.securityToken;
1976
+ let credentialType = credentialModel.type;
1933
1977
  let openPlatformEndpoint = this._openPlatformEndpoint;
1934
- if ($dara.isNull(openPlatformEndpoint)) {
1978
+ if ($dara.isNull(openPlatformEndpoint) || openPlatformEndpoint == "") {
1935
1979
  openPlatformEndpoint = "openplatform.aliyuncs.com";
1936
1980
  }
1937
1981
  if ($dara.isNull(credentialType)) {
@@ -1946,51 +1990,54 @@ class Client extends openapi_core_1.default {
1946
1990
  protocol: this._protocol,
1947
1991
  regionId: this._regionId,
1948
1992
  });
1949
- let authClient = new openplatform20191219_1.default(authConfig);
1950
- let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
1951
- product: "dataworks-public",
1952
- regionId: this._regionId,
1993
+ let authClient = new openapi_core_1.default(authConfig);
1994
+ let authRequest = {
1995
+ Product: "dataworks-public",
1996
+ RegionId: this._regionId,
1997
+ };
1998
+ let authReq = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
1999
+ query: openapi_core_2.OpenApiUtil.query(authRequest),
1953
2000
  });
1954
- let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({});
1955
- let ossConfig = new $OSS.Config({
1956
- accessKeyId: accessKeyId,
1957
- accessKeySecret: accessKeySecret,
1958
- type: "access_key",
1959
- protocol: this._protocol,
1960
- regionId: this._regionId,
2001
+ let authParams = new openapi_core_2.$OpenApiUtil.Params({
2002
+ action: "AuthorizeFileUpload",
2003
+ version: "2019-12-19",
2004
+ protocol: "HTTPS",
2005
+ pathname: "/",
2006
+ method: "GET",
2007
+ authType: "AK",
2008
+ style: "RPC",
2009
+ reqBodyType: "formData",
2010
+ bodyType: "json",
1961
2011
  });
1962
- let ossClient = new oss_client_1.default(ossConfig);
1963
- let fileObj = new $FileForm.FileField({});
1964
- let ossHeader = new $OSS.PostObjectRequestHeader({});
1965
- let uploadRequest = new $OSS.PostObjectRequest({});
1966
- let ossRuntime = new $OSSUtil.RuntimeOptions({});
1967
- openapi_core_2.OpenApiUtil.convert(runtime, ossRuntime);
2012
+ let authResponse = {};
2013
+ let fileObj = new $dara.FileField({});
2014
+ let ossHeader = {};
2015
+ let tmpBody = {};
2016
+ let useAccelerate = false;
2017
+ let authResponseBody = {};
1968
2018
  let createResourceFileReq = new $_model.CreateResourceFileRequest({});
1969
2019
  openapi_core_2.OpenApiUtil.convert(request, createResourceFileReq);
1970
2020
  if (!$dara.isNull(request.resourceFileObject)) {
1971
- authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
1972
- ossConfig.accessKeyId = authResponse.body.accessKeyId;
1973
- ossConfig.endpoint = openapi_core_2.OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
1974
- ossClient = new oss_client_1.default(ossConfig);
1975
- fileObj = new $FileForm.FileField({
1976
- filename: authResponse.body.objectKey,
2021
+ authResponse = await authClient.callApi(authParams, authReq, runtime);
2022
+ tmpBody = authResponse["body"];
2023
+ useAccelerate = Boolean(tmpBody["UseAccelerate"]);
2024
+ authResponseBody = openapi_core_2.OpenApiUtil.stringifyMapValue(tmpBody);
2025
+ fileObj = new $dara.FileField({
2026
+ filename: authResponseBody["ObjectKey"],
1977
2027
  content: request.resourceFileObject,
1978
2028
  contentType: "",
1979
2029
  });
1980
- ossHeader = new $OSS.PostObjectRequestHeader({
1981
- accessKeyId: authResponse.body.accessKeyId,
1982
- policy: authResponse.body.encodedPolicy,
1983
- signature: authResponse.body.signature,
1984
- key: authResponse.body.objectKey,
2030
+ ossHeader = {
2031
+ host: `${authResponseBody["Bucket"]}.${openapi_core_2.OpenApiUtil.getEndpoint(authResponseBody["Endpoint"], useAccelerate, this._endpointType)}`,
2032
+ OSSAccessKeyId: authResponseBody["AccessKeyId"],
2033
+ policy: authResponseBody["EncodedPolicy"],
2034
+ Signature: authResponseBody["Signature"],
2035
+ key: authResponseBody["ObjectKey"],
1985
2036
  file: fileObj,
1986
- successActionStatus: "201",
1987
- });
1988
- uploadRequest = new $OSS.PostObjectRequest({
1989
- bucketName: authResponse.body.bucket,
1990
- header: ossHeader,
1991
- });
1992
- await ossClient.postObject(uploadRequest, ossRuntime);
1993
- createResourceFileReq.resourceFile = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
2037
+ success_action_status: "201",
2038
+ };
2039
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
2040
+ createResourceFileReq.resourceFile = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
1994
2041
  }
1995
2042
  let createResourceFileResp = await this.createResourceFileWithOptions(createResourceFileReq, runtime);
1996
2043
  return createResourceFileResp;
@@ -5605,12 +5652,19 @@ class Client extends openapi_core_1.default {
5605
5652
  }
5606
5653
  async importCertificateAdvance(request, runtime) {
5607
5654
  // Step 0: init client
5608
- let accessKeyId = await this._credential.getAccessKeyId();
5609
- let accessKeySecret = await this._credential.getAccessKeySecret();
5610
- let securityToken = await this._credential.getSecurityToken();
5611
- let credentialType = this._credential.getType();
5655
+ if ($dara.isNull(this._credential)) {
5656
+ throw new $OpenApi.ClientError({
5657
+ code: "InvalidCredentials",
5658
+ 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.",
5659
+ });
5660
+ }
5661
+ let credentialModel = await this._credential.getCredential();
5662
+ let accessKeyId = credentialModel.accessKeyId;
5663
+ let accessKeySecret = credentialModel.accessKeySecret;
5664
+ let securityToken = credentialModel.securityToken;
5665
+ let credentialType = credentialModel.type;
5612
5666
  let openPlatformEndpoint = this._openPlatformEndpoint;
5613
- if ($dara.isNull(openPlatformEndpoint)) {
5667
+ if ($dara.isNull(openPlatformEndpoint) || openPlatformEndpoint == "") {
5614
5668
  openPlatformEndpoint = "openplatform.aliyuncs.com";
5615
5669
  }
5616
5670
  if ($dara.isNull(credentialType)) {
@@ -5625,51 +5679,54 @@ class Client extends openapi_core_1.default {
5625
5679
  protocol: this._protocol,
5626
5680
  regionId: this._regionId,
5627
5681
  });
5628
- let authClient = new openplatform20191219_1.default(authConfig);
5629
- let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
5630
- product: "dataworks-public",
5631
- regionId: this._regionId,
5682
+ let authClient = new openapi_core_1.default(authConfig);
5683
+ let authRequest = {
5684
+ Product: "dataworks-public",
5685
+ RegionId: this._regionId,
5686
+ };
5687
+ let authReq = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
5688
+ query: openapi_core_2.OpenApiUtil.query(authRequest),
5632
5689
  });
5633
- let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({});
5634
- let ossConfig = new $OSS.Config({
5635
- accessKeyId: accessKeyId,
5636
- accessKeySecret: accessKeySecret,
5637
- type: "access_key",
5638
- protocol: this._protocol,
5639
- regionId: this._regionId,
5690
+ let authParams = new openapi_core_2.$OpenApiUtil.Params({
5691
+ action: "AuthorizeFileUpload",
5692
+ version: "2019-12-19",
5693
+ protocol: "HTTPS",
5694
+ pathname: "/",
5695
+ method: "GET",
5696
+ authType: "AK",
5697
+ style: "RPC",
5698
+ reqBodyType: "formData",
5699
+ bodyType: "json",
5640
5700
  });
5641
- let ossClient = new oss_client_1.default(ossConfig);
5642
- let fileObj = new $FileForm.FileField({});
5643
- let ossHeader = new $OSS.PostObjectRequestHeader({});
5644
- let uploadRequest = new $OSS.PostObjectRequest({});
5645
- let ossRuntime = new $OSSUtil.RuntimeOptions({});
5646
- openapi_core_2.OpenApiUtil.convert(runtime, ossRuntime);
5701
+ let authResponse = {};
5702
+ let fileObj = new $dara.FileField({});
5703
+ let ossHeader = {};
5704
+ let tmpBody = {};
5705
+ let useAccelerate = false;
5706
+ let authResponseBody = {};
5647
5707
  let importCertificateReq = new $_model.ImportCertificateRequest({});
5648
5708
  openapi_core_2.OpenApiUtil.convert(request, importCertificateReq);
5649
5709
  if (!$dara.isNull(request.certificateFileObject)) {
5650
- authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
5651
- ossConfig.accessKeyId = authResponse.body.accessKeyId;
5652
- ossConfig.endpoint = openapi_core_2.OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
5653
- ossClient = new oss_client_1.default(ossConfig);
5654
- fileObj = new $FileForm.FileField({
5655
- filename: authResponse.body.objectKey,
5710
+ authResponse = await authClient.callApi(authParams, authReq, runtime);
5711
+ tmpBody = authResponse["body"];
5712
+ useAccelerate = Boolean(tmpBody["UseAccelerate"]);
5713
+ authResponseBody = openapi_core_2.OpenApiUtil.stringifyMapValue(tmpBody);
5714
+ fileObj = new $dara.FileField({
5715
+ filename: authResponseBody["ObjectKey"],
5656
5716
  content: request.certificateFileObject,
5657
5717
  contentType: "",
5658
5718
  });
5659
- ossHeader = new $OSS.PostObjectRequestHeader({
5660
- accessKeyId: authResponse.body.accessKeyId,
5661
- policy: authResponse.body.encodedPolicy,
5662
- signature: authResponse.body.signature,
5663
- key: authResponse.body.objectKey,
5719
+ ossHeader = {
5720
+ host: `${authResponseBody["Bucket"]}.${openapi_core_2.OpenApiUtil.getEndpoint(authResponseBody["Endpoint"], useAccelerate, this._endpointType)}`,
5721
+ OSSAccessKeyId: authResponseBody["AccessKeyId"],
5722
+ policy: authResponseBody["EncodedPolicy"],
5723
+ Signature: authResponseBody["Signature"],
5724
+ key: authResponseBody["ObjectKey"],
5664
5725
  file: fileObj,
5665
- successActionStatus: "201",
5666
- });
5667
- uploadRequest = new $OSS.PostObjectRequest({
5668
- bucketName: authResponse.body.bucket,
5669
- header: ossHeader,
5670
- });
5671
- await ossClient.postObject(uploadRequest, ossRuntime);
5672
- importCertificateReq.certificateFile = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
5726
+ success_action_status: "201",
5727
+ };
5728
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
5729
+ importCertificateReq.certificateFile = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
5673
5730
  }
5674
5731
  let importCertificateResp = await this.importCertificateWithOptions(importCertificateReq, runtime);
5675
5732
  return importCertificateResp;
@@ -9948,22 +10005,22 @@ class Client extends openapi_core_1.default {
9948
10005
  request.transformationRulesShrink = openapi_core_2.OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.transformationRules, "TransformationRules", "json");
9949
10006
  }
9950
10007
  let query = {};
10008
+ if (!$dara.isNull(request.DIJobId)) {
10009
+ query["DIJobId"] = request.DIJobId;
10010
+ }
9951
10011
  if (!$dara.isNull(request.id)) {
9952
10012
  query["Id"] = request.id;
9953
10013
  }
9954
- let body = {};
9955
- if (!$dara.isNull(request.DIJobId)) {
9956
- body["DIJobId"] = request.DIJobId;
10014
+ if (!$dara.isNull(request.projectId)) {
10015
+ query["ProjectId"] = request.projectId;
9957
10016
  }
10017
+ let body = {};
9958
10018
  if (!$dara.isNull(request.description)) {
9959
10019
  body["Description"] = request.description;
9960
10020
  }
9961
10021
  if (!$dara.isNull(request.jobSettingsShrink)) {
9962
10022
  body["JobSettings"] = request.jobSettingsShrink;
9963
10023
  }
9964
- if (!$dara.isNull(request.projectId)) {
9965
- body["ProjectId"] = request.projectId;
9966
- }
9967
10024
  if (!$dara.isNull(request.resourceSettingsShrink)) {
9968
10025
  body["ResourceSettings"] = request.resourceSettingsShrink;
9969
10026
  }
@@ -10834,12 +10891,19 @@ class Client extends openapi_core_1.default {
10834
10891
  }
10835
10892
  async updateResourceAdvance(request, runtime) {
10836
10893
  // Step 0: init client
10837
- let accessKeyId = await this._credential.getAccessKeyId();
10838
- let accessKeySecret = await this._credential.getAccessKeySecret();
10839
- let securityToken = await this._credential.getSecurityToken();
10840
- let credentialType = this._credential.getType();
10894
+ if ($dara.isNull(this._credential)) {
10895
+ throw new $OpenApi.ClientError({
10896
+ code: "InvalidCredentials",
10897
+ 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.",
10898
+ });
10899
+ }
10900
+ let credentialModel = await this._credential.getCredential();
10901
+ let accessKeyId = credentialModel.accessKeyId;
10902
+ let accessKeySecret = credentialModel.accessKeySecret;
10903
+ let securityToken = credentialModel.securityToken;
10904
+ let credentialType = credentialModel.type;
10841
10905
  let openPlatformEndpoint = this._openPlatformEndpoint;
10842
- if ($dara.isNull(openPlatformEndpoint)) {
10906
+ if ($dara.isNull(openPlatformEndpoint) || openPlatformEndpoint == "") {
10843
10907
  openPlatformEndpoint = "openplatform.aliyuncs.com";
10844
10908
  }
10845
10909
  if ($dara.isNull(credentialType)) {
@@ -10854,51 +10918,54 @@ class Client extends openapi_core_1.default {
10854
10918
  protocol: this._protocol,
10855
10919
  regionId: this._regionId,
10856
10920
  });
10857
- let authClient = new openplatform20191219_1.default(authConfig);
10858
- let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
10859
- product: "dataworks-public",
10860
- regionId: this._regionId,
10921
+ let authClient = new openapi_core_1.default(authConfig);
10922
+ let authRequest = {
10923
+ Product: "dataworks-public",
10924
+ RegionId: this._regionId,
10925
+ };
10926
+ let authReq = new openapi_core_2.$OpenApiUtil.OpenApiRequest({
10927
+ query: openapi_core_2.OpenApiUtil.query(authRequest),
10861
10928
  });
10862
- let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({});
10863
- let ossConfig = new $OSS.Config({
10864
- accessKeyId: accessKeyId,
10865
- accessKeySecret: accessKeySecret,
10866
- type: "access_key",
10867
- protocol: this._protocol,
10868
- regionId: this._regionId,
10929
+ let authParams = new openapi_core_2.$OpenApiUtil.Params({
10930
+ action: "AuthorizeFileUpload",
10931
+ version: "2019-12-19",
10932
+ protocol: "HTTPS",
10933
+ pathname: "/",
10934
+ method: "GET",
10935
+ authType: "AK",
10936
+ style: "RPC",
10937
+ reqBodyType: "formData",
10938
+ bodyType: "json",
10869
10939
  });
10870
- let ossClient = new oss_client_1.default(ossConfig);
10871
- let fileObj = new $FileForm.FileField({});
10872
- let ossHeader = new $OSS.PostObjectRequestHeader({});
10873
- let uploadRequest = new $OSS.PostObjectRequest({});
10874
- let ossRuntime = new $OSSUtil.RuntimeOptions({});
10875
- openapi_core_2.OpenApiUtil.convert(runtime, ossRuntime);
10940
+ let authResponse = {};
10941
+ let fileObj = new $dara.FileField({});
10942
+ let ossHeader = {};
10943
+ let tmpBody = {};
10944
+ let useAccelerate = false;
10945
+ let authResponseBody = {};
10876
10946
  let updateResourceReq = new $_model.UpdateResourceRequest({});
10877
10947
  openapi_core_2.OpenApiUtil.convert(request, updateResourceReq);
10878
10948
  if (!$dara.isNull(request.resourceFileObject)) {
10879
- authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
10880
- ossConfig.accessKeyId = authResponse.body.accessKeyId;
10881
- ossConfig.endpoint = openapi_core_2.OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
10882
- ossClient = new oss_client_1.default(ossConfig);
10883
- fileObj = new $FileForm.FileField({
10884
- filename: authResponse.body.objectKey,
10949
+ authResponse = await authClient.callApi(authParams, authReq, runtime);
10950
+ tmpBody = authResponse["body"];
10951
+ useAccelerate = Boolean(tmpBody["UseAccelerate"]);
10952
+ authResponseBody = openapi_core_2.OpenApiUtil.stringifyMapValue(tmpBody);
10953
+ fileObj = new $dara.FileField({
10954
+ filename: authResponseBody["ObjectKey"],
10885
10955
  content: request.resourceFileObject,
10886
10956
  contentType: "",
10887
10957
  });
10888
- ossHeader = new $OSS.PostObjectRequestHeader({
10889
- accessKeyId: authResponse.body.accessKeyId,
10890
- policy: authResponse.body.encodedPolicy,
10891
- signature: authResponse.body.signature,
10892
- key: authResponse.body.objectKey,
10958
+ ossHeader = {
10959
+ host: `${authResponseBody["Bucket"]}.${openapi_core_2.OpenApiUtil.getEndpoint(authResponseBody["Endpoint"], useAccelerate, this._endpointType)}`,
10960
+ OSSAccessKeyId: authResponseBody["AccessKeyId"],
10961
+ policy: authResponseBody["EncodedPolicy"],
10962
+ Signature: authResponseBody["Signature"],
10963
+ key: authResponseBody["ObjectKey"],
10893
10964
  file: fileObj,
10894
- successActionStatus: "201",
10895
- });
10896
- uploadRequest = new $OSS.PostObjectRequest({
10897
- bucketName: authResponse.body.bucket,
10898
- header: ossHeader,
10899
- });
10900
- await ossClient.postObject(uploadRequest, ossRuntime);
10901
- updateResourceReq.resourceFile = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
10965
+ success_action_status: "201",
10966
+ };
10967
+ await this._postOSSObject(authResponseBody["Bucket"], ossHeader);
10968
+ updateResourceReq.resourceFile = `http://${authResponseBody["Bucket"]}.${authResponseBody["Endpoint"]}/${authResponseBody["ObjectKey"]}`;
10902
10969
  }
10903
10970
  let updateResourceResp = await this.updateResourceWithOptions(updateResourceReq, runtime);
10904
10971
  return updateResourceResp;