Package net.snowflake.ingest.connection
Class ServiceResponseHandler
- java.lang.Object
-
- net.snowflake.ingest.connection.ServiceResponseHandler
-
public final class ServiceResponseHandler extends Object
This class handles taking the HttpResponses we've gotten back, and producing an appropriate response object for usage
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classServiceResponseHandler.ApiNameEnums for Snowpipe REST API: https://docs.snowflake.com/en/user-guide/data-load-snowpipe-rest-apis.html Used in handleExceptionalStatus for logging purpose
-
Constructor Summary
Constructors Constructor Description ServiceResponseHandler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HistoryRangeResponseunmarshallHistoryRangeResponse(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response, UUID requestId, net.snowflake.client.jdbc.internal.apache.http.impl.client.CloseableHttpClient httpClient, net.snowflake.client.jdbc.internal.apache.http.client.methods.HttpGet request, RequestBuilder builder)Given an HttpResponse object - attempts to deserialize it into a HistoryRangeResponsestatic HistoryResponseunmarshallHistoryResponse(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response, UUID requestId, net.snowflake.client.jdbc.internal.apache.http.impl.client.CloseableHttpClient httpClient, net.snowflake.client.jdbc.internal.apache.http.client.methods.HttpGet httpGetHistory, RequestBuilder builder)unmarshallHistoryResponse Given an HttpResponse object - attempts to deserialize it into a HistoryResponse objectstatic IngestResponseunmarshallIngestResponse(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response, UUID requestId, net.snowflake.client.jdbc.internal.apache.http.impl.client.CloseableHttpClient httpClient, net.snowflake.client.jdbc.internal.apache.http.client.methods.HttpPost httpPostForIngestFile, RequestBuilder builder)unmarshallIngestResponse Given an HttpResponse object - attempts to deserialize it into an IngestResponse objectstatic <T> TunmarshallStreamingIngestResponse(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response, Class<T> valueType, ServiceResponseHandler.ApiName apiName, net.snowflake.client.jdbc.internal.apache.http.impl.client.CloseableHttpClient httpClient, net.snowflake.client.jdbc.internal.apache.http.client.methods.HttpUriRequest request, RequestBuilder requestBuilder)unmarshallStreamingIngestResponse Given an HttpResponse object - attempts to deserialize it into an Object based on input type
-
-
-
Method Detail
-
unmarshallIngestResponse
public static IngestResponse unmarshallIngestResponse(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response, UUID requestId, net.snowflake.client.jdbc.internal.apache.http.impl.client.CloseableHttpClient httpClient, net.snowflake.client.jdbc.internal.apache.http.client.methods.HttpPost httpPostForIngestFile, RequestBuilder builder) throws IOException, IngestResponseException, BackOffException
unmarshallIngestResponse Given an HttpResponse object - attempts to deserialize it into an IngestResponse object- Parameters:
response- the HTTPResponse we want to distill into an IngestResponserequestId-httpClient- HttpClient for retrieshttpPostForIngestFile- HttpRequest for retriesbuilder- RequestBuilder for retries- Returns:
- An IngestResponse with all of the parsed out information
- Throws:
IOException- if our entity is somehow corrupt or we can't get itIngestResponseException- - if we have an uncategorized network issueBackOffException- - if we have a 503 issue
-
unmarshallHistoryResponse
public static HistoryResponse unmarshallHistoryResponse(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response, UUID requestId, net.snowflake.client.jdbc.internal.apache.http.impl.client.CloseableHttpClient httpClient, net.snowflake.client.jdbc.internal.apache.http.client.methods.HttpGet httpGetHistory, RequestBuilder builder) throws IOException, IngestResponseException, BackOffException
unmarshallHistoryResponse Given an HttpResponse object - attempts to deserialize it into a HistoryResponse object- Parameters:
response- the HttpResponse object we are trying to deserializerequestId-httpClient- HttpClient for retrieshttpGetHistory- HttpRequest for retriesbuilder- RequestBuilder for retries- Returns:
- a HistoryResponse with all the parsed out information
- Throws:
IOException- if our entity is somehow corrupt or we can't get itIngestResponseException- - if we have an uncategorized network issueBackOffException- - if we have a 503 issue
-
unmarshallHistoryRangeResponse
public static HistoryRangeResponse unmarshallHistoryRangeResponse(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response, UUID requestId, net.snowflake.client.jdbc.internal.apache.http.impl.client.CloseableHttpClient httpClient, net.snowflake.client.jdbc.internal.apache.http.client.methods.HttpGet request, RequestBuilder builder) throws IOException, IngestResponseException, BackOffException
Given an HttpResponse object - attempts to deserialize it into a HistoryRangeResponse- Parameters:
response- the HttpResponse object we are trying to deserializerequestId-httpClient- HttpClient for retriesrequest- HttpRequest for retriesbuilder- HttpBuilder for retries- Returns:
- HistoryRangeResponse
- Throws:
IOException- if our entity is somehow corrupt or we can't get itIngestResponseException- - if we have an uncategorized network issueBackOffException- - if we have a 503 issue
-
unmarshallStreamingIngestResponse
public static <T> T unmarshallStreamingIngestResponse(net.snowflake.client.jdbc.internal.apache.http.HttpResponse response, Class<T> valueType, ServiceResponseHandler.ApiName apiName, net.snowflake.client.jdbc.internal.apache.http.impl.client.CloseableHttpClient httpClient, net.snowflake.client.jdbc.internal.apache.http.client.methods.HttpUriRequest request, RequestBuilder requestBuilder) throws IOException, IngestResponseExceptionunmarshallStreamingIngestResponse Given an HttpResponse object - attempts to deserialize it into an Object based on input type- Parameters:
response- http response from servervalueType- the class typeapiName- enum to represent the corresponding api name- Returns:
- the corresponding response object based on input class type
- Throws:
IOException- if a low-level I/O problemIngestResponseException- if received an exceptional status code
-
-