Skip to content

Commit 3b0f952

Browse files
authored
feat(IAM Identity): add trusted profile identities API (#206)
Signed-off-by: Somanath Chavan <[email protected]>
1 parent a35907b commit 3b0f952

File tree

4 files changed

+2605
-266
lines changed

4 files changed

+2605
-266
lines changed

examples/test_iam_identity_v1_examples.py

Lines changed: 111 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
profile_id = None
6161
profile_etag = None
62+
profile_identity_etag = None
6263

6364
claimRule_id = None
6465
claimRule_etag = None
@@ -469,7 +470,7 @@ def test_get_profile_example(self):
469470

470471
response = iam_identity_service.get_profile(
471472
profile_id=profile_id,
472-
include_history=True,
473+
include_activity=True,
473474
)
474475

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

665666
CreateProfileLinkRequestLink = {}
666-
CreateProfileLinkRequestLink[
667-
'crn'
668-
] = 'crn:v1:staging:public:iam-identity::a/18e3020749ce4744b0b472466d61fdb4::computeresource:Fake-Compute-Resource'
667+
CreateProfileLinkRequestLink['crn'] = (
668+
'crn:v1:staging:public:iam-identity::a/' + account_id + '::computeresource:Fake-Compute-Resource'
669+
)
669670
CreateProfileLinkRequestLink['namespace'] = 'default'
670671
CreateProfileLinkRequestLink['name'] = 'nice name'
671672

@@ -744,6 +745,112 @@ def test_delete_link_example(self):
744745
except ApiException as e:
745746
pytest.fail(str(e))
746747

748+
@needscredentials
749+
def test_get_profile_identities(self):
750+
"""
751+
get_profile_identities request example
752+
"""
753+
try:
754+
global profile_id, profile_identity_etag
755+
756+
# begin-get_profile_identities
757+
758+
response = iam_identity_service.get_profile_identities(profile_id=profile_id)
759+
760+
# end-get_profile_identities
761+
print('\nget_profile_identities() response status code: ', response.get_status_code())
762+
profile_identity_etag = response.get_headers()['Etag']
763+
764+
except ApiException as e:
765+
pytest.fail(str(e))
766+
767+
@needscredentials
768+
def test_set_profile_identities(self):
769+
"""
770+
set_profile_identities request example
771+
"""
772+
try:
773+
global profile_id, profile_identity_etag
774+
775+
# begin-set_profile_identities
776+
accounts = [account_id]
777+
profileIdentity = ProfileIdentity(
778+
identifier=iam_id, accounts=accounts, type="user", description="Identity description"
779+
)
780+
profile_identities_input = [profileIdentity]
781+
782+
response = iam_identity_service.set_profile_identities(
783+
profile_id=profile_id, if_match=profile_identity_etag, identities=profile_identities_input
784+
)
785+
786+
# end-set_profile_identities
787+
print('\nset_profile_identities() response status code: ', response.get_status_code())
788+
789+
except ApiException as e:
790+
pytest.fail(str(e))
791+
792+
@needscredentials
793+
def test_set_profile_identity(self):
794+
"""
795+
set_profile_identity request example
796+
"""
797+
try:
798+
global profile_id
799+
800+
# begin-set_profile_identity
801+
accounts = [account_id]
802+
response = iam_identity_service.set_profile_identity(
803+
profile_id=profile_id,
804+
identity_type="user",
805+
identifier=iam_id_member,
806+
type="user",
807+
accounts=accounts,
808+
description="Identity description",
809+
)
810+
811+
# end-set_profile_identity
812+
print('\nset_profile_identities() response status code: ', response.get_status_code())
813+
except ApiException as e:
814+
pytest.fail(str(e))
815+
816+
@needscredentials
817+
def test_get_profile_identity(self):
818+
"""
819+
get_profile_identity request example
820+
"""
821+
try:
822+
global profile_id
823+
824+
# begin-get_profile_identity
825+
826+
response = iam_identity_service.get_profile_identity(
827+
profile_id=profile_id, identity_type="user", identifier_id=iam_id_member
828+
)
829+
830+
# end-get_profile_identity
831+
print('\nget_profile_identities() response status code: ', response.get_status_code())
832+
except ApiException as e:
833+
pytest.fail(str(e))
834+
835+
@needscredentials
836+
def test_delete_profile_identity(self):
837+
"""
838+
delete_profile_identity request example
839+
"""
840+
try:
841+
global profile_id
842+
843+
# begin-delete_profile_identity
844+
845+
response = iam_identity_service.delete_profile_identity(
846+
profile_id=profile_id, identity_type="user", identifier_id=iam_id_member
847+
)
848+
849+
# end-delete_profile_identity
850+
print('\ndelete_profile_identity() response status code: ', response.get_status_code())
851+
except ApiException as e:
852+
pytest.fail(str(e))
853+
747854
@needscredentials
748855
def test_delete_profile_example(self):
749856
"""

0 commit comments

Comments
 (0)