コード例 #1
0
ファイル: EC2Cloud.java プロジェクト: ryanaslett/ec2-plugin
 /**
  * Computes the presigned URL for the given S3 resource.
  *
  * @param path String like "/bucketName/folder/folder/abc.txt" that represents the resource to
  *     request.
  */
 public URL buildPresignedURL(String path) throws AmazonClientException {
   AWSCredentials credentials = awsCredentialsProvider.getCredentials();
   long expires = System.currentTimeMillis() + 60 * 60 * 1000;
   GeneratePresignedUrlRequest request =
       new GeneratePresignedUrlRequest(path, credentials.getAWSSecretKey());
   request.setExpiration(new Date(expires));
   AmazonS3 s3 = new AmazonS3Client(credentials);
   return s3.generatePresignedUrl(request);
 }
コード例 #2
0
ファイル: Computer.java プロジェクト: recampbell/jenkins
 /**
  * Do the same as {@link #doLaunchSlaveAgent(StaplerRequest, StaplerResponse)} but outside the
  * context of serving a request.
  *
  * <p>If already connected or if this computer doesn't support proactive launching, no-op. This
  * method may return immediately while the launch operation happens asynchronously.
  *
  * @see #disconnect()
  * @param forceReconnect If true and a connect activity is already in progress, it will be
  *     cancelled and the new one will be started. If false, and a connect activity is already in
  *     progress, this method will do nothing and just return the pending connection operation.
  * @return A {@link Future} representing pending completion of the task. The 'completion' includes
  *     both a successful completion and a non-successful completion (such distinction typically
  *     doesn't make much sense because as soon as {@link Computer} is connected it can be
  *     disconnected by some other threads.)
  */
 public final Future<?> connect(boolean forceReconnect) {
   connectTime = System.currentTimeMillis();
   return _connect(forceReconnect);
 }