mirror of
https://github.com/rclone/rclone.git
synced 2024-12-13 10:45:16 +01:00
25 lines
601 B
Go
25 lines
601 B
Go
package awstesting
|
|
|
|
import (
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
"github.com/aws/aws-sdk-go/aws/client"
|
|
"github.com/aws/aws-sdk-go/aws/client/metadata"
|
|
"github.com/aws/aws-sdk-go/aws/defaults"
|
|
)
|
|
|
|
// NewClient creates and initializes a generic service client for testing.
|
|
func NewClient(cfgs ...*aws.Config) *client.Client {
|
|
info := metadata.ClientInfo{
|
|
Endpoint: "http://endpoint",
|
|
SigningName: "",
|
|
}
|
|
def := defaults.Get()
|
|
def.Config.MergeIn(cfgs...)
|
|
|
|
if v := aws.StringValue(def.Config.Endpoint); len(v) > 0 {
|
|
info.Endpoint = v
|
|
}
|
|
|
|
return client.New(*def.Config, info, def.Handlers)
|
|
}
|