Skip to content

Commit d1d12d1

Browse files
authored
Merge pull request #58 from IBM/http3_setting
feat(http3): added http3 setting
2 parents fe7231d + a757e50 commit d1d12d1

File tree

10 files changed

+315
-40
lines changed

10 files changed

+315
-40
lines changed

cis.env.enc

-3.59 KB
Binary file not shown.

cis/zones-settings/v1.ts

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,84 @@ class ZonesSettingsV1 extends BaseService {
14941494
return this.createRequest(parameters);
14951495
};
14961496

1497+
1498+
/**
1499+
* Get http/3 setting.
1500+
*
1501+
* Get http/3 setting for a zone.
1502+
*
1503+
* @param {Object} [params] - The parameters to send to the service.
1504+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
1505+
* @returns {Promise<ZonesSettingsV1.Response<ZonesSettingsV1.Http3Resp>>}
1506+
*/
1507+
public getHttp3(params?: ZonesSettingsV1.GetHttp3Params): Promise<ZonesSettingsV1.Response<ZonesSettingsV1.Http3Resp>> {
1508+
const _params = Object.assign({}, params);
1509+
1510+
const path = {
1511+
'crn': this.crn,
1512+
'zone_identifier': this.zoneIdentifier
1513+
};
1514+
1515+
const sdkHeaders = getSdkHeaders(ZonesSettingsV1.DEFAULT_SERVICE_NAME, 'v1', 'getHttp3');
1516+
1517+
const parameters = {
1518+
options: {
1519+
url: '/v1/{crn}/zones/{zone_identifier}/settings/http3',
1520+
method: 'GET',
1521+
path,
1522+
},
1523+
defaultOptions: extend(true, {}, this.baseOptions, {
1524+
headers: extend(true, sdkHeaders, {
1525+
'Accept': 'application/json',
1526+
}, _params.headers),
1527+
}),
1528+
};
1529+
1530+
return this.createRequest(parameters);
1531+
};
1532+
1533+
/**
1534+
* Update http/3 setting.
1535+
*
1536+
* Update http/3 setting for a zone.
1537+
*
1538+
* @param {Object} [params] - The parameters to send to the service.
1539+
* @param {string} [params.value] - Value.
1540+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
1541+
* @returns {Promise<ZonesSettingsV1.Response<ZonesSettingsV1.Http3Resp>>}
1542+
*/
1543+
public updateHttp3(params?: ZonesSettingsV1.UpdateHttp3Params): Promise<ZonesSettingsV1.Response<ZonesSettingsV1.Http3Resp>> {
1544+
const _params = Object.assign({}, params);
1545+
1546+
const body = {
1547+
'value': _params.value
1548+
};
1549+
1550+
const path = {
1551+
'crn': this.crn,
1552+
'zone_identifier': this.zoneIdentifier
1553+
};
1554+
1555+
const sdkHeaders = getSdkHeaders(ZonesSettingsV1.DEFAULT_SERVICE_NAME, 'v1', 'updateHttp3');
1556+
1557+
const parameters = {
1558+
options: {
1559+
url: '/v1/{crn}/zones/{zone_identifier}/settings/http3',
1560+
method: 'PATCH',
1561+
body,
1562+
path,
1563+
},
1564+
defaultOptions: extend(true, {}, this.baseOptions, {
1565+
headers: extend(true, sdkHeaders, {
1566+
'Accept': 'application/json',
1567+
'Content-Type': 'application/json',
1568+
}, _params.headers),
1569+
}),
1570+
};
1571+
1572+
return this.createRequest(parameters);
1573+
};
1574+
14971575
/**
14981576
* Get IPv6 compatibility setting.
14991577
*
@@ -2723,6 +2801,27 @@ namespace ZonesSettingsV1 {
27232801
}
27242802
}
27252803

2804+
/** Parameters for the `getHttp3` operation. */
2805+
export interface GetHttp3Params {
2806+
headers?: OutgoingHttpHeaders;
2807+
}
2808+
2809+
/** Parameters for the `updateHttp3` operation. */
2810+
export interface UpdateHttp3Params {
2811+
/** Value. */
2812+
value?: UpdateHttp3Constants.Value | string;
2813+
headers?: OutgoingHttpHeaders;
2814+
}
2815+
2816+
/** Constants for the `updateHttp3` operation. */
2817+
export namespace UpdateHttp3Constants {
2818+
/** Value. */
2819+
export enum Value {
2820+
ON = 'on',
2821+
OFF = 'off',
2822+
}
2823+
}
2824+
27262825
/** Parameters for the `getIpv6` operation. */
27272826
export interface GetIpv6Params {
27282827
headers?: OutgoingHttpHeaders;
@@ -3055,6 +3154,18 @@ namespace ZonesSettingsV1 {
30553154
modified_on: string;
30563155
}
30573156

3157+
/** Container for response information. */
3158+
export interface Http3RespResult {
3159+
/** ID. */
3160+
id: string;
3161+
/** Value. */
3162+
value: string;
3163+
/** Editable. */
3164+
editable: boolean;
3165+
/** Modified date. */
3166+
modified_on: string;
3167+
}
3168+
30583169
/** Container for response information. */
30593170
export interface ImageLoadOptimizationRespResult {
30603171
/** ID. */
@@ -3495,6 +3606,18 @@ namespace ZonesSettingsV1 {
34953606
messages: string[][];
34963607
}
34973608

3609+
/** HTTP3 Response. */
3610+
export interface Http3Resp {
3611+
/** Container for response information. */
3612+
result: Http3RespResult;
3613+
/** Was the get successful. */
3614+
success: boolean;
3615+
/** Array of errors encountered. */
3616+
errors: string[][];
3617+
/** Array of messages returned. */
3618+
messages: string[][];
3619+
}
3620+
34983621
/** Image Load Optimization response. */
34993622
export interface ImageLoadOptimizationResp {
35003623
/** Container for response information. */

test/integration/cis/global-load-balancer.v1.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe.skip('GlobalLoadBalancerApi', () => {
7272
steeringPolicy: 'dynamic_latency',
7373
};
7474

75-
describe.skip('Create and verify load balancer', () => {
75+
describe('Create and verify load balancer', () => {
7676
// Construct the params object for operation createLoadBalancer
7777
const randomId = new Date().getTime().toString(36);
7878
const poolConfig = {
@@ -139,7 +139,7 @@ describe.skip('GlobalLoadBalancerApi', () => {
139139
});
140140
});
141141

142-
describe.skip('List Load Balancers', () => {
142+
describe('List Load Balancers', () => {
143143
test('should list all the load balancers', async done => {
144144
try {
145145
const response = await loadBalancerInstance.listAllLoadBalancers({});

test/integration/cis/range-applications.v1.test.js

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const describe = authHelper.prepareTests(configFile);
3333
// config properties, rather than let the SDK do it for us.
3434
const config = authHelper.loadConfig();
3535

36-
describe.skip('RangeApplicationsV1', () => {
36+
describe('RangeApplicationsV1', () => {
3737
jest.setTimeout(timeout);
3838

3939
// Initialize the service client.
@@ -64,32 +64,21 @@ describe.skip('RangeApplicationsV1', () => {
6464

6565
test('should successfully create the range application', async done => {
6666
try {
67-
let response = await zonesV1.listZones();
68-
let zone;
69-
expect(response).toBeDefined();
70-
expect(response.status).toEqual(200);
71-
let { result } = response || {};
72-
73-
if (result && result.result) {
74-
expect(result.result.length).toBeGreaterThanOrEqual(1);
75-
expect(result.result).toBeDefined();
76-
zone = result.result[0];
77-
}
7867
const params = {
79-
protocol: 'tcp/32',
80-
dns: { type: 'CNAME', name: 'ab.' + zone.name },
81-
originDirect: ['tcp://2.5.6.7:32'],
68+
protocol: 'tcp/35',
69+
dns: { type: 'CNAME', name: 'ab.' + config.DOMAIN_NAME },
70+
originDirect: ['tcp://2.5.6.7:35'],
8271
proxyProtocol: 'off',
83-
ipFirewall: true,
72+
ipFirewall: false,
8473
tls: 'off',
8574
trafficType: 'direct',
8675
edgeIps: { connectivity: 'all', type: 'dynamic' },
8776
};
88-
response = await rangeApplicationsV1.createRangeApp(params);
77+
const response = await rangeApplicationsV1.createRangeApp(params);
8978
expect(response).toBeDefined();
9079
expect(response.status).toEqual(200);
9180

92-
result = response || {};
81+
const result = response || {};
9382
expect(result).toBeDefined();
9483

9584
rangeAppCreated = result.result;
@@ -112,14 +101,13 @@ describe.skip('RangeApplicationsV1', () => {
112101
try {
113102
const params = {
114103
appIdentifier: rangeAppCreated.result.id,
115-
protocol: 'tcp/32',
104+
protocol: 'tcp/35',
116105
dns: { type: 'CNAME', name: rangeAppCreated.result.dns.name },
117106
originDirect: ['tcp://2.5.6.7:32'],
118107
proxyProtocol: 'v1',
119108
ipFirewall: true,
120109
tls: 'flexible',
121110
trafficType: 'direct',
122-
edgeIps: { connectivity: 'all', type: 'dynamic' },
123111
};
124112
const response = await rangeApplicationsV1.updateRangeApp(params);
125113
expect(response).toBeDefined();

test/integration/cis/ssl-certificate-api.v1.test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -341,20 +341,19 @@ describe.skip('SSL Certificate', () => {
341341
test('successfully order a certificate', async done => {
342342
try {
343343
const params = {
344-
hosts: [`test-cert.${config.DOMAIN_NAME}`],
344+
hosts: [config.DOMAIN_NAME, `dev.${config.DOMAIN_NAME}`],
345345
type: 'dedicated_custom',
346346
};
347347
const response = await sslCertInstance.orderCertificate(params);
348348
expect(response).toBeDefined();
349-
expect(response.status).toEqual(200);
350-
349+
expect([200, 201]).toContain(response.status);
351350
const { result } = response || {};
352351
if (result.result && Object.keys(result.result).length > 0) {
353352
certificateId = result.result.id;
354353
expect(result.success).toBeTruthy();
355354
expect(result.result.id).toBeDefined();
356-
expect(result.result.status).toBe('pending_deployment');
357355
expect(result.result.validity_days).toBe(365);
356+
expect(['initializing', 'pending_deployment']).toContain(result.result.status);
358357
}
359358
done();
360359
} catch (err) {
@@ -365,14 +364,14 @@ describe.skip('SSL Certificate', () => {
365364
test('should fail to order certificate for invalid domain configuration', async done => {
366365
try {
367366
const params = {
368-
hosts: [`cert${config.DOMAIN_NAME}`],
367+
hosts: [`dev-${config.DOMAIN_NAME}`],
369368
type: 'dedicated_custom',
370369
};
371370
await sslCertInstance.orderCertificate(params);
372371
} catch (err) {
373372
expect(err.status).toEqual(400);
374373
expect(err.message).toEqual(
375-
'You must complete domain control validation (DCV) for all hostnames on the Dedicated Certificate before placing an order.'
374+
'Hosts contains an invalid host for your zone. Please check your input and try again.'
376375
);
377376
done();
378377
}
@@ -387,7 +386,7 @@ describe.skip('SSL Certificate', () => {
387386

388387
const { result } = response || {};
389388
if (result.result) {
390-
expect(result.result.length).toBeGreaterThanOrEqual(1);
389+
expect(result.result.length).toBeGreaterThanOrEqual(0);
391390
}
392391
done();
393392
} catch (err) {
@@ -423,8 +422,9 @@ describe.skip('SSL Certificate', () => {
423422
done();
424423
});
425424
});
425+
426426
// this should be automated
427-
describe('Custom Edge Certificate', () => {
427+
describe.skip('Custom Edge Certificate', () => {
428428
let customCertificateId;
429429
test('successfully upload a certificate', async done => {
430430
try {
@@ -486,7 +486,7 @@ describe.skip('SSL Certificate', () => {
486486
}
487487
});
488488

489-
it.skip('successfully update a custom certificate', async done => {
489+
test('successfully update a custom certificate', async done => {
490490
try {
491491
const params = {
492492
certificate: config.CERTIFICATE, // todo: replace with a new certificate
@@ -510,7 +510,7 @@ describe.skip('SSL Certificate', () => {
510510
}
511511
});
512512

513-
it.skip('should successfully change priority of certificates', async done => {
513+
test('should successfully change priority of certificates', async done => {
514514
try {
515515
const certPriorityReqCertificatesItemModel = {
516516
customCertId: customCertificateId,

0 commit comments

Comments
 (0)