Skip to content

Commit

Permalink
Add isPriority parameter to Log Streams (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
duedares-rvj authored Nov 27, 2024
1 parent 076b6ea commit a74730f
Show file tree
Hide file tree
Showing 33 changed files with 441 additions and 435 deletions.
3 changes: 3 additions & 0 deletions management/log_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ type LogStream struct {
// "eventgrid", "datadog", "splunk", "sumo", "mixpanel", "segment.
Type *string `json:"type,omitempty"`

// True for priority log streams, false for non-priority
IsPriority *bool `json:"isPriority,omitempty"`

// The status of the log-stream. Can be one of "active", "paused", or "suspended".
Status *string `json:"status,omitempty"`

Expand Down
35 changes: 21 additions & 14 deletions management/log_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ var logStreamTestCases = []logStreamTestCase{
{
name: "AmazonEventBridge LogStream",
logStream: LogStream{
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeAmazonEventBridge),
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeAmazonEventBridge),
IsPriority: auth0.Bool(true),
Sink: &LogStreamSinkAmazonEventBridge{
AccountID: auth0.String("999999999999"),
Region: auth0.String("us-west-2"),
Expand All @@ -39,8 +40,9 @@ var logStreamTestCases = []logStreamTestCase{
{
name: "HTTP LogStream",
logStream: LogStream{
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeHTTP),
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeHTTP),
IsPriority: auth0.Bool(false),
Sink: &LogStreamSinkHTTP{
Endpoint: auth0.String("https://example.com/logs"),
Authorization: auth0.String("Bearer f2368bbe77074527a37be2fdd5b92bad"),
Expand All @@ -52,8 +54,9 @@ var logStreamTestCases = []logStreamTestCase{
{
name: "DataDog LogStream",
logStream: LogStream{
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeDatadog),
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeDatadog),
IsPriority: auth0.Bool(true),
Sink: &LogStreamSinkDatadog{
APIKey: auth0.String("121233123455"),
Region: auth0.String("us"),
Expand All @@ -63,8 +66,9 @@ var logStreamTestCases = []logStreamTestCase{
{
name: "Segment LogStream",
logStream: LogStream{
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeSegment),
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeSegment),
IsPriority: auth0.Bool(true),
Sink: &LogStreamSinkSegment{
WriteKey: auth0.String("121233123455"),
},
Expand All @@ -73,8 +77,9 @@ var logStreamTestCases = []logStreamTestCase{
{
name: "Splunk LogStream",
logStream: LogStream{
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeSplunk),
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeSplunk),
IsPriority: auth0.Bool(true),
Sink: &LogStreamSinkSplunk{
Domain: auth0.String("demo.splunk.com"),
Port: auth0.String("8080"),
Expand All @@ -86,8 +91,9 @@ var logStreamTestCases = []logStreamTestCase{
{
name: "Sumo LogStream",
logStream: LogStream{
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeSumo),
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeSumo),
IsPriority: auth0.Bool(true),
Sink: &LogStreamSinkSumo{
SourceAddress: auth0.String("https://example.com"),
},
Expand All @@ -96,8 +102,9 @@ var logStreamTestCases = []logStreamTestCase{
{
name: "Mixpanel LogStream",
logStream: LogStream{
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeMixpanel),
Name: auth0.Stringf("Test-LogStream-%d", time.Now().Unix()),
Type: auth0.String(LogStreamTypeMixpanel),
IsPriority: auth0.Bool(false),
Sink: &LogStreamSinkMixpanel{
Region: auth0.String("us"),
ProjectID: auth0.String("123456789"),
Expand Down
8 changes: 8 additions & 0 deletions management/management.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions management/management.gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ interactions:
proto: HTTP/1.1
proto_major: 1
proto_minor: 1
content_length: 121
content_length: 139
transfer_encoding: []
trailer: {}
host: go-auth0-dev.eu.auth0.com
remote_addr: ""
request_uri: ""
body: |
{"name":"Test-LogStream-1674668511","type":"eventbridge","sink":{"awsAccountId":"999999999999","awsRegion":"us-west-2"}}
{"name":"Test-LogStream-1732609495","type":"eventbridge","isPriority":true,"sink":{"awsAccountId":"999999999999","awsRegion":"us-west-2"}}
form: {}
headers:
Content-Type:
- application/json
User-Agent:
- Go-Auth0-SDK/latest
- Go-Auth0/1.11.2
url: https://go-auth0-dev.eu.auth0.com/api/v2/log-streams
method: POST
response:
Expand All @@ -30,13 +30,13 @@ interactions:
trailer: {}
content_length: -1
uncompressed: true
body: '{"id":"lst_0000000000011620","name":"Test-LogStream-1674668511","type":"eventbridge","status":"active","sink":{"awsAccountId":"999999999999","awsRegion":"us-west-2","awsPartnerEventSource":"aws.partner/auth0.com/go-auth0-dev.eu.auth0.com-ad17dd8c-ece0-4f9e-983f-798b38768005/auth0.logs"}}'
body: '{"id":"lst_0000000000002059","name":"Test-LogStream-1732609495","type":"eventbridge","status":"active","sink":{"awsAccountId":"999999999999","awsRegion":"us-west-2","awsPartnerEventSource":"aws.partner/auth0.com/go-auth0-dev.eu.auth0.com-879cfb72-351f-4e66-82a7-2b570ce6e963/auth0.logs"},"filters":[{"type":"category","name":"security"}],"isPriority":true}'
headers:
Content-Type:
- application/json; charset=utf-8
status: 200 OK
code: 200
duration: 846.665417ms
duration: 1.388066916s
- id: 1
request:
proto: HTTP/1.1
Expand All @@ -54,8 +54,8 @@ interactions:
Content-Type:
- application/json
User-Agent:
- Go-Auth0-SDK/latest
url: https://go-auth0-dev.eu.auth0.com/api/v2/log-streams/lst_0000000000011620
- Go-Auth0/1.11.2
url: https://go-auth0-dev.eu.auth0.com/api/v2/log-streams/lst_0000000000002059
method: DELETE
response:
proto: HTTP/2.0
Expand All @@ -71,4 +71,4 @@ interactions:
- application/json; charset=utf-8
status: 204 No Content
code: 204
duration: 762.066916ms
duration: 446.801125ms
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ interactions:
proto: HTTP/1.1
proto_major: 1
proto_minor: 1
content_length: 115
content_length: 133
transfer_encoding: []
trailer: {}
host: go-auth0-dev.eu.auth0.com
remote_addr: ""
request_uri: ""
body: |
{"name":"Test-LogStream-1674668511","type":"datadog","sink":{"datadogRegion":"us","datadogApiKey":"121233123455"}}
{"name":"Test-LogStream-1732609495","type":"datadog","isPriority":true,"sink":{"datadogRegion":"us","datadogApiKey":"121233123455"}}
form: {}
headers:
Content-Type:
- application/json
User-Agent:
- Go-Auth0-SDK/latest
- Go-Auth0/1.11.2
url: https://go-auth0-dev.eu.auth0.com/api/v2/log-streams
method: POST
response:
Expand All @@ -30,13 +30,13 @@ interactions:
trailer: {}
content_length: -1
uncompressed: true
body: '{"id":"lst_0000000000011622","name":"Test-LogStream-1674668511","type":"datadog","status":"active","sink":{"datadogApiKey":"121233123455","datadogRegion":"us"}}'
body: '{"id":"lst_0000000000002061","name":"Test-LogStream-1732609495","type":"datadog","status":"active","sink":{"datadogApiKey":"121233123455","datadogRegion":"us"},"filters":[{"type":"category","name":"security"}],"isPriority":true}'
headers:
Content-Type:
- application/json; charset=utf-8
status: 200 OK
code: 200
duration: 132.212416ms
duration: 417.121583ms
- id: 1
request:
proto: HTTP/1.1
Expand All @@ -54,8 +54,8 @@ interactions:
Content-Type:
- application/json
User-Agent:
- Go-Auth0-SDK/latest
url: https://go-auth0-dev.eu.auth0.com/api/v2/log-streams/lst_0000000000011622
- Go-Auth0/1.11.2
url: https://go-auth0-dev.eu.auth0.com/api/v2/log-streams/lst_0000000000002061
method: DELETE
response:
proto: HTTP/2.0
Expand All @@ -71,4 +71,4 @@ interactions:
- application/json; charset=utf-8
status: 204 No Content
code: 204
duration: 100.031167ms
duration: 384.841708ms
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ interactions:
proto: HTTP/1.1
proto_major: 1
proto_minor: 1
content_length: 233
content_length: 252
transfer_encoding: []
trailer: {}
host: go-auth0-dev.eu.auth0.com
remote_addr: ""
request_uri: ""
body: |
{"name":"Test-LogStream-1674668511","type":"http","sink":{"httpContentFormat":"JSONLINES","httpContentType":"application/json","httpEndpoint":"https://example.com/logs","httpAuthorization":"Bearer f2368bbe77074527a37be2fdd5b92bad"}}
{"name":"Test-LogStream-1732609495","type":"http","isPriority":false,"sink":{"httpContentFormat":"JSONLINES","httpContentType":"application/json","httpEndpoint":"https://example.com/logs","httpAuthorization":"Bearer f2368bbe77074527a37be2fdd5b92bad"}}
form: {}
headers:
Content-Type:
- application/json
User-Agent:
- Go-Auth0-SDK/latest
- Go-Auth0/1.11.2
url: https://go-auth0-dev.eu.auth0.com/api/v2/log-streams
method: POST
response:
Expand All @@ -30,13 +30,13 @@ interactions:
trailer: {}
content_length: -1
uncompressed: true
body: '{"id":"lst_0000000000011621","name":"Test-LogStream-1674668511","type":"http","status":"active","sink":{"httpAuthorization":"Bearer f2368bbe77074527a37be2fdd5b92bad","httpContentFormat":"JSONLINES","httpContentType":"application/json","httpEndpoint":"https://example.com/logs"}}'
body: '{"id":"lst_0000000000002060","name":"Test-LogStream-1732609495","type":"http","status":"active","sink":{"httpAuthorization":"Bearer f2368bbe77074527a37be2fdd5b92bad","httpContentFormat":"JSONLINES","httpContentType":"application/json","httpEndpoint":"https://example.com/logs"},"isPriority":false}'
headers:
Content-Type:
- application/json; charset=utf-8
status: 200 OK
code: 200
duration: 200.115291ms
duration: 440.237875ms
- id: 1
request:
proto: HTTP/1.1
Expand All @@ -54,8 +54,8 @@ interactions:
Content-Type:
- application/json
User-Agent:
- Go-Auth0-SDK/latest
url: https://go-auth0-dev.eu.auth0.com/api/v2/log-streams/lst_0000000000011621
- Go-Auth0/1.11.2
url: https://go-auth0-dev.eu.auth0.com/api/v2/log-streams/lst_0000000000002060
method: DELETE
response:
proto: HTTP/2.0
Expand All @@ -71,4 +71,4 @@ interactions:
- application/json; charset=utf-8
status: 204 No Content
code: 204
duration: 139.570416ms
duration: 360.544ms
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ interactions:
proto: HTTP/1.1
proto_major: 1
proto_minor: 1
content_length: 260
content_length: 279
transfer_encoding: []
trailer: {}
host: go-auth0-dev.eu.auth0.com
remote_addr: ""
request_uri: ""
body: |
{"name":"Test-LogStream-1674668511","type":"mixpanel","sink":{"mixpanelRegion":"us","mixpanelProjectId":"123456789","mixpanelServiceAccountUsername":"fake-account.123abc.mp-service-account","mixpanelServiceAccountPassword":"8iwyKSzwV2brfakepassGGKhsZ3INozo"}}
{"name":"Test-LogStream-1732609495","type":"mixpanel","isPriority":false,"sink":{"mixpanelRegion":"us","mixpanelProjectId":"123456789","mixpanelServiceAccountUsername":"fake-account.123abc.mp-service-account","mixpanelServiceAccountPassword":"8iwyKSzwV2brfakepassGGKhsZ3INozo"}}
form: {}
headers:
Content-Type:
- application/json
User-Agent:
- Go-Auth0-SDK/latest
- Go-Auth0/1.11.2
url: https://go-auth0-dev.eu.auth0.com/api/v2/log-streams
method: POST
response:
Expand All @@ -30,13 +30,13 @@ interactions:
trailer: {}
content_length: -1
uncompressed: true
body: '{"id":"lst_0000000000011626","name":"Test-LogStream-1674668511","type":"mixpanel","status":"active","sink":{"mixpanelRegion":"us","mixpanelProjectId":"123456789","mixpanelServiceAccountUsername":"fake-account.123abc.mp-service-account","mixpanelServiceAccountPassword":"********"}}'
body: '{"id":"lst_0000000000002065","name":"Test-LogStream-1732609495","type":"mixpanel","status":"active","sink":{"mixpanelRegion":"us","mixpanelProjectId":"123456789","mixpanelServiceAccountUsername":"fake-account.123abc.mp-service-account","mixpanelServiceAccountPassword":"********"},"isPriority":false}'
headers:
Content-Type:
- application/json; charset=utf-8
status: 200 OK
code: 200
duration: 130.8185ms
duration: 378.886167ms
- id: 1
request:
proto: HTTP/1.1
Expand All @@ -54,8 +54,8 @@ interactions:
Content-Type:
- application/json
User-Agent:
- Go-Auth0-SDK/latest
url: https://go-auth0-dev.eu.auth0.com/api/v2/log-streams/lst_0000000000011626
- Go-Auth0/1.11.2
url: https://go-auth0-dev.eu.auth0.com/api/v2/log-streams/lst_0000000000002065
method: DELETE
response:
proto: HTTP/2.0
Expand All @@ -71,4 +71,4 @@ interactions:
- application/json; charset=utf-8
status: 204 No Content
code: 204
duration: 116.658791ms
duration: 328.02275ms
Loading

0 comments on commit a74730f

Please sign in to comment.