forked from TrueCloudLab/xk6-frostfs
[#181] Support AWS credentials profiles
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
parent
14f26e47dc
commit
a326fbcbf8
2 changed files with 5 additions and 2 deletions
|
@ -107,11 +107,12 @@ const s3_cli = s3.connect("https://s3.frostfs.devenv:8080")
|
||||||
You can also provide additional options:
|
You can also provide additional options:
|
||||||
```js
|
```js
|
||||||
import s3 from 'k6/x/frostfs/s3';
|
import s3 from 'k6/x/frostfs/s3';
|
||||||
const s3_cli = s3.connect("https://s3.frostfs.devenv:8080", {'no_verify_ssl': 'true', 'timeout': '60s'})
|
const s3_cli = s3.connect("https://s3.frostfs.devenv:8080", {'no_verify_ssl': 'true', 'timeout': '60s', 'aws_profile': 'metal'})
|
||||||
```
|
```
|
||||||
|
|
||||||
* `no_verify_ss` - Bool. If `true` - skip verifying the s3 certificate chain and host name (useful if s3 uses self-signed certificates)
|
* `no_verify_ss` - Bool. If `true` - skip verifying the s3 certificate chain and host name (useful if s3 uses self-signed certificates)
|
||||||
* `timeout` - Duration. Set timeout for requests (in http client). If omitted or zero - timeout is infinite.
|
* `timeout` - Duration. Set timeout for requests (in http client). If omitted or zero - timeout is infinite.
|
||||||
|
* `aws_profile` - String. Use custom profile credentials from `$HOME/.aws/credentials` file. If omitted or empty - use default profile.
|
||||||
|
|
||||||
### Methods
|
### Methods
|
||||||
- `createBucket(bucket, params)`. Returns dictionary with `success` boolean flag
|
- `createBucket(bucket, params)`. Returns dictionary with `success` boolean flag
|
||||||
|
|
|
@ -59,7 +59,9 @@ func (s *S3) Connect(endpoint string, params map[string]string) (*Client, error)
|
||||||
}, nil
|
}, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
cfg, err := config.LoadDefaultConfig(s.vu.Context(), config.WithEndpointResolverWithOptions(resolver))
|
cfg, err := config.LoadDefaultConfig(s.vu.Context(),
|
||||||
|
config.WithEndpointResolverWithOptions(resolver),
|
||||||
|
config.WithSharedConfigProfile(params["aws_profile"]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("configuration error: %w", err)
|
return nil, fmt.Errorf("configuration error: %w", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue