String authHeader(Map<String, String> attributes, Map<String, String> headers, String body,
                      AwsCredentials credentials, String timestamp, String httpMethod) {
        return buildAuthHeader(
            credentials.getAccessKey(),
            credentialScopeEcs(timestamp),
            signedHeaders(headers),
            sign(attributes, headers, body, credentials, timestamp, httpMethod)
        );
    }
@Test
    public void authHeaderEcs() {
        // given
        String timestamp = "20141106T111126Z";

        Map<String, String> headers = new HashMap<>();
        headers.put("X-Amz-Date", timestamp);
        headers.put("Host", "ecs.eu-central-1.amazonaws.com");

        //language=JSON
        String body = """
                {
                  "cluster": "123456",
                  "family": "abcdef"
                }""";

        AwsCredentials credentials = AwsCredentials.builder()
            .setAccessKey("AKIDEXAMPLE")
            .setSecretKey("wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY")
            .build();

        AwsRequestSigner requestSigner = new AwsRequestSigner("eu-central-1", "ecs");

        // when
        String authHeader = requestSigner.authHeader(emptyMap(), headers, body, credentials, timestamp, "GET");

        // then
        String expectedAuthHeader = "AWS4-HMAC-SHA256 "
            + "Credential=AKIDEXAMPLE/20141106/eu-central-1/ecs/aws4_request, "
            + "SignedHeaders=host;x-amz-date, "
            + "Signature=d25323cd86f9e960d0303599891d54fb9a1a0975bd132c06e95f767118d5bf55";
        assertEquals(expectedAuthHeader, authHeader);
    }