Class: Conversant::V3::Services::CDN::Audit

Inherits:
Object
  • Object
show all
Defined in:
lib/conversant/v3/services/cdn/audit.rb

Overview

Audit service for CDN activity logging

Provides access to audit logs and compliance tracking for CDN configuration changes and administrative actions.

Examples:

View audit logs

cdn = Conversant::V3.cdn(12345)

logs = cdn.audit.list({
  startTime: "2025-01-01T00:00:00Z",
  endTime: "2025-01-01T23:59:59Z",
  pageSize: 100,
  pageNumber: 0
})

logs.each do |log|
  puts "#{log['timestamp']}: #{log['action']} by #{log['user']}"
end

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Audit

Initialize audit service

Since:

  • 1.0.0



34
35
36
# File 'lib/conversant/v3/services/cdn/audit.rb', line 34

def initialize(parent)
  @parent = parent
end

Instance Attribute Details

#parentCDN (readonly)

Returns the parent CDN service instance.

Since:

  • 1.0.0



29
30
31
# File 'lib/conversant/v3/services/cdn/audit.rb', line 29

def parent
  @parent
end

Instance Method Details

#list(payload) ⇒ Array

Get audit log entries

Examples:

Get recent audit logs

logs = cdn.audit.list({
  startTime: "2025-01-01T00:00:00Z",
  endTime: "2025-01-01T23:59:59Z",
  pageSize: 100,
  pageNumber: 0
})
logs.each { |log| puts "#{log['timestamp']}: #{log['action']} by #{log['user']}" }

Options Hash (payload):

  • :startTime (String)

    start time for audit logs

  • :endTime (String)

    end time for audit logs

  • :action (String)

    specific action to filter by

  • :user (String)

    user ID to filter by

  • :pageSize (Integer)

    number of results per page

  • :pageNumber (Integer)

    page number (0-based)

Since:

  • 1.0.0



60
61
62
63
64
65
66
# File 'lib/conversant/v3/services/cdn/audit.rb', line 60

def list(payload)
  response = JSON.parse(@parent.send(:call, 'POST', '/api/audit_list', payload))
  response&.[]('list') || []
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  []
end