Skip to content

Commit 7acda69

Browse files
author
Phil Cluff
committed
New new
1 parent 17cdc08 commit 7acda69

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

service/sqs/sqs.go

+6-20
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,29 @@ type SQS struct {
2222
}
2323

2424
// New returns a new SQS client.
25-
func New(creds aws.CredentialsProvider, region string, client *http.Client) *SQS {
25+
func New(creds aws.CredentialsProvider, region string, endpoint string, client *http.Client) *SQS {
2626
if client == nil {
2727
client = http.DefaultClient
2828
}
2929

30-
endpoint, service, region := endpoints.Lookup("sqs", region)
30+
service := "sqs"
3131

32-
return &SQS{
33-
client: &aws.QueryClient{
34-
Context: aws.Context{
35-
Credentials: creds,
36-
Service: service,
37-
Region: region,
38-
},
39-
Client: client,
40-
Endpoint: endpoint,
41-
APIVersion: "2012-11-05",
42-
},
32+
if endpoint == "" {
33+
endpoint, service, region = endpoints.Lookup("sqs", region)
4334
}
44-
}
45-
46-
func NewWithCustomEndpoint(creds aws.CredentialsProvider, endpoint string) *SQS {
47-
client := http.DefaultClient
4835

4936
return &SQS{
5037
client: &aws.QueryClient{
5138
Context: aws.Context{
5239
Credentials: creds,
53-
Service: "sqs",
54-
Region: "local",
40+
Service: service,
41+
Region: region,
5542
},
5643
Client: client,
5744
Endpoint: endpoint,
5845
APIVersion: "2012-11-05",
5946
},
6047
}
61-
6248
}
6349

6450
// AddPermission adds a permission to a queue for a specific principal .

0 commit comments

Comments
 (0)