MCPcopy
hub / github.com/minio/minio-go / NewClient

Function NewClient

functional_tests.go:420–447  ·  functional_tests.go::NewClient
(config ClientConfig)

Source from the content-addressed store, hash-verified

418}
419
420func 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.
450func testMakeBucketError() {

Calls 6

NewStaticV2Function · 0.92
NewStaticV4Function · 0.92
createHTTPTransportFunction · 0.85
TraceOnMethod · 0.80
SetAppInfoMethod · 0.80
mustParseBoolFunction · 0.70

Tested by

no test coverage detected