Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
package com.amazonaws;
/* loaded from: classes.dex */
public class AbortedException extends AmazonClientException {
private static final long serialVersionUID = 1;
public AbortedException() {
super("");
}
}

View File

@@ -0,0 +1,14 @@
package com.amazonaws;
/* loaded from: classes.dex */
public class AmazonClientException extends RuntimeException {
private static final long serialVersionUID = 1;
public AmazonClientException(String str, Throwable th) {
super(str, th);
}
public AmazonClientException(String str) {
super(str);
}
}

View File

@@ -0,0 +1,75 @@
package com.amazonaws;
/* loaded from: classes.dex */
public class AmazonServiceException extends AmazonClientException {
private static final long serialVersionUID = 1;
public String errorCode;
public String errorMessage;
public ErrorType errorType;
public String requestId;
public String serviceName;
public int statusCode;
public enum ErrorType {
Client,
Service,
Unknown
}
public String getErrorCode() {
return this.errorCode;
}
public String getErrorMessage() {
return this.errorMessage;
}
public String getRequestId() {
return this.requestId;
}
public String getServiceName() {
return this.serviceName;
}
public int getStatusCode() {
return this.statusCode;
}
public void setErrorCode(String str) {
this.errorCode = str;
}
public void setErrorType(ErrorType errorType) {
this.errorType = errorType;
}
public void setRequestId(String str) {
this.requestId = str;
}
public void setServiceName(String str) {
this.serviceName = str;
}
public void setStatusCode(int i) {
this.statusCode = i;
}
public AmazonServiceException(String str) {
super(str);
this.errorType = ErrorType.Unknown;
this.errorMessage = str;
}
public AmazonServiceException(String str, Exception exc) {
super(null, exc);
this.errorType = ErrorType.Unknown;
this.errorMessage = str;
}
@Override // java.lang.Throwable
public String getMessage() {
return getErrorMessage() + " (Service: " + getServiceName() + "; Status Code: " + getStatusCode() + "; Error Code: " + getErrorCode() + "; Request ID: " + getRequestId() + ")";
}
}

View File

@@ -0,0 +1,227 @@
package com.amazonaws;
import com.amazonaws.auth.RegionAwareSigner;
import com.amazonaws.auth.Signer;
import com.amazonaws.auth.SignerFactory;
import com.amazonaws.http.AmazonHttpClient;
import com.amazonaws.http.ExecutionContext;
import com.amazonaws.http.HttpClient;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.metrics.AwsSdkMetrics;
import com.amazonaws.metrics.RequestMetricCollector;
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.util.AWSRequestMetrics;
import com.amazonaws.util.AwsHostNameUtils;
import com.amazonaws.util.Classes;
import com.amazonaws.util.StringUtils;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
/* loaded from: classes.dex */
public abstract class AmazonWebServiceClient {
public static final Log LOG = LogFactory.getLog(AmazonWebServiceClient.class);
public AmazonHttpClient client;
public ClientConfiguration clientConfiguration;
public volatile URI endpoint;
public volatile String endpointPrefix;
public volatile Region region;
public final List requestHandler2s = new CopyOnWriteArrayList();
public volatile String serviceName;
public volatile Signer signer;
public volatile String signerRegionOverride;
public long timeOffset;
public String getEndpointPrefix() {
return this.endpointPrefix;
}
public AmazonWebServiceClient(ClientConfiguration clientConfiguration, HttpClient httpClient) {
this.clientConfiguration = clientConfiguration;
this.client = new AmazonHttpClient(clientConfiguration, httpClient);
}
public void setEndpoint(String str) {
URI uri = toURI(str);
Signer computeSignerByURI = computeSignerByURI(uri, this.signerRegionOverride, false);
synchronized (this) {
this.endpoint = uri;
this.signer = computeSignerByURI;
}
}
public final URI toURI(String str) {
if (!str.contains("://")) {
str = this.clientConfiguration.getProtocol().toString() + "://" + str;
}
try {
return new URI(str);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
public Signer getSignerByURI(URI uri) {
return computeSignerByURI(uri, this.signerRegionOverride, true);
}
public final Signer computeSignerByURI(URI uri, String str, boolean z) {
if (uri == null) {
throw new IllegalArgumentException("Endpoint is not set. Use setEndpoint to set an endpoint before performing any request.");
}
String serviceNameIntern = getServiceNameIntern();
return computeSignerByServiceRegion(serviceNameIntern, AwsHostNameUtils.parseRegionName(uri.getHost(), serviceNameIntern), str, z);
}
public final Signer computeSignerByServiceRegion(String str, String str2, String str3, boolean z) {
Signer signerByTypeAndService;
String signerOverride = this.clientConfiguration.getSignerOverride();
if (signerOverride == null) {
signerByTypeAndService = SignerFactory.getSigner(str, str2);
} else {
signerByTypeAndService = SignerFactory.getSignerByTypeAndService(signerOverride, str);
}
if (signerByTypeAndService instanceof RegionAwareSigner) {
RegionAwareSigner regionAwareSigner = (RegionAwareSigner) signerByTypeAndService;
if (str3 != null) {
regionAwareSigner.setRegionName(str3);
} else if (str2 != null && z) {
regionAwareSigner.setRegionName(str2);
}
}
synchronized (this) {
this.region = Region.getRegion(str2);
}
return signerByTypeAndService;
}
public void setRegion(Region region) {
String format;
if (region == null) {
throw new IllegalArgumentException("No region provided");
}
String serviceNameIntern = getServiceNameIntern();
if (region.isServiceSupported(serviceNameIntern)) {
format = region.getServiceEndpoint(serviceNameIntern);
int indexOf = format.indexOf("://");
if (indexOf >= 0) {
format = format.substring(indexOf + 3);
}
} else {
format = String.format("%s.%s.%s", getEndpointPrefix(), region.getName(), region.getDomain());
}
URI uri = toURI(format);
Signer computeSignerByServiceRegion = computeSignerByServiceRegion(serviceNameIntern, region.getName(), this.signerRegionOverride, false);
synchronized (this) {
this.endpoint = uri;
this.signer = computeSignerByServiceRegion;
}
}
public Regions getRegions() {
Regions fromName;
synchronized (this) {
fromName = Regions.fromName(this.region.getName());
}
return fromName;
}
public ExecutionContext createExecutionContext(AmazonWebServiceRequest amazonWebServiceRequest) {
return new ExecutionContext(this.requestHandler2s, isRequestMetricsEnabled(amazonWebServiceRequest) || isProfilingEnabled(), this);
}
public static boolean isProfilingEnabled() {
return System.getProperty("com.amazonaws.sdk.enableRuntimeProfiling") != null;
}
public final boolean isRequestMetricsEnabled(AmazonWebServiceRequest amazonWebServiceRequest) {
RequestMetricCollector requestMetricCollector = amazonWebServiceRequest.getRequestMetricCollector();
if (requestMetricCollector == null || !requestMetricCollector.isEnabled()) {
return isRMCEnabledAtClientOrSdkLevel();
}
return true;
}
public final boolean isRMCEnabledAtClientOrSdkLevel() {
RequestMetricCollector requestMetricCollector = requestMetricCollector();
return requestMetricCollector != null && requestMetricCollector.isEnabled();
}
public RequestMetricCollector getRequestMetricsCollector() {
return this.client.getRequestMetricCollector();
}
public RequestMetricCollector requestMetricCollector() {
RequestMetricCollector requestMetricCollector = this.client.getRequestMetricCollector();
return requestMetricCollector == null ? AwsSdkMetrics.getRequestMetricCollector() : requestMetricCollector;
}
public final RequestMetricCollector findRequestMetricCollector(Request request) {
RequestMetricCollector requestMetricCollector = request.getOriginalRequest().getRequestMetricCollector();
if (requestMetricCollector != null) {
return requestMetricCollector;
}
RequestMetricCollector requestMetricsCollector = getRequestMetricsCollector();
return requestMetricsCollector == null ? AwsSdkMetrics.getRequestMetricCollector() : requestMetricsCollector;
}
public final void endClientExecution(AWSRequestMetrics aWSRequestMetrics, Request request, Response response) {
endClientExecution(aWSRequestMetrics, request, response, false);
}
public final void endClientExecution(AWSRequestMetrics aWSRequestMetrics, Request request, Response response, boolean z) {
if (request != null) {
aWSRequestMetrics.endEvent(AWSRequestMetrics.Field.ClientExecuteTime);
aWSRequestMetrics.getTimingInfo().endTiming();
findRequestMetricCollector(request).collectMetrics(request, response);
}
if (z) {
aWSRequestMetrics.log();
}
}
public String getServiceNameIntern() {
if (this.serviceName == null) {
synchronized (this) {
try {
if (this.serviceName == null) {
this.serviceName = computeServiceName();
return this.serviceName;
}
} finally {
}
}
}
return this.serviceName;
}
public final String computeServiceName() {
int i;
String simpleName = Classes.childClassOf(AmazonWebServiceClient.class, this).getSimpleName();
String serviceName = ServiceNameFactory.getServiceName(simpleName);
if (serviceName != null) {
return serviceName;
}
int indexOf = simpleName.indexOf("JavaClient");
if (indexOf == -1 && (indexOf = simpleName.indexOf("Client")) == -1) {
throw new IllegalStateException("Unrecognized suffix for the AWS http client class name " + simpleName);
}
int indexOf2 = simpleName.indexOf("Amazon");
if (indexOf2 == -1) {
indexOf2 = simpleName.indexOf("AWS");
if (indexOf2 == -1) {
throw new IllegalStateException("Unrecognized prefix for the AWS http client class name " + simpleName);
}
i = 3;
} else {
i = 6;
}
if (indexOf2 >= indexOf) {
throw new IllegalStateException("Unrecognized AWS http client class name " + simpleName);
}
return StringUtils.lowerCase(simpleName.substring(indexOf2 + i, indexOf));
}
}

View File

@@ -0,0 +1,39 @@
package com.amazonaws;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.metrics.RequestMetricCollector;
/* loaded from: classes.dex */
public abstract class AmazonWebServiceRequest implements Cloneable {
public AmazonWebServiceRequest cloneSource;
public AWSCredentials credentials;
public final RequestClientOptions requestClientOptions = new RequestClientOptions();
public RequestMetricCollector requestMetricCollector;
public RequestClientOptions getRequestClientOptions() {
return this.requestClientOptions;
}
public AWSCredentials getRequestCredentials() {
return this.credentials;
}
public RequestMetricCollector getRequestMetricCollector() {
return this.requestMetricCollector;
}
public final void setCloneSource(AmazonWebServiceRequest amazonWebServiceRequest) {
this.cloneSource = amazonWebServiceRequest;
}
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
public AmazonWebServiceRequest m204clone() {
try {
AmazonWebServiceRequest amazonWebServiceRequest = (AmazonWebServiceRequest) super.clone();
amazonWebServiceRequest.setCloneSource(this);
return amazonWebServiceRequest;
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() even though we're Cloneable!", e);
}
}
}

View File

@@ -0,0 +1,27 @@
package com.amazonaws;
/* loaded from: classes.dex */
public class AmazonWebServiceResponse<T> {
public ResponseMetadata responseMetadata;
public Object result;
public Object getResult() {
return this.result;
}
public void setResponseMetadata(ResponseMetadata responseMetadata) {
this.responseMetadata = responseMetadata;
}
public void setResult(Object obj) {
this.result = obj;
}
public String getRequestId() {
ResponseMetadata responseMetadata = this.responseMetadata;
if (responseMetadata == null) {
return null;
}
return responseMetadata.getRequestId();
}
}

View File

@@ -0,0 +1,144 @@
package com.amazonaws;
import com.amazonaws.retry.PredefinedRetryPolicies;
import com.amazonaws.retry.RetryPolicy;
import com.amazonaws.util.VersionInfoUtils;
import com.mbridge.msdk.playercommon.exoplayer2.DefaultLoadControl;
import java.net.InetAddress;
import javax.net.ssl.TrustManager;
/* loaded from: classes.dex */
public class ClientConfiguration {
public int connectionTimeout;
public boolean curlLogging;
public boolean enableGzip;
public InetAddress localAddress;
public int maxConnections;
public int maxErrorRetry;
public boolean preemptiveBasicProxyAuth;
public Protocol protocol;
public String proxyDomain;
public String proxyHost;
public String proxyPassword;
public int proxyPort;
public String proxyUsername;
public String proxyWorkstation;
public RetryPolicy retryPolicy;
public String signerOverride;
public int socketReceiveBufferSizeHint;
public int socketSendBufferSizeHint;
public int socketTimeout;
public TrustManager trustManager;
public String userAgent;
public String userAgentOverride;
public static final String DEFAULT_USER_AGENT = VersionInfoUtils.getUserAgent();
public static final RetryPolicy DEFAULT_RETRY_POLICY = PredefinedRetryPolicies.DEFAULT;
public int getConnectionTimeout() {
return this.connectionTimeout;
}
public int getMaxErrorRetry() {
return this.maxErrorRetry;
}
public Protocol getProtocol() {
return this.protocol;
}
public RetryPolicy getRetryPolicy() {
return this.retryPolicy;
}
public String getSignerOverride() {
return this.signerOverride;
}
public int getSocketTimeout() {
return this.socketTimeout;
}
public TrustManager getTrustManager() {
return this.trustManager;
}
public String getUserAgent() {
return this.userAgent;
}
public String getUserAgentOverride() {
return this.userAgentOverride;
}
public boolean isCurlLogging() {
return this.curlLogging;
}
public boolean isEnableGzip() {
return this.enableGzip;
}
public ClientConfiguration() {
this.userAgent = DEFAULT_USER_AGENT;
this.maxErrorRetry = -1;
this.retryPolicy = DEFAULT_RETRY_POLICY;
this.protocol = Protocol.HTTPS;
this.proxyHost = null;
this.proxyPort = -1;
this.proxyUsername = null;
this.proxyPassword = null;
this.proxyDomain = null;
this.proxyWorkstation = null;
this.maxConnections = 10;
this.socketTimeout = DefaultLoadControl.DEFAULT_MIN_BUFFER_MS;
this.connectionTimeout = DefaultLoadControl.DEFAULT_MIN_BUFFER_MS;
this.socketSendBufferSizeHint = 0;
this.socketReceiveBufferSizeHint = 0;
this.trustManager = null;
this.curlLogging = false;
this.enableGzip = false;
}
public ClientConfiguration(ClientConfiguration clientConfiguration) {
this.userAgent = DEFAULT_USER_AGENT;
this.maxErrorRetry = -1;
this.retryPolicy = DEFAULT_RETRY_POLICY;
this.protocol = Protocol.HTTPS;
this.proxyHost = null;
this.proxyPort = -1;
this.proxyUsername = null;
this.proxyPassword = null;
this.proxyDomain = null;
this.proxyWorkstation = null;
this.maxConnections = 10;
this.socketTimeout = DefaultLoadControl.DEFAULT_MIN_BUFFER_MS;
this.connectionTimeout = DefaultLoadControl.DEFAULT_MIN_BUFFER_MS;
this.socketSendBufferSizeHint = 0;
this.socketReceiveBufferSizeHint = 0;
this.trustManager = null;
this.curlLogging = false;
this.enableGzip = false;
this.connectionTimeout = clientConfiguration.connectionTimeout;
this.maxConnections = clientConfiguration.maxConnections;
this.maxErrorRetry = clientConfiguration.maxErrorRetry;
this.retryPolicy = clientConfiguration.retryPolicy;
this.localAddress = clientConfiguration.localAddress;
this.protocol = clientConfiguration.protocol;
this.proxyDomain = clientConfiguration.proxyDomain;
this.proxyHost = clientConfiguration.proxyHost;
this.proxyPassword = clientConfiguration.proxyPassword;
this.proxyPort = clientConfiguration.proxyPort;
this.proxyUsername = clientConfiguration.proxyUsername;
this.proxyWorkstation = clientConfiguration.proxyWorkstation;
this.preemptiveBasicProxyAuth = clientConfiguration.preemptiveBasicProxyAuth;
this.socketTimeout = clientConfiguration.socketTimeout;
this.userAgent = clientConfiguration.userAgent;
this.userAgentOverride = clientConfiguration.userAgentOverride;
this.socketReceiveBufferSizeHint = clientConfiguration.socketReceiveBufferSizeHint;
this.socketSendBufferSizeHint = clientConfiguration.socketSendBufferSizeHint;
this.signerOverride = clientConfiguration.signerOverride;
this.trustManager = clientConfiguration.trustManager;
this.curlLogging = clientConfiguration.curlLogging;
this.enableGzip = clientConfiguration.enableGzip;
}
}

View File

@@ -0,0 +1,192 @@
package com.amazonaws;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.util.AWSRequestMetrics;
import java.io.InputStream;
import java.net.URI;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/* loaded from: classes.dex */
public class DefaultRequest<T> implements Request<T> {
public InputStream content;
public String encodedUriResourcePath;
public URI endpoint;
public String hostPrefix;
public AWSRequestMetrics metrics;
public final AmazonWebServiceRequest originalRequest;
public String resourcePath;
public String serviceName;
public long timeOffset;
public boolean streaming = false;
public final Map parameters = new LinkedHashMap();
public final Map headers = new HashMap();
public HttpMethodName httpMethod = HttpMethodName.POST;
@Override // com.amazonaws.Request
public AWSRequestMetrics getAWSRequestMetrics() {
return this.metrics;
}
@Override // com.amazonaws.Request
public InputStream getContent() {
return this.content;
}
@Override // com.amazonaws.Request
public String getEncodedUriResourcePath() {
return this.encodedUriResourcePath;
}
@Override // com.amazonaws.Request
public URI getEndpoint() {
return this.endpoint;
}
@Override // com.amazonaws.Request
public Map getHeaders() {
return this.headers;
}
@Override // com.amazonaws.Request
public String getHostPrefix() {
return this.hostPrefix;
}
@Override // com.amazonaws.Request
public HttpMethodName getHttpMethod() {
return this.httpMethod;
}
@Override // com.amazonaws.Request
public AmazonWebServiceRequest getOriginalRequest() {
return this.originalRequest;
}
@Override // com.amazonaws.Request
public Map getParameters() {
return this.parameters;
}
@Override // com.amazonaws.Request
public String getResourcePath() {
return this.resourcePath;
}
@Override // com.amazonaws.Request
public String getServiceName() {
return this.serviceName;
}
@Override // com.amazonaws.Request
public long getTimeOffset() {
return this.timeOffset;
}
@Override // com.amazonaws.Request
public boolean isStreaming() {
return this.streaming;
}
@Override // com.amazonaws.Request
public void setContent(InputStream inputStream) {
this.content = inputStream;
}
@Override // com.amazonaws.Request
public void setEndpoint(URI uri) {
this.endpoint = uri;
}
@Override // com.amazonaws.Request
public void setHttpMethod(HttpMethodName httpMethodName) {
this.httpMethod = httpMethodName;
}
@Override // com.amazonaws.Request
public void setResourcePath(String str) {
this.resourcePath = str;
}
@Override // com.amazonaws.Request
public void setTimeOffset(long j) {
this.timeOffset = j;
}
public DefaultRequest(AmazonWebServiceRequest amazonWebServiceRequest, String str) {
this.serviceName = str;
this.originalRequest = amazonWebServiceRequest;
}
@Override // com.amazonaws.Request
public void addHeader(String str, String str2) {
this.headers.put(str, str2);
}
@Override // com.amazonaws.Request
public void addParameter(String str, String str2) {
this.parameters.put(str, str2);
}
@Override // com.amazonaws.Request
public void setHeaders(Map map) {
this.headers.clear();
this.headers.putAll(map);
}
@Override // com.amazonaws.Request
public void setParameters(Map map) {
this.parameters.clear();
this.parameters.putAll(map);
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getHttpMethod());
sb.append(" ");
sb.append(getEndpoint());
sb.append(" ");
String resourcePath = getResourcePath();
if (resourcePath == null) {
sb.append("/");
} else {
if (!resourcePath.startsWith("/")) {
sb.append("/");
}
sb.append(resourcePath);
}
sb.append(" ");
if (!getParameters().isEmpty()) {
sb.append("Parameters: (");
for (String str : getParameters().keySet()) {
String str2 = (String) getParameters().get(str);
sb.append(str);
sb.append(": ");
sb.append(str2);
sb.append(", ");
}
sb.append(") ");
}
if (!getHeaders().isEmpty()) {
sb.append("Headers: (");
for (String str3 : getHeaders().keySet()) {
String str4 = (String) getHeaders().get(str3);
sb.append(str3);
sb.append(": ");
sb.append(str4);
sb.append(", ");
}
sb.append(") ");
}
return sb.toString();
}
@Override // com.amazonaws.Request
public void setAWSRequestMetrics(AWSRequestMetrics aWSRequestMetrics) {
if (this.metrics != null) {
throw new IllegalStateException("AWSRequestMetrics has already been set on this request");
}
this.metrics = aWSRequestMetrics;
}
}

View File

@@ -0,0 +1,18 @@
package com.amazonaws;
/* loaded from: classes.dex */
public enum Protocol {
HTTP("http"),
HTTPS("https");
private final String protocol;
@Override // java.lang.Enum
public String toString() {
return this.protocol;
}
Protocol(String str) {
this.protocol = str;
}
}

View File

@@ -0,0 +1,56 @@
package com.amazonaws;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.util.AWSRequestMetrics;
import java.io.InputStream;
import java.net.URI;
import java.util.Map;
/* loaded from: classes.dex */
public interface Request<T> {
void addHeader(String str, String str2);
void addParameter(String str, String str2);
AWSRequestMetrics getAWSRequestMetrics();
InputStream getContent();
String getEncodedUriResourcePath();
URI getEndpoint();
Map getHeaders();
String getHostPrefix();
HttpMethodName getHttpMethod();
AmazonWebServiceRequest getOriginalRequest();
Map getParameters();
String getResourcePath();
String getServiceName();
long getTimeOffset();
boolean isStreaming();
void setAWSRequestMetrics(AWSRequestMetrics aWSRequestMetrics);
void setContent(InputStream inputStream);
void setEndpoint(URI uri);
void setHeaders(Map map);
void setHttpMethod(HttpMethodName httpMethodName);
void setParameters(Map map);
void setResourcePath(String str);
void setTimeOffset(long j);
}

View File

@@ -0,0 +1,38 @@
package com.amazonaws;
import java.util.EnumMap;
import java.util.Map;
/* loaded from: classes.dex */
public final class RequestClientOptions {
public final Map markers = new EnumMap(Marker.class);
public enum Marker {
USER_AGENT
}
public String getClientMarker(Marker marker) {
return (String) this.markers.get(marker);
}
public void putClientMarker(Marker marker, String str) {
this.markers.put(marker, str);
}
public void appendUserAgent(String str) {
Map map = this.markers;
Marker marker = Marker.USER_AGENT;
String str2 = (String) map.get(marker);
if (str2 == null) {
str2 = "";
}
putClientMarker(marker, createUserAgentMarkerString(str2, str));
}
public final String createUserAgentMarkerString(String str, String str2) {
if (str.contains(str2)) {
return str;
}
return str + " " + str2;
}
}

View File

@@ -0,0 +1,18 @@
package com.amazonaws;
import com.amazonaws.http.HttpResponse;
/* loaded from: classes.dex */
public final class Response<T> {
public final HttpResponse httpResponse;
public final Object response;
public Object getAwsResponse() {
return this.response;
}
public Response(Object obj, HttpResponse httpResponse) {
this.response = obj;
this.httpResponse = httpResponse;
}
}

View File

@@ -0,0 +1,22 @@
package com.amazonaws;
import com.applovin.impl.sdk.utils.JsonUtils;
import java.util.Map;
/* loaded from: classes.dex */
public class ResponseMetadata {
public final Map metadata;
public ResponseMetadata(Map map) {
this.metadata = map;
}
public String getRequestId() {
return (String) this.metadata.get("AWS_REQUEST_ID");
}
public String toString() {
Map map = this.metadata;
return map == null ? JsonUtils.EMPTY_JSON : map.toString();
}
}

View File

@@ -0,0 +1,16 @@
package com.amazonaws;
import java.util.concurrent.atomic.AtomicLong;
/* loaded from: classes.dex */
public abstract class SDKGlobalConfiguration {
public static final AtomicLong GLOBAL_TIME_OFFSET = new AtomicLong(0);
public static void setGlobalTimeOffset(long j) {
GLOBAL_TIME_OFFSET.set(j);
}
public static long getGlobalTimeOffset() {
return GLOBAL_TIME_OFFSET.get();
}
}

View File

@@ -0,0 +1,17 @@
package com.amazonaws;
import com.amazonaws.internal.config.HttpClientConfig;
import com.amazonaws.internal.config.InternalConfig;
/* loaded from: classes.dex */
enum ServiceNameFactory {
;
public static String getServiceName(String str) {
HttpClientConfig httpClientConfig = InternalConfig.Factory.getInternalConfig().getHttpClientConfig(str);
if (httpClientConfig == null) {
return null;
}
return httpClientConfig.getServiceName();
}
}

View File

@@ -0,0 +1,261 @@
package com.amazonaws.auth;
import com.amazonaws.AmazonClientException;
import com.amazonaws.Request;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.util.AwsHostNameUtils;
import com.amazonaws.util.BinaryUtils;
import com.amazonaws.util.DateUtils;
import com.amazonaws.util.HttpUtils;
import com.amazonaws.util.StringUtils;
import com.facebook.internal.security.CertificateUtil;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.dex */
public class AWS4Signer extends AbstractAWSSigner implements ServiceAwareSigner, RegionAwareSigner {
protected static final String ALGORITHM = "AWS4-HMAC-SHA256";
private static final String DATE_PATTERN = "yyyyMMdd";
private static final long MAX_EXPIRATION_TIME_IN_SECONDS = 604800;
private static final long MILLISEC = 1000;
protected static final String TERMINATOR = "aws4_request";
private static final String TIME_PATTERN = "yyyyMMdd'T'HHmmss'Z'";
protected static final Log log = LogFactory.getLog(AWS4Signer.class);
protected boolean doubleUrlEncode;
protected Date overriddenDate;
protected String regionName;
protected String serviceName;
public void overrideDate(Date date) {
this.overriddenDate = date;
}
public void processRequestPayload(Request<?> request, HeaderSigningResult headerSigningResult) {
}
@Override // com.amazonaws.auth.RegionAwareSigner
public void setRegionName(String str) {
this.regionName = str;
}
@Override // com.amazonaws.auth.ServiceAwareSigner
public void setServiceName(String str) {
this.serviceName = str;
}
public AWS4Signer() {
this(true);
}
public AWS4Signer(boolean z) {
this.doubleUrlEncode = z;
}
@Override // com.amazonaws.auth.Signer
public void sign(Request<?> request, AWSCredentials aWSCredentials) {
if (aWSCredentials instanceof AnonymousAWSCredentials) {
return;
}
AWSCredentials sanitizeCredentials = sanitizeCredentials(aWSCredentials);
if (sanitizeCredentials instanceof AWSSessionCredentials) {
addSessionCredentials(request, (AWSSessionCredentials) sanitizeCredentials);
}
addHostHeader(request);
long dateFromRequest = getDateFromRequest(request);
String dateStamp = getDateStamp(dateFromRequest);
String scope = getScope(request, dateStamp);
String calculateContentHash = calculateContentHash(request);
String timeStamp = getTimeStamp(dateFromRequest);
request.addHeader("X-Amz-Date", timeStamp);
if (request.getHeaders().get("x-amz-content-sha256") != null && "required".equals(request.getHeaders().get("x-amz-content-sha256"))) {
request.addHeader("x-amz-content-sha256", calculateContentHash);
}
String str = sanitizeCredentials.getAWSAccessKeyId() + "/" + scope;
HeaderSigningResult computeSignature = computeSignature(request, dateStamp, timeStamp, ALGORITHM, calculateContentHash, sanitizeCredentials);
request.addHeader("Authorization", "AWS4-HMAC-SHA256 " + ("Credential=" + str) + ", " + ("SignedHeaders=" + getSignedHeadersString(request)) + ", " + ("Signature=" + BinaryUtils.toHex(computeSignature.getSignature())));
processRequestPayload(request, computeSignature);
}
public void addSessionCredentials(Request<?> request, AWSSessionCredentials aWSSessionCredentials) {
request.addHeader("x-amz-security-token", aWSSessionCredentials.getSessionToken());
}
public String extractRegionName(URI uri) {
String str = this.regionName;
return str != null ? str : AwsHostNameUtils.parseRegionName(uri.getHost(), this.serviceName);
}
public String extractServiceName(URI uri) {
String str = this.serviceName;
return str != null ? str : AwsHostNameUtils.parseServiceName(uri);
}
public String getCanonicalizedHeaderString(Request<?> request) {
ArrayList<String> arrayList = new ArrayList();
arrayList.addAll(request.getHeaders().keySet());
Collections.sort(arrayList, String.CASE_INSENSITIVE_ORDER);
StringBuilder sb = new StringBuilder();
for (String str : arrayList) {
if (needsSign(str)) {
String replaceAll = StringUtils.lowerCase(str).replaceAll("\\s+", " ");
String str2 = (String) request.getHeaders().get(str);
sb.append(replaceAll);
sb.append(CertificateUtil.DELIMITER);
if (str2 != null) {
sb.append(str2.replaceAll("\\s+", " "));
}
sb.append("\n");
}
}
return sb.toString();
}
public String getSignedHeadersString(Request<?> request) {
ArrayList<String> arrayList = new ArrayList();
arrayList.addAll(request.getHeaders().keySet());
Collections.sort(arrayList, String.CASE_INSENSITIVE_ORDER);
StringBuilder sb = new StringBuilder();
for (String str : arrayList) {
if (needsSign(str)) {
if (sb.length() > 0) {
sb.append(";");
}
sb.append(StringUtils.lowerCase(str));
}
}
return sb.toString();
}
public String getCanonicalRequest(Request<?> request, String str) {
String appendUri;
if (request.getEncodedUriResourcePath() != null) {
appendUri = HttpUtils.appendUriEncoded(request.getEndpoint().getPath(), request.getEncodedUriResourcePath());
} else {
appendUri = HttpUtils.appendUri(request.getEndpoint().getPath(), request.getResourcePath());
}
String str2 = request.getHttpMethod().toString() + "\n" + getCanonicalizedResourcePath(appendUri, this.doubleUrlEncode) + "\n" + getCanonicalizedQueryString(request) + "\n" + getCanonicalizedHeaderString(request) + "\n" + getSignedHeadersString(request) + "\n" + str;
log.debug("AWS4 Canonical Request: '\"" + str2 + "\"");
return str2;
}
public String getStringToSign(String str, String str2, String str3, String str4) {
String str5 = str + "\n" + str2 + "\n" + str3 + "\n" + BinaryUtils.toHex(hash(str4));
log.debug("AWS4 String to Sign: '\"" + str5 + "\"");
return str5;
}
public final HeaderSigningResult computeSignature(Request<?> request, String str, String str2, String str3, String str4, AWSCredentials aWSCredentials) {
String extractRegionName = extractRegionName(request.getEndpoint());
String extractServiceName = extractServiceName(request.getEndpoint());
String str5 = str + "/" + extractRegionName + "/" + extractServiceName + "/" + TERMINATOR;
String stringToSign = getStringToSign(str3, str2, str5, getCanonicalRequest(request, str4));
String str6 = "AWS4" + aWSCredentials.getAWSSecretKey();
Charset charset = StringUtils.UTF8;
byte[] bytes = str6.getBytes(charset);
SigningAlgorithm signingAlgorithm = SigningAlgorithm.HmacSHA256;
byte[] sign = sign(TERMINATOR, sign(extractServiceName, sign(extractRegionName, sign(str, bytes, signingAlgorithm), signingAlgorithm), signingAlgorithm), signingAlgorithm);
return new HeaderSigningResult(str2, str5, sign, sign(stringToSign.getBytes(charset), sign, signingAlgorithm));
}
public final String getTimeStamp(long j) {
return DateUtils.format(TIME_PATTERN, new Date(j));
}
public final String getDateStamp(long j) {
return DateUtils.format(DATE_PATTERN, new Date(j));
}
public final long getDateFromRequest(Request<?> request) {
Date signatureDate = getSignatureDate(getTimeOffset(request));
Date date = this.overriddenDate;
if (date != null) {
signatureDate = date;
}
return signatureDate.getTime();
}
public void addHostHeader(Request<?> request) {
String host = request.getEndpoint().getHost();
if (HttpUtils.isUsingNonDefaultPort(request.getEndpoint())) {
host = host + CertificateUtil.DELIMITER + request.getEndpoint().getPort();
}
request.addHeader(HTTP.TARGET_HOST, host);
}
public String getScope(Request<?> request, String str) {
return str + "/" + extractRegionName(request.getEndpoint()) + "/" + extractServiceName(request.getEndpoint()) + "/" + TERMINATOR;
}
public String calculateContentHash(Request<?> request) {
InputStream binaryRequestPayloadStream = getBinaryRequestPayloadStream(request);
binaryRequestPayloadStream.mark(-1);
String hex = BinaryUtils.toHex(hash(binaryRequestPayloadStream));
try {
binaryRequestPayloadStream.reset();
return hex;
} catch (IOException e) {
throw new AmazonClientException("Unable to reset stream after calculating AWS4 signature", e);
}
}
public static class HeaderSigningResult {
public final String dateTime;
public final byte[] kSigning;
public final String scope;
public final byte[] signature;
public HeaderSigningResult(String str, String str2, byte[] bArr, byte[] bArr2) {
this.dateTime = str;
this.scope = str2;
this.kSigning = bArr;
this.signature = bArr2;
}
public byte[] getSignature() {
byte[] bArr = this.signature;
byte[] bArr2 = new byte[bArr.length];
System.arraycopy(bArr, 0, bArr2, 0, bArr.length);
return bArr2;
}
}
public void presignRequest(Request<?> request, AWSCredentials aWSCredentials, Date date) {
if (aWSCredentials instanceof AnonymousAWSCredentials) {
return;
}
long time = date != null ? (date.getTime() - System.currentTimeMillis()) / 1000 : 604800L;
if (time > MAX_EXPIRATION_TIME_IN_SECONDS) {
throw new AmazonClientException("Requests that are pre-signed by SigV4 algorithm are valid for at most 7 days. The expiration date set on the current request [" + getTimeStamp(date.getTime()) + "] has exceeded this limit.");
}
addHostHeader(request);
AWSCredentials sanitizeCredentials = sanitizeCredentials(aWSCredentials);
if (sanitizeCredentials instanceof AWSSessionCredentials) {
request.addParameter("X-Amz-Security-Token", ((AWSSessionCredentials) sanitizeCredentials).getSessionToken());
}
long dateFromRequest = getDateFromRequest(request);
String dateStamp = getDateStamp(dateFromRequest);
String str = sanitizeCredentials.getAWSAccessKeyId() + "/" + getScope(request, dateStamp);
String timeStamp = getTimeStamp(dateFromRequest);
request.addParameter("X-Amz-Algorithm", ALGORITHM);
request.addParameter("X-Amz-Date", timeStamp);
request.addParameter("X-Amz-SignedHeaders", getSignedHeadersString(request));
request.addParameter("X-Amz-Expires", Long.toString(time));
request.addParameter("X-Amz-Credential", str);
request.addParameter("X-Amz-Signature", BinaryUtils.toHex(computeSignature(request, dateStamp, timeStamp, ALGORITHM, calculateContentHashPresign(request), sanitizeCredentials).getSignature()));
}
public String calculateContentHashPresign(Request<?> request) {
return calculateContentHash(request);
}
public boolean needsSign(String str) {
return "date".equalsIgnoreCase(str) || "Content-MD5".equalsIgnoreCase(str) || "host".equalsIgnoreCase(str) || str.startsWith("x-amz") || str.startsWith("X-Amz");
}
}

View File

@@ -0,0 +1,125 @@
package com.amazonaws.auth;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.services.cognitoidentity.AmazonCognitoIdentity;
import com.amazonaws.services.cognitoidentity.model.GetIdRequest;
import com.amazonaws.services.cognitoidentity.model.GetIdResult;
import com.amazonaws.services.cognitoidentity.model.GetOpenIdTokenRequest;
import com.amazonaws.services.cognitoidentity.model.GetOpenIdTokenResult;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public abstract class AWSAbstractCognitoIdentityProvider implements AWSCognitoIdentityProvider {
public final String accountId;
public final AmazonCognitoIdentity cib;
public String identityId;
public final String identityPoolId;
public String token;
public Map loginsMap = new HashMap();
public List listeners = new ArrayList();
public String getAccountId() {
return this.accountId;
}
@Override // com.amazonaws.auth.AWSCognitoIdentityProvider
public String getIdentityPoolId() {
return this.identityPoolId;
}
@Override // com.amazonaws.auth.AWSCognitoIdentityProvider
public Map getLogins() {
return this.loginsMap;
}
public String getUserAgent() {
return "";
}
public void setToken(String str) {
this.token = str;
}
public AWSAbstractCognitoIdentityProvider(String str, String str2, AmazonCognitoIdentity amazonCognitoIdentity) {
this.accountId = str;
this.identityPoolId = str2;
this.cib = amazonCognitoIdentity;
}
@Override // com.amazonaws.auth.AWSCognitoIdentityProvider
public String getIdentityId() {
if (this.identityId == null) {
GetIdRequest withLogins = new GetIdRequest().withAccountId(getAccountId()).withIdentityPoolId(getIdentityPoolId()).withLogins(this.loginsMap);
appendUserAgent(withLogins, getUserAgent());
GetIdResult id = this.cib.getId(withLogins);
if (id.getIdentityId() != null) {
identityChanged(id.getIdentityId());
}
}
return this.identityId;
}
public String getToken() {
if (this.token == null) {
GetOpenIdTokenRequest withLogins = new GetOpenIdTokenRequest().withIdentityId(getIdentityId()).withLogins(this.loginsMap);
appendUserAgent(withLogins, getUserAgent());
GetOpenIdTokenResult openIdToken = this.cib.getOpenIdToken(withLogins);
if (!openIdToken.getIdentityId().equals(getIdentityId())) {
identityChanged(openIdToken.getIdentityId());
}
this.token = openIdToken.getToken();
}
return this.token;
}
@Override // com.amazonaws.auth.AWSCognitoIdentityProvider
public boolean isAuthenticated() {
Map map = this.loginsMap;
return map != null && map.size() > 0;
}
@Override // com.amazonaws.auth.AWSCognitoIdentityProvider
public void registerIdentityChangedListener(IdentityChangedListener identityChangedListener) {
this.listeners.add(identityChangedListener);
}
@Override // com.amazonaws.auth.AWSCognitoIdentityProvider
public void identityChanged(String str) {
String str2 = this.identityId;
if (str2 == null || !str2.equals(str)) {
String str3 = this.identityId;
this.identityId = str;
Iterator it = this.listeners.iterator();
while (it.hasNext()) {
((IdentityChangedListener) it.next()).identityChanged(str3, this.identityId);
}
}
}
public void appendUserAgent(AmazonWebServiceRequest amazonWebServiceRequest, String str) {
amazonWebServiceRequest.getRequestClientOptions().appendUserAgent(str);
}
public void update(String str, String str2) {
String str3 = this.identityId;
if (str3 == null || !str3.equals(str)) {
identityChanged(str);
}
String str4 = this.token;
if (str4 == null || !str4.equals(str2)) {
this.token = str2;
}
}
@Override // com.amazonaws.auth.AWSIdentityProvider
public String refresh() {
getIdentityId();
String token = getToken();
update(getIdentityId(), token);
return token;
}
}

View File

@@ -0,0 +1,16 @@
package com.amazonaws.auth;
import com.amazonaws.services.cognitoidentity.AmazonCognitoIdentity;
/* loaded from: classes.dex */
public class AWSBasicCognitoIdentityProvider extends AWSAbstractCognitoIdentityProvider {
public AWSBasicCognitoIdentityProvider(String str, String str2, AmazonCognitoIdentity amazonCognitoIdentity) {
super(str, str2, amazonCognitoIdentity);
}
@Override // com.amazonaws.auth.AWSAbstractCognitoIdentityProvider, com.amazonaws.auth.AWSIdentityProvider
public String refresh() {
setToken(null);
return super.refresh();
}
}

View File

@@ -0,0 +1,18 @@
package com.amazonaws.auth;
import java.util.Map;
/* loaded from: classes.dex */
public interface AWSCognitoIdentityProvider extends AWSIdentityProvider {
String getIdentityId();
String getIdentityPoolId();
Map getLogins();
void identityChanged(String str);
boolean isAuthenticated();
void registerIdentityChangedListener(IdentityChangedListener identityChangedListener);
}

View File

@@ -0,0 +1,8 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public interface AWSCredentials {
String getAWSAccessKeyId();
String getAWSSecretKey();
}

View File

@@ -0,0 +1,6 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public interface AWSCredentialsProvider {
AWSCredentials getCredentials();
}

View File

@@ -0,0 +1,5 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public abstract class AWSCredentialsProviderChain implements AWSCredentialsProvider {
}

View File

@@ -0,0 +1,16 @@
package com.amazonaws.auth;
import com.amazonaws.services.cognitoidentity.AmazonCognitoIdentity;
/* loaded from: classes.dex */
public final class AWSEnhancedCognitoIdentityProvider extends AWSAbstractCognitoIdentityProvider {
public AWSEnhancedCognitoIdentityProvider(String str, String str2, AmazonCognitoIdentity amazonCognitoIdentity) {
super(str, str2, amazonCognitoIdentity);
}
@Override // com.amazonaws.auth.AWSAbstractCognitoIdentityProvider, com.amazonaws.auth.AWSIdentityProvider
public String refresh() {
getIdentityId();
return null;
}
}

View File

@@ -0,0 +1,6 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public interface AWSIdentityProvider {
String refresh();
}

View File

@@ -0,0 +1,6 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public interface AWSSessionCredentials extends AWSCredentials {
String getSessionToken();
}

View File

@@ -0,0 +1,267 @@
package com.amazonaws.auth;
import com.amazonaws.AmazonClientException;
import com.amazonaws.Request;
import com.amazonaws.SDKGlobalConfiguration;
import com.amazonaws.internal.SdkDigestInputStream;
import com.amazonaws.util.Base64;
import com.amazonaws.util.BinaryUtils;
import com.amazonaws.util.HttpUtils;
import com.amazonaws.util.StringInputStream;
import com.amazonaws.util.StringUtils;
import com.facebook.internal.security.CertificateUtil;
import com.ironsource.v8;
import csdk.gluads.Consts;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
/* loaded from: classes.dex */
public abstract class AbstractAWSSigner implements Signer {
private static final int BUFFER_SIZE_MULTIPLIER = 5;
private static final int DEFAULT_BUFFER_SIZE = 1024;
private static final int TIME_MILLISEC = 1000;
private static final ThreadLocal<MessageDigest> SHA256_MESSAGE_DIGEST = new ThreadLocal<MessageDigest>() { // from class: com.amazonaws.auth.AbstractAWSSigner.1
@Override // java.lang.ThreadLocal
public MessageDigest initialValue() {
try {
return MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw new AmazonClientException("Unable to get SHA256 Function" + e.getMessage(), e);
}
}
};
public static final String EMPTY_STRING_SHA256_HEX = BinaryUtils.toHex(doHash(""));
public String signAndBase64Encode(String str, String str2, SigningAlgorithm signingAlgorithm) {
return signAndBase64Encode(str.getBytes(StringUtils.UTF8), str2, signingAlgorithm);
}
public String signAndBase64Encode(byte[] bArr, String str, SigningAlgorithm signingAlgorithm) {
try {
return Base64.encodeAsString(sign(bArr, str.getBytes(StringUtils.UTF8), signingAlgorithm));
} catch (Exception e) {
throw new AmazonClientException("Unable to calculate a request signature: " + e.getMessage(), e);
}
}
public byte[] sign(String str, byte[] bArr, SigningAlgorithm signingAlgorithm) {
try {
return sign(str.getBytes(StringUtils.UTF8), bArr, signingAlgorithm);
} catch (Exception e) {
throw new AmazonClientException("Unable to calculate a request signature: " + e.getMessage(), e);
}
}
public byte[] sign(byte[] bArr, byte[] bArr2, SigningAlgorithm signingAlgorithm) {
try {
Mac mac = Mac.getInstance(signingAlgorithm.toString());
mac.init(new SecretKeySpec(bArr2, signingAlgorithm.toString()));
return mac.doFinal(bArr);
} catch (Exception e) {
throw new AmazonClientException("Unable to calculate a request signature: " + e.getMessage(), e);
}
}
public byte[] hash(String str) {
return doHash(str);
}
public static byte[] doHash(String str) {
try {
MessageDigest messageDigestInstance = getMessageDigestInstance();
messageDigestInstance.update(str.getBytes(StringUtils.UTF8));
return messageDigestInstance.digest();
} catch (Exception e) {
throw new AmazonClientException("Unable to compute hash while signing request: " + e.getMessage(), e);
}
}
public byte[] hash(InputStream inputStream) {
try {
SdkDigestInputStream sdkDigestInputStream = new SdkDigestInputStream(inputStream, getMessageDigestInstance());
while (sdkDigestInputStream.read(new byte[1024]) > -1) {
}
return sdkDigestInputStream.getMessageDigest().digest();
} catch (Exception e) {
throw new AmazonClientException("Unable to compute hash while signing request: " + e.getMessage(), e);
}
}
public byte[] hash(byte[] bArr) {
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(bArr);
return messageDigest.digest();
} catch (Exception e) {
throw new AmazonClientException("Unable to compute hash while signing request: " + e.getMessage(), e);
}
}
public String getCanonicalizedQueryString(Map<String, String> map) {
TreeMap treeMap = new TreeMap();
for (Map.Entry<String, String> entry : map.entrySet()) {
treeMap.put(HttpUtils.urlEncode(entry.getKey(), false), HttpUtils.urlEncode(entry.getValue(), false));
}
StringBuilder sb = new StringBuilder();
Iterator it = treeMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry2 = (Map.Entry) it.next();
sb.append((String) entry2.getKey());
sb.append(v8.i.b);
sb.append((String) entry2.getValue());
if (it.hasNext()) {
sb.append(v8.i.c);
}
}
return sb.toString();
}
public String getCanonicalizedQueryString(Request<?> request) {
return HttpUtils.usePayloadForQueryParameters(request) ? "" : getCanonicalizedQueryString(request.getParameters());
}
public byte[] getBinaryRequestPayload(Request<?> request) {
if (HttpUtils.usePayloadForQueryParameters(request)) {
String encodeParameters = HttpUtils.encodeParameters(request);
return encodeParameters == null ? new byte[0] : encodeParameters.getBytes(StringUtils.UTF8);
}
return getBinaryRequestPayloadWithoutQueryParams(request);
}
public String getRequestPayload(Request<?> request) {
return newString(getBinaryRequestPayload(request));
}
public String getRequestPayloadWithoutQueryParams(Request<?> request) {
return newString(getBinaryRequestPayloadWithoutQueryParams(request));
}
public byte[] getBinaryRequestPayloadWithoutQueryParams(Request<?> request) {
InputStream binaryRequestPayloadStreamWithoutQueryParams = getBinaryRequestPayloadStreamWithoutQueryParams(request);
try {
binaryRequestPayloadStreamWithoutQueryParams.mark(-1);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bArr = new byte[Consts.APP_CUSTOM_DATA_LIMIT];
while (true) {
int read = binaryRequestPayloadStreamWithoutQueryParams.read(bArr);
if (read != -1) {
byteArrayOutputStream.write(bArr, 0, read);
} else {
byteArrayOutputStream.close();
binaryRequestPayloadStreamWithoutQueryParams.reset();
return byteArrayOutputStream.toByteArray();
}
}
} catch (Exception e) {
throw new AmazonClientException("Unable to read request payload to sign request: " + e.getMessage(), e);
}
}
public InputStream getBinaryRequestPayloadStream(Request<?> request) {
if (HttpUtils.usePayloadForQueryParameters(request)) {
String encodeParameters = HttpUtils.encodeParameters(request);
if (encodeParameters == null) {
return new ByteArrayInputStream(new byte[0]);
}
return new ByteArrayInputStream(encodeParameters.getBytes(StringUtils.UTF8));
}
return getBinaryRequestPayloadStreamWithoutQueryParams(request);
}
public InputStream getBinaryRequestPayloadStreamWithoutQueryParams(Request<?> request) {
try {
InputStream content = request.getContent();
if (content == null) {
return new ByteArrayInputStream(new byte[0]);
}
if (content instanceof StringInputStream) {
return content;
}
if (!content.markSupported()) {
throw new AmazonClientException("Unable to read request payload to sign request.");
}
return request.getContent();
} catch (Exception e) {
throw new AmazonClientException("Unable to read request payload to sign request: " + e.getMessage(), e);
}
}
public String getCanonicalizedResourcePath(String str) {
return getCanonicalizedResourcePath(str, true);
}
public String getCanonicalizedResourcePath(String str, boolean z) {
if (str == null || str.length() == 0) {
return "/";
}
if (z) {
str = HttpUtils.urlEncode(str, true);
}
return str.startsWith("/") ? str : "/".concat(str);
}
public String getCanonicalizedEndpoint(URI uri) {
String lowerCase = StringUtils.lowerCase(uri.getHost());
if (!HttpUtils.isUsingNonDefaultPort(uri)) {
return lowerCase;
}
return lowerCase + CertificateUtil.DELIMITER + uri.getPort();
}
public AWSCredentials sanitizeCredentials(AWSCredentials aWSCredentials) {
String aWSAccessKeyId;
String aWSSecretKey;
String sessionToken;
synchronized (aWSCredentials) {
try {
aWSAccessKeyId = aWSCredentials.getAWSAccessKeyId();
aWSSecretKey = aWSCredentials.getAWSSecretKey();
sessionToken = aWSCredentials instanceof AWSSessionCredentials ? ((AWSSessionCredentials) aWSCredentials).getSessionToken() : null;
} catch (Throwable th) {
throw th;
}
}
if (aWSSecretKey != null) {
aWSSecretKey = aWSSecretKey.trim();
}
if (aWSAccessKeyId != null) {
aWSAccessKeyId = aWSAccessKeyId.trim();
}
if (sessionToken != null) {
sessionToken = sessionToken.trim();
}
if (aWSCredentials instanceof AWSSessionCredentials) {
return new BasicSessionCredentials(aWSAccessKeyId, aWSSecretKey, sessionToken);
}
return new BasicAWSCredentials(aWSAccessKeyId, aWSSecretKey);
}
public String newString(byte[] bArr) {
return new String(bArr, StringUtils.UTF8);
}
public Date getSignatureDate(long j) {
Date date = new Date();
return j != 0 ? new Date(date.getTime() - (j * 1000)) : date;
}
public long getTimeOffset(Request<?> request) {
return SDKGlobalConfiguration.getGlobalTimeOffset() != 0 ? SDKGlobalConfiguration.getGlobalTimeOffset() : request.getTimeOffset();
}
public static MessageDigest getMessageDigestInstance() {
MessageDigest messageDigest = SHA256_MESSAGE_DIGEST.get();
messageDigest.reset();
return messageDigest;
}
}

View File

@@ -0,0 +1,14 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public class AnonymousAWSCredentials implements AWSCredentials {
@Override // com.amazonaws.auth.AWSCredentials
public String getAWSAccessKeyId() {
return null;
}
@Override // com.amazonaws.auth.AWSCredentials
public String getAWSSecretKey() {
return null;
}
}

View File

@@ -0,0 +1,28 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public class BasicAWSCredentials implements AWSCredentials {
public final String accessKey;
public final String secretKey;
@Override // com.amazonaws.auth.AWSCredentials
public String getAWSAccessKeyId() {
return this.accessKey;
}
@Override // com.amazonaws.auth.AWSCredentials
public String getAWSSecretKey() {
return this.secretKey;
}
public BasicAWSCredentials(String str, String str2) {
if (str == null) {
throw new IllegalArgumentException("Access key cannot be null.");
}
if (str2 == null) {
throw new IllegalArgumentException("Secret key cannot be null.");
}
this.accessKey = str;
this.secretKey = str2;
}
}

View File

@@ -0,0 +1,29 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public class BasicSessionCredentials implements AWSSessionCredentials {
public final String awsAccessKey;
public final String awsSecretKey;
public final String sessionToken;
@Override // com.amazonaws.auth.AWSCredentials
public String getAWSAccessKeyId() {
return this.awsAccessKey;
}
@Override // com.amazonaws.auth.AWSCredentials
public String getAWSSecretKey() {
return this.awsSecretKey;
}
@Override // com.amazonaws.auth.AWSSessionCredentials
public String getSessionToken() {
return this.sessionToken;
}
public BasicSessionCredentials(String str, String str2, String str3) {
this.awsAccessKey = str;
this.awsSecretKey = str2;
this.sessionToken = str3;
}
}

View File

@@ -0,0 +1,213 @@
package com.amazonaws.auth;
import android.content.Context;
import com.amazonaws.internal.keyvaluestore.AWSKeyValueStore;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.regions.Regions;
import com.amazonaws.util.VersionInfoUtils;
import csdk.gluads.Consts;
import java.util.Date;
/* loaded from: classes.dex */
public class CognitoCachingCredentialsProvider extends CognitoCredentialsProvider {
public AWSKeyValueStore awsKeyValueStore;
public String identityId;
public boolean isPersistenceEnabled;
public final IdentityChangedListener listener;
public volatile boolean needIdentityRefresh;
public String userAgentOverride;
public static final String USER_AGENT = CognitoCachingCredentialsProvider.class.getName() + "/" + VersionInfoUtils.getVersion();
public static final Log LOG = LogFactory.getLog(CognitoCachingCredentialsProvider.class);
public static final String AWS_KEY_VALUE_STORE_NAMESPACE_IDENTIFIER = "com.amazonaws.android.auth";
public static final String ID_KEY = "identityId";
public static final String AK_KEY = "accessKey";
public static final String SK_KEY = "secretKey";
public static final String ST_KEY = "sessionToken";
public static final String EXP_KEY = "expirationDate";
@Override // com.amazonaws.auth.CognitoCredentialsProvider
public String getUserAgent() {
String str = this.userAgentOverride;
return str != null ? str : USER_AGENT;
}
public CognitoCachingCredentialsProvider(Context context, String str, String str2, String str3, String str4, Regions regions) {
super(str, str2, str3, str4, regions);
this.needIdentityRefresh = false;
this.listener = new IdentityChangedListener() { // from class: com.amazonaws.auth.CognitoCachingCredentialsProvider.1
@Override // com.amazonaws.auth.IdentityChangedListener
public void identityChanged(String str5, String str6) {
CognitoCachingCredentialsProvider.LOG.debug("Identity id is changed");
CognitoCachingCredentialsProvider.this.saveIdentityId(str6);
CognitoCachingCredentialsProvider.this.clearCredentials();
}
};
this.isPersistenceEnabled = true;
if (context == null) {
throw new IllegalArgumentException("context can't be null");
}
initialize(context);
}
public final void initialize(Context context) {
this.awsKeyValueStore = new AWSKeyValueStore(context, AWS_KEY_VALUE_STORE_NAMESPACE_IDENTIFIER, this.isPersistenceEnabled);
checkUpgrade();
this.identityId = getCachedIdentityId();
loadCachedCredentials();
registerIdentityChangedListener(this.listener);
}
@Override // com.amazonaws.auth.CognitoCredentialsProvider
public String getIdentityId() {
if (this.needIdentityRefresh) {
this.needIdentityRefresh = false;
refresh();
String identityId = super.getIdentityId();
this.identityId = identityId;
saveIdentityId(identityId);
}
String cachedIdentityId = getCachedIdentityId();
this.identityId = cachedIdentityId;
if (cachedIdentityId == null) {
String identityId2 = super.getIdentityId();
this.identityId = identityId2;
saveIdentityId(identityId2);
}
return this.identityId;
}
@Override // com.amazonaws.auth.CognitoCredentialsProvider, com.amazonaws.auth.AWSCredentialsProvider
public AWSSessionCredentials getCredentials() {
AWSSessionCredentials aWSSessionCredentials;
this.credentialsLock.writeLock().lock();
try {
if (this.sessionCredentials == null) {
loadCachedCredentials();
}
if (this.sessionCredentialsExpiration == null || needsNewSession()) {
LOG.debug("Making a network call to fetch credentials.");
super.getCredentials();
Date date = this.sessionCredentialsExpiration;
if (date != null) {
saveCredentials(this.sessionCredentials, date.getTime());
}
aWSSessionCredentials = this.sessionCredentials;
} else {
aWSSessionCredentials = this.sessionCredentials;
}
this.credentialsLock.writeLock().unlock();
return aWSSessionCredentials;
} catch (Throwable th) {
this.credentialsLock.writeLock().unlock();
throw th;
}
}
@Override // com.amazonaws.auth.CognitoCredentialsProvider
public void refresh() {
this.credentialsLock.writeLock().lock();
try {
super.refresh();
Date date = this.sessionCredentialsExpiration;
if (date != null) {
saveCredentials(this.sessionCredentials, date.getTime());
}
} finally {
this.credentialsLock.writeLock().unlock();
}
}
@Override // com.amazonaws.auth.CognitoCredentialsProvider
public void clearCredentials() {
this.credentialsLock.writeLock().lock();
try {
super.clearCredentials();
LOG.debug("Clearing credentials from SharedPreferences");
this.awsKeyValueStore.remove(namespace(AK_KEY));
this.awsKeyValueStore.remove(namespace(SK_KEY));
this.awsKeyValueStore.remove(namespace(ST_KEY));
this.awsKeyValueStore.remove(namespace(EXP_KEY));
} finally {
this.credentialsLock.writeLock().unlock();
}
}
public String getCachedIdentityId() {
String str = this.awsKeyValueStore.get(namespace(ID_KEY));
if (str != null && this.identityId == null) {
super.setIdentityId(str);
}
return str;
}
public final void loadCachedCredentials() {
Log log = LOG;
log.debug("Loading credentials from SharedPreferences");
String str = this.awsKeyValueStore.get(namespace(EXP_KEY));
if (str == null) {
this.sessionCredentialsExpiration = null;
return;
}
try {
this.sessionCredentialsExpiration = new Date(Long.parseLong(str));
if (!hasCredentials()) {
this.sessionCredentialsExpiration = null;
return;
}
String str2 = this.awsKeyValueStore.get(namespace(AK_KEY));
String str3 = this.awsKeyValueStore.get(namespace(SK_KEY));
String str4 = this.awsKeyValueStore.get(namespace(ST_KEY));
if (str2 == null || str3 == null || str4 == null) {
log.debug("No valid credentials found in SharedPreferences");
this.sessionCredentialsExpiration = null;
} else {
this.sessionCredentials = new BasicSessionCredentials(str2, str3, str4);
}
} catch (NumberFormatException unused) {
this.sessionCredentialsExpiration = null;
}
}
public final boolean hasCredentials() {
boolean contains = this.awsKeyValueStore.contains(namespace(AK_KEY));
boolean contains2 = this.awsKeyValueStore.contains(namespace(SK_KEY));
boolean contains3 = this.awsKeyValueStore.contains(namespace(ST_KEY));
if (!contains && !contains2 && !contains3) {
return false;
}
LOG.debug("No valid credentials found in SharedPreferences");
return true;
}
public final void saveCredentials(AWSSessionCredentials aWSSessionCredentials, long j) {
LOG.debug("Saving credentials to SharedPreferences");
if (aWSSessionCredentials != null) {
this.awsKeyValueStore.put(namespace(AK_KEY), aWSSessionCredentials.getAWSAccessKeyId());
this.awsKeyValueStore.put(namespace(SK_KEY), aWSSessionCredentials.getAWSSecretKey());
this.awsKeyValueStore.put(namespace(ST_KEY), aWSSessionCredentials.getSessionToken());
this.awsKeyValueStore.put(namespace(EXP_KEY), String.valueOf(j));
}
}
public final void saveIdentityId(String str) {
LOG.debug("Saving identity id to SharedPreferences");
this.identityId = str;
this.awsKeyValueStore.put(namespace(ID_KEY), str);
}
public final void checkUpgrade() {
AWSKeyValueStore aWSKeyValueStore = this.awsKeyValueStore;
String str = ID_KEY;
if (aWSKeyValueStore.contains(str)) {
LOG.info("Identity id without namespace is detected. It will be saved under new namespace.");
String str2 = this.awsKeyValueStore.get(str);
this.awsKeyValueStore.clear();
this.awsKeyValueStore.put(namespace(str), str2);
}
}
public final String namespace(String str) {
return getIdentityPoolId() + Consts.STRING_PERIOD + str;
}
}

View File

@@ -0,0 +1,229 @@
package com.amazonaws.auth;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.SDKGlobalConfiguration;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.cognitoidentity.AmazonCognitoIdentity;
import com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityClient;
import com.amazonaws.services.cognitoidentity.model.Credentials;
import com.amazonaws.services.cognitoidentity.model.GetCredentialsForIdentityRequest;
import com.amazonaws.services.cognitoidentity.model.GetCredentialsForIdentityResult;
import com.amazonaws.services.securitytoken.AWSSecurityTokenService;
import com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClient;
import com.amazonaws.services.securitytoken.model.AssumeRoleWithWebIdentityRequest;
import com.firemint.realracing.Platform;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/* loaded from: classes.dex */
public class CognitoCredentialsProvider implements AWSCredentialsProvider {
public static final Log log = LogFactory.getLog(AWSCredentialsProviderChain.class);
public String authRoleArn;
public AmazonCognitoIdentity cib;
public final ReentrantReadWriteLock credentialsLock;
public String customRoleArn;
public final AWSCognitoIdentityProvider identityProvider;
public int refreshThreshold;
public final String region;
public AWSSecurityTokenService securityTokenService;
public AWSSessionCredentials sessionCredentials;
public Date sessionCredentialsExpiration;
public int sessionDuration;
public String token;
public String unauthRoleArn;
public final boolean useEnhancedFlow;
public String getUserAgent() {
return "";
}
public CognitoCredentialsProvider(String str, String str2, String str3, String str4, Regions regions) {
this(str, str2, str3, str4, regions, new ClientConfiguration());
}
public CognitoCredentialsProvider(String str, String str2, String str3, String str4, Regions regions, ClientConfiguration clientConfiguration) {
this(str, str2, str3, str4, createIdentityClient(clientConfiguration, regions), (str3 == null && str4 == null) ? null : new AWSSecurityTokenServiceClient(new AnonymousAWSCredentials(), clientConfiguration));
}
public static AmazonCognitoIdentityClient createIdentityClient(ClientConfiguration clientConfiguration, Regions regions) {
AmazonCognitoIdentityClient amazonCognitoIdentityClient = new AmazonCognitoIdentityClient(new AnonymousAWSCredentials(), clientConfiguration);
amazonCognitoIdentityClient.setRegion(Region.getRegion(regions));
return amazonCognitoIdentityClient;
}
public CognitoCredentialsProvider(String str, String str2, String str3, String str4, AmazonCognitoIdentityClient amazonCognitoIdentityClient, AWSSecurityTokenService aWSSecurityTokenService) {
this.cib = amazonCognitoIdentityClient;
this.region = amazonCognitoIdentityClient.getRegions().getName();
this.securityTokenService = aWSSecurityTokenService;
this.unauthRoleArn = str3;
this.authRoleArn = str4;
this.sessionDuration = Platform.INTERNET_CONNECTION_DELAY;
this.refreshThreshold = 500;
boolean z = str3 == null && str4 == null;
this.useEnhancedFlow = z;
if (z) {
this.identityProvider = new AWSEnhancedCognitoIdentityProvider(str, str2, amazonCognitoIdentityClient);
} else {
this.identityProvider = new AWSBasicCognitoIdentityProvider(str, str2, amazonCognitoIdentityClient);
}
this.credentialsLock = new ReentrantReadWriteLock(true);
}
public String getIdentityId() {
return this.identityProvider.getIdentityId();
}
public void setSessionCredentialsExpiration(Date date) {
this.credentialsLock.writeLock().lock();
try {
this.sessionCredentialsExpiration = date;
} finally {
this.credentialsLock.writeLock().unlock();
}
}
public String getIdentityPoolId() {
return this.identityProvider.getIdentityPoolId();
}
@Override // com.amazonaws.auth.AWSCredentialsProvider
public AWSSessionCredentials getCredentials() {
this.credentialsLock.writeLock().lock();
try {
if (needsNewSession()) {
startSession();
}
AWSSessionCredentials aWSSessionCredentials = this.sessionCredentials;
this.credentialsLock.writeLock().unlock();
return aWSSessionCredentials;
} catch (Throwable th) {
this.credentialsLock.writeLock().unlock();
throw th;
}
}
public void setIdentityId(String str) {
this.identityProvider.identityChanged(str);
}
public Map getLogins() {
return this.identityProvider.getLogins();
}
public void refresh() {
this.credentialsLock.writeLock().lock();
try {
startSession();
} finally {
this.credentialsLock.writeLock().unlock();
}
}
public void clearCredentials() {
this.credentialsLock.writeLock().lock();
try {
this.sessionCredentials = null;
this.sessionCredentialsExpiration = null;
} finally {
this.credentialsLock.writeLock().unlock();
}
}
public void startSession() {
try {
this.token = this.identityProvider.refresh();
} catch (AmazonServiceException e) {
if (e.getErrorCode().equals("ValidationException")) {
this.token = retryRefresh();
} else {
throw e;
}
}
if (this.useEnhancedFlow) {
populateCredentialsWithCognito(this.token);
} else {
populateCredentialsWithSts(this.token);
}
}
public final String retryRefresh() {
setIdentityId(null);
String refresh = this.identityProvider.refresh();
this.token = refresh;
return refresh;
}
public String getLoginsKey() {
return Regions.CN_NORTH_1.getName().equals(this.region) ? "cognito-identity.cn-north-1.amazonaws.com.cn" : "cognito-identity.amazonaws.com";
}
public final GetCredentialsForIdentityResult retryGetCredentialsForIdentity() {
Map logins;
String retryRefresh = retryRefresh();
this.token = retryRefresh;
if (retryRefresh != null && !retryRefresh.isEmpty()) {
logins = new HashMap();
logins.put(getLoginsKey(), this.token);
} else {
logins = getLogins();
}
return this.cib.getCredentialsForIdentity(new GetCredentialsForIdentityRequest().withIdentityId(getIdentityId()).withLogins(logins).withCustomRoleArn(this.customRoleArn));
}
public final void populateCredentialsWithCognito(String str) {
Map logins;
GetCredentialsForIdentityResult retryGetCredentialsForIdentity;
if (str != null && !str.isEmpty()) {
logins = new HashMap();
logins.put(getLoginsKey(), str);
} else {
logins = getLogins();
}
try {
retryGetCredentialsForIdentity = this.cib.getCredentialsForIdentity(new GetCredentialsForIdentityRequest().withIdentityId(getIdentityId()).withLogins(logins).withCustomRoleArn(this.customRoleArn));
} catch (AmazonServiceException e) {
if (e.getErrorCode().equals("ValidationException")) {
retryGetCredentialsForIdentity = retryGetCredentialsForIdentity();
} else {
throw e;
}
}
Credentials credentials = retryGetCredentialsForIdentity.getCredentials();
this.sessionCredentials = new BasicSessionCredentials(credentials.getAccessKeyId(), credentials.getSecretKey(), credentials.getSessionToken());
setSessionCredentialsExpiration(credentials.getExpiration());
if (retryGetCredentialsForIdentity.getIdentityId().equals(getIdentityId())) {
return;
}
setIdentityId(retryGetCredentialsForIdentity.getIdentityId());
}
public final void populateCredentialsWithSts(String str) {
AssumeRoleWithWebIdentityRequest withDurationSeconds = new AssumeRoleWithWebIdentityRequest().withWebIdentityToken(str).withRoleArn(this.identityProvider.isAuthenticated() ? this.authRoleArn : this.unauthRoleArn).withRoleSessionName("ProviderSession").withDurationSeconds(Integer.valueOf(this.sessionDuration));
appendUserAgent(withDurationSeconds, getUserAgent());
com.amazonaws.services.securitytoken.model.Credentials credentials = this.securityTokenService.assumeRoleWithWebIdentity(withDurationSeconds).getCredentials();
this.sessionCredentials = new BasicSessionCredentials(credentials.getAccessKeyId(), credentials.getSecretAccessKey(), credentials.getSessionToken());
setSessionCredentialsExpiration(credentials.getExpiration());
}
public boolean needsNewSession() {
if (this.sessionCredentials == null) {
return true;
}
return this.sessionCredentialsExpiration.getTime() - (System.currentTimeMillis() - (SDKGlobalConfiguration.getGlobalTimeOffset() * 1000)) < ((long) (this.refreshThreshold * 1000));
}
public final void appendUserAgent(AmazonWebServiceRequest amazonWebServiceRequest, String str) {
amazonWebServiceRequest.getRequestClientOptions().appendUserAgent(str);
}
public void registerIdentityChangedListener(IdentityChangedListener identityChangedListener) {
this.identityProvider.registerIdentityChangedListener(identityChangedListener);
}
}

View File

@@ -0,0 +1,6 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public interface IdentityChangedListener {
void identityChanged(String str, String str2);
}

View File

@@ -0,0 +1,10 @@
package com.amazonaws.auth;
import com.amazonaws.Request;
/* loaded from: classes.dex */
public class NoOpSigner implements Signer {
@Override // com.amazonaws.auth.Signer
public void sign(Request<?> request, AWSCredentials aWSCredentials) {
}
}

View File

@@ -0,0 +1,44 @@
package com.amazonaws.auth;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
/* loaded from: classes.dex */
public class PropertiesCredentials implements AWSCredentials {
public final String accessKey;
public final String secretAccessKey;
@Override // com.amazonaws.auth.AWSCredentials
public String getAWSAccessKeyId() {
return this.accessKey;
}
@Override // com.amazonaws.auth.AWSCredentials
public String getAWSSecretKey() {
return this.secretAccessKey;
}
public PropertiesCredentials(File file) {
if (!file.exists()) {
throw new FileNotFoundException("File doesn't exist: " + file.getAbsolutePath());
}
FileInputStream fileInputStream = new FileInputStream(file);
try {
Properties properties = new Properties();
properties.load(fileInputStream);
if (properties.getProperty("accessKey") == null || properties.getProperty("secretKey") == null) {
throw new IllegalArgumentException("The specified file (" + file.getAbsolutePath() + ") doesn't contain the expected properties 'accessKey' and 'secretKey'.");
}
this.accessKey = properties.getProperty("accessKey");
this.secretAccessKey = properties.getProperty("secretKey");
} finally {
try {
fileInputStream.close();
} catch (IOException unused) {
}
}
}
}

View File

@@ -0,0 +1,94 @@
package com.amazonaws.auth;
import com.amazonaws.AmazonClientException;
import com.amazonaws.Request;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.TimeZone;
import java.util.TreeMap;
/* loaded from: classes.dex */
public class QueryStringSigner extends AbstractAWSSigner implements Signer {
private Date overriddenDate;
public void overrideDate(Date date) {
this.overriddenDate = date;
}
@Override // com.amazonaws.auth.Signer
public void sign(Request<?> request, AWSCredentials aWSCredentials) {
sign(request, SignatureVersion.V2, SigningAlgorithm.HmacSHA256, aWSCredentials);
}
public void sign(Request<?> request, SignatureVersion signatureVersion, SigningAlgorithm signingAlgorithm, AWSCredentials aWSCredentials) {
String calculateStringToSignV2;
if (aWSCredentials instanceof AnonymousAWSCredentials) {
return;
}
AWSCredentials sanitizeCredentials = sanitizeCredentials(aWSCredentials);
request.addParameter("AWSAccessKeyId", sanitizeCredentials.getAWSAccessKeyId());
request.addParameter("SignatureVersion", signatureVersion.toString());
request.addParameter("Timestamp", getFormattedTimestamp(getTimeOffset(request)));
if (sanitizeCredentials instanceof AWSSessionCredentials) {
addSessionCredentials(request, (AWSSessionCredentials) sanitizeCredentials);
}
if (signatureVersion.equals(SignatureVersion.V1)) {
calculateStringToSignV2 = calculateStringToSignV1(request.getParameters());
} else if (signatureVersion.equals(SignatureVersion.V2)) {
request.addParameter("SignatureMethod", signingAlgorithm.toString());
calculateStringToSignV2 = calculateStringToSignV2(request);
} else {
throw new AmazonClientException("Invalid Signature Version specified");
}
request.addParameter("Signature", signAndBase64Encode(calculateStringToSignV2, sanitizeCredentials.getAWSSecretKey(), signingAlgorithm));
}
private String calculateStringToSignV1(Map<String, String> map) {
StringBuilder sb = new StringBuilder();
TreeMap treeMap = new TreeMap(String.CASE_INSENSITIVE_ORDER);
treeMap.putAll(map);
for (Map.Entry entry : treeMap.entrySet()) {
sb.append((String) entry.getKey());
sb.append((String) entry.getValue());
}
return sb.toString();
}
private String calculateStringToSignV2(Request<?> request) {
return "POST\n" + getCanonicalizedEndpoint(request.getEndpoint()) + "\n" + getCanonicalizedResourcePath(request) + "\n" + getCanonicalizedQueryString(request.getParameters());
}
private String getCanonicalizedResourcePath(Request<?> request) {
String str = "";
if (request.getEndpoint().getPath() != null) {
str = "" + request.getEndpoint().getPath();
}
if (request.getResourcePath() != null) {
if (str.length() > 0 && !str.endsWith("/") && !request.getResourcePath().startsWith("/")) {
str = str + "/";
}
str = str + request.getResourcePath();
} else if (!str.endsWith("/")) {
str = str + "/";
}
if (!str.startsWith("/")) {
str = "/" + str;
}
return str.startsWith("//") ? str.substring(1) : str;
}
private String getFormattedTimestamp(long j) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date = this.overriddenDate;
if (date != null) {
return simpleDateFormat.format(date);
}
return simpleDateFormat.format(getSignatureDate(j));
}
public void addSessionCredentials(Request<?> request, AWSSessionCredentials aWSSessionCredentials) {
request.addParameter("SecurityToken", aWSSessionCredentials.getSessionToken());
}
}

View File

@@ -0,0 +1,6 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public interface RegionAwareSigner extends Signer {
void setRegionName(String str);
}

View File

@@ -0,0 +1,6 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public interface ServiceAwareSigner extends Signer {
void setServiceName(String str);
}

View File

@@ -0,0 +1,18 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public enum SignatureVersion {
V1("1"),
V2("2");
private String value;
@Override // java.lang.Enum
public String toString() {
return this.value;
}
SignatureVersion(String str) {
this.value = str;
}
}

View File

@@ -0,0 +1,8 @@
package com.amazonaws.auth;
import com.amazonaws.Request;
/* loaded from: classes.dex */
public interface Signer {
void sign(Request request, AWSCredentials aWSCredentials);
}

View File

@@ -0,0 +1,48 @@
package com.amazonaws.auth;
import com.amazonaws.internal.config.InternalConfig;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/* loaded from: classes.dex */
public abstract class SignerFactory {
public static final Map SIGNERS;
static {
ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap();
SIGNERS = concurrentHashMap;
concurrentHashMap.put("QueryStringSignerType", QueryStringSigner.class);
concurrentHashMap.put("AWS4SignerType", AWS4Signer.class);
concurrentHashMap.put("NoOpSignerType", NoOpSigner.class);
}
public static Signer getSigner(String str, String str2) {
return lookupAndCreateSigner(str, str2);
}
public static Signer getSignerByTypeAndService(String str, String str2) {
return createSigner(str, str2);
}
public static Signer lookupAndCreateSigner(String str, String str2) {
return createSigner(InternalConfig.Factory.getInternalConfig().getSignerConfig(str, str2).getSignerType(), str);
}
public static Signer createSigner(String str, String str2) {
Class cls = (Class) SIGNERS.get(str);
if (cls == null) {
throw new IllegalArgumentException();
}
try {
Signer signer = (Signer) cls.newInstance();
if (signer instanceof ServiceAwareSigner) {
((ServiceAwareSigner) signer).setServiceName(str2);
}
return signer;
} catch (IllegalAccessException e) {
throw new IllegalStateException("Cannot create an instance of " + cls.getName(), e);
} catch (InstantiationException e2) {
throw new IllegalStateException("Cannot create an instance of " + cls.getName(), e2);
}
}
}

View File

@@ -0,0 +1,7 @@
package com.amazonaws.auth;
/* loaded from: classes.dex */
public enum SigningAlgorithm {
HmacSHA1,
HmacSHA256
}

View File

@@ -0,0 +1,10 @@
package com.amazonaws.handlers;
/* loaded from: classes.dex */
public abstract /* synthetic */ class HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0 {
public static /* synthetic */ void m(Object obj) {
if (obj != null) {
throw new ClassCastException();
}
}
}

View File

@@ -0,0 +1,82 @@
package com.amazonaws.handlers;
import com.amazonaws.AmazonClientException;
import com.amazonaws.util.ClassLoaderHelper;
import com.amazonaws.util.StringUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public class HandlerChainFactory {
public List newRequestHandlerChain(String str) {
return createRequestHandlerChain(str, RequestHandler.class);
}
public List newRequestHandler2Chain(String str) {
return createRequestHandlerChain(str, RequestHandler2.class);
}
public final List createRequestHandlerChain(String str, Class cls) {
ArrayList arrayList = new ArrayList();
BufferedReader bufferedReader = null;
try {
try {
InputStream resourceAsStream = getClass().getResourceAsStream(str);
if (resourceAsStream == null) {
return arrayList;
}
BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(resourceAsStream, StringUtils.UTF8));
while (true) {
try {
String readLine = bufferedReader2.readLine();
if (readLine != null) {
String trim = readLine.trim();
if (!"".equals(trim)) {
Object newInstance = ClassLoaderHelper.loadClass(trim, cls, getClass()).newInstance();
if (!cls.isInstance(newInstance)) {
throw new AmazonClientException("Unable to instantiate request handler chain for client. Listed request handler ('" + trim + "') does not implement the " + cls + " API.");
}
if (cls == RequestHandler2.class) {
arrayList.add((RequestHandler2) newInstance);
} else if (cls == RequestHandler.class) {
HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0.m(newInstance);
arrayList.add(RequestHandler2.adapt(null));
} else {
throw new IllegalStateException();
}
}
} else {
try {
bufferedReader2.close();
} catch (IOException unused) {
}
return arrayList;
}
} catch (Exception e) {
e = e;
bufferedReader = bufferedReader2;
throw new AmazonClientException("Unable to instantiate request handler chain for client: " + e.getMessage(), e);
} catch (Throwable th) {
th = th;
bufferedReader = bufferedReader2;
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException unused2) {
}
}
throw th;
}
}
} catch (Exception e2) {
e = e2;
}
} catch (Throwable th2) {
th = th2;
}
}
}

View File

@@ -0,0 +1,6 @@
package com.amazonaws.handlers;
@Deprecated
/* loaded from: classes.dex */
public interface RequestHandler {
}

View File

@@ -0,0 +1,17 @@
package com.amazonaws.handlers;
import com.amazonaws.Request;
import com.amazonaws.Response;
/* loaded from: classes.dex */
public abstract class RequestHandler2 {
public abstract void afterError(Request request, Response response, Exception exc);
public abstract void afterResponse(Request request, Response response);
public abstract void beforeRequest(Request request);
public static RequestHandler2 adapt(RequestHandler requestHandler) {
return new RequestHandler2Adaptor(requestHandler);
}
}

View File

@@ -0,0 +1,49 @@
package com.amazonaws.handlers;
import com.amazonaws.Request;
import com.amazonaws.Response;
import com.amazonaws.util.AWSRequestMetrics;
/* loaded from: classes.dex */
final class RequestHandler2Adaptor extends RequestHandler2 {
public RequestHandler2Adaptor(RequestHandler requestHandler) {
if (requestHandler == null) {
throw new IllegalArgumentException();
}
}
@Override // com.amazonaws.handlers.RequestHandler2
public void beforeRequest(Request request) {
throw null;
}
@Override // com.amazonaws.handlers.RequestHandler2
public void afterResponse(Request request, Response response) {
AWSRequestMetrics aWSRequestMetrics = request == null ? null : request.getAWSRequestMetrics();
if (response != null) {
response.getAwsResponse();
}
if (aWSRequestMetrics != null) {
aWSRequestMetrics.getTimingInfo();
throw null;
}
throw null;
}
@Override // com.amazonaws.handlers.RequestHandler2
public void afterError(Request request, Response response, Exception exc) {
throw null;
}
public int hashCode() {
throw null;
}
public boolean equals(Object obj) {
if (!(obj instanceof RequestHandler2Adaptor)) {
return false;
}
((RequestHandler2Adaptor) obj).getClass();
throw null;
}
}

View File

@@ -0,0 +1,329 @@
package com.amazonaws.http;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.AmazonWebServiceResponse;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.Request;
import com.amazonaws.RequestClientOptions;
import com.amazonaws.Response;
import com.amazonaws.handlers.RequestHandler2;
import com.amazonaws.internal.CRC32MismatchException;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.metrics.RequestMetricCollector;
import com.amazonaws.retry.RetryPolicy;
import com.amazonaws.util.AWSRequestMetrics;
import com.amazonaws.util.DateUtils;
import com.amazonaws.util.TimingInfo;
import com.amazonaws.util.URIBuilder;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import org.apache.http.HttpStatus;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.dex */
public class AmazonHttpClient {
public static final Log REQUEST_LOG = LogFactory.getLog("com.amazonaws.request");
public static final Log log = LogFactory.getLog(AmazonHttpClient.class);
public final ClientConfiguration config;
public final HttpClient httpClient;
public final HttpRequestFactory requestFactory = new HttpRequestFactory();
public final RequestMetricCollector requestMetricCollector = null;
public RequestMetricCollector getRequestMetricCollector() {
return this.requestMetricCollector;
}
public AmazonHttpClient(ClientConfiguration clientConfiguration, HttpClient httpClient) {
this.config = clientConfiguration;
this.httpClient = httpClient;
}
public Response execute(Request request, HttpResponseHandler httpResponseHandler, HttpResponseHandler httpResponseHandler2, ExecutionContext executionContext) {
Response response;
if (request.getHostPrefix() != null) {
try {
URI endpoint = request.getEndpoint();
request.setEndpoint(URIBuilder.builder(endpoint).host(request.getHostPrefix() + endpoint.getHost()).build());
} catch (URISyntaxException e) {
Log log2 = log;
if (log2.isDebugEnabled()) {
log2.debug("Failed to prepend host prefix: " + e.getMessage(), e);
}
}
}
if (executionContext == null) {
throw new AmazonClientException("Internal SDK Error: No execution context parameter specified.");
}
List requestHandler2s = requestHandler2s(request, executionContext);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
try {
response = executeHelper(request, httpResponseHandler, httpResponseHandler2, executionContext);
} catch (AmazonClientException e2) {
e = e2;
response = null;
}
try {
afterResponse(request, requestHandler2s, response, awsRequestMetrics.getTimingInfo().endTiming());
return response;
} catch (AmazonClientException e3) {
e = e3;
afterError(request, response, requestHandler2s, e);
throw e;
}
}
public void afterError(Request request, Response response, List list, AmazonClientException amazonClientException) {
Iterator it = list.iterator();
while (it.hasNext()) {
((RequestHandler2) it.next()).afterError(request, response, amazonClientException);
}
}
public void afterResponse(Request request, List list, Response response, TimingInfo timingInfo) {
Iterator it = list.iterator();
while (it.hasNext()) {
((RequestHandler2) it.next()).afterResponse(request, response);
}
}
public List requestHandler2s(Request request, ExecutionContext executionContext) {
List requestHandler2s = executionContext.getRequestHandler2s();
if (requestHandler2s == null) {
return Collections.emptyList();
}
Iterator it = requestHandler2s.iterator();
while (it.hasNext()) {
((RequestHandler2) it.next()).beforeRequest(request);
}
return requestHandler2s;
}
/* JADX WARN: Removed duplicated region for block: B:41:0x0473 */
/* JADX WARN: Removed duplicated region for block: B:54:? A[SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:64:0x03ec A[Catch: all -> 0x03ab, TRY_ENTER, TryCatch #6 {all -> 0x03ab, blocks: (B:61:0x03e2, B:64:0x03ec, B:65:0x0402, B:67:0x0444, B:81:0x0470, B:246:0x03a5, B:247:0x03aa), top: B:60:0x03e2 }] */
/* JADX WARN: Removed duplicated region for block: B:67:0x0444 A[Catch: all -> 0x03ab, TRY_LEAVE, TryCatch #6 {all -> 0x03ab, blocks: (B:61:0x03e2, B:64:0x03ec, B:65:0x0402, B:67:0x0444, B:81:0x0470, B:246:0x03a5, B:247:0x03aa), top: B:60:0x03e2 }] */
/* JADX WARN: Removed duplicated region for block: B:80:0x0470 A[SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public com.amazonaws.Response executeHelper(com.amazonaws.Request r27, com.amazonaws.http.HttpResponseHandler r28, com.amazonaws.http.HttpResponseHandler r29, com.amazonaws.http.ExecutionContext r30) {
/*
Method dump skipped, instructions count: 1162
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.amazonaws.http.AmazonHttpClient.executeHelper(com.amazonaws.Request, com.amazonaws.http.HttpResponseHandler, com.amazonaws.http.HttpResponseHandler, com.amazonaws.http.ExecutionContext):com.amazonaws.Response");
}
public final Throwable handleUnexpectedFailure(Throwable th, AWSRequestMetrics aWSRequestMetrics) {
AWSRequestMetrics.Field field = AWSRequestMetrics.Field.Exception;
aWSRequestMetrics.incrementCounter(field);
aWSRequestMetrics.addProperty(field, th);
return th;
}
public void resetRequestAfterError(Request request, Exception exc) {
if (request.getContent() == null) {
return;
}
if (!request.getContent().markSupported()) {
throw new AmazonClientException("Encountered an exception and stream is not resettable", exc);
}
try {
request.getContent().reset();
} catch (IOException unused) {
throw new AmazonClientException("Encountered an exception and couldn't reset the stream to retry", exc);
}
}
public void setUserAgent(Request request) {
RequestClientOptions requestClientOptions;
String clientMarker;
String str = ClientConfiguration.DEFAULT_USER_AGENT;
AmazonWebServiceRequest originalRequest = request.getOriginalRequest();
String createUserAgentString = (originalRequest == null || (requestClientOptions = originalRequest.getRequestClientOptions()) == null || (clientMarker = requestClientOptions.getClientMarker(RequestClientOptions.Marker.USER_AGENT)) == null) ? str : createUserAgentString(str, clientMarker);
if (!str.equals(this.config.getUserAgent())) {
createUserAgentString = createUserAgentString(createUserAgentString, this.config.getUserAgent());
}
if (this.config.getUserAgentOverride() != null) {
createUserAgentString = this.config.getUserAgentOverride();
}
request.addHeader("User-Agent", createUserAgentString);
}
public static String createUserAgentString(String str, String str2) {
if (str.contains(str2)) {
return str;
}
return str.trim() + " " + str2.trim();
}
public void shutdown() {
this.httpClient.shutdown();
}
public final boolean shouldRetry(AmazonWebServiceRequest amazonWebServiceRequest, InputStream inputStream, AmazonClientException amazonClientException, int i, RetryPolicy retryPolicy) {
int i2 = i - 1;
int maxErrorRetry = this.config.getMaxErrorRetry();
if (maxErrorRetry < 0 || !retryPolicy.isMaxErrorRetryInClientConfigHonored()) {
maxErrorRetry = retryPolicy.getMaxErrorRetry();
}
if (i2 >= maxErrorRetry) {
return false;
}
if (inputStream != null && !inputStream.markSupported()) {
Log log2 = log;
if (log2.isDebugEnabled()) {
log2.debug("Content not repeatable");
}
return false;
}
return retryPolicy.getRetryCondition().shouldRetry(amazonWebServiceRequest, amazonClientException, i2);
}
public static boolean isTemporaryRedirect(HttpResponse httpResponse) {
int statusCode = httpResponse.getStatusCode();
String str = (String) httpResponse.getHeaders().get("Location");
return (statusCode != 307 || str == null || str.isEmpty()) ? false : true;
}
public final boolean isRequestSuccessful(HttpResponse httpResponse) {
int statusCode = httpResponse.getStatusCode();
return statusCode >= 200 && statusCode < 300;
}
public Object handleResponse(Request request, HttpResponseHandler httpResponseHandler, HttpResponse httpResponse, ExecutionContext executionContext) {
try {
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
AWSRequestMetrics.Field field = AWSRequestMetrics.Field.ResponseProcessingTime;
awsRequestMetrics.startEvent(field);
try {
AmazonWebServiceResponse amazonWebServiceResponse = (AmazonWebServiceResponse) httpResponseHandler.handle(httpResponse);
awsRequestMetrics.endEvent(field);
if (amazonWebServiceResponse == null) {
throw new RuntimeException("Unable to unmarshall response metadata. Response Code: " + httpResponse.getStatusCode() + ", Response Text: " + httpResponse.getStatusText());
}
Log log2 = REQUEST_LOG;
if (log2.isDebugEnabled()) {
log2.debug("Received successful response: " + httpResponse.getStatusCode() + ", AWS Request ID: " + amazonWebServiceResponse.getRequestId());
}
awsRequestMetrics.addProperty(AWSRequestMetrics.Field.AWSRequestID, amazonWebServiceResponse.getRequestId());
return amazonWebServiceResponse.getResult();
} catch (Throwable th) {
awsRequestMetrics.endEvent(AWSRequestMetrics.Field.ResponseProcessingTime);
throw th;
}
} catch (CRC32MismatchException e) {
throw e;
} catch (IOException e2) {
throw e2;
} catch (Exception e3) {
throw new AmazonClientException("Unable to unmarshall response (" + e3.getMessage() + "). Response Code: " + httpResponse.getStatusCode() + ", Response Text: " + httpResponse.getStatusText(), e3);
}
}
public AmazonServiceException handleErrorResponse(Request request, HttpResponseHandler httpResponseHandler, HttpResponse httpResponse) {
AmazonServiceException amazonServiceException;
int statusCode = httpResponse.getStatusCode();
try {
amazonServiceException = (AmazonServiceException) httpResponseHandler.handle(httpResponse);
REQUEST_LOG.debug("Received error response: " + amazonServiceException.toString());
} catch (Exception e) {
if (statusCode == 413) {
amazonServiceException = new AmazonServiceException("Request entity too large");
amazonServiceException.setServiceName(request.getServiceName());
amazonServiceException.setStatusCode(HttpStatus.SC_REQUEST_TOO_LONG);
amazonServiceException.setErrorType(AmazonServiceException.ErrorType.Client);
amazonServiceException.setErrorCode("Request entity too large");
} else if (statusCode == 503 && "Service Unavailable".equalsIgnoreCase(httpResponse.getStatusText())) {
amazonServiceException = new AmazonServiceException("Service unavailable");
amazonServiceException.setServiceName(request.getServiceName());
amazonServiceException.setStatusCode(HttpStatus.SC_SERVICE_UNAVAILABLE);
amazonServiceException.setErrorType(AmazonServiceException.ErrorType.Service);
amazonServiceException.setErrorCode("Service unavailable");
} else {
if (e instanceof IOException) {
throw ((IOException) e);
}
throw new AmazonClientException("Unable to unmarshall error response (" + e.getMessage() + "). Response Code: " + statusCode + ", Response Text: " + httpResponse.getStatusText() + ", Response Headers: " + httpResponse.getHeaders(), e);
}
}
amazonServiceException.setStatusCode(statusCode);
amazonServiceException.setServiceName(request.getServiceName());
amazonServiceException.fillInStackTrace();
return amazonServiceException;
}
public final long pauseBeforeNextRetry(AmazonWebServiceRequest amazonWebServiceRequest, AmazonClientException amazonClientException, int i, RetryPolicy retryPolicy) {
int i2 = i - 2;
long delayBeforeNextRetry = retryPolicy.getBackoffStrategy().delayBeforeNextRetry(amazonWebServiceRequest, amazonClientException, i2);
Log log2 = log;
if (log2.isDebugEnabled()) {
log2.debug("Retriable error detected, will retry in " + delayBeforeNextRetry + "ms, attempt number: " + i2);
}
try {
Thread.sleep(delayBeforeNextRetry);
return delayBeforeNextRetry;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new AmazonClientException(e.getMessage(), e);
}
}
public final String getServerDateFromException(String str) {
int indexOf;
int indexOf2 = str.indexOf("(");
if (str.contains(" + 15")) {
indexOf = str.indexOf(" + 15");
} else {
indexOf = str.indexOf(" - 15");
}
return str.substring(indexOf2 + 1, indexOf);
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r4v12 */
/* JADX WARN: Type inference failed for: r4v3, types: [java.lang.String] */
public long parseClockSkewOffset(HttpResponse httpResponse, AmazonServiceException amazonServiceException) {
Date parseRFC822Date;
Date date = new Date();
String str = (String) httpResponse.getHeaders().get(HTTP.DATE_HEADER);
try {
if (str != 0) {
try {
if (!str.isEmpty()) {
parseRFC822Date = DateUtils.parseRFC822Date(str);
long time = date.getTime() - parseRFC822Date.getTime();
str = 1000;
return time / 1000;
}
} catch (RuntimeException e) {
e = e;
str = 0;
log.warn("Unable to parse clock skew offset from response: " + str, e);
return 0L;
}
}
parseRFC822Date = DateUtils.parseCompressedISO8601Date(getServerDateFromException(amazonServiceException.getMessage()));
long time2 = date.getTime() - parseRFC822Date.getTime();
str = 1000;
return time2 / 1000;
} catch (RuntimeException e2) {
e = e2;
}
}
public void finalize() {
shutdown();
super.finalize();
}
}

View File

@@ -0,0 +1,64 @@
package com.amazonaws.http;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.util.IOUtils;
import com.amazonaws.util.XpathUtils;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import org.w3c.dom.Document;
/* loaded from: classes.dex */
public class DefaultErrorResponseHandler implements HttpResponseHandler<AmazonServiceException> {
public static final Log log = LogFactory.getLog(DefaultErrorResponseHandler.class);
public List unmarshallerList;
@Override // com.amazonaws.http.HttpResponseHandler
public boolean needsConnectionLeftOpen() {
return false;
}
public DefaultErrorResponseHandler(List list) {
this.unmarshallerList = list;
}
@Override // com.amazonaws.http.HttpResponseHandler
public AmazonServiceException handle(HttpResponse httpResponse) {
try {
String iOUtils = IOUtils.toString(httpResponse.getContent());
try {
Document documentFrom = XpathUtils.documentFrom(iOUtils);
Iterator it = this.unmarshallerList.iterator();
while (it.hasNext()) {
AmazonServiceException amazonServiceException = (AmazonServiceException) ((Unmarshaller) it.next()).unmarshall(documentFrom);
if (amazonServiceException != null) {
amazonServiceException.setStatusCode(httpResponse.getStatusCode());
return amazonServiceException;
}
}
throw new AmazonClientException("Unable to unmarshall error response from service");
} catch (Exception e) {
return newAmazonServiceException(String.format("Unable to unmarshall error response (%s)", iOUtils), httpResponse, e);
}
} catch (IOException e2) {
Log log2 = log;
if (log2.isDebugEnabled()) {
log2.debug("Failed in reading the error response", e2);
}
return newAmazonServiceException("Unable to unmarshall error response", httpResponse, e2);
}
}
public final AmazonServiceException newAmazonServiceException(String str, HttpResponse httpResponse, Exception exc) {
AmazonServiceException amazonServiceException = new AmazonServiceException(str, exc);
int statusCode = httpResponse.getStatusCode();
amazonServiceException.setErrorCode(statusCode + " " + httpResponse.getStatusText());
amazonServiceException.setErrorType(AmazonServiceException.ErrorType.Unknown);
amazonServiceException.setStatusCode(statusCode);
return amazonServiceException;
}
}

View File

@@ -0,0 +1,52 @@
package com.amazonaws.http;
import com.amazonaws.AmazonWebServiceClient;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.Signer;
import com.amazonaws.util.AWSRequestMetrics;
import com.amazonaws.util.AWSRequestMetricsFullSupport;
import java.net.URI;
import java.util.List;
/* loaded from: classes.dex */
public class ExecutionContext {
public final AmazonWebServiceClient awsClient;
public final AWSRequestMetrics awsRequestMetrics;
public String contextUserAgent;
public AWSCredentials credentials;
public final List requestHandler2s;
public AWSRequestMetrics getAwsRequestMetrics() {
return this.awsRequestMetrics;
}
public String getContextUserAgent() {
return this.contextUserAgent;
}
public AWSCredentials getCredentials() {
return this.credentials;
}
public List getRequestHandler2s() {
return this.requestHandler2s;
}
public void setCredentials(AWSCredentials aWSCredentials) {
this.credentials = aWSCredentials;
}
public ExecutionContext(List list, boolean z, AmazonWebServiceClient amazonWebServiceClient) {
this.requestHandler2s = list;
this.awsRequestMetrics = z ? new AWSRequestMetricsFullSupport() : new AWSRequestMetrics();
this.awsClient = amazonWebServiceClient;
}
public Signer getSignerByURI(URI uri) {
AmazonWebServiceClient amazonWebServiceClient = this.awsClient;
if (amazonWebServiceClient == null) {
return null;
}
return amazonWebServiceClient.getSignerByURI(uri);
}
}

View File

@@ -0,0 +1,8 @@
package com.amazonaws.http;
/* loaded from: classes.dex */
public interface HttpClient {
HttpResponse execute(HttpRequest httpRequest);
void shutdown();
}

View File

@@ -0,0 +1,11 @@
package com.amazonaws.http;
/* loaded from: classes.dex */
public enum HttpMethodName {
GET,
POST,
PUT,
DELETE,
HEAD,
PATCH
}

View File

@@ -0,0 +1,63 @@
package com.amazonaws.http;
import com.amazonaws.util.StringUtils;
import java.io.InputStream;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.dex */
public class HttpRequest {
public final InputStream content;
public final Map headers;
public boolean isStreaming;
public final String method;
public URI uri;
public InputStream getContent() {
return this.content;
}
public Map getHeaders() {
return this.headers;
}
public String getMethod() {
return this.method;
}
public URI getUri() {
return this.uri;
}
public boolean isStreaming() {
return this.isStreaming;
}
public void setStreaming(boolean z) {
this.isStreaming = z;
}
public HttpRequest(String str, URI uri, Map map, InputStream inputStream) {
Map unmodifiableMap;
this.method = StringUtils.upperCase(str);
this.uri = uri;
if (map == null) {
unmodifiableMap = Collections.EMPTY_MAP;
} else {
unmodifiableMap = Collections.unmodifiableMap(map);
}
this.headers = unmodifiableMap;
this.content = inputStream;
}
public long getContentLength() {
String str;
Map map = this.headers;
if (map == null || (str = (String) map.get(HTTP.CONTENT_LEN)) == null || str.isEmpty()) {
return 0L;
}
return Long.valueOf(str).longValue();
}
}

View File

@@ -0,0 +1,85 @@
package com.amazonaws.http;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.Request;
import com.amazonaws.util.HttpUtils;
import com.amazonaws.util.StringUtils;
import com.facebook.internal.security.CertificateUtil;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.dex */
public class HttpRequestFactory {
public HttpRequest createHttpRequest(Request request, ClientConfiguration clientConfiguration, ExecutionContext executionContext) {
String appendUri;
URI endpoint = request.getEndpoint();
boolean z = true;
if (request.getEncodedUriResourcePath() != null) {
appendUri = HttpUtils.appendUriEncoded(endpoint.toString(), request.getEncodedUriResourcePath());
} else {
appendUri = HttpUtils.appendUri(endpoint.toString(), request.getResourcePath(), true);
}
String encodeParameters = HttpUtils.encodeParameters(request);
HttpMethodName httpMethod = request.getHttpMethod();
boolean z2 = request.getContent() != null;
HttpMethodName httpMethodName = HttpMethodName.POST;
if (httpMethod == httpMethodName && !z2) {
z = false;
}
if (encodeParameters != null && z) {
appendUri = appendUri + "?" + encodeParameters;
}
HashMap hashMap = new HashMap();
configureHeaders(hashMap, request, executionContext, clientConfiguration);
InputStream content = request.getContent();
HttpMethodName httpMethodName2 = HttpMethodName.PATCH;
if (httpMethod == httpMethodName2) {
hashMap.put("X-HTTP-Method-Override", httpMethodName2.toString());
httpMethod = httpMethodName;
}
if (httpMethod == httpMethodName && request.getContent() == null && encodeParameters != null) {
byte[] bytes = encodeParameters.getBytes(StringUtils.UTF8);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
hashMap.put(HTTP.CONTENT_LEN, String.valueOf(bytes.length));
content = byteArrayInputStream;
}
if (clientConfiguration.isEnableGzip() && hashMap.get("Accept-Encoding") == null) {
hashMap.put("Accept-Encoding", "gzip");
} else {
hashMap.put("Accept-Encoding", HTTP.IDENTITY_CODING);
}
HttpRequest httpRequest = new HttpRequest(httpMethod.toString(), URI.create(appendUri), hashMap, content);
httpRequest.setStreaming(request.isStreaming());
return httpRequest;
}
public final void configureHeaders(Map map, Request request, ExecutionContext executionContext, ClientConfiguration clientConfiguration) {
URI endpoint = request.getEndpoint();
String host = endpoint.getHost();
if (HttpUtils.isUsingNonDefaultPort(endpoint)) {
host = host + CertificateUtil.DELIMITER + endpoint.getPort();
}
map.put(HTTP.TARGET_HOST, host);
for (Map.Entry entry : request.getHeaders().entrySet()) {
map.put(entry.getKey(), entry.getValue());
}
if (map.get("Content-Type") == null || ((String) map.get("Content-Type")).isEmpty()) {
map.put("Content-Type", "application/x-www-form-urlencoded; charset=" + StringUtils.lowerCase("UTF-8"));
}
if (executionContext == null || executionContext.getContextUserAgent() == null) {
return;
}
map.put("User-Agent", createUserAgentString(clientConfiguration, executionContext.getContextUserAgent()));
}
public final String createUserAgentString(ClientConfiguration clientConfiguration, String str) {
if (clientConfiguration.getUserAgent().contains(str)) {
return clientConfiguration.getUserAgent();
}
return clientConfiguration.getUserAgent() + " " + str;
}
}

View File

@@ -0,0 +1,91 @@
package com.amazonaws.http;
import java.io.InputStream;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.zip.GZIPInputStream;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.dex */
public class HttpResponse {
public InputStream content;
public final Map headers;
public final InputStream rawContent;
public final int statusCode;
public final String statusText;
public Map getHeaders() {
return this.headers;
}
public InputStream getRawContent() {
return this.rawContent;
}
public int getStatusCode() {
return this.statusCode;
}
public String getStatusText() {
return this.statusText;
}
public HttpResponse(String str, int i, Map map, InputStream inputStream) {
this.statusText = str;
this.statusCode = i;
this.headers = map;
this.rawContent = inputStream;
}
public InputStream getContent() {
if (this.content == null) {
synchronized (this) {
try {
if (this.rawContent == null || !"gzip".equals(this.headers.get(HTTP.CONTENT_ENCODING))) {
this.content = this.rawContent;
} else {
this.content = new GZIPInputStream(this.rawContent);
}
} finally {
}
}
}
return this.content;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
public InputStream content;
public final Map headers = new HashMap();
public int statusCode;
public String statusText;
public Builder content(InputStream inputStream) {
this.content = inputStream;
return this;
}
public Builder statusCode(int i) {
this.statusCode = i;
return this;
}
public Builder statusText(String str) {
this.statusText = str;
return this;
}
public Builder header(String str, String str2) {
this.headers.put(str, str2);
return this;
}
public HttpResponse build() {
return new HttpResponse(this.statusText, this.statusCode, Collections.unmodifiableMap(this.headers), this.content);
}
}
}

View File

@@ -0,0 +1,8 @@
package com.amazonaws.http;
/* loaded from: classes.dex */
public interface HttpResponseHandler<T> {
Object handle(HttpResponse httpResponse);
boolean needsConnectionLeftOpen();
}

View File

@@ -0,0 +1,110 @@
package com.amazonaws.http;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.transform.JsonErrorUnmarshaller;
import com.amazonaws.util.StringUtils;
import com.amazonaws.util.json.JsonUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public class JsonErrorResponseHandler implements HttpResponseHandler<AmazonServiceException> {
public final List unmarshallerList;
@Override // com.amazonaws.http.HttpResponseHandler
public boolean needsConnectionLeftOpen() {
return false;
}
public JsonErrorResponseHandler(List list) {
this.unmarshallerList = list;
}
@Override // com.amazonaws.http.HttpResponseHandler
public AmazonServiceException handle(HttpResponse httpResponse) {
try {
JsonErrorResponse fromResponse = JsonErrorResponse.fromResponse(httpResponse);
AmazonServiceException runErrorUnmarshallers = runErrorUnmarshallers(fromResponse);
if (runErrorUnmarshallers == null) {
return null;
}
runErrorUnmarshallers.setStatusCode(httpResponse.getStatusCode());
if (httpResponse.getStatusCode() < 500) {
runErrorUnmarshallers.setErrorType(AmazonServiceException.ErrorType.Client);
} else {
runErrorUnmarshallers.setErrorType(AmazonServiceException.ErrorType.Service);
}
runErrorUnmarshallers.setErrorCode(fromResponse.getErrorCode());
for (Map.Entry entry : httpResponse.getHeaders().entrySet()) {
if ("X-Amzn-RequestId".equalsIgnoreCase((String) entry.getKey())) {
runErrorUnmarshallers.setRequestId((String) entry.getValue());
}
}
return runErrorUnmarshallers;
} catch (IOException e) {
throw new AmazonClientException("Unable to parse error response", e);
}
}
public final AmazonServiceException runErrorUnmarshallers(JsonErrorResponse jsonErrorResponse) {
for (JsonErrorUnmarshaller jsonErrorUnmarshaller : this.unmarshallerList) {
if (jsonErrorUnmarshaller.match(jsonErrorResponse)) {
return jsonErrorUnmarshaller.unmarshall(jsonErrorResponse);
}
}
return null;
}
public static final class JsonErrorResponse {
public final String errorCode;
public final Map map;
public final String message = get("message");
public final int statusCode;
public String getErrorCode() {
return this.errorCode;
}
public String getMessage() {
return this.message;
}
public JsonErrorResponse(int i, String str, Map map) {
this.statusCode = i;
this.errorCode = str;
this.map = map;
}
public String get(String str) {
if (str == null || str.length() == 0) {
return null;
}
String str2 = StringUtils.lowerCase(str.substring(0, 1)) + str.substring(1);
String str3 = StringUtils.upperCase(str.substring(0, 1)) + str.substring(1);
if (this.map.containsKey(str3)) {
return (String) this.map.get(str3);
}
return this.map.containsKey(str2) ? (String) this.map.get(str2) : "";
}
public static JsonErrorResponse fromResponse(HttpResponse httpResponse) {
int statusCode = httpResponse.getStatusCode();
Map jsonToStringMapWithList = JsonUtils.jsonToStringMapWithList(new BufferedReader(new InputStreamReader(httpResponse.getContent(), StringUtils.UTF8)));
String str = (String) httpResponse.getHeaders().get("x-amzn-ErrorType");
if (str != null) {
int indexOf = str.indexOf(58);
if (indexOf != -1) {
str = str.substring(0, indexOf);
}
} else if (jsonToStringMapWithList.containsKey("__type")) {
String str2 = (String) jsonToStringMapWithList.get("__type");
str = str2.substring(str2.lastIndexOf("#") + 1);
}
return new JsonErrorResponse(statusCode, str, jsonToStringMapWithList);
}
}
}

View File

@@ -0,0 +1,96 @@
package com.amazonaws.http;
import com.amazonaws.AmazonWebServiceResponse;
import com.amazonaws.ResponseMetadata;
import com.amazonaws.internal.CRC32MismatchException;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.transform.JsonUnmarshallerContext;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.transform.VoidJsonUnmarshaller;
import com.amazonaws.util.CRC32ChecksumCalculatingInputStream;
import com.amazonaws.util.StringUtils;
import com.amazonaws.util.json.AwsJsonReader;
import com.applovin.impl.sdk.utils.JsonUtils;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.zip.GZIPInputStream;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.dex */
public class JsonResponseHandler<T> implements HttpResponseHandler<AmazonWebServiceResponse<T>> {
public static final Log log = LogFactory.getLog("com.amazonaws.request");
public boolean needsConnectionLeftOpen = false;
public Unmarshaller responseUnmarshaller;
@Override // com.amazonaws.http.HttpResponseHandler
public boolean needsConnectionLeftOpen() {
return this.needsConnectionLeftOpen;
}
public JsonResponseHandler(Unmarshaller unmarshaller) {
this.responseUnmarshaller = unmarshaller;
if (unmarshaller == null) {
this.responseUnmarshaller = new VoidJsonUnmarshaller();
}
}
@Override // com.amazonaws.http.HttpResponseHandler
public AmazonWebServiceResponse handle(HttpResponse httpResponse) {
CRC32ChecksumCalculatingInputStream cRC32ChecksumCalculatingInputStream;
Log log2 = log;
log2.trace("Parsing service response JSON");
String str = (String) httpResponse.getHeaders().get("x-amz-crc32");
InputStream rawContent = httpResponse.getRawContent();
if (rawContent == null) {
rawContent = new ByteArrayInputStream(JsonUtils.EMPTY_JSON.getBytes(StringUtils.UTF8));
}
log2.debug("CRC32Checksum = " + str);
log2.debug("content encoding = " + ((String) httpResponse.getHeaders().get(HTTP.CONTENT_ENCODING)));
boolean equals = "gzip".equals(httpResponse.getHeaders().get(HTTP.CONTENT_ENCODING));
if (str != null) {
cRC32ChecksumCalculatingInputStream = new CRC32ChecksumCalculatingInputStream(rawContent);
rawContent = cRC32ChecksumCalculatingInputStream;
} else {
cRC32ChecksumCalculatingInputStream = null;
}
if (equals) {
rawContent = new GZIPInputStream(rawContent);
}
AwsJsonReader jsonReader = com.amazonaws.util.json.JsonUtils.getJsonReader(new InputStreamReader(rawContent, StringUtils.UTF8));
try {
AmazonWebServiceResponse amazonWebServiceResponse = new AmazonWebServiceResponse();
Object unmarshall = this.responseUnmarshaller.unmarshall(new JsonUnmarshallerContext(jsonReader, httpResponse));
if (cRC32ChecksumCalculatingInputStream != null) {
if (cRC32ChecksumCalculatingInputStream.getCRC32Checksum() != Long.parseLong(str)) {
throw new CRC32MismatchException("Client calculated crc32 checksum didn't match that calculated by server side");
}
}
amazonWebServiceResponse.setResult(unmarshall);
HashMap hashMap = new HashMap();
hashMap.put("AWS_REQUEST_ID", httpResponse.getHeaders().get("x-amzn-RequestId"));
amazonWebServiceResponse.setResponseMetadata(new ResponseMetadata(hashMap));
log2.trace("Done parsing service response");
if (!this.needsConnectionLeftOpen) {
try {
jsonReader.close();
} catch (IOException e) {
log.warn("Error closing json parser", e);
}
}
return amazonWebServiceResponse;
} catch (Throwable th) {
if (!this.needsConnectionLeftOpen) {
try {
jsonReader.close();
} catch (IOException e2) {
log.warn("Error closing json parser", e2);
}
}
throw th;
}
}
}

View File

@@ -0,0 +1,73 @@
package com.amazonaws.http;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonWebServiceResponse;
import com.amazonaws.ResponseMetadata;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.transform.VoidStaxUnmarshaller;
import com.amazonaws.util.StringUtils;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Map;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
/* loaded from: classes.dex */
public class StaxResponseHandler<T> implements HttpResponseHandler<AmazonWebServiceResponse<T>> {
public static final XmlPullParserFactory XML_PULL_PARSER_FACTORY;
public static final Log log = LogFactory.getLog("com.amazonaws.request");
public Unmarshaller responseUnmarshaller;
@Override // com.amazonaws.http.HttpResponseHandler
public boolean needsConnectionLeftOpen() {
return false;
}
public void registerAdditionalMetadataExpressions(StaxUnmarshallerContext staxUnmarshallerContext) {
}
static {
try {
XML_PULL_PARSER_FACTORY = XmlPullParserFactory.newInstance();
} catch (XmlPullParserException e) {
throw new AmazonClientException("Couldn't initialize XmlPullParserFactory", e);
}
}
public StaxResponseHandler(Unmarshaller unmarshaller) {
this.responseUnmarshaller = unmarshaller;
if (unmarshaller == null) {
this.responseUnmarshaller = new VoidStaxUnmarshaller();
}
}
@Override // com.amazonaws.http.HttpResponseHandler
public AmazonWebServiceResponse handle(HttpResponse httpResponse) {
Log log2 = log;
log2.trace("Parsing service response XML");
InputStream content = httpResponse.getContent();
if (content == null) {
content = new ByteArrayInputStream("<eof/>".getBytes(StringUtils.UTF8));
}
XmlPullParser newPullParser = XML_PULL_PARSER_FACTORY.newPullParser();
newPullParser.setInput(content, null);
AmazonWebServiceResponse amazonWebServiceResponse = new AmazonWebServiceResponse();
StaxUnmarshallerContext staxUnmarshallerContext = new StaxUnmarshallerContext(newPullParser, httpResponse.getHeaders());
staxUnmarshallerContext.registerMetadataExpression("ResponseMetadata/RequestId", 2, "AWS_REQUEST_ID");
staxUnmarshallerContext.registerMetadataExpression("requestId", 2, "AWS_REQUEST_ID");
registerAdditionalMetadataExpressions(staxUnmarshallerContext);
amazonWebServiceResponse.setResult(this.responseUnmarshaller.unmarshall(staxUnmarshallerContext));
Map metadata = staxUnmarshallerContext.getMetadata();
Map headers = httpResponse.getHeaders();
if (headers != null && headers.get("x-amzn-RequestId") != null) {
metadata.put("AWS_REQUEST_ID", headers.get("x-amzn-RequestId"));
}
amazonWebServiceResponse.setResponseMetadata(new ResponseMetadata(metadata));
log2.trace("Done parsing service response");
return amazonWebServiceResponse;
}
}

View File

@@ -0,0 +1,23 @@
package com.amazonaws.http;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
/* loaded from: classes.dex */
public abstract class TLS12SocketFactory extends SSLSocketFactory {
public static final Object contextLock = new Object();
public static final String[] SUPPORTED_PROTOCOLS = {"TLSv1", "TLSv1.1", "TLSv1.2"};
public static SSLContext sslContext = null;
public static TLS12SocketFactory createTLS12SocketFactory(SSLContext sSLContext) {
return null;
}
public static void fixTLSPre21(HttpsURLConnection httpsURLConnection, TLS12SocketFactory tLS12SocketFactory) {
}
public static TLS12SocketFactory createTLS12SocketFactory() {
return createTLS12SocketFactory(null);
}
}

View File

@@ -0,0 +1,249 @@
package com.amazonaws.http;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.http.HttpResponse;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.facebook.internal.security.CertificateUtil;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.security.GeneralSecurityException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.protocol.HTTP;
/* loaded from: classes.dex */
public class UrlHttpClient implements HttpClient {
public static final Log log = LogFactory.getLog(UrlHttpClient.class);
public final ClientConfiguration config;
public SSLContext customTrustSSLContext = null;
public TLS12SocketFactory customTrustTls12SocketFactory;
public final TLS12SocketFactory tls12SocketFactory;
@Override // com.amazonaws.http.HttpClient
public void shutdown() {
}
public UrlHttpClient(ClientConfiguration clientConfiguration) {
this.config = clientConfiguration;
TLS12SocketFactory.createTLS12SocketFactory();
}
@Override // com.amazonaws.http.HttpClient
public HttpResponse execute(HttpRequest httpRequest) {
HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(httpRequest.getUri().toURL().openConnection()));
CurlBuilder curlBuilder = this.config.isCurlLogging() ? new CurlBuilder(httpRequest.getUri().toURL()) : null;
configureConnection(httpRequest, httpURLConnection);
applyHeadersAndMethod(httpRequest, httpURLConnection, curlBuilder);
writeContentToConnection(httpRequest, httpURLConnection, curlBuilder);
if (curlBuilder != null) {
if (curlBuilder.isValid()) {
printToLog(curlBuilder.build());
} else {
printToLog("Failed to create curl, content too long");
}
}
return createHttpResponse(httpRequest, httpURLConnection);
}
public HttpResponse createHttpResponse(HttpRequest httpRequest, HttpURLConnection httpURLConnection) {
String responseMessage = httpURLConnection.getResponseMessage();
int responseCode = httpURLConnection.getResponseCode();
InputStream errorStream = httpURLConnection.getErrorStream();
if (errorStream == null && !HttpHead.METHOD_NAME.equals(httpRequest.getMethod())) {
try {
errorStream = httpURLConnection.getInputStream();
} catch (IOException unused) {
}
}
HttpResponse.Builder content = HttpResponse.builder().statusCode(responseCode).statusText(responseMessage).content(errorStream);
for (Map.Entry<String, List<String>> entry : httpURLConnection.getHeaderFields().entrySet()) {
if (entry.getKey() != null) {
content.header(entry.getKey(), entry.getValue().get(0));
}
}
return content.build();
}
public void writeContentToConnection(HttpRequest httpRequest, HttpURLConnection httpURLConnection, CurlBuilder curlBuilder) {
ByteBuffer byteBuffer;
if (httpRequest.getContent() == null || httpRequest.getContentLength() < 0) {
return;
}
httpURLConnection.setDoOutput(true);
if (!httpRequest.isStreaming()) {
httpURLConnection.setFixedLengthStreamingMode((int) httpRequest.getContentLength());
}
OutputStream outputStream = httpURLConnection.getOutputStream();
if (curlBuilder != null) {
if (httpRequest.getContentLength() < 2147483647L) {
byteBuffer = ByteBuffer.allocate((int) httpRequest.getContentLength());
write(httpRequest.getContent(), outputStream, curlBuilder, byteBuffer);
if (curlBuilder != null && byteBuffer != null && byteBuffer.position() != 0) {
curlBuilder.setContent(new String(byteBuffer.array(), "UTF-8"));
}
outputStream.flush();
outputStream.close();
}
curlBuilder.setContentOverflow(true);
}
byteBuffer = null;
write(httpRequest.getContent(), outputStream, curlBuilder, byteBuffer);
if (curlBuilder != null) {
curlBuilder.setContent(new String(byteBuffer.array(), "UTF-8"));
}
outputStream.flush();
outputStream.close();
}
public HttpURLConnection applyHeadersAndMethod(HttpRequest httpRequest, HttpURLConnection httpURLConnection, CurlBuilder curlBuilder) {
if (httpRequest.getHeaders() != null && !httpRequest.getHeaders().isEmpty()) {
if (curlBuilder != null) {
curlBuilder.setHeaders(httpRequest.getHeaders());
}
for (Map.Entry entry : httpRequest.getHeaders().entrySet()) {
String str = (String) entry.getKey();
if (!str.equals(HTTP.CONTENT_LEN) && !str.equals(HTTP.TARGET_HOST)) {
httpURLConnection.setRequestProperty(str, (String) entry.getValue());
}
}
}
String method = httpRequest.getMethod();
httpURLConnection.setRequestMethod(method);
if (curlBuilder != null) {
curlBuilder.setMethod(method);
}
return httpURLConnection;
}
public void printToLog(String str) {
log.debug(str);
}
public final void write(InputStream inputStream, OutputStream outputStream, CurlBuilder curlBuilder, ByteBuffer byteBuffer) {
byte[] bArr = new byte[8192];
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
return;
}
if (byteBuffer != null) {
try {
byteBuffer.put(bArr, 0, read);
} catch (BufferOverflowException unused) {
curlBuilder.setContentOverflow(true);
}
}
outputStream.write(bArr, 0, read);
}
}
public void configureConnection(HttpRequest httpRequest, HttpURLConnection httpURLConnection) {
httpURLConnection.setConnectTimeout(this.config.getConnectionTimeout());
httpURLConnection.setReadTimeout(this.config.getSocketTimeout());
httpURLConnection.setInstanceFollowRedirects(false);
httpURLConnection.setUseCaches(false);
if (httpRequest.isStreaming()) {
httpURLConnection.setChunkedStreamingMode(0);
}
if (httpURLConnection instanceof HttpsURLConnection) {
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) httpURLConnection;
if (this.config.getTrustManager() != null) {
enableCustomTrustManager(httpsURLConnection);
}
}
}
public final void enableCustomTrustManager(HttpsURLConnection httpsURLConnection) {
if (this.customTrustSSLContext == null) {
TrustManager[] trustManagerArr = {this.config.getTrustManager()};
try {
SSLContext sSLContext = SSLContext.getInstance("TLS");
this.customTrustSSLContext = sSLContext;
sSLContext.init(null, trustManagerArr, null);
TLS12SocketFactory.createTLS12SocketFactory(this.customTrustSSLContext);
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
}
}
httpsURLConnection.setSSLSocketFactory(this.customTrustSSLContext.getSocketFactory());
}
public final class CurlBuilder {
public final URL url;
public String method = null;
public final HashMap headers = new HashMap();
public String content = null;
public boolean contentOverflow = false;
public boolean isValid() {
return !this.contentOverflow;
}
public CurlBuilder setContent(String str) {
this.content = str;
return this;
}
public CurlBuilder setContentOverflow(boolean z) {
this.contentOverflow = z;
return this;
}
public CurlBuilder setMethod(String str) {
this.method = str;
return this;
}
public CurlBuilder(URL url) {
if (url == null) {
throw new IllegalArgumentException("Must have a valid url");
}
this.url = url;
}
public CurlBuilder setHeaders(Map map) {
this.headers.clear();
this.headers.putAll(map);
return this;
}
public String build() {
if (!isValid()) {
throw new IllegalStateException("Invalid state, cannot create curl command");
}
StringBuilder sb = new StringBuilder("curl");
if (this.method != null) {
sb.append(" -X ");
sb.append(this.method);
}
for (Map.Entry entry : this.headers.entrySet()) {
sb.append(" -H \"");
sb.append((String) entry.getKey());
sb.append(CertificateUtil.DELIMITER);
sb.append((String) entry.getValue());
sb.append("\"");
}
if (this.content != null) {
sb.append(" -d '");
sb.append(this.content);
sb.append("'");
}
sb.append(" ");
sb.append(this.url.toString());
return sb.toString();
}
}
}

View File

@@ -0,0 +1,12 @@
package com.amazonaws.internal;
import java.io.IOException;
/* loaded from: classes.dex */
public class CRC32MismatchException extends IOException {
private static final long serialVersionUID = 1;
public CRC32MismatchException(String str) {
super(str);
}
}

View File

@@ -0,0 +1,34 @@
package com.amazonaws.internal;
import android.support.v4.media.session.PlaybackStateCompat;
import java.io.InputStream;
import java.security.DigestInputStream;
import java.security.MessageDigest;
/* loaded from: classes.dex */
public class SdkDigestInputStream extends DigestInputStream {
public SdkDigestInputStream(InputStream inputStream, MessageDigest messageDigest) {
super(inputStream, messageDigest);
}
@Override // java.io.FilterInputStream, java.io.InputStream
public final long skip(long j) {
if (j <= 0) {
return j;
}
int min = (int) Math.min(PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH, j);
byte[] bArr = new byte[min];
long j2 = j;
while (j2 > 0) {
int read = read(bArr, 0, (int) Math.min(j2, min));
if (read == -1) {
if (j2 == j) {
return -1L;
}
return j - j2;
}
j2 -= read;
}
return j;
}
}

View File

@@ -0,0 +1,58 @@
package com.amazonaws.internal;
import com.amazonaws.AbortedException;
import java.io.FilterInputStream;
import java.io.InputStream;
/* loaded from: classes.dex */
public abstract class SdkFilterInputStream extends FilterInputStream {
public void abort() {
}
public SdkFilterInputStream(InputStream inputStream) {
super(inputStream);
}
public final void abortIfNeeded() {
if (Thread.interrupted()) {
abort();
throw new AbortedException();
}
}
@Override // java.io.FilterInputStream, java.io.InputStream
public long skip(long j) {
abortIfNeeded();
return ((FilterInputStream) this).in.skip(j);
}
@Override // java.io.FilterInputStream, java.io.InputStream
public int available() {
abortIfNeeded();
return ((FilterInputStream) this).in.available();
}
@Override // java.io.FilterInputStream, java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
public void close() {
((FilterInputStream) this).in.close();
abortIfNeeded();
}
@Override // java.io.FilterInputStream, java.io.InputStream
public synchronized void mark(int i) {
abortIfNeeded();
((FilterInputStream) this).in.mark(i);
}
@Override // java.io.FilterInputStream, java.io.InputStream
public synchronized void reset() {
abortIfNeeded();
((FilterInputStream) this).in.reset();
}
@Override // java.io.FilterInputStream, java.io.InputStream
public boolean markSupported() {
abortIfNeeded();
return ((FilterInputStream) this).in.markSupported();
}
}

View File

@@ -0,0 +1,18 @@
package com.amazonaws.internal;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
/* loaded from: classes.dex */
public class StaticCredentialsProvider implements AWSCredentialsProvider {
public final AWSCredentials credentials;
@Override // com.amazonaws.auth.AWSCredentialsProvider
public AWSCredentials getCredentials() {
return this.credentials;
}
public StaticCredentialsProvider(AWSCredentials aWSCredentials) {
this.credentials = aWSCredentials;
}
}

View File

@@ -0,0 +1,34 @@
package com.amazonaws.internal.config;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
/* loaded from: classes.dex */
public class HostRegexToRegionMapping {
public final String hostNameRegex;
public final String regionName;
public String getHostNameRegex() {
return this.hostNameRegex;
}
public String getRegionName() {
return this.regionName;
}
public HostRegexToRegionMapping(String str, String str2) {
if (str == null || str.isEmpty()) {
throw new IllegalArgumentException("Invalid HostRegexToRegionMapping configuration: hostNameRegex must be non-empty");
}
try {
Pattern.compile(str);
if (str2 == null || str2.isEmpty()) {
throw new IllegalArgumentException("Invalid HostRegexToRegionMapping configuration: regionName must be non-empty");
}
this.hostNameRegex = str;
this.regionName = str2;
} catch (PatternSyntaxException e) {
throw new IllegalArgumentException("Invalid HostRegexToRegionMapping configuration: hostNameRegex is not a valid regex", e);
}
}
}

View File

@@ -0,0 +1,18 @@
package com.amazonaws.internal.config;
/* loaded from: classes.dex */
public class HttpClientConfig {
public final String serviceName;
public String getServiceName() {
return this.serviceName;
}
public HttpClientConfig(String str) {
this.serviceName = str;
}
public String toString() {
return "serviceName: " + this.serviceName;
}
}

View File

@@ -0,0 +1,136 @@
package com.amazonaws.internal.config;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public class InternalConfig {
public static final Log log = LogFactory.getLog(InternalConfig.class);
public final SignerConfig defaultSignerConfig = getDefaultSigner();
public final Map regionSigners = getDefaultRegionSigners();
public final Map serviceSigners = getDefaultServiceSigners();
public final Map serviceRegionSigners = getDefaultServiceRegionSigners();
public final Map httpClients = getDefaultHttpClients();
public final List hostRegexToRegionMappings = getDefaultHostRegexToRegionMappings();
public HttpClientConfig getHttpClientConfig(String str) {
return (HttpClientConfig) this.httpClients.get(str);
}
public SignerConfig getSignerConfig(String str, String str2) {
if (str == null) {
throw new IllegalArgumentException();
}
if (str2 != null) {
SignerConfig signerConfig = (SignerConfig) this.serviceRegionSigners.get(str + "/" + str2);
if (signerConfig != null) {
return signerConfig;
}
SignerConfig signerConfig2 = (SignerConfig) this.regionSigners.get(str2);
if (signerConfig2 != null) {
return signerConfig2;
}
}
SignerConfig signerConfig3 = (SignerConfig) this.serviceSigners.get(str);
return signerConfig3 == null ? this.defaultSignerConfig : signerConfig3;
}
public List getHostRegexToRegionMappings() {
return Collections.unmodifiableList(this.hostRegexToRegionMappings);
}
public static Map getDefaultHttpClients() {
HashMap hashMap = new HashMap();
hashMap.put("AmazonCloudWatchClient", new HttpClientConfig("monitoring"));
hashMap.put("AmazonCloudWatchLogsClient", new HttpClientConfig("logs"));
hashMap.put("AmazonCognitoIdentityClient", new HttpClientConfig("cognito-identity"));
hashMap.put("AmazonCognitoIdentityProviderClient", new HttpClientConfig("cognito-idp"));
hashMap.put("AmazonCognitoSyncClient", new HttpClientConfig("cognito-sync"));
hashMap.put("AmazonComprehendClient", new HttpClientConfig("comprehend"));
hashMap.put("AmazonConnectClient", new HttpClientConfig("connect"));
hashMap.put("AmazonKinesisFirehoseClient", new HttpClientConfig("firehose"));
hashMap.put("AWSKinesisVideoArchivedMediaClient", new HttpClientConfig("kinesisvideo"));
hashMap.put("AWSKinesisVideoSignalingClient", new HttpClientConfig("kinesisvideo"));
hashMap.put("AWSIotClient", new HttpClientConfig("execute-api"));
hashMap.put("AmazonLexRuntimeClient", new HttpClientConfig("lex"));
hashMap.put("AmazonPinpointClient", new HttpClientConfig("mobiletargeting"));
hashMap.put("AmazonPinpointAnalyticsClient", new HttpClientConfig("mobileanalytics"));
hashMap.put("AmazonSageMakerRuntimeClient", new HttpClientConfig("sagemaker"));
hashMap.put("AmazonSimpleDBClient", new HttpClientConfig("sdb"));
hashMap.put("AmazonSimpleEmailServiceClient", new HttpClientConfig("email"));
hashMap.put("AWSSecurityTokenServiceClient", new HttpClientConfig("sts"));
hashMap.put("AmazonTextractClient", new HttpClientConfig("textract"));
hashMap.put("AmazonTranscribeClient", new HttpClientConfig("transcribe"));
hashMap.put("AmazonTranslateClient", new HttpClientConfig("translate"));
return hashMap;
}
public static Map getDefaultRegionSigners() {
HashMap hashMap = new HashMap();
hashMap.put("eu-central-1", new SignerConfig("AWS4SignerType"));
hashMap.put("cn-north-1", new SignerConfig("AWS4SignerType"));
return hashMap;
}
public static Map getDefaultServiceRegionSigners() {
HashMap hashMap = new HashMap();
hashMap.put("s3/eu-central-1", new SignerConfig("AWSS3V4SignerType"));
hashMap.put("s3/cn-north-1", new SignerConfig("AWSS3V4SignerType"));
hashMap.put("s3/us-east-2", new SignerConfig("AWSS3V4SignerType"));
hashMap.put("s3/ca-central-1", new SignerConfig("AWSS3V4SignerType"));
hashMap.put("s3/ap-south-1", new SignerConfig("AWSS3V4SignerType"));
hashMap.put("s3/ap-northeast-2", new SignerConfig("AWSS3V4SignerType"));
hashMap.put("s3/eu-west-2", new SignerConfig("AWSS3V4SignerType"));
hashMap.put("lex/eu-central-1", new SignerConfig("AmazonLexV4Signer"));
hashMap.put("lex/cn-north-1", new SignerConfig("AmazonLexV4Signer"));
hashMap.put("polly/eu-central-1", new SignerConfig("AmazonPollyCustomPresigner"));
hashMap.put("polly/cn-north-1", new SignerConfig("AmazonPollyCustomPresigner"));
return hashMap;
}
public static Map getDefaultServiceSigners() {
HashMap hashMap = new HashMap();
hashMap.put("ec2", new SignerConfig("QueryStringSignerType"));
hashMap.put("email", new SignerConfig("AWS4SignerType"));
hashMap.put("s3", new SignerConfig("AWSS3V4SignerType"));
hashMap.put("sdb", new SignerConfig("QueryStringSignerType"));
hashMap.put("lex", new SignerConfig("AmazonLexV4Signer"));
hashMap.put("polly", new SignerConfig("AmazonPollyCustomPresigner"));
return hashMap;
}
public static SignerConfig getDefaultSigner() {
return new SignerConfig("AWS4SignerType");
}
public static List getDefaultHostRegexToRegionMappings() {
ArrayList arrayList = new ArrayList();
arrayList.add(new HostRegexToRegionMapping("(.+\\.)?s3\\.amazonaws\\.com", "us-east-1"));
arrayList.add(new HostRegexToRegionMapping("(.+\\.)?s3-external-1\\.amazonaws\\.com", "us-east-1"));
arrayList.add(new HostRegexToRegionMapping("(.+\\.)?s3-fips-us-gov-west-1\\.amazonaws\\.com", "us-gov-west-1"));
return arrayList;
}
public static class Factory {
public static final InternalConfig SINGELTON;
public static InternalConfig getInternalConfig() {
return SINGELTON;
}
static {
try {
SINGELTON = new InternalConfig();
} catch (RuntimeException e) {
throw e;
} catch (Exception e2) {
throw new IllegalStateException("Fatal: Failed to load the internal config for AWS Android SDK", e2);
}
}
}
}

View File

@@ -0,0 +1,18 @@
package com.amazonaws.internal.config;
/* loaded from: classes.dex */
public class SignerConfig {
public final String signerType;
public String getSignerType() {
return this.signerType;
}
public String toString() {
return this.signerType;
}
public SignerConfig(String str) {
this.signerType = str;
}
}

View File

@@ -0,0 +1,290 @@
package com.amazonaws.internal.keyvaluestore;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.util.Base64;
import java.security.Key;
import java.security.SecureRandom;
import java.security.spec.AlgorithmParameterSpec;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import javax.crypto.Cipher;
import javax.crypto.spec.GCMParameterSpec;
/* loaded from: classes.dex */
public class AWSKeyValueStore {
public Map cache;
public Context context;
public boolean isPersistenceEnabled;
public KeyProvider keyProvider;
public SecureRandom secureRandom = new SecureRandom();
public SharedPreferences sharedPreferencesForData;
public SharedPreferences sharedPreferencesForEncryptionMaterials;
public final String sharedPreferencesName;
public static final Log logger = LogFactory.getLog(AWSKeyValueStore.class);
public static Map cacheFactory = new HashMap();
public static Map getCacheForKey(String str) {
if (cacheFactory.containsKey(str)) {
return (Map) cacheFactory.get(str);
}
HashMap hashMap = new HashMap();
cacheFactory.put(str, hashMap);
return hashMap;
}
public AWSKeyValueStore(Context context, String str, boolean z) {
this.cache = getCacheForKey(str);
this.sharedPreferencesName = str;
this.context = context;
setPersistenceEnabled(z);
}
public synchronized void setPersistenceEnabled(boolean z) {
try {
try {
boolean z2 = this.isPersistenceEnabled;
this.isPersistenceEnabled = z;
if (z && !z2) {
this.sharedPreferencesForData = this.context.getSharedPreferences(this.sharedPreferencesName, 0);
this.sharedPreferencesForEncryptionMaterials = this.context.getSharedPreferences(this.sharedPreferencesName + ".encryptionkey", 0);
initKeyProviderBasedOnAPILevel();
Log log = logger;
log.info("Detected Android API Level = " + Build.VERSION.SDK_INT);
log.info("Creating the AWSKeyValueStore with key for sharedPreferencesForData = " + this.sharedPreferencesName);
onMigrateFromNoEncryption();
} else if (!z) {
logger.info("Persistence is disabled. Data will be accessed from memory.");
}
if (!z && z2) {
this.sharedPreferencesForData.edit().clear().apply();
}
} catch (Exception e) {
logger.error("Error in enabling persistence for " + this.sharedPreferencesName, e);
}
} catch (Throwable th) {
throw th;
}
}
public synchronized boolean contains(String str) {
if (this.isPersistenceEnabled) {
if (this.cache.containsKey(str)) {
return true;
}
return this.sharedPreferencesForData.contains(getDataKeyUsedInPersistentStore(str));
}
return this.cache.containsKey(str);
}
public synchronized String get(String str) {
if (str == null) {
return null;
}
if (!this.cache.containsKey(str) && this.isPersistenceEnabled) {
String dataKeyUsedInPersistentStore = getDataKeyUsedInPersistentStore(str);
Key retrieveEncryptionKey = retrieveEncryptionKey(getEncryptionKeyAlias());
if (retrieveEncryptionKey == null) {
logger.warn("Error in retrieving the decryption key used to decrypt the data from the persistent store. Returning null for the requested dataKey = " + str);
return null;
}
if (!this.sharedPreferencesForData.contains(dataKeyUsedInPersistentStore)) {
return null;
}
try {
if (Integer.parseInt(this.sharedPreferencesForData.getString(dataKeyUsedInPersistentStore + ".keyvaluestoreversion", null)) != 1) {
logger.error("The version of the data read from SharedPreferences for " + str + " does not match the version of the store.");
return null;
}
String decrypt = decrypt(retrieveEncryptionKey, getInitializationVector(dataKeyUsedInPersistentStore), this.sharedPreferencesForData.getString(dataKeyUsedInPersistentStore, null));
this.cache.put(str, decrypt);
return decrypt;
} catch (Exception e) {
logger.warn("Error in retrieving value for dataKey = " + str, e);
remove(str);
return null;
}
}
return (String) this.cache.get(str);
}
public synchronized void put(String str, String str2) {
byte[] generateInitializationVector;
if (str == null) {
logger.error("dataKey is null.");
return;
}
this.cache.put(str, str2);
if (this.isPersistenceEnabled) {
if (str2 == null) {
logger.debug("Value is null. Removing the data, IV and version from SharedPreferences");
this.cache.remove(str);
remove(str);
return;
}
String dataKeyUsedInPersistentStore = getDataKeyUsedInPersistentStore(str);
String encryptionKeyAlias = getEncryptionKeyAlias();
Key retrieveEncryptionKey = retrieveEncryptionKey(encryptionKeyAlias);
if (retrieveEncryptionKey == null) {
Log log = logger;
log.warn("No encryption key found for encryptionKeyAlias: " + encryptionKeyAlias);
Key generateEncryptionKey = generateEncryptionKey(encryptionKeyAlias);
if (generateEncryptionKey == null) {
log.warn("Error in generating the encryption key for encryptionKeyAlias: " + encryptionKeyAlias + " used to encrypt the data before storing. Skipping persisting the data in the persistent store.");
return;
}
retrieveEncryptionKey = generateEncryptionKey;
}
try {
generateInitializationVector = generateInitializationVector();
} catch (Exception e) {
logger.error("Error in storing value for dataKey = " + str + ". This data has not been stored in the persistent store.", e);
}
if (generateInitializationVector == null) {
throw new Exception("The generated IV for dataKey = " + str + " is null.");
}
String encrypt = encrypt(retrieveEncryptionKey, getAlgorithmParameterSpecForIV(generateInitializationVector), str2);
String encodeAsString = Base64.encodeAsString(generateInitializationVector);
if (encodeAsString == null) {
throw new Exception("Error in Base64 encoding the IV for dataKey = " + str);
}
this.sharedPreferencesForData.edit().putString(dataKeyUsedInPersistentStore, encrypt).putString(dataKeyUsedInPersistentStore + ".iv", encodeAsString).putString(dataKeyUsedInPersistentStore + ".keyvaluestoreversion", String.valueOf(1)).apply();
}
}
public synchronized void remove(String str) {
this.cache.remove(str);
if (this.isPersistenceEnabled) {
String dataKeyUsedInPersistentStore = getDataKeyUsedInPersistentStore(str);
this.sharedPreferencesForData.edit().remove(dataKeyUsedInPersistentStore).remove(dataKeyUsedInPersistentStore + ".iv").remove(dataKeyUsedInPersistentStore + ".keyvaluestoreversion").apply();
}
}
public synchronized void clear() {
this.cache.clear();
if (this.isPersistenceEnabled) {
this.sharedPreferencesForData.edit().clear().apply();
}
}
public final String encrypt(Key key, AlgorithmParameterSpec algorithmParameterSpec, String str) {
try {
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
cipher.init(1, key, algorithmParameterSpec);
return Base64.encodeAsString(cipher.doFinal(str.getBytes("UTF-8")));
} catch (Exception e) {
logger.error("Error in encrypting data. ", e);
return null;
}
}
public final String decrypt(Key key, AlgorithmParameterSpec algorithmParameterSpec, String str) {
try {
byte[] decode = Base64.decode(str);
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
cipher.init(2, key, algorithmParameterSpec);
return new String(cipher.doFinal(decode), "UTF-8");
} catch (Exception e) {
logger.error("Error in decrypting data. ", e);
return null;
}
}
public final AlgorithmParameterSpec getInitializationVector(String str) {
String str2 = str + ".iv";
if (!this.sharedPreferencesForData.contains(str2)) {
throw new Exception("Initialization vector for " + str + " is missing from the SharedPreferences.");
}
String string = this.sharedPreferencesForData.getString(str2, null);
if (string == null) {
throw new Exception("Cannot read the initialization vector for " + str + " from SharedPreferences.");
}
byte[] decode = Base64.decode(string);
if (decode == null || decode.length == 0) {
throw new Exception("Cannot base64 decode the initialization vector for " + str + " read from SharedPreferences.");
}
return getAlgorithmParameterSpecForIV(decode);
}
public final byte[] generateInitializationVector() {
byte[] bArr = new byte[12];
this.secureRandom.nextBytes(bArr);
return bArr;
}
public final AlgorithmParameterSpec getAlgorithmParameterSpecForIV(byte[] bArr) {
return new GCMParameterSpec(128, bArr);
}
public final synchronized Key retrieveEncryptionKey(String str) {
try {
} catch (KeyNotFoundException e) {
Log log = logger;
log.warn(e);
log.info("Deleting the encryption key identified by the keyAlias: " + str);
this.keyProvider.deleteKey(str);
return null;
}
return this.keyProvider.retrieveKey(str);
}
public synchronized Key generateEncryptionKey(String str) {
try {
} catch (KeyNotGeneratedException e) {
logger.error("Encryption Key cannot be generated successfully.", e);
return null;
}
return this.keyProvider.generateKey(str);
}
public final String getDataKeyUsedInPersistentStore(String str) {
if (str == null) {
return null;
}
return str + ".encrypted";
}
public final String getEncryptionKeyAlias() {
return this.sharedPreferencesName + ".aesKeyStoreAlias";
}
public final void initKeyProviderBasedOnAPILevel() {
this.keyProvider = new KeyProvider23();
}
public final void onMigrateFromNoEncryption() {
Map<String, ?> all = this.sharedPreferencesForData.getAll();
for (String str : all.keySet()) {
if (!str.endsWith(".encrypted") && !str.endsWith(".iv") && !str.endsWith(".keyvaluestoreversion")) {
if (all.get(str) instanceof Long) {
put(str, String.valueOf(Long.valueOf(this.sharedPreferencesForData.getLong(str, 0L))));
} else if (all.get(str) instanceof String) {
put(str, this.sharedPreferencesForData.getString(str, null));
} else if (all.get(str) instanceof Float) {
put(str, String.valueOf(Float.valueOf(this.sharedPreferencesForData.getFloat(str, 0.0f))));
} else if (all.get(str) instanceof Boolean) {
put(str, String.valueOf(Boolean.valueOf(this.sharedPreferencesForData.getBoolean(str, false))));
} else if (all.get(str) instanceof Integer) {
put(str, String.valueOf(Integer.valueOf(this.sharedPreferencesForData.getInt(str, 0))));
} else if (all.get(str) instanceof Set) {
Set set = (Set) all.get(str);
StringBuilder sb = new StringBuilder();
Iterator it = set.iterator();
while (it.hasNext()) {
sb.append((String) it.next());
if (it.hasNext()) {
sb.append(",");
}
}
put(str, sb.toString());
}
this.sharedPreferencesForData.edit().remove(str).apply();
}
}
}
}

View File

@@ -0,0 +1,14 @@
package com.amazonaws.internal.keyvaluestore;
/* loaded from: classes.dex */
public class KeyNotFoundException extends Exception {
private static final long serialVersionUID = 1;
public KeyNotFoundException(String str, Throwable th) {
super(str, th);
}
public KeyNotFoundException(String str) {
super(str);
}
}

View File

@@ -0,0 +1,12 @@
package com.amazonaws.internal.keyvaluestore;
/* loaded from: classes.dex */
public class KeyNotGeneratedException extends Exception {
public KeyNotGeneratedException(String str) {
super(str);
}
public KeyNotGeneratedException(String str, Throwable th) {
super(str, th);
}
}

View File

@@ -0,0 +1,12 @@
package com.amazonaws.internal.keyvaluestore;
import java.security.Key;
/* loaded from: classes.dex */
interface KeyProvider {
void deleteKey(String str);
Key generateKey(String str);
Key retrieveKey(String str);
}

View File

@@ -0,0 +1,75 @@
package com.amazonaws.internal.keyvaluestore;
import android.security.keystore.KeyGenParameterSpec;
import androidx.annotation.RequiresApi;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.google.android.gms.stats.CodePackage;
import java.security.Key;
import java.security.KeyStore;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
@RequiresApi(api = 23)
/* loaded from: classes.dex */
class KeyProvider23 implements KeyProvider {
public static final Log logger = LogFactory.getLog(KeyProvider23.class);
@Override // com.amazonaws.internal.keyvaluestore.KeyProvider
public synchronized Key retrieveKey(String str) {
Key key;
try {
try {
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
keyStore.load(null);
if (keyStore.containsAlias(str)) {
Log log = logger;
log.debug("AndroidKeyStore contains keyAlias " + str);
log.debug("Loading the encryption key from Android KeyStore.");
key = keyStore.getKey(str, null);
if (key == null) {
throw new KeyNotFoundException("Key is null even though the keyAlias: " + str + " is present in AndroidKeyStore");
}
} else {
throw new KeyNotFoundException("AndroidKeyStore does not contain the keyAlias: " + str);
}
} catch (Exception e) {
throw new KeyNotFoundException("Error occurred while accessing AndroidKeyStore to retrieve the key for keyAlias: " + str, e);
}
} catch (Throwable th) {
throw th;
}
return key;
}
@Override // com.amazonaws.internal.keyvaluestore.KeyProvider
public synchronized Key generateKey(String str) {
SecretKey generateKey;
try {
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
keyStore.load(null);
if (!keyStore.containsAlias(str)) {
KeyGenerator keyGenerator = KeyGenerator.getInstance("AES", "AndroidKeyStore");
keyGenerator.init(new KeyGenParameterSpec.Builder(str, 3).setBlockModes(CodePackage.GCM).setEncryptionPaddings("NoPadding").setKeySize(256).setRandomizedEncryptionRequired(false).build());
generateKey = keyGenerator.generateKey();
logger.info("Generated the encryption key identified by the keyAlias: " + str + " using AndroidKeyStore");
} else {
throw new KeyNotGeneratedException("Key already exists for the keyAlias: " + str + " in AndroidKeyStore");
}
} catch (Exception e) {
throw new KeyNotGeneratedException("Cannot generate a key for alias: " + str + " in AndroidKeyStore", e);
}
return generateKey;
}
@Override // com.amazonaws.internal.keyvaluestore.KeyProvider
public synchronized void deleteKey(String str) {
try {
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
keyStore.load(null);
keyStore.deleteEntry(str);
} catch (Exception e) {
logger.error("Error in deleting the key for keyAlias: " + str + " from Android KeyStore.", e);
}
}
}

View File

@@ -0,0 +1,84 @@
package com.amazonaws.logging;
import com.amazonaws.logging.LogFactory;
/* loaded from: classes.dex */
public class AndroidLog implements Log {
public LogFactory.Level level = null;
public final String tag;
public AndroidLog(String str) {
this.tag = str;
}
@Override // com.amazonaws.logging.Log
public boolean isDebugEnabled() {
return android.util.Log.isLoggable(this.tag, 3) && (getLevel() == null || getLevel().getValue() <= LogFactory.Level.DEBUG.getValue());
}
@Override // com.amazonaws.logging.Log
public boolean isInfoEnabled() {
return android.util.Log.isLoggable(this.tag, 4) && (getLevel() == null || getLevel().getValue() <= LogFactory.Level.INFO.getValue());
}
@Override // com.amazonaws.logging.Log
public void trace(Object obj) {
if (getLevel() == null || getLevel().getValue() <= LogFactory.Level.TRACE.getValue()) {
obj.toString();
}
}
@Override // com.amazonaws.logging.Log
public void debug(Object obj) {
if (getLevel() == null || getLevel().getValue() <= LogFactory.Level.DEBUG.getValue()) {
obj.toString();
}
}
@Override // com.amazonaws.logging.Log
public void debug(Object obj, Throwable th) {
if (getLevel() == null || getLevel().getValue() <= LogFactory.Level.DEBUG.getValue()) {
obj.toString();
}
}
@Override // com.amazonaws.logging.Log
public void info(Object obj) {
if (getLevel() == null || getLevel().getValue() <= LogFactory.Level.INFO.getValue()) {
obj.toString();
}
}
@Override // com.amazonaws.logging.Log
public void warn(Object obj) {
if (getLevel() == null || getLevel().getValue() <= LogFactory.Level.WARN.getValue()) {
android.util.Log.w(this.tag, obj.toString());
}
}
@Override // com.amazonaws.logging.Log
public void warn(Object obj, Throwable th) {
if (getLevel() == null || getLevel().getValue() <= LogFactory.Level.WARN.getValue()) {
android.util.Log.w(this.tag, obj.toString(), th);
}
}
@Override // com.amazonaws.logging.Log
public void error(Object obj) {
if (getLevel() == null || getLevel().getValue() <= LogFactory.Level.ERROR.getValue()) {
android.util.Log.e(this.tag, obj.toString());
}
}
@Override // com.amazonaws.logging.Log
public void error(Object obj, Throwable th) {
if (getLevel() == null || getLevel().getValue() <= LogFactory.Level.ERROR.getValue()) {
android.util.Log.e(this.tag, obj.toString(), th);
}
}
public final LogFactory.Level getLevel() {
LogFactory.Level level = this.level;
return level != null ? level : LogFactory.getLevel();
}
}

View File

@@ -0,0 +1,105 @@
package com.amazonaws.logging;
import com.amazonaws.logging.LogFactory;
import java.io.PrintStream;
/* loaded from: classes.dex */
public final class ConsoleLog implements Log {
public LogFactory.Level level = null;
public final String tag;
public ConsoleLog(String str) {
this.tag = str;
}
@Override // com.amazonaws.logging.Log
public boolean isDebugEnabled() {
return getLevel() == null || getLevel().getValue() <= LogFactory.Level.DEBUG.getValue();
}
public boolean isErrorEnabled() {
return getLevel() == null || getLevel().getValue() <= LogFactory.Level.ERROR.getValue();
}
@Override // com.amazonaws.logging.Log
public boolean isInfoEnabled() {
return getLevel() == null || getLevel().getValue() <= LogFactory.Level.INFO.getValue();
}
public boolean isTraceEnabled() {
return getLevel() == null || getLevel().getValue() <= LogFactory.Level.TRACE.getValue();
}
public boolean isWarnEnabled() {
return getLevel() == null || getLevel().getValue() <= LogFactory.Level.WARN.getValue();
}
@Override // com.amazonaws.logging.Log
public void trace(Object obj) {
if (isTraceEnabled()) {
log(LogFactory.Level.TRACE, obj, null);
}
}
@Override // com.amazonaws.logging.Log
public void debug(Object obj) {
if (isDebugEnabled()) {
log(LogFactory.Level.DEBUG, obj, null);
}
}
@Override // com.amazonaws.logging.Log
public void debug(Object obj, Throwable th) {
if (isDebugEnabled()) {
log(LogFactory.Level.DEBUG, obj, th);
}
}
@Override // com.amazonaws.logging.Log
public void info(Object obj) {
if (isInfoEnabled()) {
log(LogFactory.Level.INFO, obj, null);
}
}
@Override // com.amazonaws.logging.Log
public void warn(Object obj) {
if (isWarnEnabled()) {
log(LogFactory.Level.WARN, obj, null);
}
}
@Override // com.amazonaws.logging.Log
public void warn(Object obj, Throwable th) {
if (isWarnEnabled()) {
log(LogFactory.Level.WARN, obj, th);
}
}
@Override // com.amazonaws.logging.Log
public void error(Object obj) {
if (isErrorEnabled()) {
log(LogFactory.Level.ERROR, obj, null);
}
}
@Override // com.amazonaws.logging.Log
public void error(Object obj, Throwable th) {
if (isErrorEnabled()) {
log(LogFactory.Level.ERROR, obj, th);
}
}
public final void log(LogFactory.Level level, Object obj, Throwable th) {
PrintStream printStream = System.out;
printStream.printf("%s/%s: %s\n", this.tag, level.name(), obj);
if (th != null) {
printStream.println(th.toString());
}
}
private LogFactory.Level getLevel() {
LogFactory.Level level = this.level;
return level != null ? level : LogFactory.getLevel();
}
}

View File

@@ -0,0 +1,13 @@
package com.amazonaws.logging;
/* loaded from: classes.dex */
public abstract class Environment {
public static boolean isJUnitTest() {
for (StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace()) {
if (stackTraceElement.getClassName().startsWith("org.junit.")) {
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,24 @@
package com.amazonaws.logging;
/* loaded from: classes.dex */
public interface Log {
void debug(Object obj);
void debug(Object obj, Throwable th);
void error(Object obj);
void error(Object obj, Throwable th);
void info(Object obj);
boolean isDebugEnabled();
boolean isInfoEnabled();
void trace(Object obj);
void warn(Object obj);
void warn(Object obj, Throwable th);
}

View File

@@ -0,0 +1,78 @@
package com.amazonaws.logging;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public abstract class LogFactory {
public static final String TAG = "LogFactory";
public static final Map logMap = new HashMap();
public static Level globalLogLevel = null;
public static Level getLevel() {
return globalLogLevel;
}
public static void setLevel(Level level) {
globalLogLevel = level;
}
public static synchronized Log getLog(Class cls) {
Log log;
synchronized (LogFactory.class) {
log = getLog(getTruncatedLogTag(cls.getSimpleName()));
}
return log;
}
public static synchronized Log getLog(String str) {
Log androidLog;
synchronized (LogFactory.class) {
try {
String truncatedLogTag = getTruncatedLogTag(str);
Map map = logMap;
Log log = (Log) map.get(truncatedLogTag);
if (log != null) {
return log;
}
if (Environment.isJUnitTest()) {
androidLog = new ConsoleLog(truncatedLogTag);
} else {
androidLog = new AndroidLog(truncatedLogTag);
}
map.put(truncatedLogTag, androidLog);
return androidLog;
} catch (Throwable th) {
throw th;
}
}
}
public static String getTruncatedLogTag(String str) {
if (str.length() <= 23) {
return str;
}
getLog(TAG).warn("Truncating log tag length as it exceed 23, the limit imposed by Android on certain API Levels");
return str.substring(0, 23);
}
public enum Level {
ALL(Integer.MIN_VALUE),
TRACE(0),
DEBUG(1),
INFO(2),
WARN(3),
ERROR(4),
OFF(Integer.MAX_VALUE);
private final int value;
public int getValue() {
return this.value;
}
Level(int i) {
this.value = i;
}
}
}

View File

@@ -0,0 +1,458 @@
package com.amazonaws.metrics;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.PropertiesCredentials;
import com.amazonaws.handlers.HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.regions.Regions;
import com.amazonaws.util.AWSRequestMetrics;
import com.amazonaws.util.AWSServiceMetrics;
import com.ironsource.v8;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/* loaded from: classes.dex */
public enum AwsSdkMetrics {
;
public static final String AWS_CREDENTAIL_PROPERTIES_FILE = "credentialFile";
public static final String CLOUDWATCH_REGION = "cloudwatchRegion";
private static final boolean DEFAULT_METRICS_ENABLED;
private static final String DEFAULT_METRIC_COLLECTOR_FACTORY = "com.amazonaws.metrics.internal.cloudwatch.DefaultMetricCollectorFactory";
public static final String DEFAULT_METRIC_NAMESPACE = "AWSSDK/Java";
public static final String EXCLUDE_MACHINE_METRICS = "excludeMachineMetrics";
public static final String HOST_METRIC_NAME = "hostMetricName";
public static final String INCLUDE_PER_HOST_METRICS = "includePerHostMetrics";
public static final String JVM_METRIC_NAME = "jvmMetricName";
private static final String MBEAN_OBJECT_NAME = "com.amazonaws.management:type=" + AwsSdkMetrics.class.getSimpleName();
public static final String METRIC_NAME_SPACE = "metricNameSpace";
public static final String METRIC_QUEUE_SIZE = "metricQueueSize";
public static final String QUEUE_POLL_TIMEOUT_MILLI = "getQueuePollTimeoutMilli";
private static final int QUEUE_POLL_TIMEOUT_MILLI_MINUMUM = 1000;
private static final MetricRegistry REGISTRY;
public static final String USE_SINGLE_METRIC_NAMESPACE = "useSingleMetricNamespace";
private static volatile String credentialFile;
private static volatile AWSCredentialsProvider credentialProvider;
private static boolean dirtyEnabling;
private static volatile String hostMetricName;
private static volatile String jvmMetricName;
private static volatile boolean machineMetricsExcluded;
private static volatile MetricCollector mc;
private static volatile String metricNameSpace;
private static volatile Integer metricQueueSize;
private static volatile boolean perHostMetricsIncluded;
private static volatile Long queuePollTimeoutMilli;
private static volatile Regions region;
private static volatile boolean singleMetricNamespace;
public static String getCredentailFile() {
return credentialFile;
}
public static String getHostMetricName() {
return hostMetricName;
}
public static MetricCollector getInternalMetricCollector() {
return mc;
}
public static String getJvmMetricName() {
return jvmMetricName;
}
public static String getMetricNameSpace() {
return metricNameSpace;
}
public static Integer getMetricQueueSize() {
return metricQueueSize;
}
public static Long getQueuePollTimeoutMilli() {
return queuePollTimeoutMilli;
}
public static Regions getRegion() {
return region;
}
public static boolean isDefaultMetricsEnabled() {
return DEFAULT_METRICS_ENABLED;
}
public static boolean isMachineMetricExcluded() {
return machineMetricsExcluded;
}
public static boolean isPerHostMetricIncluded() {
return perHostMetricsIncluded;
}
public static boolean isSingleMetricNamespace() {
return singleMetricNamespace;
}
public static void setHostMetricName(String str) {
hostMetricName = str;
}
public static void setJvmMetricName(String str) {
jvmMetricName = str;
}
public static void setMachineMetricsExcluded(boolean z) {
machineMetricsExcluded = z;
}
public static void setMetricQueueSize(Integer num) {
metricQueueSize = num;
}
public static void setPerHostMetricsIncluded(boolean z) {
perHostMetricsIncluded = z;
}
public static void setQueuePollTimeoutMilli(Long l) {
queuePollTimeoutMilli = l;
}
public static void setRegion(Regions regions) {
region = regions;
}
public static void setSingleMetricNamespace(boolean z) {
singleMetricNamespace = z;
}
static {
metricNameSpace = DEFAULT_METRIC_NAMESPACE;
String property = System.getProperty("com.amazonaws.sdk.enableDefaultMetrics");
boolean z = property != null;
DEFAULT_METRICS_ENABLED = z;
if (z) {
boolean z2 = false;
boolean z3 = false;
boolean z4 = false;
for (String str : property.split(",")) {
String trim = str.trim();
if (!z2 && EXCLUDE_MACHINE_METRICS.equals(trim)) {
z2 = true;
} else if (!z3 && INCLUDE_PER_HOST_METRICS.equals(trim)) {
z3 = true;
} else if (z4 || !USE_SINGLE_METRIC_NAMESPACE.equals(trim)) {
String[] split = trim.split(v8.i.b);
if (split.length == 2) {
String trim2 = split[0].trim();
String trim3 = split[1].trim();
try {
if (AWS_CREDENTAIL_PROPERTIES_FILE.equals(trim2)) {
setCredentialFile0(trim3);
} else if (CLOUDWATCH_REGION.equals(trim2)) {
region = Regions.fromName(trim3);
} else if (METRIC_QUEUE_SIZE.equals(trim2)) {
Integer num = new Integer(trim3);
if (num.intValue() < 1) {
throw new IllegalArgumentException("metricQueueSize must be at least 1");
}
metricQueueSize = num;
} else if (QUEUE_POLL_TIMEOUT_MILLI.equals(trim2)) {
Long l = new Long(trim3);
if (l.intValue() < 1000) {
throw new IllegalArgumentException("getQueuePollTimeoutMilli must be at least 1000");
}
queuePollTimeoutMilli = l;
} else if (METRIC_NAME_SPACE.equals(trim2)) {
metricNameSpace = trim3;
} else if (JVM_METRIC_NAME.equals(trim2)) {
jvmMetricName = trim3;
} else if (HOST_METRIC_NAME.equals(trim2)) {
hostMetricName = trim3;
} else {
LogFactory.getLog(AwsSdkMetrics.class).debug("Ignoring unrecognized parameter: " + trim);
}
} catch (Exception e) {
LogFactory.getLog(AwsSdkMetrics.class).debug("Ignoring failure", e);
}
} else {
continue;
}
} else {
z4 = true;
}
}
machineMetricsExcluded = z2;
perHostMetricsIncluded = z3;
singleMetricNamespace = z4;
}
REGISTRY = new MetricRegistry();
}
public static <T extends RequestMetricCollector> T getRequestMetricCollector() {
if (mc == null && isDefaultMetricsEnabled()) {
enableDefaultMetrics();
}
return mc == null ? (T) RequestMetricCollector.NONE : (T) mc.getRequestMetricCollector();
}
public static <T extends ServiceMetricCollector> T getServiceMetricCollector() {
if (mc == null && isDefaultMetricsEnabled()) {
enableDefaultMetrics();
}
return mc == null ? (T) ServiceMetricCollector.NONE : (T) mc.getServiceMetricCollector();
}
public static <T extends MetricCollector> T getMetricCollector() {
if (mc == null && isDefaultMetricsEnabled()) {
enableDefaultMetrics();
}
return mc == null ? (T) MetricCollector.NONE : (T) mc;
}
public static synchronized void setMetricCollector(MetricCollector metricCollector) {
synchronized (AwsSdkMetrics.class) {
MetricCollector metricCollector2 = mc;
mc = metricCollector;
if (metricCollector2 != null) {
metricCollector2.stop();
}
}
}
public static boolean isMetricsEnabled() {
MetricCollector metricCollector = mc;
return metricCollector != null && metricCollector.isEnabled();
}
public static boolean isPerHostMetricEnabled() {
if (perHostMetricsIncluded) {
return true;
}
String str = hostMetricName;
return (str == null ? "" : str.trim()).length() > 0;
}
public static synchronized boolean enableDefaultMetrics() {
synchronized (AwsSdkMetrics.class) {
try {
if (mc != null) {
if (!mc.isEnabled()) {
}
}
if (dirtyEnabling) {
throw new IllegalStateException("Reentrancy is not allowed");
}
dirtyEnabling = true;
try {
try {
HandlerChainFactory$$ExternalSyntheticThrowCCEIfNotNull0.m(Class.forName(DEFAULT_METRIC_COLLECTOR_FACTORY).newInstance());
throw null;
} catch (Throwable th) {
dirtyEnabling = false;
throw th;
}
} catch (Exception e) {
LogFactory.getLog(AwsSdkMetrics.class).warn("Failed to enable the default metrics", e);
dirtyEnabling = false;
}
} catch (Throwable th2) {
throw th2;
}
}
return false;
}
public static void disableMetrics() {
setMetricCollector(MetricCollector.NONE);
}
public static boolean add(MetricType metricType) {
if (metricType == null) {
return false;
}
return REGISTRY.addMetricType(metricType);
}
public static <T extends MetricType> boolean addAll(Collection<T> collection) {
if (collection == null || collection.size() == 0) {
return false;
}
return REGISTRY.addMetricTypes(collection);
}
public static <T extends MetricType> void set(Collection<T> collection) {
REGISTRY.setMetricTypes(collection);
}
public static boolean remove(MetricType metricType) {
if (metricType == null) {
return false;
}
return REGISTRY.removeMetricType(metricType);
}
public static Set<MetricType> getPredefinedMetrics() {
return REGISTRY.predefinedMetrics();
}
public static AWSCredentialsProvider getCredentialProvider() {
for (StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace()) {
if (stackTraceElement.getClassName().equals(DEFAULT_METRIC_COLLECTOR_FACTORY)) {
return credentialProvider;
}
}
SecurityException securityException = new SecurityException();
LogFactory.getLog(AwsSdkMetrics.class).warn("Illegal attempt to access the credential provider", securityException);
throw securityException;
}
public static synchronized void setCredentialProvider(AWSCredentialsProvider aWSCredentialsProvider) {
synchronized (AwsSdkMetrics.class) {
credentialProvider = aWSCredentialsProvider;
}
}
public static void setCredentialFile(String str) throws IOException {
setCredentialFile0(str);
}
private static void setCredentialFile0(String str) throws IOException {
final PropertiesCredentials propertiesCredentials = new PropertiesCredentials(new File(str));
synchronized (AwsSdkMetrics.class) {
credentialProvider = new AWSCredentialsProvider() { // from class: com.amazonaws.metrics.AwsSdkMetrics.1
@Override // com.amazonaws.auth.AWSCredentialsProvider
public AWSCredentials getCredentials() {
return PropertiesCredentials.this;
}
};
credentialFile = str;
}
}
public static void setMetricNameSpace(String str) {
if (str == null || str.trim().length() == 0) {
throw new IllegalArgumentException();
}
metricNameSpace = str;
}
public static class MetricRegistry {
public final Set metricTypes;
public volatile Set readOnly;
public Set predefinedMetrics() {
return this.readOnly;
}
public MetricRegistry() {
HashSet hashSet = new HashSet();
this.metricTypes = hashSet;
hashSet.add(AWSRequestMetrics.Field.ClientExecuteTime);
hashSet.add(AWSRequestMetrics.Field.Exception);
hashSet.add(AWSRequestMetrics.Field.HttpClientRetryCount);
hashSet.add(AWSRequestMetrics.Field.HttpRequestTime);
hashSet.add(AWSRequestMetrics.Field.RequestCount);
hashSet.add(AWSRequestMetrics.Field.RetryCount);
hashSet.add(AWSRequestMetrics.Field.HttpClientSendRequestTime);
hashSet.add(AWSRequestMetrics.Field.HttpClientReceiveResponseTime);
hashSet.add(AWSServiceMetrics.HttpClientGetConnectionTime);
syncReadOnly();
}
public final void syncReadOnly() {
this.readOnly = Collections.unmodifiableSet(new HashSet(this.metricTypes));
}
public boolean addMetricType(MetricType metricType) {
boolean add;
synchronized (this.metricTypes) {
try {
add = this.metricTypes.add(metricType);
if (add) {
syncReadOnly();
}
} catch (Throwable th) {
throw th;
}
}
return add;
}
public boolean addMetricTypes(Collection collection) {
boolean addAll;
synchronized (this.metricTypes) {
try {
addAll = this.metricTypes.addAll(collection);
if (addAll) {
syncReadOnly();
}
} catch (Throwable th) {
throw th;
}
}
return addAll;
}
/* JADX WARN: Removed duplicated region for block: B:13:0x0029 A[Catch: all -> 0x000c, TryCatch #0 {all -> 0x000c, blocks: (B:17:0x0005, B:11:0x001e, B:13:0x0029, B:14:0x002c, B:4:0x000e, B:6:0x0016, B:10:0x001a), top: B:16:0x0005 }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void setMetricTypes(java.util.Collection r3) {
/*
r2 = this;
java.util.Set r0 = r2.metricTypes
monitor-enter(r0)
if (r3 == 0) goto Le
int r1 = r3.size() // Catch: java.lang.Throwable -> Lc
if (r1 != 0) goto L1e
goto Le
Lc:
r3 = move-exception
goto L2e
Le:
java.util.Set r1 = r2.metricTypes // Catch: java.lang.Throwable -> Lc
int r1 = r1.size() // Catch: java.lang.Throwable -> Lc
if (r1 != 0) goto L18
monitor-exit(r0) // Catch: java.lang.Throwable -> Lc
return
L18:
if (r3 != 0) goto L1e
java.util.List r3 = java.util.Collections.emptyList() // Catch: java.lang.Throwable -> Lc
L1e:
java.util.Set r1 = r2.metricTypes // Catch: java.lang.Throwable -> Lc
r1.clear() // Catch: java.lang.Throwable -> Lc
boolean r3 = r2.addMetricTypes(r3) // Catch: java.lang.Throwable -> Lc
if (r3 != 0) goto L2c
r2.syncReadOnly() // Catch: java.lang.Throwable -> Lc
L2c:
monitor-exit(r0) // Catch: java.lang.Throwable -> Lc
return
L2e:
monitor-exit(r0) // Catch: java.lang.Throwable -> Lc
throw r3
*/
throw new UnsupportedOperationException("Method not decompiled: com.amazonaws.metrics.AwsSdkMetrics.MetricRegistry.setMetricTypes(java.util.Collection):void");
}
public boolean removeMetricType(MetricType metricType) {
boolean remove;
synchronized (this.metricTypes) {
try {
remove = this.metricTypes.remove(metricType);
if (remove) {
syncReadOnly();
}
} catch (Throwable th) {
throw th;
}
}
return remove;
}
}
}

View File

@@ -0,0 +1,34 @@
package com.amazonaws.metrics;
/* loaded from: classes.dex */
public abstract class MetricCollector {
public static final MetricCollector NONE = new MetricCollector() { // from class: com.amazonaws.metrics.MetricCollector.1
@Override // com.amazonaws.metrics.MetricCollector
public boolean isEnabled() {
return false;
}
@Override // com.amazonaws.metrics.MetricCollector
public boolean stop() {
return true;
}
@Override // com.amazonaws.metrics.MetricCollector
public RequestMetricCollector getRequestMetricCollector() {
return RequestMetricCollector.NONE;
}
@Override // com.amazonaws.metrics.MetricCollector
public ServiceMetricCollector getServiceMetricCollector() {
return ServiceMetricCollector.NONE;
}
};
public abstract RequestMetricCollector getRequestMetricCollector();
public abstract ServiceMetricCollector getServiceMetricCollector();
public abstract boolean isEnabled();
public abstract boolean stop();
}

View File

@@ -0,0 +1,6 @@
package com.amazonaws.metrics;
/* loaded from: classes.dex */
public interface MetricType {
String name();
}

View File

@@ -0,0 +1,22 @@
package com.amazonaws.metrics;
import com.amazonaws.Request;
import com.amazonaws.Response;
/* loaded from: classes.dex */
public abstract class RequestMetricCollector {
public static final RequestMetricCollector NONE = new RequestMetricCollector() { // from class: com.amazonaws.metrics.RequestMetricCollector.1
@Override // com.amazonaws.metrics.RequestMetricCollector
public void collectMetrics(Request request, Response response) {
}
@Override // com.amazonaws.metrics.RequestMetricCollector
public boolean isEnabled() {
return false;
}
};
public abstract void collectMetrics(Request request, Response response);
public abstract boolean isEnabled();
}

View File

@@ -0,0 +1,7 @@
package com.amazonaws.metrics;
/* loaded from: classes.dex */
public abstract class ServiceMetricCollector {
public static final ServiceMetricCollector NONE = new ServiceMetricCollector() { // from class: com.amazonaws.metrics.ServiceMetricCollector.1
};
}

View File

@@ -0,0 +1,145 @@
package com.amazonaws.mobileconnectors.kinesis.kinesisrecorder;
import com.amazonaws.AmazonClientException;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.FileRecordStore;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes.dex */
public abstract class AbstractKinesisRecorder {
public static final Log LOGGER = LogFactory.getLog(AbstractKinesisRecorder.class);
public KinesisRecorderConfig config;
public FileRecordStore recordStore;
public KinesisRecorderConfig getKinesisRecorderConfig() {
return this.config;
}
public abstract RecordSender getRecordSender();
public AbstractKinesisRecorder(FileRecordStore fileRecordStore, KinesisRecorderConfig kinesisRecorderConfig) {
if (fileRecordStore == null) {
throw new IllegalArgumentException("Record store can't be null");
}
this.recordStore = fileRecordStore;
this.config = kinesisRecorderConfig;
}
public void saveRecord(byte[] bArr, String str) {
try {
this.recordStore.put(FileRecordParser.asString(str, bArr));
} catch (IOException e) {
throw new AmazonClientException("Error saving record", e);
}
}
public synchronized void submitAllRecords() {
String nextBatch;
List list;
RecordSender recordSender = getRecordSender();
FileRecordStore.RecordIterator it = this.recordStore.iterator();
ArrayList arrayList = new ArrayList(128);
int i = 0;
int i2 = 0;
boolean z = false;
while (it.hasNext() && i < 3 && (nextBatch = nextBatch(it, arrayList, 128, 524288)) != null && !arrayList.isEmpty()) {
try {
try {
try {
list = recordSender.sendBatch(nextBatch, arrayList);
} catch (AmazonClientException e) {
if (z || e.getMessage() == null || !e.getMessage().contains("Unable to unmarshall error response")) {
throw e;
}
list = arrayList;
z = true;
}
try {
int size = arrayList.size() - list.size();
i2 += size;
it.removeReadRecords();
if (size == 0) {
i++;
}
if (!list.isEmpty()) {
Iterator it2 = list.iterator();
while (it2.hasNext()) {
saveRecord((byte[]) it2.next(), nextBatch);
}
}
} catch (AmazonClientException e2) {
if (recordSender.isRecoverable(e2)) {
LOGGER.error("ServiceException in submit all, the values of the data inside the requests appears valid. The request will be kept", e2);
} else {
try {
this.config.getDeadLetterListener();
throw null;
} catch (Exception e3) {
Log log = LOGGER;
log.error("DeadLetterListener onRecordsDropped has thrown an exception (user code)", e3);
try {
it.removeReadRecords();
log.error("ServiceException in submit all, the last request is presumed to be the cause and will be dropped", e2);
throw e2;
} catch (IOException e4) {
throw new AmazonClientException("Failed to drop bad records.", e4);
}
}
}
throw e2;
}
} catch (IOException e5) {
throw new AmazonClientException("Failed to remove read records", e5);
}
} catch (Throwable th) {
LOGGER.debug(String.format("submitAllRecords sent %d records", Integer.valueOf(i2)));
try {
it.close();
throw th;
} catch (IOException e6) {
throw new AmazonClientException("Failed to close record file", e6);
}
}
}
LOGGER.debug(String.format("submitAllRecords sent %d records", Integer.valueOf(i2)));
try {
it.close();
} catch (IOException e7) {
throw new AmazonClientException("Failed to close record file", e7);
}
}
public String nextBatch(FileRecordStore.RecordIterator recordIterator, List list, int i, int i2) {
list.clear();
FileRecordParser fileRecordParser = new FileRecordParser();
String str = null;
int i3 = 0;
int i4 = 0;
while (recordIterator.hasNext() && i3 < i && i4 < i2) {
String peek = recordIterator.peek();
if (peek == null || peek.isEmpty()) {
recordIterator.next();
} else {
try {
fileRecordParser.parse(peek);
if (str != null && !str.equals(fileRecordParser.streamName)) {
break;
}
list.add(fileRecordParser.bytes);
i3++;
i4 += fileRecordParser.bytes.length;
str = fileRecordParser.streamName;
recordIterator.next();
} catch (Exception e) {
LOGGER.warn("Failed to read line. Skip.", e);
recordIterator.next();
}
}
}
return str;
}
}

View File

@@ -0,0 +1,5 @@
package com.amazonaws.mobileconnectors.kinesis.kinesisrecorder;
/* loaded from: classes.dex */
public interface DeadLetterListener {
}

View File

@@ -0,0 +1,39 @@
package com.amazonaws.mobileconnectors.kinesis.kinesisrecorder;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
/* loaded from: classes.dex */
class FileManager {
public final File directory;
public FileManager(File file) {
this.directory = file;
}
public File createDirectory(String str) {
File file = new File(this.directory, str);
if (file.exists() || file.mkdirs()) {
return file;
}
return null;
}
public File createFile(File file) {
if (file.exists() || file.createNewFile()) {
return file;
}
return null;
}
public InputStream newInputStream(File file) {
return new FileInputStream(file);
}
public OutputStream newOutputStream(File file, boolean z) {
return new FileOutputStream(file, z);
}
}

View File

@@ -0,0 +1,26 @@
package com.amazonaws.mobileconnectors.kinesis.kinesisrecorder;
import com.amazonaws.util.Base64;
/* loaded from: classes.dex */
class FileRecordParser {
public byte[] bytes;
public String streamName;
public void parse(String str) {
String[] split = str.split(",", 2);
if (split.length < 2) {
throw new IllegalArgumentException("Invalid line: " + str);
}
this.streamName = split[0];
this.bytes = Base64.decode(split[1]);
}
public String toString() {
return asString(this.streamName, this.bytes);
}
public static String asString(String str, byte[] bArr) {
return str + "," + Base64.encodeAsString(bArr);
}
}

View File

@@ -0,0 +1,314 @@
package com.amazonaws.mobileconnectors.kinesis.kinesisrecorder;
import com.amazonaws.AmazonClientException;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.util.StringUtils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.concurrent.locks.ReentrantLock;
/* loaded from: classes.dex */
class FileRecordStore {
public static final Log LOGGER = LogFactory.getLog(FileRecordStore.class);
public final ReentrantLock accessLock = new ReentrantLock(true);
public final FileManager fileManager;
public final long maxStorageSize;
public File recordFile;
public final String recordFileName;
public FileRecordStore(File file, String str, long j) {
this.fileManager = new FileManager(file);
this.recordFileName = str;
this.maxStorageSize = j;
try {
tryCreateRecordsFile();
} catch (IOException e) {
throw new AmazonClientException("Failed to create file store", e);
}
}
public boolean put(String str) {
BufferedWriter bufferedWriter;
boolean z;
this.accessLock.lock();
try {
bufferedWriter = tryInitializeWriter();
} catch (Throwable th) {
th = th;
bufferedWriter = null;
}
try {
if (this.recordFile.length() + str.getBytes(StringUtils.UTF8).length <= this.maxStorageSize) {
bufferedWriter.write(str);
bufferedWriter.newLine();
bufferedWriter.flush();
z = true;
} else {
z = false;
}
if (bufferedWriter != null) {
bufferedWriter.close();
}
this.accessLock.unlock();
return z;
} catch (Throwable th2) {
th = th2;
if (bufferedWriter != null) {
bufferedWriter.close();
}
this.accessLock.unlock();
throw th;
}
}
public final void tryCreateRecordsFile() {
File file = this.recordFile;
if (file == null || !file.exists()) {
synchronized (this) {
try {
File file2 = this.recordFile;
if (file2 == null || !file2.exists()) {
this.recordFile = this.fileManager.createFile(new File(this.fileManager.createDirectory("KinesisRecorder"), this.recordFileName));
}
} catch (Throwable th) {
throw th;
}
}
}
}
public final BufferedWriter tryInitializeWriter() {
tryCreateRecordsFile();
return new BufferedWriter(new OutputStreamWriter(this.fileManager.newOutputStream(this.recordFile, true), StringUtils.UTF8));
}
public final File deleteReadRecords(int i) {
BufferedReader bufferedReader;
File file = new File(this.fileManager.createDirectory("KinesisRecorder"), this.recordFileName + ".tmp");
if (file.exists() && !file.delete()) {
throw new IOException("Failed to delete previous temp file");
}
File createFile = this.fileManager.createFile(file);
if (createFile != null && this.recordFile.exists() && createFile.exists()) {
PrintWriter printWriter = null;
try {
FileInputStream fileInputStream = new FileInputStream(this.recordFile);
Charset charset = StringUtils.UTF8;
bufferedReader = new BufferedReader(new InputStreamReader(fileInputStream, charset));
try {
PrintWriter printWriter2 = new PrintWriter(new OutputStreamWriter(new FileOutputStream(createFile, true), charset));
int i2 = 0;
while (true) {
try {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
i2++;
if (i2 > i) {
printWriter2.println(readLine);
printWriter2.flush();
}
} catch (Throwable th) {
th = th;
printWriter = printWriter2;
if (printWriter != null) {
printWriter.close();
}
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException e) {
LOGGER.error("failed to close reader", e);
}
}
if (!this.recordFile.delete() || !createFile.renameTo(this.recordFile)) {
throw new IOException("Failed to delete read records and persist unread records");
}
throw th;
}
}
printWriter2.close();
try {
bufferedReader.close();
} catch (IOException e2) {
LOGGER.error("failed to close reader", e2);
}
if (!this.recordFile.delete() || !createFile.renameTo(this.recordFile)) {
throw new IOException("Failed to delete read records and persist unread records");
}
if (file.exists() && !file.delete()) {
LOGGER.error("Failed to delete temp file");
}
} catch (Throwable th2) {
th = th2;
}
} catch (Throwable th3) {
th = th3;
bufferedReader = null;
}
}
return this.recordFile;
}
public RecordIterator iterator() {
return new RecordIterator();
}
public class RecordIterator implements Iterator<String> {
public int linesRead = 0;
public String nextBuffer = null;
public BufferedReader reader = null;
public boolean isEndOfFile = false;
public RecordIterator() {
}
public final boolean tryOpenReader() {
if (this.reader != null) {
return true;
}
if (this.isEndOfFile) {
return false;
}
this.reader = new BufferedReader(new InputStreamReader(FileRecordStore.this.fileManager.newInputStream(FileRecordStore.this.recordFile), StringUtils.UTF8));
return true;
}
public final void tryCloseReader() {
BufferedReader bufferedReader = this.reader;
if (bufferedReader != null) {
bufferedReader.close();
this.reader = null;
}
}
@Override // java.util.Iterator
public boolean hasNext() {
FileRecordStore.this.accessLock.lock();
try {
try {
boolean z = true;
if (this.nextBuffer == null) {
if (!tryOpenReader()) {
return false;
}
try {
this.nextBuffer = this.reader.readLine();
} catch (IOException unused) {
this.nextBuffer = null;
}
if (this.nextBuffer == null) {
this.isEndOfFile = true;
tryCloseReader();
z = false;
}
}
return z;
} finally {
FileRecordStore.this.accessLock.unlock();
}
} catch (FileNotFoundException e) {
throw new AmazonClientException("Cannot find records file", e);
} catch (IOException e2) {
throw new AmazonClientException("IO Error", e2);
}
}
@Override // java.util.Iterator
public String next() {
String str;
FileRecordStore.this.accessLock.lock();
try {
try {
String str2 = this.nextBuffer;
if (str2 != null) {
this.linesRead++;
this.nextBuffer = null;
} else {
if (!tryOpenReader()) {
FileRecordStore.this.accessLock.unlock();
return null;
}
boolean z = false;
loop0: while (true) {
str = null;
while (!z) {
try {
str = this.reader.readLine();
z = true;
} catch (IOException unused) {
z = true;
}
}
break loop0;
}
if (str != null) {
this.linesRead++;
} else {
this.isEndOfFile = true;
tryCloseReader();
}
str2 = str;
}
FileRecordStore.this.accessLock.unlock();
return str2;
} catch (FileNotFoundException e) {
throw new AmazonClientException("Cannot find records file", e);
} catch (IOException e2) {
throw new AmazonClientException("IO Error", e2);
}
} catch (Throwable th) {
FileRecordStore.this.accessLock.unlock();
throw th;
}
}
public String peek() {
FileRecordStore.this.accessLock.lock();
try {
hasNext();
return this.nextBuffer;
} finally {
FileRecordStore.this.accessLock.unlock();
}
}
@Override // java.util.Iterator
public void remove() {
throw new UnsupportedOperationException("The remove() operation is not supported for this iterator");
}
public void removeReadRecords() {
FileRecordStore.this.accessLock.lock();
try {
FileRecordStore.this.deleteReadRecords(this.linesRead);
resetReader();
} finally {
FileRecordStore.this.accessLock.unlock();
}
}
public final void resetReader() {
tryCloseReader();
this.linesRead = 0;
this.nextBuffer = null;
this.isEndOfFile = false;
}
public void close() {
tryCloseReader();
}
}
}

View File

@@ -0,0 +1,21 @@
package com.amazonaws.mobileconnectors.kinesis.kinesisrecorder;
import android.util.Base64;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import java.nio.ByteBuffer;
import org.json.JSONObject;
@Deprecated
/* loaded from: classes.dex */
abstract class JSONRecordAdapter {
public static final Log LOGGER = LogFactory.getLog(JSONRecordAdapter.class);
public static ByteBuffer getData(JSONObject jSONObject) {
return ByteBuffer.wrap(Base64.decode(jSONObject.getString("Data"), 0));
}
public static String getStreamName(JSONObject jSONObject) {
return jSONObject.getString("StreamName");
}
}

View File

@@ -0,0 +1,92 @@
package com.amazonaws.mobileconnectors.kinesis.kinesisrecorder;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.FileRecordStore;
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.kinesis.AmazonKinesisClient;
import com.amazonaws.util.VersionInfoUtils;
import java.io.File;
import java.io.IOException;
import java.util.regex.Pattern;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class KinesisRecorder extends AbstractKinesisRecorder {
public final KinesisStreamRecordSender sender;
public static final Log LOGGER = LogFactory.getLog(KinesisRecorder.class);
public static final String USER_AGENT = KinesisRecorder.class.getName() + "/" + VersionInfoUtils.getVersion();
public static final Pattern STREAM_NAME_PATTERN = Pattern.compile("[a-zA-Z0-9_.-]{1,128}");
@Override // com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.AbstractKinesisRecorder
public RecordSender getRecordSender() {
return this.sender;
}
public KinesisRecorder(File file, Regions regions, AWSCredentialsProvider aWSCredentialsProvider) {
this(file, regions, aWSCredentialsProvider, new KinesisRecorderConfig());
}
public KinesisRecorder(File file, Regions regions, AWSCredentialsProvider aWSCredentialsProvider, KinesisRecorderConfig kinesisRecorderConfig) {
super(new FileRecordStore(file, "kinesis_stream_records", kinesisRecorderConfig.getMaxStorageSize()), kinesisRecorderConfig);
if (file == null || aWSCredentialsProvider == null || regions == null) {
throw new IllegalArgumentException("You must pass a non-null credentialsProvider, region, directory, and config to KinesisRecordStore");
}
AmazonKinesisClient amazonKinesisClient = new AmazonKinesisClient(aWSCredentialsProvider, kinesisRecorderConfig.getClientConfiguration());
amazonKinesisClient.setRegion(Region.getRegion(regions));
this.sender = new KinesisStreamRecordSender(amazonKinesisClient, USER_AGENT, kinesisRecorderConfig.getPartitionKey());
checkUpgrade(file);
}
public final void checkUpgrade(final File file) {
if (new File(new File(file, "KinesisRecorder"), "KinesisRecords").isFile()) {
new Thread(new Runnable() { // from class: com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.KinesisRecorder.1
@Override // java.lang.Runnable
public void run() {
KinesisRecorder.this.upgrade(file);
}
}).start();
}
}
public void upgrade(File file) {
synchronized (this) {
try {
File file2 = new File(new File(file, "KinesisRecorder"), "KinesisRecords");
if (file2.isFile()) {
FileRecordStore.RecordIterator it = new FileRecordStore(file, "KinesisRecords", Long.MAX_VALUE).iterator();
while (it.hasNext()) {
try {
JSONObject jSONObject = new JSONObject(it.next());
saveRecord(JSONRecordAdapter.getData(jSONObject).array(), JSONRecordAdapter.getStreamName(jSONObject));
} catch (JSONException e) {
LOGGER.debug("caught exception", e);
}
}
try {
it.close();
} catch (IOException e2) {
LOGGER.debug("caught exception", e2);
}
file2.delete();
}
} catch (Throwable th) {
throw th;
}
}
}
@Override // com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.AbstractKinesisRecorder
public void saveRecord(byte[] bArr, String str) {
if (str == null || !STREAM_NAME_PATTERN.matcher(str).matches()) {
throw new IllegalArgumentException("Invalid stream name: " + str);
}
if (bArr == null || bArr.length == 0 || bArr.length > 1048576) {
throw new IllegalArgumentException("Invalid data size.");
}
super.saveRecord(bArr, str);
}
}

View File

@@ -0,0 +1,44 @@
package com.amazonaws.mobileconnectors.kinesis.kinesisrecorder;
import com.amazonaws.ClientConfiguration;
import com.unity3d.services.core.di.ServiceProvider;
/* loaded from: classes.dex */
public class KinesisRecorderConfig {
public final ClientConfiguration clientConfiguration;
public long maxStorageSize;
public String partitionKey;
public ClientConfiguration getClientConfiguration() {
return this.clientConfiguration;
}
public DeadLetterListener getDeadLetterListener() {
return null;
}
public long getMaxStorageSize() {
return this.maxStorageSize;
}
public String getPartitionKey() {
return this.partitionKey;
}
public KinesisRecorderConfig withMaxStorageSize(long j) {
this.maxStorageSize = j;
return this;
}
public KinesisRecorderConfig() {
this(new ClientConfiguration());
}
public KinesisRecorderConfig(ClientConfiguration clientConfiguration) {
this.maxStorageSize = ServiceProvider.HTTP_CACHE_DISK_SIZE;
if (clientConfiguration == null) {
throw new IllegalArgumentException();
}
this.clientConfiguration = new ClientConfiguration(clientConfiguration);
}
}

View File

@@ -0,0 +1,69 @@
package com.amazonaws.mobileconnectors.kinesis.kinesisrecorder;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.kinesis.AmazonKinesis;
import com.amazonaws.services.kinesis.model.PutRecordsRequest;
import com.amazonaws.services.kinesis.model.PutRecordsRequestEntry;
import com.amazonaws.services.kinesis.model.PutRecordsResult;
import com.amazonaws.services.kinesis.model.PutRecordsResultEntry;
import com.amazonaws.util.StringUtils;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
/* loaded from: classes.dex */
class KinesisStreamRecordSender implements RecordSender {
public final AmazonKinesis client;
public final String partitionKey;
public final String userAgent;
public KinesisStreamRecordSender(AmazonKinesis amazonKinesis, String str, String str2) {
this.client = amazonKinesis;
this.userAgent = str;
this.partitionKey = str2;
}
@Override // com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.RecordSender
public List sendBatch(String str, List list) {
if (list == null || list.isEmpty()) {
return Collections.emptyList();
}
PutRecordsRequest putRecordsRequest = new PutRecordsRequest();
putRecordsRequest.setStreamName(str);
ArrayList arrayList = new ArrayList(list.size());
Iterator it = list.iterator();
while (it.hasNext()) {
byte[] bArr = (byte[]) it.next();
String uuid = StringUtils.isBlank(this.partitionKey) ? UUID.randomUUID().toString() : this.partitionKey;
PutRecordsRequestEntry putRecordsRequestEntry = new PutRecordsRequestEntry();
putRecordsRequestEntry.setData(ByteBuffer.wrap(bArr));
putRecordsRequestEntry.setPartitionKey(uuid);
arrayList.add(putRecordsRequestEntry);
}
putRecordsRequest.setRecords(arrayList);
putRecordsRequest.getRequestClientOptions().appendUserAgent(this.userAgent);
PutRecordsResult putRecords = this.client.putRecords(putRecordsRequest);
int size = putRecords.getRecords().size();
ArrayList arrayList2 = new ArrayList(putRecords.getFailedRecordCount().intValue());
for (int i = 0; i < size; i++) {
if (((PutRecordsResultEntry) putRecords.getRecords().get(i)).getErrorCode() != null) {
arrayList2.add(list.get(i));
}
}
return arrayList2;
}
@Override // com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.RecordSender
public boolean isRecoverable(AmazonClientException amazonClientException) {
if (!(amazonClientException instanceof AmazonServiceException)) {
return amazonClientException.getCause() != null && (amazonClientException.getCause() instanceof IOException);
}
String errorCode = ((AmazonServiceException) amazonClientException).getErrorCode();
return "InternalFailure".equals(errorCode) || "ServiceUnavailable".equals(errorCode) || "Throttling".equals(errorCode) || "ProvisionedThroughputExceededException".equals(errorCode);
}
}

View File

@@ -0,0 +1,11 @@
package com.amazonaws.mobileconnectors.kinesis.kinesisrecorder;
import com.amazonaws.AmazonClientException;
import java.util.List;
/* loaded from: classes.dex */
interface RecordSender {
boolean isRecoverable(AmazonClientException amazonClientException);
List sendBatch(String str, List list);
}

View File

@@ -0,0 +1,73 @@
package com.amazonaws.regions;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public final class Region {
public final String domain;
public final String name;
public final Map serviceEndpoints = new HashMap();
public final Map httpSupport = new HashMap();
public final Map httpsSupport = new HashMap();
public String getDomain() {
return this.domain;
}
public Map getHttpSupport() {
return this.httpSupport;
}
public Map getHttpsSupport() {
return this.httpsSupport;
}
public String getName() {
return this.name;
}
public Map getServiceEndpoints() {
return this.serviceEndpoints;
}
public Region(String str, String str2) {
this.name = str;
if (str2 == null || str2.isEmpty()) {
this.domain = "amazonaws.com";
} else {
this.domain = str2;
}
}
public static Region getRegion(Regions regions) {
return RegionUtils.getRegion(regions.getName());
}
public static Region getRegion(String str) {
return RegionUtils.getRegion(str);
}
public String getServiceEndpoint(String str) {
return (String) this.serviceEndpoints.get(str);
}
public boolean isServiceSupported(String str) {
return this.serviceEndpoints.containsKey(str);
}
public boolean equals(Object obj) {
if (obj instanceof Region) {
return getName().equals(((Region) obj).getName());
}
return false;
}
public int hashCode() {
return getName().hashCode();
}
public String toString() {
return getName();
}
}

View File

@@ -0,0 +1,590 @@
package com.amazonaws.regions;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
abstract class RegionDefaults {
public static List getRegions() {
ArrayList arrayList = new ArrayList();
Region region = new Region("af-south-1", "amazonaws.com");
arrayList.add(region);
updateRegion(region, "autoscaling", "autoscaling.af-south-1.amazonaws.com", false, true);
updateRegion(region, "dynamodb", "dynamodb.af-south-1.amazonaws.com", false, true);
updateRegion(region, "ec2", "ec2.af-south-1.amazonaws.com", false, true);
updateRegion(region, "elasticloadbalancing", "elasticloadbalancing.af-south-1.amazonaws.com", false, true);
updateRegion(region, "kms", "kms.af-south-1.amazonaws.com", false, true);
updateRegion(region, "lambda", "lambda.af-south-1.amazonaws.com", false, true);
updateRegion(region, "logs", "logs.af-south-1.amazonaws.com", false, true);
updateRegion(region, "s3", "s3.af-south-1.amazonaws.com", false, true);
updateRegion(region, "sns", "sns.af-south-1.amazonaws.com", false, true);
updateRegion(region, "sqs", "sqs.af-south-1.amazonaws.com", false, true);
updateRegion(region, "sts", "sts.af-south-1.amazonaws.com", false, true);
Region region2 = new Region("ap-northeast-1", "amazonaws.com");
arrayList.add(region2);
updateRegion(region2, "autoscaling", "autoscaling.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "cognito-identity", "cognito-identity.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "cognito-idp", "cognito-idp.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "cognito-sync", "cognito-sync.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "data.iot", "data.iot.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "dynamodb", "dynamodb.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "ec2", "ec2.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "elasticloadbalancing", "elasticloadbalancing.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "firehose", "firehose.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "iot", "iot.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "kinesis", "kinesis.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "kms", "kms.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "lambda", "lambda.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "logs", "logs.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "polly", "polly.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "s3", "s3.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "sdb", "sdb.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "sns", "sns.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "sqs", "sqs.ap-northeast-1.amazonaws.com", false, true);
updateRegion(region2, "sts", "sts.ap-northeast-1.amazonaws.com", false, true);
Region region3 = new Region("ap-northeast-2", "amazonaws.com");
arrayList.add(region3);
updateRegion(region3, "autoscaling", "autoscaling.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "cognito-identity", "cognito-identity.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "cognito-idp", "cognito-idp.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "cognito-sync", "cognito-sync.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "data.iot", "data.iot.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "dynamodb", "dynamodb.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "ec2", "ec2.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "elasticloadbalancing", "elasticloadbalancing.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "iot", "iot.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "kinesis", "kinesis.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "kms", "kms.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "lambda", "lambda.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "logs", "logs.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "polly", "polly.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "s3", "s3.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "sns", "sns.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "sqs", "sqs.ap-northeast-2.amazonaws.com", false, true);
updateRegion(region3, "sts", "sts.ap-northeast-2.amazonaws.com", false, true);
Region region4 = new Region("ap-south-1", "amazonaws.com");
arrayList.add(region4);
updateRegion(region4, "autoscaling", "autoscaling.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "cognito-identity", "cognito-identity.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "cognito-idp", "cognito-idp.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "cognito-sync", "cognito-sync.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "dynamodb", "dynamodb.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "ec2", "ec2.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "elasticloadbalancing", "elasticloadbalancing.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "kinesis", "kinesis.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "kms", "kms.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "lambda", "lambda.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "logs", "logs.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "polly", "polly.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "s3", "s3.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "sns", "sns.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "sqs", "sqs.ap-south-1.amazonaws.com", false, true);
updateRegion(region4, "sts", "sts.ap-south-1.amazonaws.com", false, true);
Region region5 = new Region("ap-southeast-1", "amazonaws.com");
arrayList.add(region5);
updateRegion(region5, "autoscaling", "autoscaling.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "cognito-identity", "cognito-identity.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "cognito-idp", "cognito-idp.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "cognito-sync", "cognito-sync.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "data.iot", "data.iot.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "dynamodb", "dynamodb.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "ec2", "ec2.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "elasticloadbalancing", "elasticloadbalancing.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "iot", "iot.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "kinesis", "kinesis.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "kms", "kms.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "lambda", "lambda.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "logs", "logs.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "polly", "polly.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "s3", "s3.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "sdb", "sdb.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "sns", "sns.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "sqs", "sqs.ap-southeast-1.amazonaws.com", false, true);
updateRegion(region5, "sts", "sts.ap-southeast-1.amazonaws.com", false, true);
Region region6 = new Region("ap-southeast-2", "amazonaws.com");
arrayList.add(region6);
updateRegion(region6, "autoscaling", "autoscaling.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "cognito-identity", "cognito-identity.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "cognito-idp", "cognito-idp.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "cognito-sync", "cognito-sync.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "data.iot", "data.iot.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "dynamodb", "dynamodb.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "ec2", "ec2.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "elasticloadbalancing", "elasticloadbalancing.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "iot", "iot.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "kinesis", "kinesis.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "kms", "kms.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "lambda", "lambda.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "logs", "logs.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "polly", "polly.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "s3", "s3.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "sdb", "sdb.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "sns", "sns.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "sqs", "sqs.ap-southeast-2.amazonaws.com", false, true);
updateRegion(region6, "sts", "sts.ap-southeast-2.amazonaws.com", false, true);
Region region7 = new Region("ca-central-1", "amazonaws.com");
arrayList.add(region7);
updateRegion(region7, "autoscaling", "autoscaling.ca-central-1.amazonaws.com", false, true);
updateRegion(region7, "dynamodb", "dynamodb.ca-central-1.amazonaws.com", false, true);
updateRegion(region7, "ec2", "ec2.ca-central-1.amazonaws.com", false, true);
updateRegion(region7, "elasticloadbalancing", "elasticloadbalancing.ca-central-1.amazonaws.com", false, true);
updateRegion(region7, "kinesis", "kinesis.ca-central-1.amazonaws.com", false, true);
updateRegion(region7, "kms", "kms.ca-central-1.amazonaws.com", false, true);
updateRegion(region7, "lambda", "lambda.ca-central-1.amazonaws.com", false, true);
updateRegion(region7, "logs", "logs.ca-central-1.amazonaws.com", false, true);
updateRegion(region7, "polly", "polly.ca-central-1.amazonaws.com", false, true);
updateRegion(region7, "s3", "s3.ca-central-1.amazonaws.com", false, true);
updateRegion(region7, "sns", "sns.ca-central-1.amazonaws.com", false, true);
updateRegion(region7, "sqs", "sqs.ca-central-1.amazonaws.com", false, true);
updateRegion(region7, "sts", "sts.ca-central-1.amazonaws.com", false, true);
Region region8 = new Region("eu-central-1", "amazonaws.com");
arrayList.add(region8);
updateRegion(region8, "autoscaling", "autoscaling.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "cognito-identity", "cognito-identity.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "cognito-idp", "cognito-idp.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "cognito-sync", "cognito-sync.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "data.iot", "data.iot.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "dynamodb", "dynamodb.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "ec2", "ec2.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "elasticloadbalancing", "elasticloadbalancing.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "firehose", "firehose.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "iot", "iot.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "kinesis", "kinesis.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "kms", "kms.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "lambda", "lambda.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "logs", "logs.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "polly", "polly.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "s3", "s3.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "sns", "sns.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "sqs", "sqs.eu-central-1.amazonaws.com", false, true);
updateRegion(region8, "sts", "sts.eu-central-1.amazonaws.com", false, true);
Region region9 = new Region("eu-central-2", "amazonaws.com");
arrayList.add(region9);
updateRegion(region9, "autoscaling", "autoscaling.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "cognito-identity", "cognito-identity.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "cognito-idp", "cognito-idp.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "cognito-sync", "cognito-sync.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "data.iot", "data.iot.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "dynamodb", "dynamodb.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "ec2", "ec2.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "elasticloadbalancing", "elasticloadbalancing.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "firehose", "firehose.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "iot", "iot.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "kinesis", "kinesis.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "kms", "kms.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "lambda", "lambda.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "logs", "logs.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "polly", "polly.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "s3", "s3.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "sdb", "sdb.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "sns", "sns.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "sqs", "sqs.eu-central-2.amazonaws.com", false, true);
updateRegion(region9, "sts", "sts.eu-central-2.amazonaws.com", false, true);
Region region10 = new Region("eu-south-1", "amazonaws.com");
arrayList.add(region10);
updateRegion(region10, "autoscaling", "autoscaling.eu-south-1.amazonaws.com", false, true);
updateRegion(region10, "dynamodb", "dynamodb.eu-south-1.amazonaws.com", false, true);
updateRegion(region10, "ec2", "ec2.eu-south-1.amazonaws.com", false, true);
updateRegion(region10, "elasticloadbalancing", "elasticloadbalancing.eu-south-1.amazonaws.com", false, true);
updateRegion(region10, "lambda", "lambda.eu-south-1.amazonaws.com", false, true);
updateRegion(region10, "logs", "logs.eu-south-1.amazonaws.com", false, true);
updateRegion(region10, "s3", "s3.eu-south-1.amazonaws.com", false, true);
updateRegion(region10, "sns", "sns.eu-south-1.amazonaws.com", false, true);
updateRegion(region10, "sqs", "sqs.eu-south-1.amazonaws.com", false, true);
updateRegion(region10, "sts", "sts.eu-south-1.amazonaws.com", false, true);
Region region11 = new Region("eu-south-2", "amazonaws.com");
arrayList.add(region11);
updateRegion(region11, "autoscaling", "autoscaling.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "cognito-identity", "cognito-identity.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "cognito-idp", "cognito-idp.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "cognito-sync", "cognito-sync.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "data.iot", "data.iot.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "dynamodb", "dynamodb.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "ec2", "ec2.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "elasticloadbalancing", "elasticloadbalancing.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "firehose", "firehose.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "iot", "iot.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "kinesis", "kinesis.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "kms", "kms.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "lambda", "lambda.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "logs", "logs.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "polly", "polly.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "s3", "s3.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "sdb", "sdb.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "sns", "sns.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "sqs", "sqs.eu-south-2.amazonaws.com", false, true);
updateRegion(region11, "sts", "sts.eu-south-2.amazonaws.com", false, true);
Region region12 = new Region("eu-west-1", "amazonaws.com");
arrayList.add(region12);
updateRegion(region12, "autoscaling", "autoscaling.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "cognito-identity", "cognito-identity.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "cognito-idp", "cognito-idp.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "cognito-sync", "cognito-sync.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "data.iot", "data.iot.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "dynamodb", "dynamodb.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "ec2", "ec2.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "elasticloadbalancing", "elasticloadbalancing.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "email", "email.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "firehose", "firehose.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "iot", "iot.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "kinesis", "kinesis.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "kms", "kms.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "lambda", "lambda.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "logs", "logs.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "machinelearning", "machinelearning.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "polly", "polly.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "rekognition", "rekognition.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "s3", "s3.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "sdb", "sdb.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "sns", "sns.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "sqs", "sqs.eu-west-1.amazonaws.com", false, true);
updateRegion(region12, "sts", "sts.eu-west-1.amazonaws.com", false, true);
Region region13 = new Region("eu-west-2", "amazonaws.com");
arrayList.add(region13);
updateRegion(region13, "autoscaling", "autoscaling.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "cognito-identity", "cognito-identity.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "cognito-idp", "cognito-idp.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "cognito-sync", "cognito-sync.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "dynamodb", "dynamodb.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "ec2", "ec2.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "elasticloadbalancing", "elasticloadbalancing.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "iot", "iot.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "kinesis", "kinesis.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "kms", "kms.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "lambda", "lambda.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "logs", "logs.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "polly", "polly.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "s3", "s3.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "sns", "sns.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "sqs", "sqs.eu-west-2.amazonaws.com", false, true);
updateRegion(region13, "sts", "sts.eu-west-2.amazonaws.com", false, true);
Region region14 = new Region("eu-west-3", "amazonaws.com");
arrayList.add(region14);
updateRegion(region14, "autoscaling", "autoscaling.eu-west-3.amazonaws.com", false, true);
updateRegion(region14, "dynamodb", "dynamodb.eu-west-3.amazonaws.com", false, true);
updateRegion(region14, "ec2", "ec2.eu-west-3.amazonaws.com", false, true);
updateRegion(region14, "elasticloadbalancing", "elasticloadbalancing.eu-west-3.amazonaws.com", false, true);
updateRegion(region14, "kinesis", "kinesis.eu-west-3.amazonaws.com", false, true);
updateRegion(region14, "kms", "kms.eu-west-3.amazonaws.com", false, true);
updateRegion(region14, "lambda", "lambda.eu-west-3.amazonaws.com", false, true);
updateRegion(region14, "logs", "logs.eu-west-3.amazonaws.com", false, true);
updateRegion(region14, "polly", "polly.eu-west-3.amazonaws.com", false, true);
updateRegion(region14, "s3", "s3.eu-west-3.amazonaws.com", false, true);
updateRegion(region14, "sns", "sns.eu-west-3.amazonaws.com", false, true);
updateRegion(region14, "sqs", "sqs.eu-west-3.amazonaws.com", false, true);
updateRegion(region14, "sts", "sts.eu-west-3.amazonaws.com", false, true);
Region region15 = new Region("sa-east-1", "amazonaws.com");
arrayList.add(region15);
updateRegion(region15, "autoscaling", "autoscaling.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "dynamodb", "dynamodb.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "ec2", "ec2.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "elasticloadbalancing", "elasticloadbalancing.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "kinesis", "kinesis.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "kms", "kms.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "lambda", "lambda.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "logs", "logs.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "polly", "polly.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "s3", "s3.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "sdb", "sdb.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "sns", "sns.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "sqs", "sqs.sa-east-1.amazonaws.com", false, true);
updateRegion(region15, "sts", "sts.sa-east-1.amazonaws.com", false, true);
Region region16 = new Region("us-east-1", "amazonaws.com");
arrayList.add(region16);
updateRegion(region16, "autoscaling", "autoscaling.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "cognito-identity", "cognito-identity.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "cognito-idp", "cognito-idp.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "cognito-sync", "cognito-sync.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "data.iot", "data.iot.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "dynamodb", "dynamodb.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "ec2", "ec2.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "elasticloadbalancing", "elasticloadbalancing.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "email", "email.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "firehose", "firehose.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "iot", "iot.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "kinesis", "kinesis.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "kms", "kms.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "lambda", "lambda.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "logs", "logs.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "machinelearning", "machinelearning.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "mobileanalytics", "mobileanalytics.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "pinpoint", "pinpoint.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "polly", "polly.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "rekognition", "rekognition.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "s3", "s3.amazonaws.com", false, true);
updateRegion(region16, "sdb", "sdb.amazonaws.com", false, true);
updateRegion(region16, "sns", "sns.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "sqs", "sqs.us-east-1.amazonaws.com", false, true);
updateRegion(region16, "sts", "sts.us-east-1.amazonaws.com", false, true);
Region region17 = new Region("us-east-2", "amazonaws.com");
arrayList.add(region17);
updateRegion(region17, "autoscaling", "autoscaling.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "cognito-identity", "cognito-identity.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "cognito-idp", "cognito-idp.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "cognito-sync", "cognito-sync.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "dynamodb", "dynamodb.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "ec2", "ec2.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "elasticloadbalancing", "elasticloadbalancing.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "firehose", "firehose.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "iot", "iot.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "kinesis", "kinesis.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "kms", "kms.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "lambda", "lambda.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "logs", "logs.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "polly", "polly.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "s3", "s3.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "sns", "sns.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "sqs", "sqs.us-east-2.amazonaws.com", false, true);
updateRegion(region17, "sts", "sts.us-east-2.amazonaws.com", false, true);
Region region18 = new Region("us-west-1", "amazonaws.com");
arrayList.add(region18);
updateRegion(region18, "autoscaling", "autoscaling.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "dynamodb", "dynamodb.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "ec2", "ec2.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "elasticloadbalancing", "elasticloadbalancing.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "kinesis", "kinesis.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "kms", "kms.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "lambda", "lambda.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "logs", "logs.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "polly", "polly.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "s3", "s3.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "sdb", "sdb.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "sns", "sns.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "sqs", "sqs.us-west-1.amazonaws.com", false, true);
updateRegion(region18, "sts", "sts.us-west-1.amazonaws.com", false, true);
Region region19 = new Region("us-west-2", "amazonaws.com");
arrayList.add(region19);
updateRegion(region19, "autoscaling", "autoscaling.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "cognito-identity", "cognito-identity.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "cognito-idp", "cognito-idp.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "cognito-sync", "cognito-sync.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "data.iot", "data.iot.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "dynamodb", "dynamodb.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "ec2", "ec2.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "elasticloadbalancing", "elasticloadbalancing.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "email", "email.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "firehose", "firehose.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "iot", "iot.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "kinesis", "kinesis.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "kms", "kms.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "lambda", "lambda.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "logs", "logs.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "polly", "polly.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "rekognition", "rekognition.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "s3", "s3.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "sdb", "sdb.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "sns", "sns.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "sqs", "sqs.us-west-2.amazonaws.com", false, true);
updateRegion(region19, "sts", "sts.us-west-2.amazonaws.com", false, true);
Region region20 = new Region("cn-north-1", "amazonaws.com.cn");
arrayList.add(region20);
updateRegion(region20, "autoscaling", "autoscaling.cn-north-1.amazonaws.com.cn", false, true);
updateRegion(region20, "cognito-identity", "cognito-identity.cn-north-1.amazonaws.com.cn", false, true);
updateRegion(region20, "dynamodb", "dynamodb.cn-north-1.amazonaws.com.cn", false, true);
updateRegion(region20, "ec2", "ec2.cn-north-1.amazonaws.com.cn", false, true);
updateRegion(region20, "elasticloadbalancing", "elasticloadbalancing.cn-north-1.amazonaws.com.cn", false, true);
updateRegion(region20, "iot", "iot.cn-north-1.amazonaws.com.cn", false, true);
updateRegion(region20, "kinesis", "kinesis.cn-north-1.amazonaws.com.cn", false, true);
updateRegion(region20, "lambda", "lambda.cn-north-1.amazonaws.com.cn", false, true);
updateRegion(region20, "logs", "logs.cn-north-1.amazonaws.com.cn", false, true);
updateRegion(region20, "s3", "s3.cn-north-1.amazonaws.com.cn", false, true);
updateRegion(region20, "sns", "sns.cn-north-1.amazonaws.com.cn", false, true);
updateRegion(region20, "sqs", "sqs.cn-north-1.amazonaws.com.cn", false, true);
updateRegion(region20, "sts", "sts.cn-north-1.amazonaws.com.cn", false, true);
Region region21 = new Region("cn-northwest-1", "amazonaws.com.cn");
arrayList.add(region21);
updateRegion(region21, "autoscaling", "autoscaling.cn-northwest-1.amazonaws.com.cn", false, true);
updateRegion(region21, "dynamodb", "dynamodb.cn-northwest-1.amazonaws.com.cn", false, true);
updateRegion(region21, "ec2", "ec2.cn-northwest-1.amazonaws.com.cn", false, true);
updateRegion(region21, "elasticloadbalancing", "elasticloadbalancing.cn-northwest-1.amazonaws.com.cn", false, true);
updateRegion(region21, "kinesis", "kinesis.cn-northwest-1.amazonaws.com.cn", false, true);
updateRegion(region21, "logs", "logs.cn-northwest-1.amazonaws.com.cn", false, true);
updateRegion(region21, "s3", "s3.cn-northwest-1.amazonaws.com.cn", false, true);
updateRegion(region21, "sns", "sns.cn-northwest-1.amazonaws.com.cn", false, true);
updateRegion(region21, "sqs", "sqs.cn-northwest-1.amazonaws.com.cn", false, true);
updateRegion(region21, "sts", "sts.cn-northwest-1.amazonaws.com.cn", false, true);
Region region22 = new Region("us-gov-west-1", "amazonaws.com");
arrayList.add(region22);
updateRegion(region22, "autoscaling", "autoscaling.us-gov-west-1.amazonaws.com", false, true);
updateRegion(region22, "dynamodb", "dynamodb.us-gov-west-1.amazonaws.com", false, true);
updateRegion(region22, "ec2", "ec2.us-gov-west-1.amazonaws.com", false, true);
updateRegion(region22, "elasticloadbalancing", "elasticloadbalancing.us-gov-west-1.amazonaws.com", false, true);
updateRegion(region22, "kinesis", "kinesis.us-gov-west-1.amazonaws.com", false, true);
updateRegion(region22, "kms", "kms.us-gov-west-1.amazonaws.com", false, true);
updateRegion(region22, "lambda", "lambda.us-gov-west-1.amazonaws.com", false, true);
updateRegion(region22, "logs", "logs.us-gov-west-1.amazonaws.com", false, true);
updateRegion(region22, "rekognition", "rekognition.us-gov-west-1.amazonaws.com", false, true);
updateRegion(region22, "s3", "s3.us-gov-west-1.amazonaws.com", false, true);
updateRegion(region22, "sns", "sns.us-gov-west-1.amazonaws.com", false, true);
updateRegion(region22, "sqs", "sqs.us-gov-west-1.amazonaws.com", false, true);
updateRegion(region22, "sts", "sts.us-gov-west-1.amazonaws.com", false, true);
Region region23 = new Region("us-gov-east-1", "amazonaws.com");
arrayList.add(region23);
updateRegion(region23, "autoscaling", "autoscaling.us-gov-east-1.amazonaws.com", false, true);
updateRegion(region23, "dynamodb", "dynamodb.us-gov-east-1.amazonaws.com", false, true);
updateRegion(region23, "ec2", "ec2.us-gov-east-1.amazonaws.com", false, true);
updateRegion(region23, "elasticloadbalancing", "elasticloadbalancing.us-gov-east-1.amazonaws.com", false, true);
updateRegion(region23, "kinesis", "kinesis.us-gov-east-1.amazonaws.com", false, true);
updateRegion(region23, "kms", "kms.us-gov-east-1.amazonaws.com", false, true);
updateRegion(region23, "lambda", "lambda.us-gov-east-1.amazonaws.com", false, true);
updateRegion(region23, "logs", "logs.us-gov-east-1.amazonaws.com", false, true);
updateRegion(region23, "rekognition", "rekognition.us-gov-east-1.amazonaws.com", false, true);
updateRegion(region23, "s3", "s3.us-gov-east-1.amazonaws.com", false, true);
updateRegion(region23, "sns", "sns.us-gov-east-1.amazonaws.com", false, true);
updateRegion(region23, "sqs", "sqs.us-gov-east-1.amazonaws.com", false, true);
updateRegion(region23, "sts", "sts.us-gov-east-1.amazonaws.com", false, true);
Region region24 = new Region("eu-north-1", "amazonaws.com");
arrayList.add(region24);
updateRegion(region24, "autoscaling", "autoscaling.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "dynamodb", "dynamodb.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "ec2", "ec2.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "elasticloadbalancing", "elasticloadbalancing.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "firehose", "firehose.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "iot", "iot.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "kinesis", "kinesis.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "kms", "kms.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "lambda", "lambda.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "logs", "logs.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "s3", "s3.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "sns", "sns.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "sqs", "sqs.eu-north-1.amazonaws.com", false, true);
updateRegion(region24, "sts", "sts.eu-north-1.amazonaws.com", false, true);
Region region25 = new Region("ap-east-1", "amazonaws.com");
arrayList.add(region25);
updateRegion(region25, "autoscaling", "autoscaling.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "dynamodb", "dynamodb.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "ec2", "ec2.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "elasticloadbalancing", "elasticloadbalancing.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "firehose", "firehose.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "kinesis", "kinesis.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "kms", "kms.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "lambda", "lambda.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "logs", "logs.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "polly", "polly.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "s3", "s3.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "sns", "sns.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "sqs", "sqs.ap-east-1.amazonaws.com", false, true);
updateRegion(region25, "sts", "sts.ap-east-1.amazonaws.com", false, true);
Region region26 = new Region("me-south-1", "amazonaws.com");
arrayList.add(region26);
updateRegion(region26, "autoscaling", "autoscaling.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "cognito-identity", "cognito-identity.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "cognito-idp", "cognito-idp.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "cognito-sync", "cognito-sync.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "data.iot", "data.iot.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "dynamodb", "dynamodb.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "ec2", "ec2.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "elasticloadbalancing", "elasticloadbalancing.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "firehose", "firehose.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "iot", "iot.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "kinesis", "kinesis.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "kms", "kms.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "lambda", "lambda.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "logs", "logs.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "polly", "polly.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "s3", "s3.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "sdb", "sdb.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "sns", "sns.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "sqs", "sqs.me-south-1.amazonaws.com", false, true);
updateRegion(region26, "sts", "sts.me-south-1.amazonaws.com", false, true);
Region region27 = new Region("ap-southeast-3", "amazonaws.com");
arrayList.add(region27);
updateRegion(region27, "autoscaling", "autoscaling.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "cognito-identity", "cognito-identity.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "cognito-idp", "cognito-idp.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "cognito-sync", "cognito-sync.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "data.iot", "data.iot.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "dynamodb", "dynamodb.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "ec2", "ec2.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "elasticloadbalancing", "elasticloadbalancing.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "firehose", "firehose.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "iot", "iot.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "kinesis", "kinesis.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "kms", "kms.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "lambda", "lambda.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "logs", "logs.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "polly", "polly.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "s3", "s3.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "sdb", "sdb.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "sns", "sns.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "sqs", "sqs.ap-southeast-3.amazonaws.com", false, true);
updateRegion(region27, "sts", "sts.ap-southeast-3.amazonaws.com", false, true);
Region region28 = new Region("me-central-1", "amazonaws.com");
arrayList.add(region28);
updateRegion(region28, "autoscaling", "autoscaling.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "cognito-identity", "cognito-identity.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "cognito-idp", "cognito-idp.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "cognito-sync", "cognito-sync.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "data.iot", "data.iot.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "dynamodb", "dynamodb.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "ec2", "ec2.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "elasticloadbalancing", "elasticloadbalancing.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "firehose", "firehose.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "iot", "iot.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "kinesis", "kinesis.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "kms", "kms.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "lambda", "lambda.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "logs", "logs.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "polly", "polly.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "s3", "s3.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "sdb", "sdb.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "sns", "sns.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "sqs", "sqs.me-central-1.amazonaws.com", false, true);
updateRegion(region28, "sts", "sts.me-central-1.amazonaws.com", false, true);
Region region29 = new Region("ap-south-2", "amazonaws.com");
arrayList.add(region29);
updateRegion(region29, "autoscaling", "autoscaling.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "cognito-identity", "cognito-identity.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "cognito-idp", "cognito-idp.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "cognito-sync", "cognito-sync.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "data.iot", "data.iot.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "dynamodb", "dynamodb.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "ec2", "ec2.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "elasticloadbalancing", "elasticloadbalancing.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "firehose", "firehose.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "iot", "iot.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "kinesis", "kinesis.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "kms", "kms.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "lambda", "lambda.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "logs", "logs.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "polly", "polly.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "s3", "s3.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "sdb", "sdb.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "sns", "sns.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "sqs", "sqs.ap-south-2.amazonaws.com", false, true);
updateRegion(region29, "sts", "sts.ap-south-2.amazonaws.com", false, true);
Region region30 = new Region("ap-southeast-4", "amazonaws.com");
arrayList.add(region30);
updateRegion(region30, "autoscaling", "autoscaling.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "cognito-identity", "cognito-identity.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "cognito-idp", "cognito-idp.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "cognito-sync", "cognito-sync.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "data.iot", "data.iot.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "dynamodb", "dynamodb.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "ec2", "ec2.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "elasticloadbalancing", "elasticloadbalancing.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "firehose", "firehose.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "iot", "iot.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "kinesis", "kinesis.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "kms", "kms.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "lambda", "lambda.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "logs", "logs.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "polly", "polly.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "s3", "s3.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "sdb", "sdb.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "sns", "sns.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "sqs", "sqs.ap-southeast-4.amazonaws.com", false, true);
updateRegion(region30, "sts", "sts.ap-southeast-4.amazonaws.com", false, true);
return arrayList;
}
public static void updateRegion(Region region, String str, String str2, boolean z, boolean z2) {
Map serviceEndpoints = region.getServiceEndpoints();
Map httpSupport = region.getHttpSupport();
Map httpsSupport = region.getHttpsSupport();
serviceEndpoints.put(str, str2);
httpSupport.put(str, Boolean.valueOf(z));
httpsSupport.put(str, Boolean.valueOf(z2));
}
}

View File

@@ -0,0 +1,85 @@
package com.amazonaws.regions;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@Deprecated
/* loaded from: classes.dex */
public class RegionMetadataParser {
@Deprecated
public RegionMetadataParser() {
}
public List parseRegionMetadata(InputStream inputStream) {
return internalParse(inputStream, false);
}
public static List internalParse(InputStream inputStream, boolean z) {
try {
try {
DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance();
newInstance.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
newInstance.setXIncludeAware(false);
newInstance.setExpandEntityReferences(false);
NodeList elementsByTagName = newInstance.newDocumentBuilder().parse(inputStream).getElementsByTagName("Region");
ArrayList arrayList = new ArrayList();
for (int i = 0; i < elementsByTagName.getLength(); i++) {
Node item = elementsByTagName.item(i);
if (item.getNodeType() == 1) {
arrayList.add(parseRegionElement((Element) item, z));
}
}
return arrayList;
} finally {
try {
inputStream.close();
} catch (IOException unused) {
}
}
} catch (IOException e) {
throw e;
} catch (Exception e2) {
throw new IOException("Unable to parse region metadata file: " + e2.getMessage(), e2);
}
}
public static Region parseRegionElement(Element element, boolean z) {
Region region = new Region(getChildElementValue("Name", element), getChildElementValue("Domain", element));
NodeList elementsByTagName = element.getElementsByTagName("Endpoint");
for (int i = 0; i < elementsByTagName.getLength(); i++) {
addRegionEndpoint(region, (Element) elementsByTagName.item(i), z);
}
return region;
}
public static void addRegionEndpoint(Region region, Element element, boolean z) {
String childElementValue = getChildElementValue("ServiceName", element);
String childElementValue2 = getChildElementValue("Hostname", element);
String childElementValue3 = getChildElementValue("Http", element);
String childElementValue4 = getChildElementValue("Https", element);
if (z && !verifyLegacyEndpoint(childElementValue2)) {
throw new IllegalStateException("Invalid service endpoint (" + childElementValue2 + ") is detected.");
}
region.getServiceEndpoints().put(childElementValue, childElementValue2);
region.getHttpSupport().put(childElementValue, Boolean.valueOf("true".equals(childElementValue3)));
region.getHttpsSupport().put(childElementValue, Boolean.valueOf("true".equals(childElementValue4)));
}
public static String getChildElementValue(String str, Element element) {
Node item = element.getElementsByTagName(str).item(0);
if (item == null) {
return null;
}
return item.getChildNodes().item(0).getNodeValue();
}
public static boolean verifyLegacyEndpoint(String str) {
return str.endsWith(".amazonaws.com");
}
}

View File

@@ -0,0 +1,82 @@
package com.amazonaws.regions;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.List;
/* loaded from: classes.dex */
public abstract class RegionUtils {
public static final Log log = LogFactory.getLog("com.amazonaws.request");
public static List regions;
public static synchronized List getRegions() {
List list;
synchronized (RegionUtils.class) {
try {
if (regions == null) {
init();
}
list = regions;
} catch (Throwable th) {
throw th;
}
}
return list;
}
public static Region getRegion(String str) {
for (Region region : getRegions()) {
if (region.getName().equals(str)) {
return region;
}
}
return null;
}
public static synchronized void init() {
synchronized (RegionUtils.class) {
if (System.getProperty("com.amazonaws.regions.RegionUtils.fileOverride") != null) {
try {
loadRegionsFromOverrideFile();
} catch (FileNotFoundException e) {
throw new RuntimeException("Couldn't find regions override file specified", e);
}
}
if (regions == null) {
initSDKRegions();
}
if (regions == null) {
throw new RuntimeException("Failed to initialize the regions.");
}
}
}
public static void loadRegionsFromOverrideFile() {
String property = System.getProperty("com.amazonaws.regions.RegionUtils.fileOverride");
Log log2 = log;
if (log2.isDebugEnabled()) {
log2.debug("Using local override of the regions file (" + property + ") to initiate regions data...");
}
initRegions(new FileInputStream(new File(property)));
}
public static void initRegions(InputStream inputStream) {
try {
regions = new RegionMetadataParser().parseRegionMetadata(inputStream);
} catch (Exception e) {
log.warn("Failed to parse regional endpoints", e);
}
}
public static void initSDKRegions() {
Log log2 = log;
if (log2.isDebugEnabled()) {
log2.debug("Initializing the regions with default regions");
}
regions = RegionDefaults.getRegions();
}
}

View File

@@ -0,0 +1,55 @@
package com.amazonaws.regions;
/* loaded from: classes.dex */
public enum Regions {
GovCloud("us-gov-west-1"),
US_GOV_EAST_1("us-gov-east-1"),
US_EAST_1("us-east-1"),
US_EAST_2("us-east-2"),
US_WEST_1("us-west-1"),
US_WEST_2("us-west-2"),
EU_SOUTH_1("eu-south-1"),
EU_SOUTH_2("eu-south-2"),
EU_WEST_1("eu-west-1"),
EU_WEST_2("eu-west-2"),
EU_WEST_3("eu-west-3"),
EU_CENTRAL_1("eu-central-1"),
EU_CENTRAL_2("eu-central-2"),
EU_NORTH_1("eu-north-1"),
AP_EAST_1("ap-east-1"),
AP_SOUTH_1("ap-south-1"),
AP_SOUTHEAST_1("ap-southeast-1"),
AP_SOUTHEAST_2("ap-southeast-2"),
AP_SOUTHEAST_4("ap-southeast-4"),
AP_NORTHEAST_1("ap-northeast-1"),
AP_NORTHEAST_2("ap-northeast-2"),
SA_EAST_1("sa-east-1"),
CA_CENTRAL_1("ca-central-1"),
CN_NORTH_1("cn-north-1"),
CN_NORTHWEST_1("cn-northwest-1"),
ME_SOUTH_1("me-south-1"),
AF_SOUTH_1("af-south-1"),
AP_SOUTHEAST_3("ap-southeast-3"),
ME_CENTRAL_1("me-central-1"),
AP_SOUTH_2("ap-south-2");
private final String name;
public static final Regions DEFAULT_REGION = US_WEST_2;
public String getName() {
return this.name;
}
Regions(String str) {
this.name = str;
}
public static Regions fromName(String str) {
for (Regions regions : values()) {
if (str.equals(regions.getName())) {
return regions;
}
}
throw new IllegalArgumentException("Cannot create enum from " + str + " value!");
}
}

View File

@@ -0,0 +1,61 @@
package com.amazonaws.retry;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.retry.RetryPolicy;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.util.Random;
/* loaded from: classes.dex */
public abstract class PredefinedRetryPolicies {
public static final RetryPolicy NO_RETRY_POLICY = new RetryPolicy(RetryPolicy.RetryCondition.NO_RETRY_CONDITION, RetryPolicy.BackoffStrategy.NO_DELAY, 0, false);
public static final RetryPolicy.RetryCondition DEFAULT_RETRY_CONDITION = new SDKDefaultRetryCondition();
public static final RetryPolicy.BackoffStrategy DEFAULT_BACKOFF_STRATEGY = new SDKDefaultBackoffStrategy(100, 20000);
public static final RetryPolicy DEFAULT = getDefaultRetryPolicy();
public static final RetryPolicy DYNAMODB_DEFAULT = getDynamoDBDefaultRetryPolicy();
public static RetryPolicy getDefaultRetryPolicy() {
return new RetryPolicy(DEFAULT_RETRY_CONDITION, DEFAULT_BACKOFF_STRATEGY, 3, true);
}
public static RetryPolicy getDynamoDBDefaultRetryPolicy() {
return new RetryPolicy(DEFAULT_RETRY_CONDITION, DEFAULT_BACKOFF_STRATEGY, 10, true);
}
public static class SDKDefaultRetryCondition implements RetryPolicy.RetryCondition {
@Override // com.amazonaws.retry.RetryPolicy.RetryCondition
public boolean shouldRetry(AmazonWebServiceRequest amazonWebServiceRequest, AmazonClientException amazonClientException, int i) {
if ((amazonClientException.getCause() instanceof IOException) && !(amazonClientException.getCause() instanceof InterruptedIOException)) {
return true;
}
if (!(amazonClientException instanceof AmazonServiceException)) {
return false;
}
AmazonServiceException amazonServiceException = (AmazonServiceException) amazonClientException;
int statusCode = amazonServiceException.getStatusCode();
return statusCode == 500 || statusCode == 503 || statusCode == 502 || statusCode == 504 || RetryUtils.isThrottlingException(amazonServiceException) || RetryUtils.isClockSkewError(amazonServiceException);
}
}
public static final class SDKDefaultBackoffStrategy implements RetryPolicy.BackoffStrategy {
public final int baseDelayMs;
public final int maxDelayMs;
public final Random random;
public SDKDefaultBackoffStrategy(int i, int i2) {
this.random = new Random();
this.baseDelayMs = i;
this.maxDelayMs = i2;
}
@Override // com.amazonaws.retry.RetryPolicy.BackoffStrategy
public final long delayBeforeNextRetry(AmazonWebServiceRequest amazonWebServiceRequest, AmazonClientException amazonClientException, int i) {
if (i <= 0) {
return 0L;
}
return this.random.nextInt(Math.min(this.maxDelayMs, (1 << i) * this.baseDelayMs));
}
}
}

View File

@@ -0,0 +1,62 @@
package com.amazonaws.retry;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonWebServiceRequest;
/* loaded from: classes.dex */
public final class RetryPolicy {
public final BackoffStrategy backoffStrategy;
public final boolean honorMaxErrorRetryInClientConfig;
public final int maxErrorRetry;
public final RetryCondition retryCondition;
public interface BackoffStrategy {
public static final BackoffStrategy NO_DELAY = new BackoffStrategy() { // from class: com.amazonaws.retry.RetryPolicy.BackoffStrategy.1
@Override // com.amazonaws.retry.RetryPolicy.BackoffStrategy
public long delayBeforeNextRetry(AmazonWebServiceRequest amazonWebServiceRequest, AmazonClientException amazonClientException, int i) {
return 0L;
}
};
long delayBeforeNextRetry(AmazonWebServiceRequest amazonWebServiceRequest, AmazonClientException amazonClientException, int i);
}
public interface RetryCondition {
public static final RetryCondition NO_RETRY_CONDITION = new RetryCondition() { // from class: com.amazonaws.retry.RetryPolicy.RetryCondition.1
@Override // com.amazonaws.retry.RetryPolicy.RetryCondition
public boolean shouldRetry(AmazonWebServiceRequest amazonWebServiceRequest, AmazonClientException amazonClientException, int i) {
return false;
}
};
boolean shouldRetry(AmazonWebServiceRequest amazonWebServiceRequest, AmazonClientException amazonClientException, int i);
}
public BackoffStrategy getBackoffStrategy() {
return this.backoffStrategy;
}
public int getMaxErrorRetry() {
return this.maxErrorRetry;
}
public RetryCondition getRetryCondition() {
return this.retryCondition;
}
public boolean isMaxErrorRetryInClientConfigHonored() {
return this.honorMaxErrorRetryInClientConfig;
}
public RetryPolicy(RetryCondition retryCondition, BackoffStrategy backoffStrategy, int i, boolean z) {
retryCondition = retryCondition == null ? PredefinedRetryPolicies.DEFAULT_RETRY_CONDITION : retryCondition;
backoffStrategy = backoffStrategy == null ? PredefinedRetryPolicies.DEFAULT_BACKOFF_STRATEGY : backoffStrategy;
if (i < 0) {
throw new IllegalArgumentException("Please provide a non-negative value for maxErrorRetry.");
}
this.retryCondition = retryCondition;
this.backoffStrategy = backoffStrategy;
this.maxErrorRetry = i;
this.honorMaxErrorRetryInClientConfig = z;
}
}

Some files were not shown because too many files have changed in this diff Show More