(config ClientConfig)
| 418 | } |
| 419 | |
| 420 | func NewClient(config ClientConfig) (*minio.Client, error) { |
| 421 | // Instantiate new MinIO client |
| 422 | var creds *credentials.Credentials |
| 423 | if config.CredsV2 { |
| 424 | creds = credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), "") |
| 425 | } else { |
| 426 | creds = credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), "") |
| 427 | } |
| 428 | opts := &minio.Options{ |
| 429 | Creds: creds, |
| 430 | Transport: createHTTPTransport(), |
| 431 | Secure: mustParseBool(os.Getenv(enableHTTPS)), |
| 432 | TrailingHeaders: config.TrailingHeaders, |
| 433 | } |
| 434 | client, err := minio.New(os.Getenv(serverEndpoint), opts) |
| 435 | if err != nil { |
| 436 | return nil, err |
| 437 | } |
| 438 | |
| 439 | if config.TraceOn { |
| 440 | client.TraceOn(os.Stderr) |
| 441 | } |
| 442 | |
| 443 | // Set user agent. |
| 444 | client.SetAppInfo("MinIO-go-FunctionalTest", appVersion) |
| 445 | |
| 446 | return client, nil |
| 447 | } |
| 448 | |
| 449 | // Tests bucket re-create errors. |
| 450 | func testMakeBucketError() { |
no test coverage detected