
com.hevodata.mavens3wagon.HevoS3Wagon Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maven-s3-wagon Show documentation
Show all versions of maven-s3-wagon Show documentation
Hevo Wagon to read from S3 Maven repositories and write to them with private permissions.
The newest version!
package com.hevodata.mavens3wagon;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.services.s3.model.CannedAccessControlList;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import kong.unirest.GetRequest;
import kong.unirest.HttpResponse;
import kong.unirest.JsonNode;
import kong.unirest.Unirest;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.repository.Repository;
import org.kuali.maven.wagon.S3Wagon;
import org.kuali.maven.wagon.auth.AwsSessionCredentials;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Map;
public class HevoS3Wagon extends S3Wagon {
private String authUrl;
private static final Logger log = LoggerFactory.getLogger(HevoS3Wagon.class);
private final File credentialsCachePath = new File("/tmp/hevo_s3_wagon");
public void setAuthUrl(String authUrl) {
this.authUrl = authUrl;
}
public String getAuthUrl() {
return this.authUrl;
}
@Override
protected CannedAccessControlList getAclFromRepository(Repository repository) {
return CannedAccessControlList.Private;
}
@Override
protected AWSCredentials getCredentials(final AuthenticationInfo authenticationInfo) {
try {
if(!credentialsCachePath.exists()){
getAwsSessionCredentials(authenticationInfo);
}
ObjectMapper objectMapper = new ObjectMapper();
Map credentials = objectMapper.readValue(credentialsCachePath, new TypeReference
© 2015 - 2025 Weber Informatics LLC | Privacy Policy