@@ -171,7 +171,7 @@ def waitUntilTrustedProfileAssignmentFinished(cls, service, assignmentId):
171171                    profile_template_assignment_etag  is  not   None 
172172                    break 
173173            except  ApiException  as  e :
174-                 if  e . code  ==  404 :
174+                 if  getattr ( e ,  "status_code" ,  None )  ==  404 :
175175                    finished  =  True 
176176                    break 
177177            time .sleep (10 )
@@ -191,7 +191,7 @@ def waitUntilAccountSettingsAssignmentFinished(cls, service, assignmentId):
191191                    account_settings_template_assignment_etag  is  not   None 
192192                    break 
193193            except  ApiException  as  e :
194-                 if  e . code  ==  404 :
194+                 if  getattr ( e ,  "status_code" ,  None )  ==  404 :
195195                    finished  =  True 
196196                    break 
197197            time .sleep (10 )
@@ -1576,15 +1576,42 @@ def test_create_account_settings_template(self):
15761576            print ('\n create_account_settings_template() result:' )
15771577            # begin-create_account_settings_template 
15781578
1579-             account_settings  =  {}
1580-             account_settings ['mfa' ] =  'LEVEL1' 
1581-             account_settings ['system_access_token_expiration_in_seconds' ] =  3000 
1579+             # Construct a dict representation of a UserMfa model 
1580+             user_mfa_model  =  {
1581+                 'iam_id' : iam_id ,
1582+                 'mfa' : 'LEVEL2' ,
1583+             }
1584+             # Construct a dict representation of a AccountSettingsUserDomainRestriction model 
1585+             account_settings_user_domain_restriction_model  =  {
1586+                 'realm_id' : 'IBMid' ,
1587+                 'invitation_email_allow_patterns' : ["*.*@ibm.com" ],
1588+                 'restrict_invitation' : True ,
1589+             }
1590+             # Construct a dict representation of a TemplateAccountSettingsRestrictUserDomains model 
1591+             template_account_settings_restrict_user_domains_model  =  {
1592+                 'account_sufficient' : True ,
1593+                 'restrictions' : [account_settings_user_domain_restriction_model ],
1594+             }
1595+             # Construct a dict representation of a TemplateAccountSettings model 
1596+             template_account_settings_model  =  {
1597+                 'restrict_create_service_id' : 'NOT_SET' ,
1598+                 'restrict_create_platform_apikey' : 'NOT_SET' ,
1599+                 'mfa' : 'LEVEL1' ,
1600+                 'user_mfa' : [user_mfa_model ],
1601+                 'session_expiration_in_seconds' : '86400' ,
1602+                 'session_invalidation_in_seconds' : '7200' ,
1603+                 'max_sessions_per_identity' : '10' ,
1604+                 'system_access_token_expiration_in_seconds' : '3600' ,
1605+                 'system_refresh_token_expiration_in_seconds' : '259200' ,
1606+                 'restrict_user_list_visibility' : 'RESTRICTED' ,
1607+                 'restrict_user_domains' : template_account_settings_restrict_user_domains_model ,
1608+             }
15821609
15831610            create_response  =  iam_identity_service .create_account_settings_template (
15841611                name = account_settings_template_name ,
15851612                description = 'IAM enterprise account settings template example' ,
15861613                account_id = enterprise_account_id ,
1587-                 account_settings = account_settings ,
1614+                 account_settings = template_account_settings_model ,
15881615            )
15891616            account_settings_template  =  create_response .get_result ()
15901617            print ('\n create_account_settings_template() response: ' , json .dumps (account_settings_template , indent = 2 ))
@@ -1648,9 +1675,36 @@ def test_update_account_settings_template(self):
16481675            global  account_settings_template_etag 
16491676            # begin-update_account_settings_template_version 
16501677
1651-             account_settings  =  {}
1652-             account_settings ['mfa' ] =  'LEVEL1' 
1653-             account_settings ['system_access_token_expiration_in_seconds' ] =  3000 
1678+             # Construct a dict representation of a UserMfa model 
1679+             user_mfa_model  =  {
1680+                 'iam_id' : iam_id ,
1681+                 'mfa' : 'LEVEL1' ,
1682+             }
1683+             # Construct a dict representation of a AccountSettingsUserDomainRestriction model 
1684+             account_settings_user_domain_restriction_model  =  {
1685+                 'realm_id' : 'IBMid' ,
1686+                 'invitation_email_allow_patterns' : ["*.*@sap.com" ],
1687+                 'restrict_invitation' : True ,
1688+             }
1689+             # Construct a dict representation of a TemplateAccountSettingsRestrictUserDomains model 
1690+             template_account_settings_restrict_user_domains_model  =  {
1691+                 'account_sufficient' : False ,
1692+                 'restrictions' : [account_settings_user_domain_restriction_model ],
1693+             }
1694+             # Construct a dict representation of a TemplateAccountSettings model 
1695+             template_account_settings_model  =  {
1696+                 'restrict_create_service_id' : 'NOT_RESTRICTED' ,
1697+                 'restrict_create_platform_apikey' : 'NOT_RESTRICTED' ,
1698+                 'mfa' : 'LEVEL2' ,
1699+                 'user_mfa' : [user_mfa_model ],
1700+                 'session_expiration_in_seconds' : '72400' ,
1701+                 'session_invalidation_in_seconds' : '6000' ,
1702+                 'max_sessions_per_identity' : '5' ,
1703+                 'system_access_token_expiration_in_seconds' : '3000' ,
1704+                 'system_refresh_token_expiration_in_seconds' : '200000' ,
1705+                 'restrict_user_list_visibility' : 'NOT_RESTRICTED' ,
1706+                 'restrict_user_domains' : template_account_settings_restrict_user_domains_model ,
1707+             }
16541708
16551709            update_response  =  iam_identity_service .update_account_settings_template_version (
16561710                account_id = enterprise_account_id ,
@@ -1659,7 +1713,7 @@ def test_update_account_settings_template(self):
16591713                if_match = account_settings_template_etag ,
16601714                name = account_settings_template_name ,
16611715                description = 'IAM enterprise account settings template example - updated' ,
1662-                 account_settings = account_settings ,
1716+                 account_settings = template_account_settings_model ,
16631717            )
16641718            account_settings_template  =  update_response .get_result ()
16651719            print ('\n update_account_settings_template() response: ' , json .dumps (account_settings_template , indent = 2 ))
@@ -1761,6 +1815,18 @@ def test_create_new_account_settings_template_version(self):
17611815            account_settings ['system_access_token_expiration_in_seconds' ] =  2600 
17621816            account_settings ['restrict_create_platform_apikey' ] =  'RESTRICTED' 
17631817            account_settings ['restrict_create_service_id' ] =  'RESTRICTED' 
1818+             account_settings ['session_expiration_in_seconds' ] =  75000 
1819+             account_settings ['session_invalidation_in_seconds' ] =  5000 
1820+             account_settings ['max_sessions_per_identity' ] =  '7' 
1821+             account_settings ['restrict_user_list_visibility' ] =  'RESTRICTED' 
1822+             account_settings_user_mfa  =  {}
1823+             account_settings_user_mfa ['iam_id' ] =  iam_id 
1824+             account_settings_user_mfa ['mfa' ] =  'LEVEL2' 
1825+             account_settings ['user_mfa' ] =  [account_settings_user_mfa ]
1826+             account_settings_user_domain_restriction_model  =  {}
1827+             account_settings_user_domain_restriction_model ['realm_id' ] =  'IBMid' 
1828+             account_settings_user_domain_restriction_model ['invitation_email_allow_patterns' ] =  ['*.*@example.com' ]
1829+             account_settings_user_domain_restriction_model ['restrict_invitation' ] =  True 
17641830
17651831            create_response  =  iam_identity_service .create_account_settings_template_version (
17661832                template_id = account_settings_template_id ,
0 commit comments