package com.amazonaws.services.kinesis; import com.amazonaws.AmazonWebServiceClient; import com.amazonaws.AmazonWebServiceRequest; import com.amazonaws.ClientConfiguration; import com.amazonaws.Request; import com.amazonaws.Response; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.handlers.HandlerChainFactory; import com.amazonaws.http.ExecutionContext; import com.amazonaws.http.HttpClient; import com.amazonaws.http.HttpResponseHandler; import com.amazonaws.http.JsonErrorResponseHandler; import com.amazonaws.http.JsonResponseHandler; import com.amazonaws.http.UrlHttpClient; import com.amazonaws.services.kinesis.model.PutRecordsRequest; import com.amazonaws.services.kinesis.model.PutRecordsResult; import com.amazonaws.services.kinesis.model.transform.ExpiredIteratorExceptionUnmarshaller; import com.amazonaws.services.kinesis.model.transform.ExpiredNextTokenExceptionUnmarshaller; import com.amazonaws.services.kinesis.model.transform.InvalidArgumentExceptionUnmarshaller; import com.amazonaws.services.kinesis.model.transform.KMSAccessDeniedExceptionUnmarshaller; import com.amazonaws.services.kinesis.model.transform.KMSDisabledExceptionUnmarshaller; import com.amazonaws.services.kinesis.model.transform.KMSInvalidStateExceptionUnmarshaller; import com.amazonaws.services.kinesis.model.transform.KMSNotFoundExceptionUnmarshaller; import com.amazonaws.services.kinesis.model.transform.KMSOptInRequiredExceptionUnmarshaller; import com.amazonaws.services.kinesis.model.transform.KMSThrottlingExceptionUnmarshaller; import com.amazonaws.services.kinesis.model.transform.LimitExceededExceptionUnmarshaller; import com.amazonaws.services.kinesis.model.transform.ProvisionedThroughputExceededExceptionUnmarshaller; import com.amazonaws.services.kinesis.model.transform.PutRecordsRequestMarshaller; import com.amazonaws.services.kinesis.model.transform.PutRecordsResultJsonUnmarshaller; import com.amazonaws.services.kinesis.model.transform.ResourceInUseExceptionUnmarshaller; import com.amazonaws.services.kinesis.model.transform.ResourceNotFoundExceptionUnmarshaller; import com.amazonaws.transform.JsonErrorUnmarshaller; import com.amazonaws.util.AWSRequestMetrics; import java.util.ArrayList; import java.util.List; /* loaded from: classes.dex */ public class AmazonKinesisClient extends AmazonWebServiceClient implements AmazonKinesis { public AWSCredentialsProvider awsCredentialsProvider; public List jsonErrorUnmarshallers; private static ClientConfiguration adjustClientConfiguration(ClientConfiguration clientConfiguration) { return clientConfiguration; } public AmazonKinesisClient(AWSCredentialsProvider aWSCredentialsProvider, ClientConfiguration clientConfiguration) { this(aWSCredentialsProvider, clientConfiguration, new UrlHttpClient(clientConfiguration)); } public AmazonKinesisClient(AWSCredentialsProvider aWSCredentialsProvider, ClientConfiguration clientConfiguration, HttpClient httpClient) { super(adjustClientConfiguration(clientConfiguration), httpClient); this.awsCredentialsProvider = aWSCredentialsProvider; init(); } private void init() { ArrayList arrayList = new ArrayList(); this.jsonErrorUnmarshallers = arrayList; arrayList.add(new ExpiredIteratorExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new ExpiredNextTokenExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new InvalidArgumentExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new KMSAccessDeniedExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new KMSDisabledExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new KMSInvalidStateExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new KMSNotFoundExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new KMSOptInRequiredExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new KMSThrottlingExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new LimitExceededExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new ProvisionedThroughputExceededExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new ResourceInUseExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new ResourceNotFoundExceptionUnmarshaller()); this.jsonErrorUnmarshallers.add(new JsonErrorUnmarshaller()); setEndpoint("kinesis.us-east-1.amazonaws.com"); this.endpointPrefix = "kinesis"; HandlerChainFactory handlerChainFactory = new HandlerChainFactory(); this.requestHandler2s.addAll(handlerChainFactory.newRequestHandlerChain("/com/amazonaws/services/kinesis/request.handlers")); this.requestHandler2s.addAll(handlerChainFactory.newRequestHandler2Chain("/com/amazonaws/services/kinesis/request.handler2s")); } /* JADX WARN: Multi-variable type inference failed */ @Override // com.amazonaws.services.kinesis.AmazonKinesis public PutRecordsResult putRecords(PutRecordsRequest putRecordsRequest) { Response response; ExecutionContext createExecutionContext = createExecutionContext(putRecordsRequest); AWSRequestMetrics awsRequestMetrics = createExecutionContext.getAwsRequestMetrics(); AWSRequestMetrics.Field field = AWSRequestMetrics.Field.ClientExecuteTime; awsRequestMetrics.startEvent(field); Request request = null; try { try { AWSRequestMetrics.Field field2 = AWSRequestMetrics.Field.RequestMarshallTime; awsRequestMetrics.startEvent(field2); try { Request marshall = new PutRecordsRequestMarshaller().marshall(putRecordsRequest); try { marshall.setAWSRequestMetrics(awsRequestMetrics); awsRequestMetrics.endEvent(field2); Response invoke = invoke(marshall, new JsonResponseHandler(new PutRecordsResultJsonUnmarshaller()), createExecutionContext); PutRecordsResult putRecordsResult = (PutRecordsResult) invoke.getAwsResponse(); awsRequestMetrics.endEvent(field); endClientExecution(awsRequestMetrics, marshall, invoke, true); return putRecordsResult; } catch (Throwable th) { th = th; awsRequestMetrics.endEvent(AWSRequestMetrics.Field.RequestMarshallTime); throw th; } } catch (Throwable th2) { th = th2; } } catch (Throwable th3) { th = th3; response = null; awsRequestMetrics.endEvent(AWSRequestMetrics.Field.ClientExecuteTime); endClientExecution(awsRequestMetrics, request, response, true); throw th; } } catch (Throwable th4) { th = th4; request = putRecordsRequest; response = null; awsRequestMetrics.endEvent(AWSRequestMetrics.Field.ClientExecuteTime); endClientExecution(awsRequestMetrics, request, response, true); throw th; } } private Response invoke(Request request, HttpResponseHandler httpResponseHandler, ExecutionContext executionContext) { request.setEndpoint(this.endpoint); request.setTimeOffset(this.timeOffset); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); AWSRequestMetrics.Field field = AWSRequestMetrics.Field.CredentialsRequestTime; awsRequestMetrics.startEvent(field); try { AWSCredentials credentials = this.awsCredentialsProvider.getCredentials(); awsRequestMetrics.endEvent(field); AmazonWebServiceRequest originalRequest = request.getOriginalRequest(); if (originalRequest != null && originalRequest.getRequestCredentials() != null) { credentials = originalRequest.getRequestCredentials(); } executionContext.setCredentials(credentials); return this.client.execute(request, httpResponseHandler, new JsonErrorResponseHandler(this.jsonErrorUnmarshallers), executionContext); } catch (Throwable th) { awsRequestMetrics.endEvent(AWSRequestMetrics.Field.CredentialsRequestTime); throw th; } } }