/* * Copyright 2018-2023 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.ebs.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; import com.amazonaws.auth.SignerTypeAware; /** * * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class PutSnapshotBlockRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable, SignerTypeAware { /** *

* The ID of the snapshot. *

* *

* If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the * snapshot. For more information, see Using encryption in * the Amazon Elastic Compute Cloud User Guide.. *

*
*/ private String snapshotId; /** *

* The block index of the block in which to write the data. A block index is a logical index in units of * 512 KiB blocks. To identify the block index, divide the logical offset of the data in the logical * volume by the block size (logical offset of data/524288). The logical offset of the data must be * 512 KiB aligned. *

*/ private Integer blockIndex; /** *

* The data to write to the block. *

*

* The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate * and provide a Base64-encoded SHA256 checksum for the block data using the x-amz-Checksum header. Also, you * must specify the checksum algorithm using the x-amz-Checksum-Algorithm header. The checksum that you * provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by * Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request * fails. For more information, see * Using checksums with the EBS direct APIs in the Amazon Elastic Compute Cloud User Guide. *

*/ private java.io.InputStream blockData; /** *

* The size of the data to write to the block, in bytes. Currently, the only supported size is 524288 * bytes. *

*

* Valid values: 524288 *

*/ private Integer dataLength; /** *

* The progress of the write process, as a percentage. *

*/ private Integer progress; /** *

* A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported. *

*/ private String checksum; /** *

* The algorithm used to generate the checksum. Currently, the only supported algorithm is SHA256. *

*/ private String checksumAlgorithm; /** *

* The ID of the snapshot. *

* *

* If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the * snapshot. For more information, see Using encryption in * the Amazon Elastic Compute Cloud User Guide.. *

*
* * @param snapshotId * The ID of the snapshot.

*

* If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to * encrypt the snapshot. For more information, see Using * encryption in the Amazon Elastic Compute Cloud User Guide.. *

*/ public void setSnapshotId(String snapshotId) { this.snapshotId = snapshotId; } /** *

* The ID of the snapshot. *

* *

* If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the * snapshot. For more information, see Using encryption in * the Amazon Elastic Compute Cloud User Guide.. *

*
* * @return The ID of the snapshot.

*

* If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to * encrypt the snapshot. For more information, see Using * encryption in the Amazon Elastic Compute Cloud User Guide.. *

*/ public String getSnapshotId() { return this.snapshotId; } /** *

* The ID of the snapshot. *

* *

* If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to encrypt the * snapshot. For more information, see Using encryption in * the Amazon Elastic Compute Cloud User Guide.. *

*
* * @param snapshotId * The ID of the snapshot.

*

* If the specified snapshot is encrypted, you must have permission to use the KMS key that was used to * encrypt the snapshot. For more information, see Using * encryption in the Amazon Elastic Compute Cloud User Guide.. *

* @return Returns a reference to this object so that method calls can be chained together. */ public PutSnapshotBlockRequest withSnapshotId(String snapshotId) { setSnapshotId(snapshotId); return this; } /** *

* The block index of the block in which to write the data. A block index is a logical index in units of * 512 KiB blocks. To identify the block index, divide the logical offset of the data in the logical * volume by the block size (logical offset of data/524288). The logical offset of the data must be * 512 KiB aligned. *

* * @param blockIndex * The block index of the block in which to write the data. A block index is a logical index in units of * 512 KiB blocks. To identify the block index, divide the logical offset of the data in the * logical volume by the block size (logical offset of data/524288). The logical offset of the * data must be 512 KiB aligned. */ public void setBlockIndex(Integer blockIndex) { this.blockIndex = blockIndex; } /** *

* The block index of the block in which to write the data. A block index is a logical index in units of * 512 KiB blocks. To identify the block index, divide the logical offset of the data in the logical * volume by the block size (logical offset of data/524288). The logical offset of the data must be * 512 KiB aligned. *

* * @return The block index of the block in which to write the data. A block index is a logical index in units of * 512 KiB blocks. To identify the block index, divide the logical offset of the data in the * logical volume by the block size (logical offset of data/524288). The logical offset of the * data must be 512 KiB aligned. */ public Integer getBlockIndex() { return this.blockIndex; } /** *

* The block index of the block in which to write the data. A block index is a logical index in units of * 512 KiB blocks. To identify the block index, divide the logical offset of the data in the logical * volume by the block size (logical offset of data/524288). The logical offset of the data must be * 512 KiB aligned. *

* * @param blockIndex * The block index of the block in which to write the data. A block index is a logical index in units of * 512 KiB blocks. To identify the block index, divide the logical offset of the data in the * logical volume by the block size (logical offset of data/524288). The logical offset of the * data must be 512 KiB aligned. * @return Returns a reference to this object so that method calls can be chained together. */ public PutSnapshotBlockRequest withBlockIndex(Integer blockIndex) { setBlockIndex(blockIndex); return this; } /** *

* The data to write to the block. *

*

* The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate * and provide a Base64-encoded SHA256 checksum for the block data using the x-amz-Checksum header. Also, you * must specify the checksum algorithm using the x-amz-Checksum-Algorithm header. The checksum that you * provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by * Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request * fails. For more information, see * Using checksums with the EBS direct APIs in the Amazon Elastic Compute Cloud User Guide. *

* * @param blockData * The data to write to the block.

*

* The block data is not signed as part of the Signature Version 4 signing process. As a result, you must * generate and provide a Base64-encoded SHA256 checksum for the block data using the x-amz-Checksum * header. Also, you must specify the checksum algorithm using the x-amz-Checksum-Algorithm header. * The checksum that you provide is part of the Signature Version 4 signing process. It is validated against * a checksum generated by Amazon EBS to ensure the validity and authenticity of the data. If the checksums * do not correspond, the request fails. For more information, see * Using checksums with the EBS direct APIs in the Amazon Elastic Compute Cloud User Guide. */ public void setBlockData(java.io.InputStream blockData) { this.blockData = blockData; } /** *

* The data to write to the block. *

*

* The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate * and provide a Base64-encoded SHA256 checksum for the block data using the x-amz-Checksum header. Also, you * must specify the checksum algorithm using the x-amz-Checksum-Algorithm header. The checksum that you * provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by * Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request * fails. For more information, see * Using checksums with the EBS direct APIs in the Amazon Elastic Compute Cloud User Guide. *

* * @return The data to write to the block.

*

* The block data is not signed as part of the Signature Version 4 signing process. As a result, you must * generate and provide a Base64-encoded SHA256 checksum for the block data using the x-amz-Checksum * header. Also, you must specify the checksum algorithm using the x-amz-Checksum-Algorithm header. * The checksum that you provide is part of the Signature Version 4 signing process. It is validated against * a checksum generated by Amazon EBS to ensure the validity and authenticity of the data. If the checksums * do not correspond, the request fails. For more information, see Using checksums with the EBS direct APIs in the Amazon Elastic Compute Cloud User Guide. */ public java.io.InputStream getBlockData() { return this.blockData; } /** *

* The data to write to the block. *

*

* The block data is not signed as part of the Signature Version 4 signing process. As a result, you must generate * and provide a Base64-encoded SHA256 checksum for the block data using the x-amz-Checksum header. Also, you * must specify the checksum algorithm using the x-amz-Checksum-Algorithm header. The checksum that you * provide is part of the Signature Version 4 signing process. It is validated against a checksum generated by * Amazon EBS to ensure the validity and authenticity of the data. If the checksums do not correspond, the request * fails. For more information, see * Using checksums with the EBS direct APIs in the Amazon Elastic Compute Cloud User Guide. *

* * @param blockData * The data to write to the block.

*

* The block data is not signed as part of the Signature Version 4 signing process. As a result, you must * generate and provide a Base64-encoded SHA256 checksum for the block data using the x-amz-Checksum * header. Also, you must specify the checksum algorithm using the x-amz-Checksum-Algorithm header. * The checksum that you provide is part of the Signature Version 4 signing process. It is validated against * a checksum generated by Amazon EBS to ensure the validity and authenticity of the data. If the checksums * do not correspond, the request fails. For more information, see * Using checksums with the EBS direct APIs in the Amazon Elastic Compute Cloud User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ public PutSnapshotBlockRequest withBlockData(java.io.InputStream blockData) { setBlockData(blockData); return this; } /** *

* The size of the data to write to the block, in bytes. Currently, the only supported size is 524288 * bytes. *

*

* Valid values: 524288 *

* * @param dataLength * The size of the data to write to the block, in bytes. Currently, the only supported size is * 524288 bytes.

*

* Valid values: 524288 */ public void setDataLength(Integer dataLength) { this.dataLength = dataLength; } /** *

* The size of the data to write to the block, in bytes. Currently, the only supported size is 524288 * bytes. *

*

* Valid values: 524288 *

* * @return The size of the data to write to the block, in bytes. Currently, the only supported size is * 524288 bytes.

*

* Valid values: 524288 */ public Integer getDataLength() { return this.dataLength; } /** *

* The size of the data to write to the block, in bytes. Currently, the only supported size is 524288 * bytes. *

*

* Valid values: 524288 *

* * @param dataLength * The size of the data to write to the block, in bytes. Currently, the only supported size is * 524288 bytes.

*

* Valid values: 524288 * @return Returns a reference to this object so that method calls can be chained together. */ public PutSnapshotBlockRequest withDataLength(Integer dataLength) { setDataLength(dataLength); return this; } /** *

* The progress of the write process, as a percentage. *

* * @param progress * The progress of the write process, as a percentage. */ public void setProgress(Integer progress) { this.progress = progress; } /** *

* The progress of the write process, as a percentage. *

* * @return The progress of the write process, as a percentage. */ public Integer getProgress() { return this.progress; } /** *

* The progress of the write process, as a percentage. *

* * @param progress * The progress of the write process, as a percentage. * @return Returns a reference to this object so that method calls can be chained together. */ public PutSnapshotBlockRequest withProgress(Integer progress) { setProgress(progress); return this; } /** *

* A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported. *

* * @param checksum * A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported. */ public void setChecksum(String checksum) { this.checksum = checksum; } /** *

* A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported. *

* * @return A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported. */ public String getChecksum() { return this.checksum; } /** *

* A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported. *

* * @param checksum * A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are supported. * @return Returns a reference to this object so that method calls can be chained together. */ public PutSnapshotBlockRequest withChecksum(String checksum) { setChecksum(checksum); return this; } /** *

* The algorithm used to generate the checksum. Currently, the only supported algorithm is SHA256. *

* * @param checksumAlgorithm * The algorithm used to generate the checksum. Currently, the only supported algorithm is * SHA256. * @see ChecksumAlgorithm */ public void setChecksumAlgorithm(String checksumAlgorithm) { this.checksumAlgorithm = checksumAlgorithm; } /** *

* The algorithm used to generate the checksum. Currently, the only supported algorithm is SHA256. *

* * @return The algorithm used to generate the checksum. Currently, the only supported algorithm is * SHA256. * @see ChecksumAlgorithm */ public String getChecksumAlgorithm() { return this.checksumAlgorithm; } /** *

* The algorithm used to generate the checksum. Currently, the only supported algorithm is SHA256. *

* * @param checksumAlgorithm * The algorithm used to generate the checksum. Currently, the only supported algorithm is * SHA256. * @return Returns a reference to this object so that method calls can be chained together. * @see ChecksumAlgorithm */ public PutSnapshotBlockRequest withChecksumAlgorithm(String checksumAlgorithm) { setChecksumAlgorithm(checksumAlgorithm); return this; } /** *

* The algorithm used to generate the checksum. Currently, the only supported algorithm is SHA256. *

* * @param checksumAlgorithm * The algorithm used to generate the checksum. Currently, the only supported algorithm is * SHA256. * @return Returns a reference to this object so that method calls can be chained together. * @see ChecksumAlgorithm */ public PutSnapshotBlockRequest withChecksumAlgorithm(ChecksumAlgorithm checksumAlgorithm) { this.checksumAlgorithm = checksumAlgorithm.toString(); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getSnapshotId() != null) sb.append("SnapshotId: ").append(getSnapshotId()).append(","); if (getBlockIndex() != null) sb.append("BlockIndex: ").append(getBlockIndex()).append(","); if (getBlockData() != null) sb.append("BlockData: ").append("***Sensitive Data Redacted***").append(","); if (getDataLength() != null) sb.append("DataLength: ").append(getDataLength()).append(","); if (getProgress() != null) sb.append("Progress: ").append(getProgress()).append(","); if (getChecksum() != null) sb.append("Checksum: ").append(getChecksum()).append(","); if (getChecksumAlgorithm() != null) sb.append("ChecksumAlgorithm: ").append(getChecksumAlgorithm()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof PutSnapshotBlockRequest == false) return false; PutSnapshotBlockRequest other = (PutSnapshotBlockRequest) obj; if (other.getSnapshotId() == null ^ this.getSnapshotId() == null) return false; if (other.getSnapshotId() != null && other.getSnapshotId().equals(this.getSnapshotId()) == false) return false; if (other.getBlockIndex() == null ^ this.getBlockIndex() == null) return false; if (other.getBlockIndex() != null && other.getBlockIndex().equals(this.getBlockIndex()) == false) return false; if (other.getBlockData() == null ^ this.getBlockData() == null) return false; if (other.getBlockData() != null && other.getBlockData().equals(this.getBlockData()) == false) return false; if (other.getDataLength() == null ^ this.getDataLength() == null) return false; if (other.getDataLength() != null && other.getDataLength().equals(this.getDataLength()) == false) return false; if (other.getProgress() == null ^ this.getProgress() == null) return false; if (other.getProgress() != null && other.getProgress().equals(this.getProgress()) == false) return false; if (other.getChecksum() == null ^ this.getChecksum() == null) return false; if (other.getChecksum() != null && other.getChecksum().equals(this.getChecksum()) == false) return false; if (other.getChecksumAlgorithm() == null ^ this.getChecksumAlgorithm() == null) return false; if (other.getChecksumAlgorithm() != null && other.getChecksumAlgorithm().equals(this.getChecksumAlgorithm()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getSnapshotId() == null) ? 0 : getSnapshotId().hashCode()); hashCode = prime * hashCode + ((getBlockIndex() == null) ? 0 : getBlockIndex().hashCode()); hashCode = prime * hashCode + ((getBlockData() == null) ? 0 : getBlockData().hashCode()); hashCode = prime * hashCode + ((getDataLength() == null) ? 0 : getDataLength().hashCode()); hashCode = prime * hashCode + ((getProgress() == null) ? 0 : getProgress().hashCode()); hashCode = prime * hashCode + ((getChecksum() == null) ? 0 : getChecksum().hashCode()); hashCode = prime * hashCode + ((getChecksumAlgorithm() == null) ? 0 : getChecksumAlgorithm().hashCode()); return hashCode; } @Override public PutSnapshotBlockRequest clone() { return (PutSnapshotBlockRequest) super.clone(); } @Override public String getSignerType() { return "AWS4UnsignedPayloadSignerType"; } }