@@ -65,6 +65,7 @@ describe('IamPolicyManagementV1', () => {
65
65
let exampleAssignmentPolicyId ;
66
66
let exampleTargetAccountId ;
67
67
let exampleAssignmentETag ;
68
+ let exampleAccountSettingsETag ;
68
69
const exampleCustomRoleDipslayName = 'IAM Groups read access' ;
69
70
const exampleUserId = 'IBMid-user1' ;
70
71
const exampleServiceName = 'iam-groups' ;
@@ -1342,4 +1343,75 @@ describe('IamPolicyManagementV1', () => {
1342
1343
1343
1344
// end-delete_policy_template
1344
1345
} ) ;
1346
+ test ( 'getSettings request example' , async ( ) => {
1347
+ consoleLogMock . mockImplementation ( ( output ) => {
1348
+ originalLog ( output ) ;
1349
+ } ) ;
1350
+ consoleWarnMock . mockImplementation ( ( output ) => {
1351
+ // if an error occurs, display the message and then fail the test
1352
+ originalWarn ( output ) ;
1353
+ expect ( true ) . toBeFalsy ( ) ;
1354
+ } ) ;
1355
+
1356
+ // begin-get_access_management_account_settings
1357
+
1358
+ const getSettingsParams = {
1359
+ accountId : exampleAccountId ,
1360
+ acceptLanguage : 'default' ,
1361
+ } ;
1362
+
1363
+ try {
1364
+ const res = await iamPolicyManagementService . getSettings ( getSettingsParams ) ;
1365
+ exampleAccountSettingsETag = res . headers . etag ;
1366
+ console . log ( JSON . stringify ( res . result , null , 2 ) ) ;
1367
+ } catch ( err ) {
1368
+ console . warn ( err )
1369
+ }
1370
+ // end-get_access_management_account_settings
1371
+ } ) ;
1372
+ test ( 'updateSettings request example' , async ( ) => {
1373
+ expect ( exampleAccountSettingsETag ) . not . toBeNull ( ) ;
1374
+ consoleLogMock . mockImplementation ( ( output ) => {
1375
+ originalLog ( output ) ;
1376
+ } ) ;
1377
+ consoleWarnMock . mockImplementation ( ( output ) => {
1378
+ // if an error occurs, display the message and then fail the test
1379
+ originalWarn ( output ) ;
1380
+ expect ( true ) . toBeFalsy ( ) ;
1381
+ } ) ;
1382
+
1383
+ // begin-update_access_management_account_settings
1384
+
1385
+ // IdentityTypesBase
1386
+ const identityTypesBaseModel = {
1387
+ state : 'monitor' ,
1388
+ external_allowed_accounts : [ ] ,
1389
+ } ;
1390
+
1391
+ // IdentityTypesPatch
1392
+ const identityTypesPatchModel = {
1393
+ user : identityTypesBaseModel ,
1394
+ service_id : identityTypesBaseModel ,
1395
+ service : identityTypesBaseModel ,
1396
+ } ;
1397
+
1398
+ // ExternalAccountIdentityInteractionPatch
1399
+ const externalAccountIdentityInteraction = {
1400
+ identity_types : identityTypesPatchModel ,
1401
+ } ;
1402
+ const updateSettingsParams = {
1403
+ accountId : exampleAccountId ,
1404
+ acceptLanguage : 'default' ,
1405
+ ifMatch : exampleAccountSettingsETag ,
1406
+ externalAccountIdentityInteraction,
1407
+ } ;
1408
+
1409
+ try {
1410
+ const res = await iamPolicyManagementService . updateSettings ( updateSettingsParams ) ;
1411
+ console . log ( JSON . stringify ( res . result , null , 2 ) ) ;
1412
+ } catch ( err ) {
1413
+ console . warn ( err )
1414
+ }
1415
+ // end-update_access_management_account_settings
1416
+ } ) ;
1345
1417
} ) ;
0 commit comments