more logs

This commit is contained in:
ravikiran-s 2023-05-03 12:19:33 +05:30
parent a372c4e9d0
commit 1babcd292f
3 changed files with 24 additions and 17 deletions

View file

@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/dynamodbstreams"
"github.com/aws/aws-sdk-go-v2/service/dynamodbstreams/types"
"github.com/aws/aws-sdk-go-v2/service/kinesis"
@ -17,9 +18,11 @@ type DynamodbStreamAdapterClient struct {
}
func (d DynamodbStreamAdapterClient) ListStreams(ctx context.Context, params *kinesis.ListStreamsInput, optFns ...func(*kinesis.Options)) (*kinesis.ListStreamsOutput, error) {
log.Info("ListStreams >>> request ", params)
req, _ := json.Marshal(params)
log.Info(fmt.Sprintf("ListStreams request %v", string(req)))
listStreamsOutput, err := d.internalClient.ListStreams(ctx, d.convertListStreamsInput(params))
log.Info("ListStreams >>> response ", params)
out, _ := json.Marshal(listStreamsOutput)
log.Info(fmt.Sprintf("ListStreams >>> response %v", string(out)))
if err != nil {
return nil, err
}
@ -27,9 +30,11 @@ func (d DynamodbStreamAdapterClient) ListStreams(ctx context.Context, params *ki
}
func (d DynamodbStreamAdapterClient) GetShardIterator(ctx context.Context, params *kinesis.GetShardIteratorInput, optFns ...func(*kinesis.Options)) (*kinesis.GetShardIteratorOutput, error) {
log.Info("GetShardIterator >>> request ", params)
requestParamsString, _ := json.Marshal(params)
log.Info(fmt.Sprintf("GetShardIterator >>> request %v", string(requestParamsString)))
shardIteratorOutput, err := d.internalClient.GetShardIterator(ctx, d.convertShardIteratorInput(params))
log.Info("GetShardIterator >>> response ", params)
out, _ := json.Marshal(shardIteratorOutput)
log.Info(fmt.Sprintf("GetShardIterator >>> response %v", string(out)))
if err != nil {
return nil, err
}
@ -37,18 +42,20 @@ func (d DynamodbStreamAdapterClient) GetShardIterator(ctx context.Context, param
}
func (d DynamodbStreamAdapterClient) GetRecords(ctx context.Context, params *kinesis.GetRecordsInput, optFns ...func(*kinesis.Options)) (*kinesis.GetRecordsOutput, error) {
log.Info("GetRecords >>> request ", params)
getRecordsInput, err := d.internalClient.GetRecords(ctx, d.convertGetRecordsInput(params))
log.Info("GetRecords >>> output ", params)
req, _ := json.Marshal(params)
log.Info(fmt.Sprintf(fmt.Sprintf("GetRecords >>> request %v", string(req))))
getRecordsOutput, err := d.internalClient.GetRecords(ctx, d.convertGetRecordsInput(params))
out, _ := json.Marshal(getRecordsOutput)
log.Info(fmt.Sprintf("GetRecords >>> output %v", string(out)))
if err != nil {
return nil, err
}
return d.convertGetRecordsOutput(getRecordsInput), nil
return d.convertGetRecordsOutput(getRecordsOutput), nil
}
func (d DynamodbStreamAdapterClient) ListShards(ctx context.Context, params *kinesis.ListShardsInput, optFns ...func(*kinesis.Options)) (*kinesis.ListShardsOutput, error) {
log.Info("ListShards >>> request ", params)
req, _ := json.Marshal(params)
log.Info(fmt.Sprintf("ListShards >>> request %v", string(req)))
var maxResults int32 = 100
if *params.MaxResults >= 100 {
params.MaxResults = &maxResults
@ -58,7 +65,8 @@ func (d DynamodbStreamAdapterClient) ListShards(ctx context.Context, params *kin
Limit: params.MaxResults,
StreamArn: params.StreamName,
})
log.Info("ListShards >>> output ", dynamoOutput)
out, _ := json.Marshal(dynamoOutput)
log.Info(fmt.Sprintf("ListShards >>> output %v", string(out)))
if err != nil {
return nil, err
}

4
go.mod
View file

@ -1,7 +1,5 @@
module github.com/ravikiran-zoman/vmware-go-kcl-v2
replace github.com/vmware/vmware-go-kcl-v2 v0.0.0-20230407010916-b12921da2398 => github.com/ravikiran-zoman/vmware-go-kcl-v2 v0.0.1
go 1.17
require (
@ -52,3 +50,5 @@ require (
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
replace github.com/vmware/vmware-go-kcl-v2 v0.0.0-20230407010916-b12921da2398 => github.com/ravikiran-zoman/vmware-go-kcl-v2 v0.0.4

7
go.sum
View file

@ -31,9 +31,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
@ -237,8 +236,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/ravikiran-zoman/vmware-go-kcl-v2 v0.0.1 h1:3W8KdrQTtQU3O5+5B+4RFSFPcDe93bkNkzJOkMD44tA=
github.com/ravikiran-zoman/vmware-go-kcl-v2 v0.0.1/go.mod h1:DmEtPEfdoN1qnYkPI4B3tx/LFH3v6AFHZS9bFte8z80=
github.com/ravikiran-zoman/vmware-go-kcl-v2 v0.0.4 h1:/U0SYsx7t6ButcYX7mI8+0ETTArfA6x48gASRpp8is0=
github.com/ravikiran-zoman/vmware-go-kcl-v2 v0.0.4/go.mod h1:Hhchnacx90ReyGMM617PCeM/RbjgwS/caGJSW/cX6gw=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.26.1 h1:/ihwxqH+4z8UxyI70wM1z9yCvkWcfz/a3mj48k/Zngc=