Class SetObjectAclRequest

java.lang.Object
com.amazonaws.AmazonWebServiceRequest
com.amazonaws.services.s3.model.SetObjectAclRequest
All Implemented Interfaces:
ReadLimitInfo, Serializable, Cloneable

public class SetObjectAclRequest extends AmazonWebServiceRequest implements Serializable
Request object containing all the options for setting a object's Access Control List (ACL).
See Also:
  • Constructor Details

    • SetObjectAclRequest

      public SetObjectAclRequest(String bucketName, String key, AccessControlList acl)
      Constructs a new SetObjectAclRequest object, ready to set the specified ACL on the specified object when this request is executed.
      Parameters:
      bucketName - The name of the bucket containing the object whose ACL is being set.
      key - The name of the object whose ACL is being set.
      acl - The custom Access Control List containing the access rules to apply to the specified bucket when this request is executed.
    • SetObjectAclRequest

      public SetObjectAclRequest(String bucketName, String key, CannedAccessControlList acl)
      Constructs a new SetObjectAclRequest object, ready to set the specified ACL on the specified object when this request is executed.
      Parameters:
      bucketName - The name of the bucket containing the object whose ACL is being set.
      key - The name of the object whose ACL is being set.
      acl - The Canned Access Control List to apply to the specified bucket when this request is executed.
    • SetObjectAclRequest

      public SetObjectAclRequest(String bucketName, String key, String versionId, AccessControlList acl)
      Constructs a new SetObjectAclRequest object, ready to set the specified ACL on the specified object when this request is executed.
      Parameters:
      bucketName - The name of the bucket containing the object whose ACL is being set.
      key - The name of the object whose ACL is being set.
      versionId - The version ID of the object version whose ACL is being set.
      acl - The custom Access Control List containing the access rules to apply to the specified bucket when this request is executed.
    • SetObjectAclRequest

      public SetObjectAclRequest(String bucketName, String key, String versionId, CannedAccessControlList acl)
      Constructs a new SetObjectAclRequest object, ready to set the specified ACL on the specified object when this request is executed.
      Parameters:
      bucketName - The name of the bucket containing the object whose ACL is being set.
      key - The name of the object whose ACL is being set.
      versionId - The version ID of the object version whose ACL is being set.
      acl - The Canned Access Control List to apply to the specified bucket when this request is executed.
  • Method Details

    • getBucketName

      public String getBucketName()
      Returns the name of the bucket containing the object whose ACL is being set.
      Returns:
      The name of the bucket containing the object whose ACL is being set.
    • getKey

      public String getKey()
      Returns the name of the object whose ACL is being set.
      Returns:
      The name of the object whose ACL is being set.
    • getVersionId

      public String getVersionId()
      Returns the version ID of the object version whose ACL is being set.
      Returns:
      The version ID of the object version whose ACL is being set.
    • getAcl

      public AccessControlList getAcl()
      Returns the custom ACL to be applied to the specified object when this request is executed. A request can use either a custom ACL or a canned ACL, but not both.
      Returns:
      The custom ACL to be applied to the specified bucket when this request is executed, or null if the request is to be executed with a canned ACL.
    • getCannedAcl

      public CannedAccessControlList getCannedAcl()
      Returns the canned ACL to be applied to the specified object when this request is executed. A request can use either a custom ACL or a canned ACL, but not both.
      Returns:
      The canned ACL to be applied to the specified bucket when this request is executed, or null if the request is to be executed with a custom ACL.
    • isRequesterPays

      public boolean isRequesterPays()
      Returns true if the user has enabled Requester Pays option when conducting this operation from Requester Pays Bucket; else false.

      If a bucket is enabled for Requester Pays, then any attempt to upload or download an object from it without Requester Pays enabled will result in a 403 error and the bucket owner will be charged for the request.

      Enabling Requester Pays disables the ability to have anonymous access to this bucket

      Returns:
      true if the user has enabled Requester Pays option for conducting this operation from Requester Pays Bucket.
    • setRequesterPays

      public void setRequesterPays(boolean isRequesterPays)
      Used for conducting this operation from a Requester Pays Bucket. If set the requester is charged for requests from the bucket.

      If a bucket is enabled for Requester Pays, then any attempt to upload or download an object from it without Requester Pays enabled will result in a 403 error and the bucket owner will be charged for the request.

      Enabling Requester Pays disables the ability to have anonymous access to this bucket.

      Parameters:
      isRequesterPays - Enable Requester Pays option for the operation.
    • withRequesterPays

      public SetObjectAclRequest withRequesterPays(boolean isRequesterPays)
      Used for conducting this operation from a Requester Pays Bucket. If set the requester is charged for requests from the bucket. It returns this updated SetObjectAclRequest object so that additional method calls can be chained together.

      If a bucket is enabled for Requester Pays, then any attempt to upload or download an object from it without Requester Pays enabled will result in a 403 error and the bucket owner will be charged for the request.

      Enabling Requester Pays disables the ability to have anonymous access to this bucket.

      Parameters:
      isRequesterPays - Enable Requester Pays option for the operation.
      Returns:
      The updated SetObjectAclRequest object.