diff --git a/management/actions.go b/management/actions.go index 4b3a9c3b..a868a550 100644 --- a/management/actions.go +++ b/management/actions.go @@ -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 @@ -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 -} diff --git a/management/actions_test.go b/management/actions_test.go index 35304eab..342ce0bf 100644 --- a/management/actions_test.go +++ b/management/actions_test.go @@ -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() diff --git a/management/http_recordings_test.go b/management/http_recordings_test.go index ca4ca5be..07534ef0 100644 --- a/management/http_recordings_test.go +++ b/management/http_recordings_test.go @@ -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 @@ -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 { diff --git a/management/management.gen.go b/management/management.gen.go index 20dd9bfd..86d8b10f 100644 --- a/management/management.gen.go +++ b/management/management.gen.go @@ -303,32 +303,6 @@ func (a *ActionList) String() string { return Stringify(a) } -// GetExpires returns the Expires field if it's non-nil, zero value otherwise. -func (a *ActionLogSession) GetExpires() time.Time { - if a == nil || a.Expires == nil { - return time.Time{} - } - return *a.Expires -} - -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (a *ActionLogSession) GetURL() string { - if a == nil || a.URL == nil { - return "" - } - return *a.URL -} - -// String returns a string representation of ActionLogSession. -func (a *ActionLogSession) String() string { - return Stringify(a) -} - -// String returns a string representation of ActionLogSessionFilter. -func (a *ActionLogSessionFilter) String() string { - return Stringify(a) -} - // GetName returns the Name field if it's non-nil, zero value otherwise. func (a *ActionSecret) GetName() string { if a == nil || a.Name == nil { diff --git a/management/management.gen_test.go b/management/management.gen_test.go index 84120bc6..228451a3 100644 --- a/management/management.gen_test.go +++ b/management/management.gen_test.go @@ -384,42 +384,6 @@ func TestActionList_String(t *testing.T) { } } -func TestActionLogSession_GetExpires(tt *testing.T) { - var zeroValue time.Time - a := &ActionLogSession{Expires: &zeroValue} - a.GetExpires() - a = &ActionLogSession{} - a.GetExpires() - a = nil - a.GetExpires() -} - -func TestActionLogSession_GetURL(tt *testing.T) { - var zeroValue string - a := &ActionLogSession{URL: &zeroValue} - a.GetURL() - a = &ActionLogSession{} - a.GetURL() - a = nil - a.GetURL() -} - -func TestActionLogSession_String(t *testing.T) { - var rawJSON json.RawMessage - v := &ActionLogSession{} - if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { - t.Errorf("failed to produce a valid json") - } -} - -func TestActionLogSessionFilter_String(t *testing.T) { - var rawJSON json.RawMessage - v := &ActionLogSessionFilter{} - if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { - t.Errorf("failed to produce a valid json") - } -} - func TestActionSecret_GetName(tt *testing.T) { var zeroValue string a := &ActionSecret{Name: &zeroValue} diff --git a/test/data/recordings/TestActionManager_LogSession.yaml b/test/data/recordings/TestActionManager_LogSession.yaml deleted file mode 100644 index ac5e6795..00000000 --- a/test/data/recordings/TestActionManager_LogSession.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -version: 2 -interactions: - - id: 0 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 50 - transfer_encoding: [] - trailer: {} - host: go-auth0-dev.eu.auth0.com - remote_addr: "" - request_uri: "" - body: | - {"filters":[{"key":"action_id","val":"act_123"}]} - form: {} - headers: - Content-Type: - - application/json - User-Agent: - - Go-Auth0-SDK/latest - url: https://go-auth0-dev.eu.auth0.com/api/v2/actions/log-sessions - method: POST - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - transfer_encoding: [] - trailer: {} - content_length: -1 - uncompressed: true - body: '{"url":"https://go-auth0-dev.eu.auth0.com.eu.auth0.com/api/v2/actions/log-sessions/tail?token=tkn_123","expires":"2023-01-25T17:47:18.956969265Z"}' - headers: - Content-Type: - - application/json; charset=utf-8 - status: 200 OK - code: 200 - duration: 167.176584ms