Skip to content

Commit

Permalink
fix(IAM Access Groups): add trusted profile as member (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
hariarla committed Feb 7, 2022
1 parent f261b41 commit 1b6e894
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
29 changes: 15 additions & 14 deletions iamaccessgroupsv2/iam_access_groups_v2.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2021.
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
*/

/*
* IBM OpenAPI SDK Code Generator Version: 3.43.0-49eab5c7-20211117-152138
* IBM OpenAPI SDK Code Generator Version: 3.43.4-432d779b-20220119-173927
*/

// Package iamaccessgroupsv2 : Operations and models for the IamAccessGroupsV2 service
Expand Down Expand Up @@ -582,10 +582,11 @@ func (iamAccessGroups *IamAccessGroupsV2) IsMemberOfAccessGroupWithContext(ctx c
}

// AddMembersToAccessGroup : Add members to an access group
// Use this API to add users (`IBMid-...`) or service IDs (`iam-ServiceId-...`) to an access group. Any member added
// gains access to resources defined in the group's policies. To revoke a given user's access, simply remove them from
// the group. There is no limit to the number of members one group can have, but each `iam_id` can only be added to 50
// groups. Additionally, this API request payload can add up to 50 members per call.
// Use this API to add users (`IBMid-...`), service IDs (`iam-ServiceId-...`) or trusted profiles (`iam-Profile-...`) to
// an access group. Any member added gains access to resources defined in the group's policies. To revoke a given
// members's access, simply remove them from the group. There is no limit to the number of members one group can have,
// but each `iam_id` can only be added to 50 groups. Additionally, this API request payload can add up to 50 members per
// call.
func (iamAccessGroups *IamAccessGroupsV2) AddMembersToAccessGroup(addMembersToAccessGroupOptions *AddMembersToAccessGroupOptions) (result *AddGroupMembersResponse, response *core.DetailedResponse, err error) {
return iamAccessGroups.AddMembersToAccessGroupWithContext(context.Background(), addMembersToAccessGroupOptions)
}
Expand Down Expand Up @@ -659,9 +660,9 @@ func (iamAccessGroups *IamAccessGroupsV2) AddMembersToAccessGroupWithContext(ctx

// ListAccessGroupMembers : List access group members
// List all members of a given group using this API. Parameters for pagination and sorting can be used to filter the
// results. The most useful query parameter may be the `verbose` flag. If `verbose=true`, user and service ID names will
// be retrieved for each `iam_id`. If performance is a concern, leave the `verbose` parameter off so that name
// information does not get retrieved.
// results. The most useful query parameter may be the `verbose` flag. If `verbose=true`, user, service ID and trusted
// profile names will be retrieved for each `iam_id`. If performance is a concern, leave the `verbose` parameter off so
// that name information does not get retrieved.
func (iamAccessGroups *IamAccessGroupsV2) ListAccessGroupMembers(listAccessGroupMembersOptions *ListAccessGroupMembersOptions) (result *GroupMembersList, response *core.DetailedResponse, err error) {
return iamAccessGroups.ListAccessGroupMembersWithContext(context.Background(), listAccessGroupMembersOptions)
}
Expand Down Expand Up @@ -1621,10 +1622,10 @@ func (options *AddAccessGroupRuleOptions) SetHeaders(param map[string]string) *A

// AddGroupMembersRequestMembersItem : AddGroupMembersRequestMembersItem struct
type AddGroupMembersRequestMembersItem struct {
// The IBMid or Service Id of the member.
// The IBMid, Service Id or Profile Id of the member.
IamID *string `json:"iam_id" validate:"required"`

// The type of the member, must be either "user" or "service".
// The type of the member, must be either "user", "service" or "trusted profile".
Type *string `json:"type" validate:"required"`
}

Expand Down Expand Up @@ -1739,7 +1740,7 @@ type AddMemberToMultipleAccessGroupsOptions struct {
// The IAM identifier.
IamID *string `json:"iam_id" validate:"required,ne="`

// The type of the member, must be either "user" or "service".
// The type of the member, must be either "user", "service" or "trusted profile".
Type *string `json:"type,omitempty"`

// The ids of the access groups a given member is to be added to.
Expand Down Expand Up @@ -2637,7 +2638,7 @@ type ListAccessGroupMembersOptions struct {
// Filter the results by member type.
Type *string `json:"type,omitempty"`

// Return user's email and name for each user id or the name for each service id.
// Return user's email and name for each user id or the name for each service id or trusted profile.
Verbose *bool `json:"verbose,omitempty"`

// If verbose is true, sort the results by id, name, or email.
Expand Down Expand Up @@ -2753,7 +2754,7 @@ type ListAccessGroupsOptions struct {
// choose. If no transaction ID is passed in, then a random ID is generated.
TransactionID *string `json:"Transaction-Id,omitempty"`

// Return groups for member id (IBMid or Service Id).
// Return groups for member id (IBMid, Service Id or Profile Id).
IamID *string `json:"iam_id,omitempty"`

// Return up to this limit of results where limit is between 0 and 100.
Expand Down
2 changes: 1 addition & 1 deletion iamaccessgroupsv2/iam_access_groups_v2_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2021.
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
16 changes: 8 additions & 8 deletions iamaccessgroupsv2/iam_access_groups_v2_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2021.
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -2090,7 +2090,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
// Construct an instance of the RemoveMembersFromAccessGroupOptions model
removeMembersFromAccessGroupOptionsModel := new(iamaccessgroupsv2.RemoveMembersFromAccessGroupOptions)
removeMembersFromAccessGroupOptionsModel.AccessGroupID = core.StringPtr("testString")
removeMembersFromAccessGroupOptionsModel.Members = []string{"IBMId-user1", "iam-ServiceId-123"}
removeMembersFromAccessGroupOptionsModel.Members = []string{"IBMId-user1", "iam-ServiceId-123", "iam-Profile-123"}
removeMembersFromAccessGroupOptionsModel.TransactionID = core.StringPtr("testString")
removeMembersFromAccessGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}
// Expect response parsing to fail since we are receiving a text/plain response
Expand Down Expand Up @@ -2161,7 +2161,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
// Construct an instance of the RemoveMembersFromAccessGroupOptions model
removeMembersFromAccessGroupOptionsModel := new(iamaccessgroupsv2.RemoveMembersFromAccessGroupOptions)
removeMembersFromAccessGroupOptionsModel.AccessGroupID = core.StringPtr("testString")
removeMembersFromAccessGroupOptionsModel.Members = []string{"IBMId-user1", "iam-ServiceId-123"}
removeMembersFromAccessGroupOptionsModel.Members = []string{"IBMId-user1", "iam-ServiceId-123", "iam-Profile-123"}
removeMembersFromAccessGroupOptionsModel.TransactionID = core.StringPtr("testString")
removeMembersFromAccessGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}

Expand Down Expand Up @@ -2240,7 +2240,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
// Construct an instance of the RemoveMembersFromAccessGroupOptions model
removeMembersFromAccessGroupOptionsModel := new(iamaccessgroupsv2.RemoveMembersFromAccessGroupOptions)
removeMembersFromAccessGroupOptionsModel.AccessGroupID = core.StringPtr("testString")
removeMembersFromAccessGroupOptionsModel.Members = []string{"IBMId-user1", "iam-ServiceId-123"}
removeMembersFromAccessGroupOptionsModel.Members = []string{"IBMId-user1", "iam-ServiceId-123", "iam-Profile-123"}
removeMembersFromAccessGroupOptionsModel.TransactionID = core.StringPtr("testString")
removeMembersFromAccessGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}

Expand All @@ -2262,7 +2262,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
// Construct an instance of the RemoveMembersFromAccessGroupOptions model
removeMembersFromAccessGroupOptionsModel := new(iamaccessgroupsv2.RemoveMembersFromAccessGroupOptions)
removeMembersFromAccessGroupOptionsModel.AccessGroupID = core.StringPtr("testString")
removeMembersFromAccessGroupOptionsModel.Members = []string{"IBMId-user1", "iam-ServiceId-123"}
removeMembersFromAccessGroupOptionsModel.Members = []string{"IBMId-user1", "iam-ServiceId-123", "iam-Profile-123"}
removeMembersFromAccessGroupOptionsModel.TransactionID = core.StringPtr("testString")
removeMembersFromAccessGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}
// Invoke operation with empty URL (negative test)
Expand Down Expand Up @@ -2305,7 +2305,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
// Construct an instance of the RemoveMembersFromAccessGroupOptions model
removeMembersFromAccessGroupOptionsModel := new(iamaccessgroupsv2.RemoveMembersFromAccessGroupOptions)
removeMembersFromAccessGroupOptionsModel.AccessGroupID = core.StringPtr("testString")
removeMembersFromAccessGroupOptionsModel.Members = []string{"IBMId-user1", "iam-ServiceId-123"}
removeMembersFromAccessGroupOptionsModel.Members = []string{"IBMId-user1", "iam-ServiceId-123", "iam-Profile-123"}
removeMembersFromAccessGroupOptionsModel.TransactionID = core.StringPtr("testString")
removeMembersFromAccessGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"}

Expand Down Expand Up @@ -4748,12 +4748,12 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
accessGroupID := "testString"
removeMembersFromAccessGroupOptionsModel := iamAccessGroupsService.NewRemoveMembersFromAccessGroupOptions(accessGroupID)
removeMembersFromAccessGroupOptionsModel.SetAccessGroupID("testString")
removeMembersFromAccessGroupOptionsModel.SetMembers([]string{"IBMId-user1", "iam-ServiceId-123"})
removeMembersFromAccessGroupOptionsModel.SetMembers([]string{"IBMId-user1", "iam-ServiceId-123", "iam-Profile-123"})
removeMembersFromAccessGroupOptionsModel.SetTransactionID("testString")
removeMembersFromAccessGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"})
Expect(removeMembersFromAccessGroupOptionsModel).ToNot(BeNil())
Expect(removeMembersFromAccessGroupOptionsModel.AccessGroupID).To(Equal(core.StringPtr("testString")))
Expect(removeMembersFromAccessGroupOptionsModel.Members).To(Equal([]string{"IBMId-user1", "iam-ServiceId-123"}))
Expect(removeMembersFromAccessGroupOptionsModel.Members).To(Equal([]string{"IBMId-user1", "iam-ServiceId-123", "iam-Profile-123"}))
Expect(removeMembersFromAccessGroupOptionsModel.TransactionID).To(Equal(core.StringPtr("testString")))
Expect(removeMembersFromAccessGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"}))
})
Expand Down

0 comments on commit 1b6e894

Please sign in to comment.