Class: Hivehook::Resources::AuditLogService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/hivehook/resources/audit_log_service.rb

Constant Summary collapse

FRAGMENT =
"id actorType actorId actorName action resourceType resourceId orgId ipAddress userAgent details createdAt"

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Hivehook::Resources::BaseService

Instance Method Details

#get(id) ⇒ Object



18
19
20
21
# File 'lib/hivehook/resources/audit_log_service.rb', line 18

def get(id)
  query = "query($id: UUID!) { auditLog(id: $id) { #{FRAGMENT} } }"
  @transport.execute(query, { "id" => id })["auditLog"]
end

#list(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/hivehook/resources/audit_log_service.rb', line 8

def list(options = {})
  query = "query($actorType: String, $resourceType: String, $resourceId: UUID, $action: String, $since: Time, $until: Time, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
    auditLogs(actorType: $actorType, resourceType: $resourceType, resourceId: $resourceId, action: $action, since: $since, until: $until, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
      nodes { #{FRAGMENT} }
      pageInfo { total limit offset endCursor hasNextPage }
    }
  }"
  @transport.execute(query, build_variables(options, %w[actorType resourceType resourceId action since until search limit offset after first]))["auditLogs"]
end