Skip to content

Commit

Permalink
SNOW-996678 Use snowflakeTransport for all clouds
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-pfus committed Dec 22, 2023
1 parent 532d19e commit 7d23fa4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions azure_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func (util *snowflakeAzureClient) createClient(info *execResponseStageInfo, _ bo
MaxRetries: 60,
RetryDelay: 2 * time.Second,
},
Transport: &http.Client{
Transport: SnowflakeTransport,
},
},
})
if err != nil {
Expand Down
15 changes: 9 additions & 6 deletions gcs_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ func (util *snowflakeGcsClient) getFileHeader(meta *fileMetadata, filename strin
for k, v := range gcsHeaders {
req.Header.Add(k, v)
}
var client gcsAPI
client = &http.Client{}
client := newGcsClient()
// for testing only
if meta.mockGcsClient != nil {
client = meta.mockGcsClient
Expand Down Expand Up @@ -216,8 +215,7 @@ func (util *snowflakeGcsClient) uploadFile(
for k, v := range gcsHeaders {
req.Header.Add(k, v)
}
var client gcsAPI
client = &http.Client{}
client := newGcsClient()
// for testing only
if meta.mockGcsClient != nil {
client = meta.mockGcsClient
Expand Down Expand Up @@ -295,8 +293,7 @@ func (util *snowflakeGcsClient) nativeDownloadFile(
for k, v := range gcsHeaders {
req.Header.Add(k, v)
}
var client gcsAPI
client = &http.Client{}
client := newGcsClient()
// for testing only
if meta.mockGcsClient != nil {
client = meta.mockGcsClient
Expand Down Expand Up @@ -390,3 +387,9 @@ func (util *snowflakeGcsClient) generateFileURL(stageLocation string, filename s
func (util *snowflakeGcsClient) isTokenExpired(resp *http.Response) bool {
return resp.StatusCode == 401
}

func newGcsClient() gcsAPI {
return &http.Client{
Transport: SnowflakeTransport,
}
}
4 changes: 4 additions & 0 deletions s3_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"io"
"net/http"
"os"
"strings"

Expand Down Expand Up @@ -52,6 +53,9 @@ func (util *snowflakeS3Client) createClient(info *execResponseStageInfo, useAcce
stageCredentials.AwsToken)),
EndpointResolver: resolver,
UseAccelerate: useAccelerateEndpoint,
HTTPClient: &http.Client{
Transport: SnowflakeTransport,
},
}), nil
}

Expand Down

0 comments on commit 7d23fa4

Please sign in to comment.