Method: WorkOS::AuditLogs.create_export

Defined in:
lib/workos/audit_logs.rb

.create_export(organization:, range_start:, range_end:, actions: nil, actors: nil, targets: nil, actor_names: nil, actor_ids: nil) ⇒ WorkOS::AuditLogExport

Create an Export of Audit Log Events.

Parameters:

  • organization (String)

    An Organization ID

  • range_start (String)

    ISO-8601 datetime

  • range_end (String)

    ISO-8601 datetime

  • actions (Array<String>) (defaults to: nil)

    A list of actions to filter by

  • @deprecated (Array<String>)

    use ‘actor_names` instead

  • actor_names (Array<String>) (defaults to: nil)

    A list of actor names to filter by

  • actor_ids (Array<String>) (defaults to: nil)

    A list of actor ids to filter by

  • targets (Array<String>) (defaults to: nil)

    A list of target types to filter by

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/workos/audit_logs.rb', line 46

def create_export(organization:, range_start:, range_end:, actions: nil, # rubocop:disable Metrics/ParameterLists
                  actors: nil, targets: nil, actor_names: nil, actor_ids: nil)
  body = {
    organization_id: organization,
    range_start: range_start,
    range_end: range_end,
  }

  body['actions'] = actions unless actions.nil?
  body['actors'] = actors unless actors.nil?
  body['actor_names'] = actor_names unless actor_names.nil?
  body['actor_ids'] = actor_ids unless actor_ids.nil?
  body['targets'] = targets unless targets.nil?

  request = post_request(
    path: '/audit_logs/exports',
    auth: true,
    body: body,
  )

  response = execute_request(request: request)

  WorkOS::AuditLogExport.new(response.body)
end