Skip to content

Commit 8edfac2

Browse files
authored
Merge pull request #14 from IBM/sdk-update-20230724-094245
Sdk update 20230724 094245
2 parents 0295840 + 6d13ee0 commit 8edfac2

File tree

8 files changed

+1537
-190
lines changed

8 files changed

+1537
-190
lines changed

CHANGELOG.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

code-engine/v2.ts

Lines changed: 616 additions & 77 deletions
Large diffs are not rendered by default.

example/example_deprecated.js

Lines changed: 0 additions & 50 deletions
This file was deleted.

examples/code-engine.v2.test.js

Lines changed: 157 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,34 @@ describe('CodeEngineV2', () => {
183183
// end-get_project_egress_ips
184184
});
185185

186+
test('getProjectStatusDetails request example', async () => {
187+
consoleLogMock.mockImplementation((output) => {
188+
originalLog(output);
189+
});
190+
consoleWarnMock.mockImplementation((output) => {
191+
// if an error occurs, display the message and then fail the test
192+
originalWarn(output);
193+
expect(true).toBeFalsy();
194+
});
195+
196+
originalLog('getProjectStatusDetails() result:');
197+
// begin-get_project_status_details
198+
199+
const params = {
200+
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
201+
};
202+
203+
let res;
204+
try {
205+
res = await codeEngineService.getProjectStatusDetails(params);
206+
console.log(JSON.stringify(res.result, null, 2));
207+
} catch (err) {
208+
console.warn(err);
209+
}
210+
211+
// end-get_project_status_details
212+
});
213+
186214
test('listApps request example', async () => {
187215
consoleLogMock.mockImplementation((output) => {
188216
originalLog(output);
@@ -586,6 +614,108 @@ describe('CodeEngineV2', () => {
586614
// end-get_job_run
587615
});
588616

617+
test('listBindings request example', async () => {
618+
consoleLogMock.mockImplementation((output) => {
619+
originalLog(output);
620+
});
621+
consoleWarnMock.mockImplementation((output) => {
622+
// if an error occurs, display the message and then fail the test
623+
originalWarn(output);
624+
expect(true).toBeFalsy();
625+
});
626+
627+
originalLog('listBindings() result:');
628+
// begin-list_bindings
629+
630+
const params = {
631+
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
632+
limit: 100,
633+
};
634+
635+
const allResults = [];
636+
try {
637+
const pager = new CodeEngineV2.BindingsPager(codeEngineService, params);
638+
while (pager.hasNext()) {
639+
const nextPage = await pager.getNext();
640+
expect(nextPage).not.toBeNull();
641+
allResults.push(...nextPage);
642+
}
643+
console.log(JSON.stringify(allResults, null, 2));
644+
} catch (err) {
645+
console.warn(err);
646+
}
647+
648+
// end-list_bindings
649+
});
650+
651+
test('createBinding request example', async () => {
652+
consoleLogMock.mockImplementation((output) => {
653+
originalLog(output);
654+
});
655+
consoleWarnMock.mockImplementation((output) => {
656+
// if an error occurs, display the message and then fail the test
657+
originalWarn(output);
658+
expect(true).toBeFalsy();
659+
});
660+
661+
originalLog('createBinding() result:');
662+
// begin-create_binding
663+
664+
// Request models needed by this operation.
665+
666+
// ComponentRef
667+
const componentRefModel = {
668+
name: 'my-app-1',
669+
resource_type: 'app_v2',
670+
};
671+
672+
const params = {
673+
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
674+
component: componentRefModel,
675+
prefix: 'MY_COS',
676+
secretName: 'my-service-access',
677+
};
678+
679+
let res;
680+
try {
681+
res = await codeEngineService.createBinding(params);
682+
console.log(JSON.stringify(res.result, null, 2));
683+
} catch (err) {
684+
console.warn(err);
685+
}
686+
687+
// end-create_binding
688+
});
689+
690+
test('getBinding request example', async () => {
691+
consoleLogMock.mockImplementation((output) => {
692+
originalLog(output);
693+
});
694+
consoleWarnMock.mockImplementation((output) => {
695+
// if an error occurs, display the message and then fail the test
696+
originalWarn(output);
697+
expect(true).toBeFalsy();
698+
});
699+
700+
originalLog('getBinding() result:');
701+
// begin-get_binding
702+
703+
const params = {
704+
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
705+
id: 'a172ced-b5f21bc-71ba50c-1638604',
706+
};
707+
708+
let res;
709+
try {
710+
res = await codeEngineService.getBinding(params);
711+
console.log(JSON.stringify(res.result, null, 2));
712+
} catch (err) {
713+
console.warn(err);
714+
}
715+
716+
// end-get_binding
717+
});
718+
589719
test('listBuilds request example', async () => {
590720
consoleLogMock.mockImplementation((output) => {
591721
originalLog(output);
@@ -638,7 +768,6 @@ describe('CodeEngineV2', () => {
638768
name: 'my-build',
639769
outputImage: 'private.de.icr.io/icr_namespace/image-name',
640770
outputSecret: 'ce-auto-icr-private-eu-de',
641-
sourceUrl: 'https://github.com/IBM/CodeEngine',
642771
strategyType: 'dockerfile',
643772
};
644773

@@ -1036,6 +1165,7 @@ describe('CodeEngineV2', () => {
10361165
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
10371166
name: 'my-secret',
10381167
ifMatch: 'testString',
1168+
format: 'generic',
10391169
};
10401170

10411171
let res;
@@ -1179,6 +1309,32 @@ describe('CodeEngineV2', () => {
11791309
// end-delete_job_run
11801310
});
11811311

1312+
test('deleteBinding request example', async () => {
1313+
consoleLogMock.mockImplementation((output) => {
1314+
originalLog(output);
1315+
});
1316+
consoleWarnMock.mockImplementation((output) => {
1317+
// if an error occurs, display the message and then fail the test
1318+
originalWarn(output);
1319+
expect(true).toBeFalsy();
1320+
});
1321+
1322+
// begin-delete_binding
1323+
1324+
const params = {
1325+
projectId: '15314cc3-85b4-4338-903f-c28cdee6d005',
1326+
id: 'a172ced-b5f21bc-71ba50c-1638604',
1327+
};
1328+
1329+
try {
1330+
await codeEngineService.deleteBinding(params);
1331+
} catch (err) {
1332+
console.warn(err);
1333+
}
1334+
1335+
// end-delete_binding
1336+
});
1337+
11821338
test('deleteBuild request example', async () => {
11831339
consoleLogMock.mockImplementation((output) => {
11841340
originalLog(output);

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ibm-cloud/ibm-code-engine-sdk",
3-
"version": "3.1.0",
3+
"version": "4.0.0",
44
"description": "IBM Cloud Code Engine NodeJS SDK",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)