当前位置: 首页>>代码示例>>Java>>正文


Java RestoreObjectRequest类代码示例

本文整理汇总了Java中com.amazonaws.services.s3.model.RestoreObjectRequest的典型用法代码示例。如果您正苦于以下问题:Java RestoreObjectRequest类的具体用法?Java RestoreObjectRequest怎么用?Java RestoreObjectRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RestoreObjectRequest类属于com.amazonaws.services.s3.model包,在下文中一共展示了RestoreObjectRequest类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertToXmlByteArray

import com.amazonaws.services.s3.model.RestoreObjectRequest; //导入依赖的package包/类
/**
 * Converts the RestoreObjectRequest to an XML fragment that can be sent to
 * the RestoreObject operation of Amazon S3.
 *
 * @param restoreObjectRequest
 *            The container which provides options for restoring an object,
 *            which was transitioned to the Glacier from S3 when it was
 *            expired, into S3 again.
 *
 * @return A byte array containing the data
 *
 * @throws SdkClientException
 */
public static byte[] convertToXmlByteArray(RestoreObjectRequest restoreObjectRequest) throws SdkClientException {
    XmlWriter xml = new XmlWriter();

    xml.start("RestoreRequest");
    xml.start("Days").value(Integer.toString(restoreObjectRequest.getExpirationInDays())).end();
    final GlacierJobParameters glacierJobParameters = restoreObjectRequest.getGlacierJobParameters();
    if (glacierJobParameters != null) {
        xml.start("GlacierJobParameters");
        addIfNotNull(xml, "Tier", glacierJobParameters.getTier());
        xml.end();
    }
    xml.end();

    return xml.getBytes();
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:29,代码来源:RequestXmlFactory.java

示例2: restoreObject

import com.amazonaws.services.s3.model.RestoreObjectRequest; //导入依赖的package包/类
@Override
public void restoreObject(RestoreObjectRequest copyGlacierObjectRequest) throws AmazonServiceException {
    delegate.restoreObject(copyGlacierObjectRequest);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AmazonS3Wrapper.java

示例3: restoreObject

import com.amazonaws.services.s3.model.RestoreObjectRequest; //导入依赖的package包/类
@Override
public void restoreObject(RestoreObjectRequest request) throws AmazonServiceException {
  run(() -> getDelegate().restoreObject(request));
}
 
开发者ID:HubSpot,项目名称:S3Decorators,代码行数:5,代码来源:S3Decorator.java

示例4: restoreObject

import com.amazonaws.services.s3.model.RestoreObjectRequest; //导入依赖的package包/类
@Override
public void restoreObject(RestoreObjectRequest requestRestore, AmazonS3 s3Client)
{
    s3Client.restoreObject(requestRestore);
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:6,代码来源:S3OperationsImpl.java

示例5: restoreObjects

import com.amazonaws.services.s3.model.RestoreObjectRequest; //导入依赖的package包/类
@Override
public void restoreObjects(final S3FileTransferRequestParamsDto params, int expirationInDays)
{
    LOGGER.info("Restoring a list of objects in S3... s3KeyPrefix=\"{}\" s3BucketName=\"{}\" s3KeyCount={}", params.getS3KeyPrefix(),
        params.getS3BucketName(), params.getFiles().size());

    if (!CollectionUtils.isEmpty(params.getFiles()))
    {
        // Initialize a key value pair for the error message in the catch block.
        String key = params.getFiles().get(0).getPath().replaceAll("\\\\", "/");

        try
        {
            // Create an S3 client.
            AmazonS3Client s3Client = getAmazonS3(params);

            // Create a restore object request.
            RestoreObjectRequest requestRestore = new RestoreObjectRequest(params.getS3BucketName(), null, expirationInDays);
            // Make Bulk as default glacier retrieval option
            requestRestore.setGlacierJobParameters(new GlacierJobParameters().withTier(GLACIER_RETRIEVAL_OPTION));

            try
            {
                for (File file : params.getFiles())
                {
                    key = file.getPath().replaceAll("\\\\", "/");
                    ObjectMetadata objectMetadata = s3Operations.getObjectMetadata(params.getS3BucketName(), key, s3Client);

                    // Request a restore for objects that are not already being restored.
                    if (BooleanUtils.isNotTrue(objectMetadata.getOngoingRestore()))
                    {
                        requestRestore.setKey(key);
                        s3Operations.restoreObject(requestRestore, s3Client);
                    }
                }
            }
            finally
            {
                s3Client.shutdown();
            }
        }
        catch (Exception e)
        {
            throw new IllegalStateException(String
                .format("Failed to initiate a restore request for \"%s\" key in \"%s\" bucket. Reason: %s", key, params.getS3BucketName(), e.getMessage()),
                e);
        }
    }
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:50,代码来源:S3DaoImpl.java

示例6: restoreObject

import com.amazonaws.services.s3.model.RestoreObjectRequest; //导入依赖的package包/类
@Override
public void restoreObject(RestoreObjectRequest request)
        throws AmazonServiceException
{
}
 
开发者ID:y-lan,项目名称:presto,代码行数:6,代码来源:MockAmazonS3.java

示例7: run

import com.amazonaws.services.s3.model.RestoreObjectRequest; //导入依赖的package包/类
public void run() {
    String message = null;
    AWSCredentials credentials = new BasicAWSCredentials(access_key, secret_key);
    File file = new File(what);
    AmazonS3 s3Client = new AmazonS3Client(credentials,
            new ClientConfiguration());
    if (endpoint.contains("amazonaws.com")) {
        String aws_endpoint = s3Client.getBucketLocation(new GetBucketLocationRequest(bucket));
        if (aws_endpoint.contains("US")) {
            s3Client.setEndpoint("https://s3.amazonaws.com");
        } else if (aws_endpoint.contains("us-west")) {
            s3Client.setEndpoint("https://s3-" + aws_endpoint + ".amazonaws.com");
        } else if (aws_endpoint.contains("eu-west")) {
            s3Client.setEndpoint("https://s3-" + aws_endpoint + ".amazonaws.com");
        } else if (aws_endpoint.contains("ap-")) {
            s3Client.setEndpoint("https://s3-" + aws_endpoint + ".amazonaws.com");
        } else if (aws_endpoint.contains("sa-east-1")) {
            s3Client.setEndpoint("https://s3-" + aws_endpoint + ".amazonaws.com");
        } else {
            s3Client.setEndpoint("https://s3." + aws_endpoint + ".amazonaws.com");
        }
    } else {
        s3Client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build());
        s3Client.setEndpoint(endpoint);
    }

    try {
        RestoreObjectRequest requestRestore = new RestoreObjectRequest(bucket, what, 2);
        s3Client.restoreObject(requestRestore);

        GetObjectMetadataRequest requestCheck = new GetObjectMetadataRequest(bucket, what);
        ObjectMetadata response = s3Client.getObjectMetadata(requestCheck);

        Boolean restoreFlag = response.getOngoingRestore();
        mainFrame.jTextArea1.append("\nRestoration in progress. Please try to access the file again in a few hours.");
        calibrate();
    } catch (AmazonS3Exception amazonS3Exception) {
        mainFrame.jTextArea1.append("\nAn Amazon S3 error occurred. Exception: %s" + amazonS3Exception.toString());
        calibrate();
    } catch (Exception ex) {
        mainFrame.jTextArea1.append("\nException: %s" + ex.toString());
        calibrate();
    }

    calibrate();
}
 
开发者ID:rusher81572,项目名称:cloudExplorer,代码行数:47,代码来源:RestoreObject.java

示例8: restoreObject

import com.amazonaws.services.s3.model.RestoreObjectRequest; //导入依赖的package包/类
@Override
public void restoreObject(RestoreObjectRequest request) throws AmazonServiceException {
  // TODO Auto-generated method stub

}
 
开发者ID:DemandCube,项目名称:Scribengin,代码行数:6,代码来源:AmazonS3Mock.java

示例9: restoreObject

import com.amazonaws.services.s3.model.RestoreObjectRequest; //导入依赖的package包/类
/**
 * Requests to restore an object, which was transitioned to Amazon Glacier from Amazon S3 when it was expired, into Amazon S3 again.
 *
 * @param requestRestore the request object containing all the options for restoring an object
 * @param s3Client the {@link AmazonS3} implementation to use
 */
public void restoreObject(RestoreObjectRequest requestRestore, AmazonS3 s3Client);
 
开发者ID:FINRAOS,项目名称:herd,代码行数:8,代码来源:S3Operations.java


注:本文中的com.amazonaws.services.s3.model.RestoreObjectRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。