Skip to content

Commit 5ebce83

Browse files
committed
reformat events, OBSS3 added
1 parent bfd11ae commit 5ebce83

27 files changed

+376
-153
lines changed

go-runtime/events/apig/APIGRequestContext.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
package apig
22

33
import (
4-
"fmt"
4+
"fmt"
55
)
66

77
type APIGRequestContext struct {
8-
ApiId string `json:"apiId"`
9-
RequestId string `json:"requestId"`
10-
Stage string `json:"stage"`
11-
SourceIp string `json:"sourceIp"`
8+
ApiId string `json:"apiId"`
9+
RequestId string `json:"requestId"`
10+
Stage string `json:"stage"`
11+
SourceIp string `json:"sourceIp"`
1212
}
1313

1414
func (rc APIGRequestContext) String() string {
15-
return fmt.Sprintf(`APIGRequestContext{
15+
return fmt.Sprintf(`APIGRequestContext{
1616
apiId='%s',
1717
requestId='%s',
1818
stage='%s',
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
package apig
22

33
import (
4-
"encoding/base64"
5-
"fmt"
4+
"encoding/base64"
5+
"fmt"
66
)
77

88
type APIGTriggerEvent struct {
9-
IsBase64Encoded bool `json:"isBase64Encoded"`
10-
HttpMethod string `json:"httpMethod"`
11-
Path string `json:"path"`
12-
Body string `json:"body"`
13-
PathParameters map[string]string `json:"pathParameters"`
14-
RequestContext APIGRequestContext `json:"requestContext"`
15-
Headers map[string]string `json:"headers"`
16-
QueryStringParameters map[string]string `json:"queryStringParameters"`
17-
UserData string `json:"user_data"`
9+
IsBase64Encoded bool `json:"isBase64Encoded"`
10+
HttpMethod string `json:"httpMethod"`
11+
Path string `json:"path"`
12+
Body string `json:"body"`
13+
PathParameters map[string]string `json:"pathParameters"`
14+
RequestContext APIGRequestContext `json:"requestContext"`
15+
Headers map[string]string `json:"headers"`
16+
QueryStringParameters map[string]string `json:"queryStringParameters"`
17+
UserData string `json:"user_data"`
1818
}
1919

2020
func (e *APIGTriggerEvent) GetRawBody() string {
21-
decoded, err := base64.StdEncoding.DecodeString(e.Body)
22-
if err != nil {
23-
return ""
24-
}
25-
return string(decoded)
21+
decoded, err := base64.StdEncoding.DecodeString(e.Body)
22+
if err != nil {
23+
return ""
24+
}
25+
return string(decoded)
2626
}
2727

2828
func (e *APIGTriggerEvent) String() string {
29-
return fmt.Sprintf(`APIGTriggerEvent{
29+
return fmt.Sprintf(`APIGTriggerEvent{
3030
isBase64Encoded=%v,
3131
httpMethod='%v',
3232
path='%v',
@@ -37,5 +37,5 @@ func (e *APIGTriggerEvent) String() string {
3737
queryStringParameters=%v,
3838
user_data=%+v,
3939
}`, e.IsBase64Encoded, e.HttpMethod, e.Path, e.Body, e.PathParameters, e.RequestContext,
40-
e.Headers, e.QueryStringParameters, e.UserData)
41-
}
40+
e.Headers, e.QueryStringParameters, e.UserData)
41+
}
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
package apig
22

33
import (
4-
"encoding/base64"
4+
"encoding/base64"
55
)
66

77
type APIGTriggerResponse struct {
8-
Body string `json:"body"`
9-
Headers map[string]string `json:"headers"`
10-
StatusCode int `json:"statusCode"`
11-
IsBase64Encoded bool `json:"isBase64Encoded"`
8+
Body string `json:"body"`
9+
Headers map[string]string `json:"headers"`
10+
StatusCode int `json:"statusCode"`
11+
IsBase64Encoded bool `json:"isBase64Encoded"`
1212
}
1313

1414
func (r *APIGTriggerResponse) SetBase64EncodedBody(body string) {
15-
r.Body = base64.StdEncoding.EncodeToString([]byte(body))
15+
r.Body = base64.StdEncoding.EncodeToString([]byte(body))
1616
}
17-
18-

go-runtime/events/cts/CTS.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
package cts
22

33
import (
4-
"fmt"
4+
"fmt"
55
)
66

77
type CTS struct {
8-
Time string `json:"time"`
9-
User User `json:"user"`
10-
Request map[string]string `json:"request"`
11-
Response map[string]string `json:"response"`
12-
Code int `json:"code"`
13-
ServiceType string `json:"service_type"`
14-
ResourceType string `json:"resource_type"`
15-
ResourceName string `json:"resource_name"`
16-
ResourceId string `json:"resource_id"`
17-
TraceName string `json:"trace_name"`
18-
TraceType string `json:"trace_type"`
19-
RecordTime string `json:"record_time"`
20-
TraceId string `json:"trace_id"`
21-
TraceStatus string `json:"trace_status"`
8+
Time string `json:"time"`
9+
User User `json:"user"`
10+
Request map[string]string `json:"request"`
11+
Response map[string]string `json:"response"`
12+
Code int `json:"code"`
13+
ServiceType string `json:"service_type"`
14+
ResourceType string `json:"resource_type"`
15+
ResourceName string `json:"resource_name"`
16+
ResourceId string `json:"resource_id"`
17+
TraceName string `json:"trace_name"`
18+
TraceType string `json:"trace_type"`
19+
RecordTime string `json:"record_time"`
20+
TraceId string `json:"trace_id"`
21+
TraceStatus string `json:"trace_status"`
2222
}
2323

2424
func (cts *CTS) String() string {
25-
return fmt.Sprintf(`CTS{
25+
return fmt.Sprintf(`CTS{
2626
time='%v',
2727
user=%+v,
2828
request=%v,
@@ -38,6 +38,6 @@ func (cts *CTS) String() string {
3838
trace_id='%v',
3939
trace_status='%v'
4040
}`, cts.Time, cts.User, cts.Request, cts.Response, cts.Code, cts.ServiceType, cts.ResourceType,
41-
cts.ResourceName,cts.ResourceId, cts.TraceName, cts.TraceType, cts.RecordTime, cts.TraceId,
42-
cts.TraceStatus)
43-
}
41+
cts.ResourceName, cts.ResourceId, cts.TraceName, cts.TraceType, cts.RecordTime, cts.TraceId,
42+
cts.TraceStatus)
43+
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package cts
22

33
import (
4-
"fmt"
4+
"fmt"
55
)
66

77
type CTSTriggerEvent struct {
8-
Cts CTS `json:"cts"`
8+
Cts CTS `json:"cts"`
99
}
1010

1111
func (e *CTSTriggerEvent) String() string {
12-
return fmt.Sprintf(`CTSTriggerEvent{
12+
return fmt.Sprintf(`CTSTriggerEvent{
1313
cts=%+v
1414
}`, e.Cts)
1515
}
16-

go-runtime/events/cts/Domain.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package cts
22

33
import (
4-
"fmt"
4+
"fmt"
55
)
66

77
type Domain struct {
8-
Name string `json:"name"`
9-
Id string `json:"id"`
8+
Name string `json:"name"`
9+
Id string `json:"id"`
1010
}
1111

1212
func (d *Domain) String() string {
13-
return fmt.Sprintf(`Domain{
13+
return fmt.Sprintf(`Domain{
1414
name='%v',
1515
id='%v'
1616
}`, d.Name, d.Id)
17-
}
17+
}

go-runtime/events/cts/User.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
package cts
22

33
import (
4-
"fmt"
4+
"fmt"
55
)
66

77
type User struct {
8-
Name string `json:"name"`
9-
Id string `json:"id"`
10-
Domain Domain `json:"domain"`
8+
Name string `json:"name"`
9+
Id string `json:"id"`
10+
Domain Domain `json:"domain"`
1111
}
1212

1313
func (u *User) String() string {
14-
return fmt.Sprintf(`User{
14+
return fmt.Sprintf(`User{
1515
name=%v,
1616
id=%v,
1717
domain=%+v
1818
}`, u.Name, u.Id, u.Domain)
19-
}
19+
}

go-runtime/events/dds/DDSRecord.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
package dds
22

33
import (
4-
"fmt"
4+
"fmt"
55
)
66

77
type DDSRecord struct {
8-
EventName string `json:"event_name"`
9-
EventVersion string `json:"event_version"`
10-
EventSource string `json:"event_source"`
11-
Region string `json:"region"`
12-
Dds map[string]string `json:"dds"`
13-
EventSourceId string `json:"event_source_id"`
8+
EventName string `json:"event_name"`
9+
EventVersion string `json:"event_version"`
10+
EventSource string `json:"event_source"`
11+
Region string `json:"region"`
12+
Dds map[string]string `json:"dds"`
13+
EventSourceId string `json:"event_source_id"`
1414
}
1515

1616
func (r *DDSRecord) String() string {
17-
return fmt.Sprintf(`DDSRecord{
17+
return fmt.Sprintf(`DDSRecord{
1818
event_name=%v,
1919
event_version=%v,
2020
event_source=%v,
2121
region=%v,
2222
dds=%+v,
2323
event_source_id=%v
2424
}`, r.EventName, r.EventVersion, r.EventSource, r.Region, r.Dds, r.EventSourceId)
25-
}
25+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package dds
22

33
import (
4-
"fmt"
4+
"fmt"
55
)
66

77
type DDSTriggerEvent struct {
8-
Records []DDSRecord `json:"records"`
8+
Records []DDSRecord `json:"records"`
99
}
1010

1111
func (e *DDSTriggerEvent) String() string {
12-
return fmt.Sprintf(`DDSTriggerEvent{
12+
return fmt.Sprintf(`DDSTriggerEvent{
1313
records=%+v
1414
}`, e.Records)
1515
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
package dis
22

33
import (
4-
"fmt"
4+
"fmt"
55
)
66

77
type DISMessage struct {
8-
NextPatitionCursor string `json:"next_patition_cursor"`
9-
Records []DISRecord `json:"records"`
10-
MillisBehindLatest string `json:"millisBehindLatest"`
8+
NextPatitionCursor string `json:"next_patition_cursor"`
9+
Records []DISRecord `json:"records"`
10+
MillisBehindLatest string `json:"millisBehindLatest"`
1111
}
1212

1313
func (d *DISMessage) String() string {
14-
return fmt.Sprintf(`DISMessage{
14+
return fmt.Sprintf(`DISMessage{
1515
next_patition_cursor=%v,
1616
records=%+v,
1717
millisBehindLatest=%v
1818
}`, d.NextPatitionCursor, d.Records, d.MillisBehindLatest)
19-
}
19+
}

0 commit comments

Comments
 (0)