All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.branch.cos.model.CopyPartRequest Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2010-2019 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.
 
 * According to cos feature, we modify some class,comment, field name, etc.
 */


package com.branch.cos.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.branch.cos.endpoint.EndpointBuilder;
import com.branch.cos.internal.CosServiceRequest;
import com.branch.cos.region.Region;

public class CopyPartRequest extends CosServiceRequest implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * The upload id of the multipart upload into which to copy this part.
     *
     * @see COS#initiateMultipartUpload(InitiateMultipartUploadRequest)
     */
    private String uploadId;

    /**
     * The part number to copy into.
     *
     * @see COS#uploadPart(UploadPartRequest)
     */
    private int partNumber;

    // The Srouce Appid. if not set, equal to the appid of cosclient.
    private String sourceAppid;
    // The Soure Bucket Region
    private Region sourceBucketRegion;

    /** The name of the bucket containing the object to be copied */
    private String sourceBucketName;

    /**
     * The key in the source bucket under which the object to be copied is stored
     */
    private String sourceKey;

    /**
     * Optional version Id specifying which version of the source object to copy. If not specified,
     * the most recent version of the source object will be copied.
     */
    private String sourceVersionId;
    
    /**
     * source endpoint builder to generate the source endpoint.
     */
    private EndpointBuilder sourceEndpointBuilder;

    /** The name of the bucket to contain the copy of the source object */
    private String destinationBucketName;

    /**
     * The key in the destination bucket under which the source object will be copied
     */
    private String destinationKey;

    /**
     * The optional customer-provided server-side encryption key to use to decrypt the source object
     * being copied.
     */
    private SSECustomerKey sourceSSECustomerKey;

    /**
     * The optional customer-provided server-side encryption key to use to encrypt the destination
     * object being copied.
     */
    private SSECustomerKey destinationSSECustomerKey;


    /**
     * Optional list of ETag values that constrain the copy request to only be executed if the
     * source object's ETag matches one of the specified ETag values.
     */
    private final List matchingETagConstraints = new ArrayList();

    /**
     * Optional list of ETag values that constrain the copy request to only be executed if the
     * source object's ETag does not match any of the specified ETag constraint values.
     */
    private final List nonmatchingEtagConstraints = new ArrayList();

    /**
     * Optional field that constrains the copy request to only be executed if the source object has
     * not been modified since the specified date.
     */
    private Date unmodifiedSinceConstraint;

    /**
     * Optional field that constrains the copy request to only be executed if the source object has
     * been modified since the specified date.
     */
    private Date modifiedSinceConstraint;

    /**
     * Optional field that copies the object starting at the given zero-based byte offset. Used with
     * {@link CopyPartRequest#lastByte}
     */
    private Long firstByte;

    /**
     * Optional field that copies the object up to and including the given zero-based byte offset.
     * Used with {@link CopyPartRequest#firstByte}.
     */
    private Long lastByte;

    /**
     * Returns the ID of the existing, initiated multipart upload with which this new part will be
     * associated.
     *
     * @return the ID of the existing, initiated multipart upload with which this new part will be
     *         associated.
     */
    public String getUploadId() {
        return uploadId;
    }

    /**
     * Sets the ID of the existing, initiated multipart upload with which this new part will be
     * associated.
     *
     * @param uploadId the ID of the existing, initiated multipart upload with which this new part
     *        will be associated.
     */
    public void setUploadId(String uploadId) {
        this.uploadId = uploadId;
    }

    /**
     * Sets the ID of the existing, initiated multipart upload with which this new part will be
     * associated.
     *
     * @param uploadId the ID of the existing, initiated multipart upload with which this new part
     *        will be associated.
     * @return This CopyPartRequest, enabling additional method calls to be chained
     *         together.
     */
    public CopyPartRequest withUploadId(String uploadId) {
        this.uploadId = uploadId;
        return this;
    }

    /**
     * Returns the part number describing this part's position relative to the other parts in the
     * multipart upload. Part number must be between 1 and 10,000 (inclusive).
     *
     * @return the part number describing this part's position relative to the other parts in the
     *         multipart upload. Part number must be between 1 and 10,000 (inclusive).
     */
    public int getPartNumber() {
        return partNumber;
    }

    /**
     * Sets the part number describing this part's position relative to the other parts in the
     * multipart upload. Part number must be between 1 and 10,000 (inclusive).
     *
     * @param partNumber the part number describing this part's position relative to the other parts
     *        in the multipart upload. Part number must be between 1 and 10,000 (inclusive).
     */
    public void setPartNumber(int partNumber) {
        this.partNumber = partNumber;
    }

    /**
     * Sets the part number describing this part's position relative to the other parts in the
     * multipart upload. Part number must be between 1 and 10,000 (inclusive).
     *
     * @param partNumber the part number describing this part's position relative to the other parts
     *        in the multipart upload. Part number must be between 1 and 10,000 (inclusive).
     * @return This CopyPartRequest, enabling additional method calls to be chained
     *         together.
     */
    public CopyPartRequest withPartNumber(int partNumber) {
        this.partNumber = partNumber;
        return this;
    }

    public String getSourceAppid() {
        return sourceAppid;
    }

    public void setSourceAppid(String sourceAppid) {
        this.sourceAppid = sourceAppid;
    }

    public CopyPartRequest withSourceAppid(String sourceAppid) {
        this.sourceAppid = sourceAppid;
        return this;
    }

    public Region getSourceBucketRegion() {
        return sourceBucketRegion;
    }

    public void setSourceBucketRegion(Region sourceBucketRegion) {
        this.sourceBucketRegion = sourceBucketRegion;
    }

    public CopyPartRequest withSourceBucketRegion(Region sourceBucketRegion) {
        this.sourceBucketRegion = sourceBucketRegion;
        return this;
    }

    /**
     * Gets the name of the bucket containing the source object to be copied.
     *
     * @return The name of the bucket containing the source object to be copied.
     * @see CopyPartRequest#setSourceBucketName(String sourceBucketName)
     */
    public String getSourceBucketName() {
        return sourceBucketName;
    }

    /**
     * Sets the name of the bucket containing the source object to be copied.
     *
     * @param sourceBucketName The name of the bucket containing the source object to be copied.
     * @see CopyPartRequest#getSourceBucketName()
     */
    public void setSourceBucketName(String sourceBucketName) {
        this.sourceBucketName = sourceBucketName;
    }

    /**
     * Sets the name of the bucket containing the source object to be copied.
     *
     * @param sourceBucketName The name of the bucket containing the source object to be copied.
     * @see CopyPartRequest#getSourceBucketName()
     * @return This CopyPartRequest, enabling additional method calls to be chained
     *         together.
     */
    public CopyPartRequest withSourceBucketName(String sourceBucketName) {
        this.sourceBucketName = sourceBucketName;
        return this;
    }

    /**
     * Gets the source bucket key under which the source object to be copied is stored.
     *
     * @return The source bucket key under which the source object to be copied is stored.
     * @see CopyPartRequest#setSourceKey(String sourceKey)
     */
    public String getSourceKey() {
        return sourceKey;
    }

    /**
     * Sets the source bucket key under which the source object to be copied is stored.
     *
     * @param sourceKey The source bucket key under which the source object to be copied is stored.
     * @see CopyPartRequest#setSourceKey(String sourceKey)
     */
    public void setSourceKey(String sourceKey) {
        this.sourceKey = sourceKey;
    }

    /**
     * Sets the source bucket key under which the source object to be copied is stored.
     *
     * @param sourceKey The source bucket key under which the source object to be copied is stored.
     * @see CopyPartRequest#setSourceKey(String sourceKey)
     * @return This CopyPartRequest, enabling additional method calls to be chained
     *         together.
     */
    public CopyPartRequest withSourceKey(String sourceKey) {
        this.sourceKey = sourceKey;
        return this;
    }

    /**
     * 

* Gets the version ID specifying which version of the source object to copy. If not specified, * the most recent version of the source object will be copied. *

*

* Objects created before enabling versioning or when versioning is suspended are given the * default null version ID (see {@link Constants#NULL_VERSION_ID}). Note that the * null version ID is a valid version ID and is not the same as not having a * version ID. *

*

* For more information about enabling versioning for a bucket, see * {@link COS#setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest)} . *

* * @return The version ID specifying which version of the source object to copy. * @see Constants#NULL_VERSION_ID * @see CopyPartRequest#setSourceVersionId(String sourceVersionId) */ public String getSourceVersionId() { return sourceVersionId; } /** *

* Sets the optional version ID specifying which version of the source object to copy. If not * specified, the most recent version of the source object will be copied. *

*

* Objects created before enabling versioning or when versioning is suspended are given the * default null version ID (see {@link Constants#NULL_VERSION_ID}). Note that the * null version ID is a valid version ID and is not the same as not having a * version ID. *

*

* For more information about enabling versioning for a bucket, see * {@link COS#setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest)} . *

* * @param sourceVersionId The optional version ID specifying which version of the source object * to copy. */ public void setSourceVersionId(String sourceVersionId) { this.sourceVersionId = sourceVersionId; } /** *

* Sets the optional version ID specifying which version of the source object to copy. If not * specified, the most recent version of the source object will be copied. *

*

* Objects created before enabling versioning or when versioning is suspended are given the * default null version ID (see {@link Constants#NULL_VERSION_ID}). Note that the * null version ID is a valid version ID and is not the same as not having a * version ID. *

*

* For more information about enabling versioning for a bucket, see * {@link COS#setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest)} . *

* * @param sourceVersionId The optional version ID specifying which version of the source object * to copy. * @return This CopyPartRequest, enabling additional method calls to be chained * together. */ public CopyPartRequest withSourceVersionId(String sourceVersionId) { this.sourceVersionId = sourceVersionId; return this; } /** * Gets the destination bucket name which will contain the new, copied object. * * @return The name of the destination bucket which will contain the new, copied object. * * @see CopyPartRequest#setDestinationBucketName(String destinationBucketName) */ public String getDestinationBucketName() { return destinationBucketName; } /** * Sets the destination bucket name which will contain the new, copied object. * * @param destinationBucketName The name of the destination bucket which will contain the new, * copied object. * * @see CopyPartRequest#getDestinationBucketName() */ public void setDestinationBucketName(String destinationBucketName) { this.destinationBucketName = destinationBucketName; } /** * Sets the name of the destination bucket which will contain the new, copied object and returns * this object, enabling additional method calls to be chained together. * * @param destinationBucketName The name of the destination bucket which will contain the new, * copied object. * * @return This CopyPartRequest, enabling additional method calls to be chained * together. */ public CopyPartRequest withDestinationBucketName(String destinationBucketName) { setDestinationBucketName(destinationBucketName); return this; } /** * Gets the destination bucket key under which the new, copied object will be stored. * * @return The destination bucket key under which the new, copied object will be stored. * * @see CopyPartRequest#setDestinationKey(String destinationKey) */ public String getDestinationKey() { return destinationKey; } /** * Sets the destination bucket key under which the new, copied object will be stored. * * @param destinationKey The destination bucket key under which the new, copied object will be * stored. * * @see CopyPartRequest#getDestinationKey() */ public void setDestinationKey(String destinationKey) { this.destinationKey = destinationKey; } /** * Sets the destination bucket key under which the new, copied object will be stored and returns * this object, enabling additional method calls can be chained together. * * @param destinationKey The destination bucket key under which the new, copied object will be * stored. * * @return This CopyPartRequest, enabling additional method calls to be chained * together. */ public CopyPartRequest withDestinationKey(String destinationKey) { setDestinationKey(destinationKey); return this; } public SSECustomerKey getSourceSSECustomerKey() { return sourceSSECustomerKey; } public void setSourceSSECustomerKey(SSECustomerKey sourceSSECustomerKey) { this.sourceSSECustomerKey = sourceSSECustomerKey; } public SSECustomerKey getDestinationSSECustomerKey() { return destinationSSECustomerKey; } public void setDestinationSSECustomerKey(SSECustomerKey destinationSSECustomerKey) { this.destinationSSECustomerKey = destinationSSECustomerKey; } /** * Returns the optional start range to copy from the source object. * * @return the optional start range to copy from the source object. */ public Long getFirstByte() { return firstByte; } /** * Sets the optional zero-based byte offset to begin copying the source object. * * @param firstByte the optional zero-based byte offset to begin copying the source object. */ public void setFirstByte(Long firstByte) { this.firstByte = firstByte; } /** * Sets the optional zero-based byte offset to begin copying the source object. * * @param firstByte the optional zero-based byte offset to begin copying the source object. * @return This CopyPartRequest, enabling additional method calls to be chained * together. */ public CopyPartRequest withFirstByte(Long firstByte) { this.firstByte = firstByte; return this; } /** * Returns the optional zero-based byte offset to stop copying the source. * * @return the optional zero-based byte offset to stop copying the source. */ public Long getLastByte() { return lastByte; } /** * Sets the optional zero-based byte offset to stop copying the source. */ public void setLastByte(Long lastByte) { this.lastByte = lastByte; } /** * Sets the optional zero-based byte offset to stop copying the source. * * @return This CopyPartRequest, enabling additional method calls to be chained * together. */ public CopyPartRequest withLastByte(Long lastByte) { this.lastByte = lastByte; return this; } /** *

* Gets the optional list of ETag constraints that, when present, must include a match * for the source object's current ETag in order for the copy object request to be executed. * Only one ETag in the list needs to match for the request to be executed by COS. *

*

* Matching ETag constraints may be used with the unmodified since constraint, but not with any * other type of constraint. *

* * @return The optional list of ETag constraints that when present must include a match for the * source object's current ETag in order for this request to be executed. */ public List getMatchingETagConstraints() { return matchingETagConstraints; } /** *

* Sets the optional list of ETag constraints that, when present, must include a match * for the source object's current ETag in order for the copy object request to be executed. If * none of the specified ETags match the source object's current ETag, the copy object operation * will be aborted. Only one ETag in the list needs to match for the request to be executed by * COS. *

*

* Matching ETag constraints may be used with the unmodified since constraint, but not with any * other type of constraint. *

* * @param eTagList The optional list of ETag constraints that must include a match for the * source object's current ETag in order for this request to be executed. */ public void setMatchingETagConstraints(List eTagList) { this.matchingETagConstraints.clear(); this.matchingETagConstraints.addAll(eTagList); } /** * Fluent API for {@link #setMatchingETagConstraints(List)}. */ public CopyPartRequest withMatchingETagConstraints(List eTagList) { setMatchingETagConstraints(eTagList); return this; } /** *

* Adds a single ETag constraint to this request and returns this object, enabling additional * method calls to be chained together. Multiple ETag constraints can be added to a request, but * one must match the source object's current ETag in order for the copy object request to be * executed. If none of the ETag constraints added to this request match the source object's * current ETag, the copy object operation will be aborted. *

*

* Matching ETag constraints may be used with the unmodified since constraint, but not with any * other type of constraint. *

* * @param eTag The matching ETag constraint to add to this request. * @return This CopyPartRequest, enabling additional method calls to be chained * together. */ public CopyPartRequest withMatchingETagConstraint(String eTag) { this.matchingETagConstraints.add(eTag); return this; } /** *

* Gets the optional list of ETag constraints that, when present, must not include a * match for the source object's current ETag in order for the copy object request to be * executed. If any entry in the non-matching ETag constraint list matches the source object's * current ETag, this copy request will not be executed by COS. *

*

* Non-matching ETag constraints may be used with the modified since constraint, but not with * any other type of constraint. *

* * @return The optional list of ETag constraints that when present must not include a * match for the source object's current ETag in order for this request to be executed. */ public List getNonmatchingETagConstraints() { return nonmatchingEtagConstraints; } /** *

* Sets the optional list of ETag constraints that, when present, must not include a * match for the source object's current ETag in order for the copy object request to be * executed. If any entry in the non-matching ETag constraint list matches the source object's * current ETag, this copy request will not be executed by COS. *

*

* Non-matching ETag constraints may be used with the modified since constraint, but not with * any other type of constraint. *

* * @param eTagList The list of ETag constraints that, when present, must not include a * match for the source object's current ETag in order for this request to be executed. */ public void setNonmatchingETagConstraints(List eTagList) { this.nonmatchingEtagConstraints.clear(); this.nonmatchingEtagConstraints.addAll(eTagList); } /** * Fluent API for {@link #setNonmatchingETagConstraints(List)}. */ public CopyPartRequest withNonmatchingETagConstraints(List eTagList) { setNonmatchingETagConstraints(eTagList); return this; } /** *

* Adds a single ETag constraint to this request and returns this object, enabling additional * method calls to be chained together. Multiple ETag constraints can be added to a request, but * all ETag constraints must not match the source object's current ETag in order for the * copy object request to be executed. If any entry in the non-matching ETag constraint list * matches the source object's current ETag, this copy request will not be executed by * COS. *

*

* Non-matching ETag constraints may be used with the modified since constraint, but not with * any other type of constraint. *

* * @param eTag The non-matching ETag constraint to add to this request. * @return This CopyPartRequest, enabling additional method calls to be chained * together. */ public CopyPartRequest withNonmatchingETagConstraint(String eTag) { this.nonmatchingEtagConstraints.add(eTag); return this; } /** *

* Gets the optional unmodified constraint that restricts this request to executing only if the * source object has not been modified after the specified date. *

*

* The unmodified since constraint may be used with matching ETag constraints, but not with any * other type of constraint. *

* * @return The optional unmodified constraint that restricts this request to executing only if * the source object has not been modified after the specified date. */ public Date getUnmodifiedSinceConstraint() { return unmodifiedSinceConstraint; } /** *

* Sets the optional unmodified constraint that restricts this request to executing only if the * source object has not been modified after the specified date. *

*

* The unmodified constraint may be used with matching ETag constraints, but not with any other * type of constraint. *

*

* Note that COS will ignore any dates occurring in the future. *

* * @param date The unmodified constraint that restricts this request to executing only if the * source object has not been modified after this date. */ public void setUnmodifiedSinceConstraint(Date date) { this.unmodifiedSinceConstraint = date; } /** *

* Sets the optional unmodified constraint that restricts this request to executing only if the * source object has not been modified after the specified date. Returns this object, * enabling additional method calls to be chained together. *

*

* The unmodified constraint may be used with matching ETag constraints, but not with any other * type of constraint. *

*

* Note that COS will ignore any dates occurring in the future. *

* * @param date The unmodified constraint that restricts this request to executing only if the * source object has not been modified after this date. * @return This CopyPartRequest, enabling additional method calls to be chained * together. */ public CopyPartRequest withUnmodifiedSinceConstraint(Date date) { setUnmodifiedSinceConstraint(date); return this; } /** *

* Gets the optional modified constraint that restricts this request to executing only if the * source object has been modified after the specified date. *

*

* The modified constraint may be used with non-matching ETag constraints, but not with any * other type of constraint. *

* * @return The optional modified constraint that restricts this request to executing only if the * source object has been modified after the specified date. */ public Date getModifiedSinceConstraint() { return modifiedSinceConstraint; } /** *

* Sets the optional modified constraint that restricts this request to executing only if the * source object has been modified after the specified date. *

*

* The modified constraint may be used with non-matching ETag constraints, but not with any * other type of constraint. *

*

* Note that COS will ignore any dates occurring in the future. *

* * @param date The modified constraint that restricts this request to executing only if the * source object has been modified after the specified date. */ public void setModifiedSinceConstraint(Date date) { this.modifiedSinceConstraint = date; } /** *

* Sets the optional modified constraint that restricts this request to executing only if the * source object has been modified after the specified date. Returns this object, * enabling additional method calls to be chained together. *

*

* The modified constraint may be used with non-matching ETag constraints, but not with any * other type of constraint. *

*

* Note that COS will ignore any dates occurring in the future. *

* * @param date The modified constraint that restricts this request to executing only if the * source object has been modified after the specified date. * @return This CopyPartRequest, enabling additional method calls to be chained * together. */ public CopyPartRequest withModifiedSinceConstraint(Date date) { setModifiedSinceConstraint(date); return this; } public EndpointBuilder getSourceEndpointBuilder() { return sourceEndpointBuilder; } public void setSourceEndpointBuilder(EndpointBuilder sourceEndpointBuilder) { this.sourceEndpointBuilder = sourceEndpointBuilder; } public CopyPartRequest withSourceEndpointBuilder(EndpointBuilder sourceEndpointBuilder) { setSourceEndpointBuilder(sourceEndpointBuilder); return this; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy