use of com.synopsys.integration.blackduck.api.manual.temporary.component.AssignedUserGroupRequest in project blackduck-common by blackducksoftware.
the class ProjectUsersService method addGroupToProject.
public void addGroupToProject(ProjectView projectView, String groupName) throws IntegrationException {
Optional<UserGroupView> optionalUserGroupView = userGroupService.getGroupByName(groupName);
UserGroupView userGroupView = optionalUserGroupView.orElseThrow(() -> new IntegrationException(String.format("The supplied group name (%s) does not exist.", groupName)));
HttpUrl userGroupUrl = userGroupView.getHref();
HttpUrl createUrl = projectView.getFirstLink(ProjectView.USERGROUPS_LINK);
AssignedUserGroupRequest userGroupRequest = new AssignedUserGroupRequest();
userGroupRequest.setGroup(userGroupUrl.string());
blackDuckApiClient.post(createUrl, userGroupRequest);
}
Aggregations