File tree 3 files changed +19
-1
lines changed
3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -213,6 +213,23 @@ func (c *Config) GetS3ResultPrefix() string {
213
213
return GetFromEnvVal (s3ResultPrefixEnvKey )
214
214
}
215
215
216
+ // SetS3OutputBucket is setter for S3 output bucket
217
+ func (c * Config ) SetS3OutputBucket (o string ) error {
218
+ if len (o ) == 0 {
219
+ return ErrConfigS3OutputBucket
220
+ }
221
+ c .values .Set ("s3_output_bucket" , o )
222
+ return nil
223
+ }
224
+
225
+ // GetS3OutputBucket is getter of s3 output bucket
226
+ func (c * Config ) GetS3OutputBucket () string {
227
+ if val := c .values .Get ("s3_output_bucket" ); val != "" {
228
+ return val
229
+ }
230
+ return ""
231
+ }
232
+
216
233
// SetUser is a setter of User.
217
234
func (c * Config ) SetUser (o string ) {
218
235
c .dsn .User = url .UserPassword (o , "" )
Original file line number Diff line number Diff line change 32
32
ErrConfigOutputLocation = errors .New ("output location must starts with s3" )
33
33
ErrConfigRegion = errors .New ("region is required" )
34
34
ErrConfigS3ResultPrefix = errors .New ("S3 result prefix is required" )
35
+ ErrConfigS3OutputBucket = errors .New ("S3 output bucket is required" )
35
36
ErrConfigWGPointer = errors .New ("workgroup pointer is nil" )
36
37
ErrConfigAccessIDRequired = errors .New ("AWS access ID is required" )
37
38
ErrConfigAccessKeyRequired = errors .New ("AWS access Key is required" )
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ func (r *Rows) DownloadResultFromS3() (*csv.Reader, error) {
109
109
110
110
client := s3 .NewFromConfig (cfg )
111
111
112
- bucket := r .config .GetOutputBucket ()
112
+ bucket := r .config .GetS3OutputBucket ()
113
113
path := fmt .Sprintf ("%s/%s.csv" , r .config .GetS3ResultPrefix (), r .queryID )
114
114
115
115
output , err := client .GetObject (context .TODO (), & s3.GetObjectInput {
You can’t perform that action at this time.
0 commit comments