Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HSEARCH-2772 Debug the elasticsearch-aws module and use the latest ve…
…rsion of aws-v4-signer-java
- Loading branch information
Showing
4 changed files
with
104 additions
and
139 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
elasticsearch-aws/src/main/java/org/hibernate/search/elasticsearch/aws/impl/AWSHeaders.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.elasticsearch.aws.impl; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import java.time.format.DateTimeFormatterBuilder; | ||
import java.time.temporal.ChronoField; | ||
|
||
/** | ||
* @author Yoann Rodiere | ||
*/ | ||
class AWSHeaders { | ||
|
||
private AWSHeaders() { | ||
// Private, this is a utils class | ||
} | ||
|
||
public static final String AUTHORIZATION = "authorization"; | ||
public static final String HOST = "host"; | ||
public static final String X_AMZ_DATE_HEADER_NAME = "x-amz-date"; | ||
public static final String X_AMZ_CONTENT_SHA256_HEADER_NAME = "x-amz-content-sha256"; | ||
|
||
private static final DateTimeFormatter AMZ_DATE_FORMATTER = new DateTimeFormatterBuilder() | ||
.appendValue( ChronoField.YEAR, 4 ) | ||
.appendValue( ChronoField.MONTH_OF_YEAR, 2 ) | ||
.appendValue( ChronoField.DAY_OF_MONTH, 2 ) | ||
.appendLiteral( 'T' ) | ||
.appendValue( ChronoField.HOUR_OF_DAY, 2 ) | ||
.appendValue( ChronoField.MINUTE_OF_HOUR, 2 ) | ||
.appendValue( ChronoField.SECOND_OF_MINUTE, 2 ) | ||
.appendLiteral( 'Z' ) | ||
.toFormatter(); | ||
|
||
public static String toAmzDate(LocalDateTime dateTime) { | ||
return AMZ_DATE_FORMATTER.format( dateTime ); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...earch-aws/src/main/java/org/hibernate/search/elasticsearch/aws/impl/AWSNormalization.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.elasticsearch.aws.impl; | ||
|
||
/** | ||
* @author Yoann Rodiere | ||
*/ | ||
class AWSNormalization { | ||
|
||
private AWSNormalization() { | ||
// Private, this is a utils class | ||
} | ||
|
||
private static final String HOST_PORT_REGEX = ":\\d+$"; | ||
|
||
public static String normalizeHost(String value) { | ||
return value.replaceAll( HOST_PORT_REGEX, "" ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters