Skip to content

Commit f8dd3dc

Browse files
authored
fix(IAM Access Groups): add trusted profile as member (#148)
1 parent 0ca1b0a commit f8dd3dc

File tree

2 files changed

+32
-27
lines changed

2 files changed

+32
-27
lines changed

ibm_platform_services/iam_access_groups_v2.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding: utf-8
22

3-
# (C) Copyright IBM Corp. 2021.
3+
# (C) Copyright IBM Corp. 2022.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# IBM OpenAPI SDK Code Generator Version: 3.43.0-49eab5c7-20211117-152138
17+
# IBM OpenAPI SDK Code Generator Version: 3.43.4-432d779b-20220119-173927
1818

1919
"""
2020
The IAM Access Groups API allows for the management of access groups (Create, Read,
@@ -187,8 +187,8 @@ def list_access_groups(self,
187187
multiple services by using one identifier. The header key must be set to
188188
Transaction-Id and the value is anything that you choose. If no transaction
189189
ID is passed in, then a random ID is generated.
190-
:param str iam_id: (optional) Return groups for member id (IBMid or Service
191-
Id).
190+
:param str iam_id: (optional) Return groups for member id (IBMid, Service
191+
Id or Profile Id).
192192
:param int limit: (optional) Return up to this limit of results where limit
193193
is between 0 and 100.
194194
:param int offset: (optional) The offset of the first result item to be
@@ -498,12 +498,12 @@ def add_members_to_access_group(self,
498498
"""
499499
Add members to an access group.
500500
501-
Use this API to add users (`IBMid-...`) or service IDs (`iam-ServiceId-...`) to an
502-
access group. Any member added gains access to resources defined in the group's
503-
policies. To revoke a given user's access, simply remove them from the group.
504-
There is no limit to the number of members one group can have, but each `iam_id`
505-
can only be added to 50 groups. Additionally, this API request payload can add up
506-
to 50 members per call.
501+
Use this API to add users (`IBMid-...`), service IDs (`iam-ServiceId-...`) or
502+
trusted profiles (`iam-Profile-...`) to an access group. Any member added gains
503+
access to resources defined in the group's policies. To revoke a given members's
504+
access, simply remove them from the group. There is no limit to the number of
505+
members one group can have, but each `iam_id` can only be added to 50 groups.
506+
Additionally, this API request payload can add up to 50 members per call.
507507
508508
:param str access_group_id: The access group identifier.
509509
:param List[AddGroupMembersRequestMembersItem] members: (optional) An array
@@ -570,9 +570,9 @@ def list_access_group_members(self,
570570
571571
List all members of a given group using this API. Parameters for pagination and
572572
sorting can be used to filter the results. The most useful query parameter may be
573-
the `verbose` flag. If `verbose=true`, user and service ID names will be retrieved
574-
for each `iam_id`. If performance is a concern, leave the `verbose` parameter off
575-
so that name information does not get retrieved.
573+
the `verbose` flag. If `verbose=true`, user, service ID and trusted profile names
574+
will be retrieved for each `iam_id`. If performance is a concern, leave the
575+
`verbose` parameter off so that name information does not get retrieved.
576576
577577
:param str access_group_id: The access group identifier.
578578
:param str transaction_id: (optional) An optional transaction ID can be
@@ -586,7 +586,7 @@ def list_access_group_members(self,
586586
returned.
587587
:param str type: (optional) Filter the results by member type.
588588
:param bool verbose: (optional) Return user's email and name for each user
589-
id or the name for each service id.
589+
id or the name for each service id or trusted profile.
590590
:param str sort: (optional) If verbose is true, sort the results by id,
591591
name, or email.
592592
:param dict headers: A `dict` containing the request headers
@@ -828,8 +828,8 @@ def add_member_to_multiple_access_groups(self,
828828
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
829829
match the account of the Authorization token.
830830
:param str iam_id: The IAM identifier.
831-
:param str type: (optional) The type of the member, must be either "user"
832-
or "service".
831+
:param str type: (optional) The type of the member, must be either "user",
832+
"service" or "trusted profile".
833833
:param List[str] groups: (optional) The ids of the access groups a given
834834
member is to be added to.
835835
:param str transaction_id: (optional) An optional transaction ID can be
@@ -1437,8 +1437,9 @@ class AddGroupMembersRequestMembersItem():
14371437
"""
14381438
AddGroupMembersRequestMembersItem.
14391439
1440-
:attr str iam_id: The IBMid or Service Id of the member.
1441-
:attr str type: The type of the member, must be either "user" or "service".
1440+
:attr str iam_id: The IBMid, Service Id or Profile Id of the member.
1441+
:attr str type: The type of the member, must be either "user", "service" or
1442+
"trusted profile".
14421443
"""
14431444

14441445
def __init__(self,
@@ -1447,9 +1448,9 @@ def __init__(self,
14471448
"""
14481449
Initialize a AddGroupMembersRequestMembersItem object.
14491450
1450-
:param str iam_id: The IBMid or Service Id of the member.
1451-
:param str type: The type of the member, must be either "user" or
1452-
"service".
1451+
:param str iam_id: The IBMid, Service Id or Profile Id of the member.
1452+
:param str type: The type of the member, must be either "user", "service"
1453+
or "trusted profile".
14531454
"""
14541455
self.iam_id = iam_id
14551456
self.type = type

test/unit/test_iam_access_groups_v2.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# (C) Copyright IBM Corp. 2021.
2+
# (C) Copyright IBM Corp. 2022.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -67,6 +67,7 @@ def test_new_instance_without_authenticator(self):
6767
"""
6868
with pytest.raises(ValueError, match='authenticator must be provided'):
6969
service = IamAccessGroupsV2.new_instance(
70+
service_name='TEST_SERVICE_NOT_FOUND',
7071
)
7172

7273
class TestCreateAccessGroup():
@@ -813,6 +814,7 @@ def test_new_instance_without_authenticator(self):
813814
"""
814815
with pytest.raises(ValueError, match='authenticator must be provided'):
815816
service = IamAccessGroupsV2.new_instance(
817+
service_name='TEST_SERVICE_NOT_FOUND',
816818
)
817819

818820
class TestIsMemberOfAccessGroup():
@@ -1389,7 +1391,7 @@ def test_remove_members_from_access_group_all_params(self):
13891391

13901392
# Set up parameter values
13911393
access_group_id = 'testString'
1392-
members = ['IBMId-user1', 'iam-ServiceId-123']
1394+
members = ['IBMId-user1', 'iam-ServiceId-123', 'iam-Profile-123']
13931395
transaction_id = 'testString'
13941396

13951397
# Invoke method
@@ -1405,7 +1407,7 @@ def test_remove_members_from_access_group_all_params(self):
14051407
assert response.status_code == 207
14061408
# Validate body params
14071409
req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
1408-
assert req_body['members'] == ['IBMId-user1', 'iam-ServiceId-123']
1410+
assert req_body['members'] == ['IBMId-user1', 'iam-ServiceId-123', 'iam-Profile-123']
14091411

14101412
def test_remove_members_from_access_group_all_params_with_retries(self):
14111413
# Enable retries and run test_remove_members_from_access_group_all_params.
@@ -1432,7 +1434,7 @@ def test_remove_members_from_access_group_required_params(self):
14321434

14331435
# Set up parameter values
14341436
access_group_id = 'testString'
1435-
members = ['IBMId-user1', 'iam-ServiceId-123']
1437+
members = ['IBMId-user1', 'iam-ServiceId-123', 'iam-Profile-123']
14361438

14371439
# Invoke method
14381440
response = _service.remove_members_from_access_group(
@@ -1446,7 +1448,7 @@ def test_remove_members_from_access_group_required_params(self):
14461448
assert response.status_code == 207
14471449
# Validate body params
14481450
req_body = json.loads(str(responses.calls[0].request.body, 'utf-8'))
1449-
assert req_body['members'] == ['IBMId-user1', 'iam-ServiceId-123']
1451+
assert req_body['members'] == ['IBMId-user1', 'iam-ServiceId-123', 'iam-Profile-123']
14501452

14511453
def test_remove_members_from_access_group_required_params_with_retries(self):
14521454
# Enable retries and run test_remove_members_from_access_group_required_params.
@@ -1473,7 +1475,7 @@ def test_remove_members_from_access_group_value_error(self):
14731475

14741476
# Set up parameter values
14751477
access_group_id = 'testString'
1476-
members = ['IBMId-user1', 'iam-ServiceId-123']
1478+
members = ['IBMId-user1', 'iam-ServiceId-123', 'iam-Profile-123']
14771479

14781480
# Pass in all but one required param and check for a ValueError
14791481
req_param_dict = {
@@ -1826,6 +1828,7 @@ def test_new_instance_without_authenticator(self):
18261828
"""
18271829
with pytest.raises(ValueError, match='authenticator must be provided'):
18281830
service = IamAccessGroupsV2.new_instance(
1831+
service_name='TEST_SERVICE_NOT_FOUND',
18291832
)
18301833

18311834
class TestAddAccessGroupRule():
@@ -2613,6 +2616,7 @@ def test_new_instance_without_authenticator(self):
26132616
"""
26142617
with pytest.raises(ValueError, match='authenticator must be provided'):
26152618
service = IamAccessGroupsV2.new_instance(
2619+
service_name='TEST_SERVICE_NOT_FOUND',
26162620
)
26172621

26182622
class TestGetAccountSettings():

0 commit comments

Comments
 (0)