Skip to content

feat(IAM Identity): adding Identity Preference API #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions examples/test_iam_identity_v1_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
# IAM_IDENTITY_IAM_ID_MEMBER=<IAM ID of a user belonging to the account but different to the one above>
# IAM_IDENTITY_ENTERPRISE_ACCOUNT_ID=<AccountID of the enterprise account>
# IAM_IDENTITY_ENTERPRISE_SUBACCOUNT_ID=<AccountID of an account in the enterprise>
# IAM_IDENTITY_IAM_ID_FOR_PREFERENCES=<IAM id of the profile to set preferences>
#
# These configuration properties can be exported as environment variables, or stored
# in a configuration file and then:
Expand All @@ -51,6 +52,9 @@

apikey_name = 'Example-ApiKey'
serviceid_name = 'Example-ServiceId'
service = 'console'
value_string = '/billing'
preference_id1 = 'landing_page'

# config property values
account_id = None
Expand Down Expand Up @@ -91,6 +95,8 @@
account_settings_template_assignment_id = None
account_settings_template_assignment_etag = None

iam_id_for_preferences = None


##############################################################################
# Start of Examples for Service: IamIdentityV1
Expand Down Expand Up @@ -136,6 +142,9 @@ def setup_class(cls):
global enterprise_subaccount_id
enterprise_subaccount_id = config['ENTERPRISE_SUBACCOUNT_ID']

global iam_id_for_preferences
iam_id_for_preferences = config['IAM_ID_FOR_PREFERENCES']

print('Setup complete.')

needscredentials = pytest.mark.skipif(
Expand Down Expand Up @@ -1775,6 +1784,82 @@ def test_delete_account_settings_template(self):
except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_update_preference_on_scope_account(self):
"""
update_preference_on_scope_account request example
"""
try:
print('\nupdate_preference_on_scope_account() result:')
# begin-update_preference_on_scope_account

preference = iam_identity_service.update_preference_on_scope_account(
iam_id=iam_id_for_preferences, service=service, preference_id=preference_id1, value_string=value_string
).get_result()
print(json.dumps(preference, indent=2))

# end-update_preference_on_scope_account

except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_get_preferences_on_scope_account(self):
"""
get_preferences_on_scope_account request example
"""
try:
print('\nget_preferences_on_scope_account() result:')
# begin-get_preferences_on_scope_account

preference = iam_identity_service.get_preferences_on_scope_account(
iam_id=iam_id_for_preferences, service=service, preference_id=preference_id1
).get_result()
print(json.dumps(preference, indent=2))

# end-get_preferences_on_scope_account

except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_get_all_preferences_on_scope_account(self):
"""
get_all_preferences_on_scope_account request example
"""
try:
print('\nget_all_preferences_on_scope_account() result:')
# begin-get_all_preferences_on_scope_account

preference = iam_identity_service.get_all_preferences_on_scope_account(
iam_id=iam_id_for_preferences
).get_result()
print(json.dumps(preference, indent=2))

# end-get_all_preferences_on_scope_account

except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_delete_preferences_on_scope_account(self):
"""
delete_preferences_on_scope_account request example
"""
try:
# begin-delete_preferences_on_scope_account

response = iam_identity_service.delete_preferences_on_scope_account(
iam_id=iam_id_for_preferences, service=service, preference_id=preference_id1
)

# end-delete_preferences_on_scope_account

print('\ndelete_preferences_on_scope_account() response status code: ', response.get_status_code())

except ApiException as e:
pytest.fail(str(e))


# endregion
##############################################################################
Expand Down
Loading