Skip to content

Commit

Permalink
fix(IAM Identity): update service after recent API changes (#85)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Byrne <[email protected]>
  • Loading branch information
padamstx and Daniel Byrne authored Mar 11, 2021
1 parent c123f64 commit dc75de1
Show file tree
Hide file tree
Showing 5 changed files with 683 additions and 97 deletions.
50 changes: 36 additions & 14 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "package-lock.json|^.secrets.baseline$",
"lines": null
},
"generated_at": "2021-02-24T21:02:41Z",
"generated_at": "2021-03-11T14:47:06Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -82,6 +82,15 @@
"verified_result": null
}
],
"examples/iam-identity.v1.test.js": [
{
"hashed_secret": "a2190c299b60e882d9fb33736d5e6ab6ffe42708",
"is_verified": false,
"line_number": 540,
"type": "Secret Keyword",
"verified_result": null
}
],
"iam-identity/v1.ts": [
{
"hashed_secret": "0a49d517da94f14c36ac92806c1d15cf95fbca67",
Expand All @@ -107,19 +116,26 @@
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "835e124f126ae02c1c18b3c992a28dde441f5e04",
"is_verified": false,
"line_number": 944,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "e058a1c493ad749bd67d368340e9056ed1c2f3ed",
"is_secret": false,
"is_verified": false,
"line_number": 1130,
"line_number": 1391,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "f5cbae85fb47446511da4c9974e2da448caee7e1",
"is_secret": false,
"is_verified": false,
"line_number": 1287,
"line_number": 1548,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -152,6 +168,15 @@
"verified_result": null
}
],
"test/integration/iam-identity.v1.test.js": [
{
"hashed_secret": "a2190c299b60e882d9fb33736d5e6ab6ffe42708",
"is_verified": false,
"line_number": 599,
"type": "Secret Keyword",
"verified_result": null
}
],
"test/integration/open-service-broker.v1.test.js": [
{
"hashed_secret": "cf65466f1394d5969a2179be065d0daa54007411",
Expand All @@ -172,16 +197,6 @@
"verified_result": null
}
],
"test/integration/user-management.v1.test.js": [
{
"hashed_secret": "2fd0f58e94ad6ad73205d72f2bd0daa099b62500",
"is_secret": false,
"is_verified": false,
"line_number": 32,
"type": "Hex High Entropy String",
"verified_result": null
}
],
"test/unit/catalog-management.v1.test.js": [
{
"hashed_secret": "b8473b86d4c2072ca9b08bd28e373e8253e865c4",
Expand Down Expand Up @@ -252,10 +267,17 @@
"line_number": 742,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "cf4d2385b84329a52ca542285b93d9c4618420df",
"is_verified": false,
"line_number": 1264,
"type": "Secret Keyword",
"verified_result": null
}
]
},
"version": "0.13.1+ibm.29.dss",
"version": "0.13.1+ibm.31.dss",
"word_list": {
"file": null,
"hash": null
Expand Down
67 changes: 66 additions & 1 deletion examples/iam-identity.v1.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, 2021.
*
* 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 @@ -74,6 +74,8 @@ describe('IamIdentityV1', () => {
let svcId = null;
let svcIdEtag = null;

let accountSettingsEtag = null;

test('createApiKey request example', done => {

consoleLogMock.mockImplementation(output => {
Expand Down Expand Up @@ -488,4 +490,67 @@ describe('IamIdentityV1', () => {

// end-delete_service_id
});
test('getAccountSettings request example', done => {

consoleLogMock.mockImplementation(output => {
originalLog(output);
done();
});
consoleWarnMock.mockImplementation(output => {
done(output);
});

expect(accountSettingsEtag).toBeNull();

// begin-getAccountSettings

const params = {
accountId: accountId,
};

iamIdentityService.getAccountSettings(params)
.then(res => {
accountSettingsEtag = res.headers['etag'];
console.log(JSON.stringify(res.result, null, 2));
})
.catch(err => {
console.warn(err)
});

// end-getAccountSettings
});
test('updateAccountSettings request example', done => {

consoleLogMock.mockImplementation(output => {
originalLog(output);
done();
});
consoleWarnMock.mockImplementation(output => {
done(output);
});

expect(accountSettingsEtag).not.toBeNull();

// begin-updateAccountSettings

const params = {
ifMatch: accountSettingsEtag,
accountId: accountId,
restrict_create_service_id: "NOT_RESTRICTED",
restrict_create_platform_apikey: "NOT_RESTRICTED",
mfa: "NONE",
session_expiration_in_seconds: "86400",
session_invalidation_in_seconds: "7200",
};

iamIdentityService.updateAccountSettings(params)
.then(res => {
console.log(JSON.stringify(res.result, null, 2));
})
.catch(err => {
console.warn(err)
});

// end-updateAccountSettings
});
});
Loading

0 comments on commit dc75de1

Please sign in to comment.