Skip to content

Commit 547d454

Browse files
committed
feat(IAM Identity): adding Identity Preference API
Signed-off-by: poorani <[email protected]>
1 parent 9a41702 commit 547d454

File tree

4 files changed

+1250
-460
lines changed

4 files changed

+1250
-460
lines changed

examples/test_iam_identity_v1_examples.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
# IAM_IDENTITY_IAM_ID_MEMBER=<IAM ID of a user belonging to the account but different to the one above>
3939
# IAM_IDENTITY_ENTERPRISE_ACCOUNT_ID=<AccountID of the enterprise account>
4040
# IAM_IDENTITY_ENTERPRISE_SUBACCOUNT_ID=<AccountID of an account in the enterprise>
41+
# IAM_IDENTITY_IAM_ID_FOR_PREFERENCES=<IAM id of the profile to set preferences>
4142
#
4243
# These configuration properties can be exported as environment variables, or stored
4344
# in a configuration file and then:
@@ -51,6 +52,9 @@
5152

5253
apikey_name = 'Example-ApiKey'
5354
serviceid_name = 'Example-ServiceId'
55+
service = 'console'
56+
value_string ='/billing'
57+
preference_id1 ='landing_page'
5458

5559
# config property values
5660
account_id = None
@@ -91,6 +95,8 @@
9195
account_settings_template_assignment_id = None
9296
account_settings_template_assignment_etag = None
9397

98+
iam_id_for_preferences = None
99+
94100

95101
##############################################################################
96102
# Start of Examples for Service: IamIdentityV1
@@ -136,6 +142,9 @@ def setup_class(cls):
136142
global enterprise_subaccount_id
137143
enterprise_subaccount_id = config['ENTERPRISE_SUBACCOUNT_ID']
138144

145+
global iam_id_for_preferences
146+
iam_id_for_preferences = config ['IAM_ID_FOR_PREFERENCES']
147+
139148
print('Setup complete.')
140149

141150
needscredentials = pytest.mark.skipif(
@@ -1774,7 +1783,76 @@ def test_delete_account_settings_template(self):
17741783
# end-delete_all_versions_of_account_settings_template
17751784
except ApiException as e:
17761785
pytest.fail(str(e))
1786+
@needscredentials
1787+
def test_update_preference_on_scope_account(self):
1788+
"""
1789+
update_preference_on_scope_account request example
1790+
"""
1791+
try:
1792+
print('\nupdate_preference_on_scope_account() result:')
1793+
# begin-update_preference_on_scope_account
17771794

1795+
preference = iam_identity_service.update_preference_on_scope_account(
1796+
iam_id=iam_id_for_preferences, service=service, preference_id=preference_id1, value_string=value_string
1797+
).get_result()
1798+
print(json.dumps(preference, indent=2))
1799+
1800+
# end-update_preference_on_scope_account
1801+
1802+
except ApiException as e:
1803+
pytest.fail(str(e))
1804+
@needscredentials
1805+
def test_get_preferences_on_scope_account(self):
1806+
"""
1807+
get_preferences_on_scope_account request example
1808+
"""
1809+
try:
1810+
print('\nget_preferences_on_scope_account() result:')
1811+
# begin-get_preferences_on_scope_account
1812+
1813+
preference = iam_identity_service.get_preferences_on_scope_account(
1814+
iam_id=iam_id_for_preferences, service=service, preference_id=preference_id1
1815+
).get_result()
1816+
print(json.dumps(preference, indent=2))
1817+
1818+
# end-get_preferences_on_scope_account
1819+
1820+
except ApiException as e:
1821+
pytest.fail(str(e))
1822+
@needscredentials
1823+
def test_get_all_preferences_on_scope_account(self):
1824+
"""
1825+
get_all_preferences_on_scope_account request example
1826+
"""
1827+
try:
1828+
print('\nget_all_preferences_on_scope_account() result:')
1829+
# begin-get_all_preferences_on_scope_account
1830+
1831+
preference = iam_identity_service.get_all_preferences_on_scope_account(
1832+
iam_id=iam_id_for_preferences
1833+
).get_result()
1834+
print(json.dumps(preference, indent=2))
1835+
1836+
# end-get_all_preferences_on_scope_account
1837+
1838+
except ApiException as e:
1839+
pytest.fail(str(e))
1840+
@needscredentials
1841+
def test_delete_preferences_on_scope_account(self):
1842+
"""
1843+
delete_preferences_on_scope_account request example
1844+
"""
1845+
try:
1846+
# begin-delete_preferences_on_scope_account
1847+
1848+
response = iam_identity_service.delete_preferences_on_scope_account(iam_id=iam_id_for_preferences, service=service, preference_id=preference_id1)
1849+
1850+
# end-delete_preferences_on_scope_account
1851+
1852+
print('\ndelete_preferences_on_scope_account() response status code: ', response.get_status_code())
1853+
1854+
except ApiException as e:
1855+
pytest.fail(str(e))
17781856

17791857
# endregion
17801858
##############################################################################

0 commit comments

Comments
 (0)