Skip to content

Commit

Permalink
fix(IAM Access Groups): regen service to get Pagers (#171)
Browse files Browse the repository at this point in the history
This commit contains a re-gen of the service to
leverage the new Pagers emitted by the SDK generator.

Signed-off-by: Phil Adams <[email protected]>
  • Loading branch information
padamstx authored Oct 31, 2022
1 parent 850ccae commit 3530603
Show file tree
Hide file tree
Showing 5 changed files with 520 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "package-lock.json|go.sum|^.secrets.baseline$",
"lines": null
},
"generated_at": "2022-10-28T09:56:02Z",
"generated_at": "2022-10-28T16:28:34Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down
44 changes: 27 additions & 17 deletions examples/iam-access-groups.v2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @jest-environment node
*/
/**
* (C) Copyright IBM Corp. 2020.
* (C) Copyright IBM Corp. 2020, 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -155,13 +155,12 @@ describe('IamAccessGroupsV2', () => {
// end-update_access_group
});
test('listAccessGroups request example', async () => {

consoleLogMock.mockImplementation(output => {
consoleLogMock.mockImplementation((output) => {
originalLog(output);
});
consoleWarnMock.mockImplementation(output => {
consoleWarnMock.mockImplementation((output) => {
// if an error occurs, display the message and then fail the test
originalWarn(output);
// when the test fails we need to print out the error message and stop execution right after it
expect(true).toBeFalsy();
});

Expand All @@ -172,9 +171,15 @@ describe('IamAccessGroupsV2', () => {
accountId: testAccountId,
};

const allResults = [];
try {
const res = await iamAccessGroupsService.listAccessGroups(params);
console.log(JSON.stringify(res.result, null, 2));
const pager = new IamAccessGroupsV2.AccessGroupsPager(iamAccessGroupsService, params);
while (pager.hasNext()) {
const nextPage = await pager.getNext();
expect(nextPage).not.toBeNull();
allResults.push(...nextPage);
}
console.log(JSON.stringify(allResults, null, 2));
} catch (err) {
console.warn(err);
}
Expand Down Expand Up @@ -205,12 +210,12 @@ describe('IamAccessGroupsV2', () => {
};
var groupMember3 = {
iam_id: profileId,
type : 'profile',
type: 'profile',
}

const params = {
accessGroupId: testGroupId,
members: [groupMember1, groupMember2,groupMember3],
members: [groupMember1, groupMember2, groupMember3],
};

try {
Expand Down Expand Up @@ -249,13 +254,12 @@ describe('IamAccessGroupsV2', () => {
// end-is_member_of_access_group
});
test('listAccessGroupMembers request example', async () => {

consoleLogMock.mockImplementation(output => {
consoleLogMock.mockImplementation((output) => {
originalLog(output);
});
consoleWarnMock.mockImplementation(output => {
consoleWarnMock.mockImplementation((output) => {
// if an error occurs, display the message and then fail the test
originalWarn(output);
// when the test fails we need to print out the error message and stop execution right after it
expect(true).toBeFalsy();
});

Expand All @@ -266,9 +270,15 @@ describe('IamAccessGroupsV2', () => {
accessGroupId: testGroupId,
};

const allResults = [];
try {
const res = await iamAccessGroupsService.listAccessGroupMembers(params);
console.log(JSON.stringify(res.result, null, 2));
const pager = new IamAccessGroupsV2.AccessGroupMembersPager(iamAccessGroupsService, params);
while (pager.hasNext()) {
const nextPage = await pager.getNext();
expect(nextPage).not.toBeNull();
allResults.push(...nextPage);
}
console.log(JSON.stringify(allResults, null, 2));
} catch (err) {
console.warn(err);
}
Expand Down Expand Up @@ -433,7 +443,7 @@ describe('IamAccessGroupsV2', () => {
accessGroupId: testGroupId,
name: 'Manager group rule',
expiration: 12,
realmName: 'https://idp.example.org/SAML2',
realmName: 'https://idp.example.org/SAML2a',
conditions: [
{
claim: 'isManager',
Expand Down
Loading

0 comments on commit 3530603

Please sign in to comment.