-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support API V2 : Get / Create / Delete Permission targets - Issue #256 #383
base: dev
Are you sure you want to change the base?
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
recheck |
Nice contribution 👍 ! Would be nice if could be added ! |
@yahavi Is it possible to have an ETA (future 2.x version linked) on this pull-request 😊 ? Or if any update should be done ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also add the new APIs to the README.
PermissionTargetV2Builder build(PermissionV2 build); | ||
PermissionTargetV2Builder releaseBundle(PermissionV2 releaseBundle); | ||
PermissionTargetV2 build(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant new-line.
if(permissionTarget == null || StringUtils.isBlank(permissionTarget.getName())){ | ||
throw new IllegalArgumentException("Permission target name is required") | ||
} | ||
if (permissionTarget.getRepo() == null || permissionTarget.getRepo().getRepositories()==null || permissionTarget.getRepo().getRepositories().isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing white-spaces before null
permissionTarget.getRepo().getRepositories()==null
if (permissionTarget.getRepo() == null || permissionTarget.getRepo().getRepositories()==null || permissionTarget.getRepo().getRepositories().isEmpty()) { | ||
throw new UnsupportedOperationException("At least 1 repository is required in permission target (could be 'ANY', 'ANY LOCAL', 'ANY REMOTE')") | ||
} | ||
if(permissionTarget.getBuild() != null && permissionTarget.getBuild().getRepositories() !=null){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing white-space after if
if(permissionTarget.getBuild()
if (permissionTarget.getRepo() == null || permissionTarget.getRepo().getRepositories()==null || permissionTarget.getRepo().getRepositories().isEmpty()) { | ||
throw new UnsupportedOperationException("At least 1 repository is required in permission target (could be 'ANY', 'ANY LOCAL', 'ANY REMOTE')") | ||
} | ||
if(permissionTarget.getBuild() != null && permissionTarget.getBuild().getRepositories() !=null){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing white-space before {
getBuild().getRepositories() !=null){
} | ||
if(permissionTarget.getBuild() != null && permissionTarget.getBuild().getRepositories() !=null){ | ||
List<String> buildRepositories = permissionTarget.getBuild().getRepositories(); | ||
if(buildRepositories.size() !=1 || !buildRepositories.contains("artifactory-build-info")){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing white-spaces in this line.
import org.jfrog.artifactory.client.model.PermissionV2; | ||
|
||
import java.util.Optional; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing new-lines according to the code conventions in a few places in this file.
|
||
public class PermissionV2BuilderImpl implements PermissionV2Builder { | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant new-line.
@@ -191,6 +191,44 @@ protected String deleteRepoIfExists(String repoName) { | |||
} | |||
} | |||
} | |||
protected void deletePermissionTargetV2IfExists(String name){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing new-line between methods.
final String GROUP_TEST_2="group_test_2_"+System.currentTimeMillis(); | ||
final String PERMISSION_TARGET_NAME="permission_target_v2_"+System.currentTimeMillis(); | ||
try{ | ||
//Eventual clean up of previous test run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing white-space after //
(The same appliues for the other comments in this file).
final String GROUP_TEST="group_test_"+System.currentTimeMillis(); | ||
final String PERMISSION_TARGET_NAME="permission_target_v2_"+System.currentTimeMillis(); | ||
try{ | ||
// remove eventual previous test run leftovers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's have all comments start with an upper-case.
Hello team !
This PR provides support for API V2 Permission target management : GET / CREATE_OR_UPDATE / DELETE
It respects code actual architecture and added features are tested.
Thanks !