Skip to content

Commit

Permalink
release 3.0.13-beta source code for nodejs
Browse files Browse the repository at this point in the history
  • Loading branch information
Huaweicloud-SDK committed Aug 26, 2021
1 parent 4864ce7 commit 7253b22
Show file tree
Hide file tree
Showing 221 changed files with 8,929 additions and 85 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
# 3.0.13-beta 2021-08-25

### HuaweiCloud SDK ECS

- _Features_
- None
- _Bug Fix_
- None
- _Change_
- Add the following response parameters to the interface `ListServerInterfaces`:
- `delete_on_termination`
- `driver_mode`
- `min_rate`
- `multiqueue_num`
- `pci_address`
- Add the response parameters `cpu_options` and `hypervisor` to the interface `ListServersDetails`.

### HuaweiCloud SDK EIP

- _Features_
- None
- _Bug Fix_
- None
- _Change_
- Add the request and response parameter `public_border_group` to the interface `BatchCreateSharedBandwidths`.
- Add the response parameter `public_border_group` to the interface `AddPublicipsIntoSharedBandwidth`.

# 3.0.12-beta 2021-08-10

### HuaweiCloud SDK EIP
Expand Down
29 changes: 29 additions & 0 deletions CHANGELOG_CN.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# 3.0.13-beta 2021-08-25

### HuaweiCloud SDK ECS

- _新增特性_
-
- _解决问题_
-
- _特性变更_
- 接口`ListServerInterfaces`新增以下响应参数:
- `delete_on_termination`
- `driver_mode`
- `min_rate`
- `multiqueue_num`
- `pci_address`
- 接口`ListServersDetails`新增响应参数`cpu_options``hypervisor`

### HuaweiCloud SDK EIP

- _新增特性_
-
- _解决问题_
-
- _特性变更_
- 接口`BatchCreateSharedBandwidths`新增请求参数和响应参数`public_border_group`
- 接口`AddPublicipsIntoSharedBandwidth`新增响应参数`public_border_group`



# 3.0.12-beta 2021-08-10

### HuaweiCloud SDK EIP
Expand Down
9 changes: 4 additions & 5 deletions core/ClientBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import { HcClient } from "./HcClient";
import { ICredential } from "./auth/ICredential";
import { DefaultHttpClient } from "./http/DefaultHttpClient";
import extend from 'extend';
import { RequiredError } from "./auth/AKSKSigner";
import { BasicCredentials } from "./auth/BasicCredentials";
import { GlobalCredentials } from "./auth/GlobalCredentials";
Expand Down Expand Up @@ -69,13 +68,13 @@ export class ClientBuilder<T> {
disableSslVerification: true
};
if (this.proxyAgent) {
extend(axiosOptions, { proxyAgent: this.proxyAgent });
Object.assign(axiosOptions, { proxyAgent: this.proxyAgent });
}

if (this.credential === null || this.credential === undefined) {
this.credential = this.getCredentialFromEnvironment();
}
}

const client = new DefaultHttpClient(axiosOptions);
const hcClient = new HcClient(client);
hcClient.withEndpoint(this.endpoint).withCredential(this.credential);
Expand Down Expand Up @@ -104,7 +103,7 @@ export class ClientBuilder<T> {
credentialTYPE = new GlobalCredentials();
break;
default:
const obj = {};
const obj = {};
const definedCredPath = path.join(this.init().getPath(), `${sdkType}`);
if (!obj[sdkType]) {
credentialTYPE = require(definedCredPath);
Expand Down
17 changes: 8 additions & 9 deletions core/auth/AKSKSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@

import * as crypto from "crypto";
import moment = require('moment');
import extend = require("extend");
import url = require('url')
import { IHttpRequest } from "../http/IHttpRequest";
import * as _ from "lodash";
import {ICredential} from "./ICredential";
import { ICredential } from "./ICredential";

export class AKSKSigner {
private static EMPTY_BODY_SHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
Expand All @@ -36,7 +35,7 @@ export class AKSKSigner {
private static HeaderContentSha256 = "X-Sdk-Content-Sha256";

private static hex: string[] = [];
private static hexTable(): string[]{
private static hexTable(): string[] {
if (this.hex.length <= 0) {
for (var i = 0; i < 256; ++i) {
this.hex[i] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
Expand Down Expand Up @@ -65,7 +64,7 @@ export class AKSKSigner {
else {
dateTimeStamp = moment().utcOffset(0).format(this.BasicDateFormat);
dateTimeStamp = dateTimeStamp + "Z";
extend(true, authenticationHeaders, { "X-Sdk-Date": dateTimeStamp });
Object.assign(authenticationHeaders, { "X-Sdk-Date": dateTimeStamp })
}
// @ts-ignore
const parsedUrl = url.parse(request.endpoint, true);
Expand All @@ -75,11 +74,11 @@ export class AKSKSigner {
if (reqUrlHostAndPort) {
host = reqUrlHostAndPort;
}
extend(true, authenticationHeaders, { "host": host });
Object.assign(authenticationHeaders, { "host": host });

let allHeaders = {};
extend(allHeaders, request.headers, authenticationHeaders);
const canonicalURI = parsedUrl.pathname + "/";
Object.assign(allHeaders, request.headers, authenticationHeaders);
const canonicalURI = parsedUrl.pathname + "/";
const canonicalQueryString = this.CanonicalQueryString(request);

let sortedKeys = _.sortBy(Object.keys(allHeaders), (x: string) => {
Expand All @@ -98,8 +97,8 @@ export class AKSKSigner {
const authorization = {
Authorization: `${this.SDK_SIGNING_ALGORITHM} Access=${credential.getAk()}, SignedHeaders=${signedHeaderNames}, Signature=${signatureString}`
};

extend(allHeaders, authorization);
Object.assign(allHeaders,authorization);
return allHeaders;
}

Expand Down
7 changes: 3 additions & 4 deletions core/auth/BasicCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { ICredential } from "./ICredential";
import { IHttpRequest } from "../http/IHttpRequest";
import { AKSKSigner } from "./AKSKSigner";
import { HttpRequestBuilder } from "../http/IHttpRequestBuilder";
import extend from "extend";
import { RequiredError } from "./AKSKSigner";

export class BasicCredentials implements ICredential {
Expand Down Expand Up @@ -62,7 +61,7 @@ export class BasicCredentials implements ICredential {
public getPathParams() {
const pathParams = {};
if (this.projectId) {
extend(pathParams, { project_id: this.projectId });
Object.assign(pathParams, { project_id: this.projectId });
}
return pathParams;
}
Expand Down Expand Up @@ -94,12 +93,12 @@ export class BasicCredentials implements ICredential {

// builder.addHeaders("Content-Type", "application/json");
builder.addAllHeaders(httpRequest.headers);
extend(httpRequest, builder.build());
Object.assign(httpRequest, builder.build());
const headers = AKSKSigner.sign(httpRequest, this);

builder.addAllHeaders(headers);

return extend(httpRequest, builder.build());
return Object.assign(httpRequest, builder.build());
}
}

Expand Down
7 changes: 3 additions & 4 deletions core/auth/GlobalCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { ICredential } from "./ICredential";
import { IHttpRequest } from "../http/IHttpRequest";
import { AKSKSigner } from "./AKSKSigner";
import { HttpRequestBuilder } from "../http/IHttpRequestBuilder";
import extend from "extend";
import { RequiredError } from "./AKSKSigner";

export class GlobalCredentials implements ICredential {
Expand Down Expand Up @@ -62,7 +61,7 @@ export class GlobalCredentials implements ICredential {
public getPathParams() {
const pathParams = {};
if (this.domainId) {
extend(pathParams, { domain_id: this.domainId });
Object.assign(pathParams, { domain_id: this.domainId });
}
return pathParams;
}
Expand Down Expand Up @@ -94,12 +93,12 @@ export class GlobalCredentials implements ICredential {

// builder.addHeaders("Content-Type", "application/json");
builder.addAllHeaders(httpRequest.headers);
extend(httpRequest, builder.build());
Object.assign(httpRequest, builder.build());
const headers = AKSKSigner.sign(httpRequest, this);

builder.addAllHeaders(headers);

return extend(httpRequest, builder.build());
return Object.assign(httpRequest, builder.build());
}
}

Expand Down
9 changes: 4 additions & 5 deletions core/http/IHttpRequestBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/

import { IHttpRequest, HttpRequestImpl } from "./IHttpRequest";
import extend from "extend";

export class HttpRequestBuilder {
private httpRequest: HttpRequestImpl;
Expand Down Expand Up @@ -67,11 +66,11 @@ export class HttpRequestBuilder {
return this;
}
public addPathParams(pathParams: {}) {
extend(this.httpRequest.getPathParams(), pathParams);
Object.assign(this.httpRequest.getPathParams(), pathParams);
return this;
}
public addQueryParams(queryParams: {}) {
extend(this.httpRequest.getQueryParams, queryParams);
Object.assign(this.httpRequest.getQueryParams, queryParams);
return this;
}

Expand All @@ -82,8 +81,8 @@ export class HttpRequestBuilder {
}
return this;
}
public addAllHeaders(header: any) {
extend(this.httpRequest.getHeaders(), header);
public addAllHeaders(header: any) {
Object.assign(this.httpRequest.getHeaders(), header);
return this;
}
}
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "huaweicloud-sdk-nodejs-v3",
"version": "3.0.12-beta",
"version": "3.0.13-beta",
"description": "Core code for Huaweicloud SDK for Node.js",
"main": "index.js",
"scripts": {
Expand All @@ -16,21 +16,19 @@
"author": "HuaweiCloud_SDK",
"license": "Apache-2.0",
"dependencies": {
"@types/express": "^4.17.6",
"@types/extend": "^3.0.1",
"@types/node": "^14.0.14",
"axios": "^0.21.1",
"express": "^4.17.1",
"extend": "^3.0.2",
"https-proxy-agent": "^5.0.0",
"lodash": "^4.17.15",
"lodash": "^4.17.21",
"log4js": "^6.3.0",
"moment": "^2.27.0",
"moment-timezone": "^0.5.31",
"form-data": "^4.0.0",
"is-stream": "^2.0.0"
},
"devDependencies": {
"@types/express": "^4.17.6",
"@types/node": "^14.0.14",
"@types/debug": "^4.1.5",
"@types/lodash": "^4.14.157",
"@types/mocha": "^8.0.0",
Expand All @@ -46,4 +44,4 @@
"ts-node-dev": "^1.0.0-pre.49",
"debug": "^4.1.1"
}
}
}
1 change: 1 addition & 0 deletions services/cce/v3/CceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ import { NodeManagement } from './model/NodeManagement';
import { NodeMetadata } from './model/NodeMetadata';
import { NodeNicSpec } from './model/NodeNicSpec';
import { NodePool } from './model/NodePool';
import { NodePoolCondition } from './model/NodePoolCondition';
import { NodePoolMetadata } from './model/NodePoolMetadata';
import { NodePoolNodeAutoscaling } from './model/NodePoolNodeAutoscaling';
import { NodePoolSpec } from './model/NodePoolSpec';
Expand Down
10 changes: 10 additions & 0 deletions services/cce/v3/model/ClusterExtendParam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ export class ClusterExtendParam {
public decMasterFlavor?: string;
public dockerUmaskMode?: string;
private 'kubernetes.io/cpuManagerPolicy'?: string | undefined;
public orderID?: string;
public periodType?: string;
public periodNum?: number;
public isAutoRenew?: string;
public isAutoPay?: string;
public upgradefrom?: string;
public constructor() {
}
public withClusterAZ(clusterAZ: string): ClusterExtendParam {
Expand Down Expand Up @@ -64,6 +66,10 @@ export class ClusterExtendParam {
public get kubernetesIoCpuManagerPolicy() {
return this['kubernetes.io/cpuManagerPolicy'];
}
public withOrderID(orderID: string): ClusterExtendParam {
this['orderID'] = orderID;
return this;
}
public withPeriodType(periodType: string): ClusterExtendParam {
this['periodType'] = periodType;
return this;
Expand All @@ -80,4 +86,8 @@ export class ClusterExtendParam {
this['isAutoPay'] = isAutoPay;
return this;
}
public withUpgradefrom(upgradefrom: string): ClusterExtendParam {
this['upgradefrom'] = upgradefrom;
return this;
}
}
16 changes: 16 additions & 0 deletions services/cce/v3/model/NodeExtendParam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export class NodeExtendParam {
private 'alpha.cce/NodeImageID'?: string | undefined;
public nicMultiqueue?: string;
public nicThreshold?: string;
private 'enterprise_project_id'?: string | undefined;
public chargingMode?: number;
public constructor() {
}
public withEcsPerformancetype(ecsPerformancetype: string): NodeExtendParam {
Expand Down Expand Up @@ -113,4 +115,18 @@ export class NodeExtendParam {
this['nicThreshold'] = nicThreshold;
return this;
}
public withEnterpriseProjectId(enterpriseProjectId: string): NodeExtendParam {
this['enterprise_project_id'] = enterpriseProjectId;
return this;
}
public set enterpriseProjectId(enterpriseProjectId: string | undefined) {
this['enterprise_project_id'] = enterpriseProjectId;
}
public get enterpriseProjectId() {
return this['enterprise_project_id'];
}
public withChargingMode(chargingMode: number): NodeExtendParam {
this['chargingMode'] = chargingMode;
return this;
}
}
Loading

0 comments on commit 7253b22

Please sign in to comment.