New - instantiate minio client with options
(endpoint string, opts *Options)
| 199 | |
| 200 | // New - instantiate minio client with options |
| 201 | func New(endpoint string, opts *Options) (*Client, error) { |
| 202 | if opts == nil { |
| 203 | return nil, errors.New("no options provided") |
| 204 | } |
| 205 | clnt, err := privateNew(endpoint, opts) |
| 206 | if err != nil { |
| 207 | return nil, err |
| 208 | } |
| 209 | if s3utils.IsAmazonEndpoint(*clnt.endpointURL) { |
| 210 | // If Amazon S3 set to signature v4. |
| 211 | clnt.overrideSignerType = credentials.SignatureV4 |
| 212 | // Amazon S3 endpoints are resolved into dual-stack endpoints by default |
| 213 | // for backwards compatibility. |
| 214 | clnt.s3DualstackEnabled = true |
| 215 | } else if s3utils.IsAmazonOutpostsEndpoint(*clnt.endpointURL) { |
| 216 | // S3 on Outposts uses signature v4 with service name s3-outposts. |
| 217 | clnt.overrideSignerType = credentials.SignatureV4 |
| 218 | } |
| 219 | |
| 220 | return clnt, nil |
| 221 | } |
| 222 | |
| 223 | // EndpointURL returns the URL of the S3-compatible endpoint that this client connects to. |
| 224 | // |