Skip to content

Commit f6840b1

Browse files
authored
Merge pull request #15 from IBM/sdk-update-20240129-114135
Sdk update 20240129 114135
2 parents 8edfac2 + 85c0a87 commit f6840b1

File tree

9 files changed

+4963
-1861
lines changed

9 files changed

+4963
-1861
lines changed

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,12 @@ secrets.tar
8989

9090
# ignore the generated integration test files, as they cannot be used without manual editing
9191
test/integration/code-engine.v1.test.js
92-
test/integration/code-engine.v2.test.js
92+
test/integration/code-engine.v2.test.js
93+
94+
95+
# ignore the generated SSH and TLS keys and certs
96+
test/integration/domain*
97+
test/integration/sshkey*
98+
99+
# API repo (pulled from Github)
100+
api

code-engine/v2.ts

Lines changed: 708 additions & 66 deletions
Large diffs are not rendered by default.

examples/code-engine.v2.test.js

Lines changed: 159 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @jest-environment node
33
*/
44
/**
5-
* (C) Copyright IBM Corp. 2023.
5+
* (C) Copyright IBM Corp. 2024.
66
*
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -1179,6 +1179,138 @@ describe('CodeEngineV2', () => {
11791179
// end-replace_secret
11801180
});
11811181

1182+
test('listDomainMappings request example', async () => {
1183+
consoleLogMock.mockImplementation((output) => {
1184+
originalLog(output);
1185+
});
1186+
consoleWarnMock.mockImplementation((output) => {
1187+
// if an error occurs, display the message and then fail the test
1188+
originalWarn(output);
1189+
expect(true).toBeFalsy();
1190+
});
1191+
1192+
originalLog('listDomainMappings() result:');
1193+
// begin-list_domain_mappings
1194+
1195+
const params = {
1196+
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
1197+
limit: 100,
1198+
};
1199+
1200+
const allResults = [];
1201+
try {
1202+
const pager = new CodeEngineV2.DomainMappingsPager(codeEngineService, params);
1203+
while (pager.hasNext()) {
1204+
const nextPage = await pager.getNext();
1205+
expect(nextPage).not.toBeNull();
1206+
allResults.push(...nextPage);
1207+
}
1208+
console.log(JSON.stringify(allResults, null, 2));
1209+
} catch (err) {
1210+
console.warn(err);
1211+
}
1212+
1213+
// end-list_domain_mappings
1214+
});
1215+
1216+
test('createDomainMapping request example', async () => {
1217+
consoleLogMock.mockImplementation((output) => {
1218+
originalLog(output);
1219+
});
1220+
consoleWarnMock.mockImplementation((output) => {
1221+
// if an error occurs, display the message and then fail the test
1222+
originalWarn(output);
1223+
expect(true).toBeFalsy();
1224+
});
1225+
1226+
originalLog('createDomainMapping() result:');
1227+
// begin-create_domain_mapping
1228+
1229+
// Request models needed by this operation.
1230+
1231+
// ComponentRef
1232+
const componentRefModel = {
1233+
name: 'my-app-1',
1234+
resource_type: 'app_v2',
1235+
};
1236+
1237+
const params = {
1238+
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
1239+
component: componentRefModel,
1240+
name: 'www.example.com',
1241+
tlsSecret: 'my-tls-secret',
1242+
};
1243+
1244+
let res;
1245+
try {
1246+
res = await codeEngineService.createDomainMapping(params);
1247+
console.log(JSON.stringify(res.result, null, 2));
1248+
} catch (err) {
1249+
console.warn(err);
1250+
}
1251+
1252+
// end-create_domain_mapping
1253+
});
1254+
1255+
test('getDomainMapping request example', async () => {
1256+
consoleLogMock.mockImplementation((output) => {
1257+
originalLog(output);
1258+
});
1259+
consoleWarnMock.mockImplementation((output) => {
1260+
// if an error occurs, display the message and then fail the test
1261+
originalWarn(output);
1262+
expect(true).toBeFalsy();
1263+
});
1264+
1265+
originalLog('getDomainMapping() result:');
1266+
// begin-get_domain_mapping
1267+
1268+
const params = {
1269+
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
1270+
name: 'www.example.com',
1271+
};
1272+
1273+
let res;
1274+
try {
1275+
res = await codeEngineService.getDomainMapping(params);
1276+
console.log(JSON.stringify(res.result, null, 2));
1277+
} catch (err) {
1278+
console.warn(err);
1279+
}
1280+
1281+
// end-get_domain_mapping
1282+
});
1283+
1284+
test('updateDomainMapping request example', async () => {
1285+
consoleLogMock.mockImplementation((output) => {
1286+
originalLog(output);
1287+
});
1288+
consoleWarnMock.mockImplementation((output) => {
1289+
// if an error occurs, display the message and then fail the test
1290+
originalWarn(output);
1291+
expect(true).toBeFalsy();
1292+
});
1293+
1294+
originalLog('updateDomainMapping() result:');
1295+
// begin-update_domain_mapping
1296+
1297+
const params = {
1298+
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
1299+
name: 'www.example.com',
1300+
ifMatch: 'testString',
1301+
};
1302+
1303+
let res;
1304+
try {
1305+
res = await codeEngineService.updateDomainMapping(params);
1306+
console.log(JSON.stringify(res.result, null, 2));
1307+
} catch (err) {
1308+
console.warn(err);
1309+
}
1310+
1311+
// end-update_domain_mapping
1312+
});
1313+
11821314
test('deleteProject request example', async () => {
11831315
consoleLogMock.mockImplementation((output) => {
11841316
originalLog(output);
@@ -1438,4 +1570,30 @@ describe('CodeEngineV2', () => {
14381570

14391571
// end-delete_secret
14401572
});
1573+
1574+
test('deleteDomainMapping request example', async () => {
1575+
consoleLogMock.mockImplementation((output) => {
1576+
originalLog(output);
1577+
});
1578+
consoleWarnMock.mockImplementation((output) => {
1579+
// if an error occurs, display the message and then fail the test
1580+
originalWarn(output);
1581+
expect(true).toBeFalsy();
1582+
});
1583+
1584+
// begin-delete_domain_mapping
1585+
1586+
const params = {
1587+
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
1588+
name: 'www.example.com',
1589+
};
1590+
1591+
try {
1592+
await codeEngineService.deleteDomainMapping(params);
1593+
} catch (err) {
1594+
console.warn(err);
1595+
}
1596+
1597+
// end-delete_domain_mapping
1598+
});
14411599
});

0 commit comments

Comments
 (0)