Package org.apache.hadoop.ozone.s3.util
Class S3Utils
java.lang.Object
org.apache.hadoop.ozone.s3.util.S3Utils
Utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleaneol(int prev, int curr) Checks if the given pair of bytes represent the end-of-line sequence (\r\n).static StringgenerateCanonicalUserId(String input) Generates a Canonical User ID compatible with S3 by returning the SHA-256 hexadecimal encoding of the input string.static booleanhasMultiChunksPayload(String amzContentSha256Header) static booleanhasUnsignedPayload(String amzContentSha256Header) static org.apache.hadoop.hdds.client.ReplicationConfigresolveS3ClientSideReplicationConfig(String s3StorageTypeHeader, String s3StorageConfigHeader, org.apache.hadoop.hdds.client.ReplicationConfig clientConfiguredReplConfig, org.apache.hadoop.hdds.client.ReplicationConfig bucketReplConfig) This API used to resolve the client side configuration preference for file system layer implementations.static org.apache.hadoop.hdds.client.ReplicationConfigtoReplicationConfig(String s3StorageType, String s3StorageConfig) static Stringstatic Stringstatic voidvalidateMultiChunksUpload(javax.ws.rs.core.HttpHeaders headers, String amzDecodedContentLength, String resource) static StringvalidateSignatureHeader(javax.ws.rs.core.HttpHeaders headers, String resource, boolean isSignedPayload) static javax.ws.rs.WebApplicationException
-
Method Details
-
urlDecode
- Throws:
UnsupportedEncodingException
-
urlEncode
- Throws:
UnsupportedEncodingException
-
resolveS3ClientSideReplicationConfig
public static org.apache.hadoop.hdds.client.ReplicationConfig resolveS3ClientSideReplicationConfig(String s3StorageTypeHeader, String s3StorageConfigHeader, org.apache.hadoop.hdds.client.ReplicationConfig clientConfiguredReplConfig, org.apache.hadoop.hdds.client.ReplicationConfig bucketReplConfig) throws OS3Exception This API used to resolve the client side configuration preference for file system layer implementations.- Parameters:
s3StorageTypeHeader- - s3 user passed storage type header.clientConfiguredReplConfig- - Client side configured replication config.bucketReplConfig- - server side bucket default replication config.- Returns:
- client resolved replication config.
- Throws:
OS3Exception
-
toReplicationConfig
public static org.apache.hadoop.hdds.client.ReplicationConfig toReplicationConfig(String s3StorageType, String s3StorageConfig) throws OS3Exception - Throws:
OS3Exception
-
wrapOS3Exception
-
hasUnsignedPayload
-
hasMultiChunksPayload
-
validateMultiChunksUpload
public static void validateMultiChunksUpload(javax.ws.rs.core.HttpHeaders headers, String amzDecodedContentLength, String resource) throws OS3Exception - Throws:
OS3Exception
-
validateSignatureHeader
public static String validateSignatureHeader(javax.ws.rs.core.HttpHeaders headers, String resource, boolean isSignedPayload) throws OS3Exception - Throws:
OS3Exception
-
eol
public static boolean eol(int prev, int curr) Checks if the given pair of bytes represent the end-of-line sequence (\r\n).- Parameters:
prev- the previous byte value (should be 13 for '\r')curr- the current byte value (should be 10 for '\n')- Returns:
- true if the pair forms a CRLF sequence, false otherwise
-
generateCanonicalUserId
Generates a Canonical User ID compatible with S3 by returning the SHA-256 hexadecimal encoding of the input string.- Parameters:
input- the input string- Returns:
- the SHA-256 hexadecimal encoded Canonical User ID
-