Skip to content

feat(IAM Identity): add trusted profile identities api #206

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
Jun 9, 2023
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
115 changes: 111 additions & 4 deletions examples/test_iam_identity_v1_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

profile_id = None
profile_etag = None
profile_identity_etag = None

claimRule_id = None
claimRule_etag = None
Expand Down Expand Up @@ -469,7 +470,7 @@ def test_get_profile_example(self):

response = iam_identity_service.get_profile(
profile_id=profile_id,
include_history=True,
include_activity=True,
)

profile_etag = response.get_headers()['Etag']
Expand Down Expand Up @@ -663,9 +664,9 @@ def test_create_link_example(self):
# begin-create_link

CreateProfileLinkRequestLink = {}
CreateProfileLinkRequestLink[
'crn'
] = 'crn:v1:staging:public:iam-identity::a/18e3020749ce4744b0b472466d61fdb4::computeresource:Fake-Compute-Resource'
CreateProfileLinkRequestLink['crn'] = (
'crn:v1:staging:public:iam-identity::a/' + account_id + '::computeresource:Fake-Compute-Resource'
)
CreateProfileLinkRequestLink['namespace'] = 'default'
CreateProfileLinkRequestLink['name'] = 'nice name'

Expand Down Expand Up @@ -744,6 +745,112 @@ def test_delete_link_example(self):
except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_get_profile_identities(self):
"""
get_profile_identities request example
"""
try:
global profile_id, profile_identity_etag

# begin-get_profile_identities

response = iam_identity_service.get_profile_identities(profile_id=profile_id)

# end-get_profile_identities
print('\nget_profile_identities() response status code: ', response.get_status_code())
profile_identity_etag = response.get_headers()['Etag']

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

@needscredentials
def test_set_profile_identities(self):
"""
set_profile_identities request example
"""
try:
global profile_id, profile_identity_etag

# begin-set_profile_identities
accounts = [account_id]
profileIdentity = ProfileIdentity(
identifier=iam_id, accounts=accounts, type="user", description="Identity description"
)
profile_identities_input = [profileIdentity]

response = iam_identity_service.set_profile_identities(
profile_id=profile_id, if_match=profile_identity_etag, identities=profile_identities_input
)

# end-set_profile_identities
print('\nset_profile_identities() response status code: ', response.get_status_code())

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

@needscredentials
def test_set_profile_identity(self):
"""
set_profile_identity request example
"""
try:
global profile_id

# begin-set_profile_identity
accounts = [account_id]
response = iam_identity_service.set_profile_identity(
profile_id=profile_id,
identity_type="user",
identifier=iam_id_member,
type="user",
accounts=accounts,
description="Identity description",
)

# end-set_profile_identity
print('\nset_profile_identities() response status code: ', response.get_status_code())
except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_get_profile_identity(self):
"""
get_profile_identity request example
"""
try:
global profile_id

# begin-get_profile_identity

response = iam_identity_service.get_profile_identity(
profile_id=profile_id, identity_type="user", identifier_id=iam_id_member
)

# end-get_profile_identity
print('\nget_profile_identities() response status code: ', response.get_status_code())
except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_delete_profile_identity(self):
"""
delete_profile_identity request example
"""
try:
global profile_id

# begin-delete_profile_identity

response = iam_identity_service.delete_profile_identity(
profile_id=profile_id, identity_type="user", identifier_id=iam_id_member
)

# end-delete_profile_identity
print('\ndelete_profile_identity() response status code: ', response.get_status_code())
except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_delete_profile_example(self):
"""
Expand Down
Loading