Skip to content

Commit 93862bd

Browse files
feat(IAM Identity): add Identity Preference API (#284)
Signed-off-by: poorani <[email protected]>
1 parent 9a41702 commit 93862bd

File tree

4 files changed

+1126
-64
lines changed

4 files changed

+1126
-64
lines changed

examples/test_iam_identity_v1_examples.py

Lines changed: 85 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(
@@ -1775,6 +1784,82 @@ def test_delete_account_settings_template(self):
17751784
except ApiException as e:
17761785
pytest.fail(str(e))
17771786

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

17791864
# endregion
17801865
##############################################################################

0 commit comments

Comments
 (0)