Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   *
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   *
   *  http://aws.amazon.com/apache2.0
   *
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.s3.model;
 
 import java.util.Map;
 
Used to create a new instruction file, typically used to share an encrypted S3 object with partners via re-encrypting the CEK of the specified S3 object with a partner-specific public key.
 
 public final class PutInstructionFileRequest extends AmazonWebServiceRequest
         implements MaterialsDescriptionProviderEncryptionMaterialsFactory {
    
The S3 object id of the respective S3 object to which this instruction file is used.
 
     private final S3ObjectId s3ObjectId;
    
Material to be used in the instruction file.
 
     private final EncryptionMaterials encryptionMaterials;
    
Material description to be stored in the instruction file; applicable only if encryptionMaterials is not specified.
 
     private final Map<StringStringmatDesc;
    
Suffix to be used for the instruction file. If suffix is null, the default suffix will be used.
 
     private final String suffix;
    
An optional pre-configured access control policy to use for the new object. Ignored in favor of accessControlList, if present.
 
     private CannedAccessControlList cannedAcl;
    
An optional access control list to apply to the new object. If specified, cannedAcl will be ignored.
 
     private AccessControlList accessControlList;
    
The optional redirect location about an object
 
     private String redirectLocation;
    
The optional Amazon S3 storage class to use when storing the new object. If not specified, the default, standard storage class will be used.

For more information on Amazon S3 storage classes and available values, see the StorageClass enumeration.

 
     private String storageClass;

    

Parameters:
s3ObjectId id of the corresponding s3 object.
matDesc material description of the instruction file
suffix suffix of the instruction file to be put
 
     public PutInstructionFileRequest(S3ObjectId s3ObjectId,
             Map<StringStringmatDescString suffix) {
         if (s3ObjectId == null || s3ObjectId instanceof InstructionFileId)
             throw new IllegalArgumentException("Invalid s3 object id");
         if (suffix == null || suffix.trim().isEmpty())
             throw new IllegalArgumentException("suffix must be specified");
         this. = s3ObjectId;
         @SuppressWarnings("unchecked")
          Map<String,Stringmd = matDesc == null
              ? .
              : Collections.unmodifiableMap(new HashMap<StringString>(matDesc));
         this. = md;
         this. = suffix;
         this. = null;
     }

    

Parameters:
s3ObjectId id of the corresponding s3 object.
encryptionMaterials encryption materials to be used for the instruction file
suffix suffix of the instruction file to be put
    public PutInstructionFileRequest(S3ObjectId s3ObjectId,
            EncryptionMaterials encryptionMaterialsString suffix) {
        if (s3ObjectId == null || s3ObjectId instanceof InstructionFileId)
            throw new IllegalArgumentException("Invalid s3 object id");
        if (suffix == null || suffix.trim().isEmpty())
            throw new IllegalArgumentException("suffix must be specified");
        if (encryptionMaterials == null)
            throw new IllegalArgumentException("encryption materials must be specified");
        this. = s3ObjectId;
        this. = suffix;
        this. = encryptionMaterials;
        this. = null;
    }

    
Returns the S3 object id for which the new instruction file will be created. This is not the instruction file id.
    public S3ObjectId getS3ObjectId() {
        return ;
    }

    
Returns the material description for the new instruction file.
    @Override
    public Map<StringStringgetMaterialsDescription() {
        return  == null
             ? .getMaterialsDescription()
             : 
             ;
    }

    
Returns the encryption materials if specified; or null if not.
    @Override
        return ;
    }
    
Returns the suffix for the new instruction file.
    public String getSuffix() {
        return ;
    }

    
Gets the optional pre-configured access control policy to use for the new object.

        return ;
    }

    
Sets the optional pre-configured access control policy to use for the new object.

Parameters:
cannedAcl The optional pre-configured access control policy to use for the new object.
See also:
AbstractPutObjectRequest.getCannedAcl()
PutObjectRequest.withCannedAcl(com.amazonaws.services.s3.model.CannedAccessControlList)
    public void setCannedAcl(CannedAccessControlList cannedAcl) {
        this. = cannedAcl;
    }

    
Sets the optional pre-configured access control policy to use for the new object. Returns this PutObjectRequest, enabling additional method calls to be chained together.

Parameters:
cannedAcl The optional pre-configured access control policy to use for the new object.
Returns:
This PutObjectRequest, enabling additional method calls to be chained together.
See also:
AbstractPutObjectRequest.getCannedAcl()
AbstractPutObjectRequest.setCannedAcl(com.amazonaws.services.s3.model.CannedAccessControlList)
            CannedAccessControlList cannedAcl) {
        setCannedAcl(cannedAcl);
        return this;
    }

    
Returns the optional access control list for the new object. If specified, cannedAcl will be ignored.
        return ;
    }

    
Sets the optional access control list for the new object. If specified, cannedAcl will be ignored.

Parameters:
accessControlList The access control list for the new object.
    public void setAccessControlList(AccessControlList accessControlList) {
        this. = accessControlList;
    }

    
Sets the optional access control list for the new object. If specified, cannedAcl will be ignored. Returns this PutObjectRequest, enabling additional method calls to be chained together.

Parameters:
accessControlList The access control list for the new object.
            AccessControlList accessControlList) {
        setAccessControlList(accessControlList);
        return this;
    }

    
Gets the optional redirect location for the new object.
    public String getRedirectLocation() {
        return this.;
    }

    
Sets the optional redirect location for the new object.

Parameters:
redirectLocation The redirect location for the new object.
    public void setRedirectLocation(String redirectLocation) {
        this. = redirectLocation;
    }

    
Sets the optional redirect location for the new object.Returns this PutObjectRequest, enabling additional method calls to be chained together.

Parameters:
redirectLocation The redirect location for the new object.
            String redirectLocation) {
        this. = redirectLocation;
        return this;
    }

    
Gets the optional Amazon S3 storage class to use when storing the new object. If not specified, the default standard storage class is used when storing the object.

For more information on available Amazon S3 storage classes, see the StorageClass enumeration.

    public String getStorageClass() {
        return ;
    }

    
Sets the optional Amazon S3 storage class to use when storing the new object. If not specified, the default standard storage class will be used when storing the new object.

For more information on Amazon S3 storage classes and available values, see the StorageClass enumeration.

    public void setStorageClass(String storageClass) {
        this. = storageClass;
    }

    
Sets the optional Amazon S3 storage class to use when storing the new object. Returns this PutObjectRequest, enabling additional method calls to be chained together. If not specified, the default standard storage class will be used when storing the object.

For more information on Amazon S3 storage classes and available values, see the StorageClass enumeration.

Parameters:
storageClass The storage class to use when storing the new object.
Returns:
This PutObjectRequest, enabling additional method calls to be chained together.
See also:
getStorageClass()
setStorageClass(com.amazonaws.services.s3.model.StorageClass)
setStorageClass(java.lang.String)
withStorageClass(com.amazonaws.services.s3.model.StorageClass)
    public PutInstructionFileRequest withStorageClass(String storageClass) {
        setStorageClass(storageClass);
        return this;
    }

    
Sets the optional Amazon S3 storage class to use when storing the new object. If not specified, the default standard storage class will be used when storing the object.

For more information on Amazon S3 storage classes and available values, see the StorageClass enumeration.

Parameters:
storageClass The storage class to use when storing the new object.
See also:
getStorageClass()
setStorageClass(java.lang.String)
    public void setStorageClass(StorageClass storageClass) {
        this. = storageClass.toString();
    }

    
Sets the optional Amazon S3 storage class to use when storing the new object. Returns this PutObjectRequest, enabling additional method calls to be chained together. If not specified, the default standard storage class will be used when storing the object.

For more information on Amazon S3 storage classes and available values, see the StorageClass enumeration.

Parameters:
storageClass The storage class to use when storing the new object.
Returns:
This PutObjectRequest, enabling additional method calls to be chained together.
See also:
getStorageClass()
setStorageClass(com.amazonaws.services.s3.model.StorageClass)
setStorageClass(java.lang.String)
withStorageClass(java.lang.String)
        setStorageClass(storageClass);
        return this;
    }

    
Creates and returns a PutObjectRequest for the instruction file with the specified suffix.
    public PutObjectRequest createPutObjectRequest(S3Object s3Object) {
        if (!s3Object.getBucketName().equals(.getBucket())
        ||  !s3Object.getKey().equals(.getKey())) {
            throw new IllegalArgumentException("s3Object passed inconsistent with the instruction file being created");
        }
//        ObjectMetadata metadata = s3Object.getObjectMetadata();
        return new PutObjectRequest(ifid.getBucket(), ifid.getKey(), )
            .withCannedAcl()
//            .withFile(file)
//            .withInputStream(inputStream)
// don't want the metadata for the new instruction file
//            .withMetadata(metadata == null ? null : metadata.clone())
            .withStorageClass()
            ;
    }
New to GrepCode? Check out our FAQ X