Skip to content

Commit 3f90c90

Browse files
committed
iam identity profile identities api
Signed-off-by: Somanath Chavan <[email protected]>
1 parent a35907b commit 3f90c90

File tree

4 files changed

+2664
-359
lines changed

4 files changed

+2664
-359
lines changed

examples/test_iam_identity_v1_examples.py

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

0 commit comments

Comments
 (0)