Skip to content

Commit

Permalink
[DXEX-3404] chore: remove actions log sessions API (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
johneke-auth0 authored Dec 6, 2023
1 parent b238963 commit 1be8fa9
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 159 deletions.
23 changes: 0 additions & 23 deletions management/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,21 +201,6 @@ type ActionExecution struct {
UpdatedAt *time.Time `json:"updated_at"`
}

// ActionLogSessionFilter defines a filter for the log session.
type ActionLogSessionFilter struct {
Key string `json:"key"`
Val string `json:"val"`
}

// ActionLogSession contains a presigned URL that can be used for tailing realtime
// logs from Actions.
type ActionLogSession struct {
URL *string `json:"url,omitempty"`
Expires *time.Time `json:"expires,omitempty"`

Filters []ActionLogSessionFilter `json:"filters,omitempty"`
}

// ActionManager manages Auth0 Action resources.
type ActionManager manager

Expand Down Expand Up @@ -341,11 +326,3 @@ func (m *ActionManager) Execution(ctx context.Context, executionID string, opts
err = m.management.Request(ctx, "GET", m.management.URI("actions", "executions", executionID), &v, opts...)
return
}

// LogSession creates a log session for tailing Actions logs.
//
// See: https://auth0.com/docs/api/management/v2/#!/Actions/post_actions_log_sessions
func (m *ActionManager) LogSession(ctx context.Context, l *ActionLogSession, opts ...RequestOption) (err error) {
err = m.management.Request(ctx, "POST", m.management.URI("actions", "log-sessions"), &l, opts...)
return
}
17 changes: 0 additions & 17 deletions management/actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,23 +239,6 @@ func TestActionManager_Execution(t *testing.T) {
assert.Equal(t, http.StatusNotFound, err.(Error).Status())
}

func TestActionManager_LogSession(t *testing.T) {
configureHTTPTestRecordings(t)

expectedLogSession := &ActionLogSession{
Filters: []ActionLogSessionFilter{{
Key: "action_id",
Val: "act_123",
}},
}

err := api.Action.LogSession(context.Background(), expectedLogSession)

assert.NoError(t, err)
assert.NotEmpty(t, expectedLogSession.GetURL())
assert.NotEmpty(t, expectedLogSession.GetExpires())
}

func cleanupAction(t *testing.T, actionID string) {
t.Helper()

Expand Down
18 changes: 0 additions & 18 deletions management/http_recordings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func removeSensitiveDataFromRecordings(t *testing.T, recorderTransport *recorder
redactSensitiveDataInSigningKey(t, i)
redactSensitiveDataInClient(t, i)
redactSensitiveDataInResourceServer(t, i)
redactSensitiveDataInLogSession(t, i)
redactSensitiveDataInLogs(t, i)

// Redact domain should always be ran last
Expand Down Expand Up @@ -221,23 +220,6 @@ func redactSensitiveDataInResourceServer(t *testing.T, i *cassette.Interaction)
}
}

func redactSensitiveDataInLogSession(t *testing.T, i *cassette.Interaction) {
isLogSessionURL := strings.Contains(i.Request.URL, "https://"+domain+"/api/v2/actions/log-sessions")
if isLogSessionURL {
var logSession ActionLogSession
err := json.Unmarshal([]byte(i.Response.Body), &logSession)
require.NoError(t, err)

replacedURL := "https://" + domain + "/api/v2/actions/log-sessions/tail?token=tkn_123"
logSession.URL = &replacedURL

logSessionBody, err := json.Marshal(logSession)
require.NoError(t, err)

i.Response.Body = string(logSessionBody)
}
}

func redactSensitiveDataInLogs(t *testing.T, i *cassette.Interaction) {
isMultipleLogsURL := strings.Contains(i.Request.URL, "https://"+domain+"/api/v2/logs?")
if isMultipleLogsURL {
Expand Down
26 changes: 0 additions & 26 deletions management/management.gen.go

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

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

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

39 changes: 0 additions & 39 deletions test/data/recordings/TestActionManager_LogSession.yaml

This file was deleted.

0 comments on commit 1be8fa9

Please sign in to comment.