-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy paths3_tags.go
67 lines (64 loc) · 1.74 KB
/
s3_tags.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// (c) Copyright IBM Corp. 2021
// (c) Copyright Instana Inc. 2021
package instaawssdk
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/opentracing/opentracing-go"
)
func extractS3Tags(req *request.Request) (opentracing.Tags, error) {
switch params := req.Params.(type) {
case *s3.CreateBucketInput:
return opentracing.Tags{
s3Op: "createBucket",
s3Bucket: aws.StringValue(params.Bucket),
}, nil
case *s3.DeleteBucketInput:
return opentracing.Tags{
s3Op: "deleteBucket",
s3Bucket: aws.StringValue(params.Bucket),
}, nil
case *s3.DeleteObjectInput:
return opentracing.Tags{
s3Op: "delete",
s3Bucket: aws.StringValue(params.Bucket),
s3Key: aws.StringValue(params.Key),
}, nil
case *s3.DeleteObjectsInput:
return opentracing.Tags{
s3Op: "delete",
s3Bucket: aws.StringValue(params.Bucket),
}, nil
case *s3.GetObjectInput:
return opentracing.Tags{
s3Op: "get",
s3Bucket: aws.StringValue(params.Bucket),
s3Key: aws.StringValue(params.Key),
}, nil
case *s3.HeadObjectInput:
return opentracing.Tags{
s3Op: "metadata",
s3Bucket: aws.StringValue(params.Bucket),
s3Key: aws.StringValue(params.Key),
}, nil
case *s3.ListObjectsInput:
return opentracing.Tags{
s3Op: "list",
s3Bucket: aws.StringValue(params.Bucket),
}, nil
case *s3.ListObjectsV2Input:
return opentracing.Tags{
s3Op: "list",
s3Bucket: aws.StringValue(params.Bucket),
}, nil
case *s3.PutObjectInput:
return opentracing.Tags{
s3Op: "put",
s3Bucket: aws.StringValue(params.Bucket),
s3Key: aws.StringValue(params.Key),
}, nil
default:
return nil, errMethodNotInstrumented
}
}