/** * 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. */ @Override public String toString() { return ToString.builder("PutObjectRequest").add("ACL", aclAsString()).add("Bucket", bucket()) .add("CacheControl", cacheControl()).add("ContentDisposition", contentDisposition()) .add("ContentEncoding", contentEncoding()).add("ContentLanguage", contentLanguage()) .add("ContentLength", contentLength()).add("ContentMD5", contentMD5()).add("ContentType", contentType()) .add("Expires", expires()).add("GrantFullControl", grantFullControl()).add("GrantRead", grantRead()) .add("GrantReadACP", grantReadACP()).add("GrantWriteACP", grantWriteACP()).add("Key", key()) .add("Metadata", metadata()).add("ServerSideEncryption", serverSideEncryptionAsString()) .add("StorageClass", storageClassAsString()).add("WebsiteRedirectLocation", websiteRedirectLocation()) .add("SSECustomerAlgorithm", sseCustomerAlgorithm()) .add("SSECustomerKey", sseCustomerKey() == null ? null : "*** Sensitive Data Redacted ***") .add("SSECustomerKeyMD5", sseCustomerKeyMD5()) .add("SSEKMSKeyId", ssekmsKeyId() == null ? null : "*** Sensitive Data Redacted ***") .add("RequestPayer", requestPayerAsString()).add("Tagging", tagging()) .add("ObjectLockMode", objectLockModeAsString()).add("ObjectLockRetainUntilDate", objectLockRetainUntilDate()) .add("ObjectLockLegalHoldStatus", objectLockLegalHoldStatusAsString()).build(); }
return Optional.ofNullable(clazz.cast(grantWriteACP())); case "Key": return Optional.ofNullable(clazz.cast(key())); case "Metadata": return Optional.ofNullable(clazz.cast(metadata()));
hashCode = 31 * hashCode + Objects.hashCode(grantReadACP()); hashCode = 31 * hashCode + Objects.hashCode(grantWriteACP()); hashCode = 31 * hashCode + Objects.hashCode(key()); hashCode = 31 * hashCode + Objects.hashCode(metadata()); hashCode = 31 * hashCode + Objects.hashCode(serverSideEncryptionAsString());
&& Objects.equals(grantFullControl(), other.grantFullControl()) && Objects.equals(grantRead(), other.grantRead()) && Objects.equals(grantReadACP(), other.grantReadACP()) && Objects.equals(grantWriteACP(), other.grantWriteACP()) && Objects.equals(key(), other.key()) && Objects.equals(metadata(), other.metadata()) && Objects.equals(serverSideEncryptionAsString(), other.serverSideEncryptionAsString()) && Objects.equals(storageClassAsString(), other.storageClassAsString())
@Override public PutObjectResponse putObject(final PutObjectRequest putObjectRequest, final RequestBody requestBody) throws S3Exception { try { bucketsWithContents.get(putObjectRequest.bucket()).put(putObjectRequest.key(), bucketItemBuilder() .withName(putObjectRequest.key()) .withData(toByteArray(requestBody.contentStreamProvider().newStream())) .withLastModifiedNow() .build()); return PutObjectResponse.builder().build(); } catch (IOException e) { throw new RuntimeException(e); } }