Class: AuditApi::EventsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pnap_audit_api/api/events_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ EventsApi

Returns a new instance of EventsApi.



19
20
21
# File 'lib/pnap_audit_api/api/events_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/pnap_audit_api/api/events_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#events_get(opts = {}) ⇒ Array<Event>

List event logs. Retrieves the event logs for given time period. All date & times are in UTC.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :from (Time)

    From the date and time (inclusive) to filter event log records by.

  • :to (Time)

    To the date and time (inclusive) to filter event log records by.

  • :limit (Integer)

    Limit the number of records returned.

  • :order (String)

    Ordering of the event&#39;s time. SortBy can be introduced later on. (default to ‘ASC’)

  • :username (String)

    The username that did the actions.

  • :verb (String)

    The HTTP verb corresponding to the action.

  • :uri (String)

    The request uri.

Returns:



33
34
35
36
# File 'lib/pnap_audit_api/api/events_api.rb', line 33

def events_get(opts = {})
  data, _status_code, _headers = events_get_with_http_info(opts)
  data
end

#events_get_with_http_info(opts = {}) ⇒ Array<(Array<Event>, Integer, Hash)>

List event logs. Retrieves the event logs for given time period. All date &amp; times are in UTC.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :from (Time)

    From the date and time (inclusive) to filter event log records by.

  • :to (Time)

    To the date and time (inclusive) to filter event log records by.

  • :limit (Integer)

    Limit the number of records returned.

  • :order (String)

    Ordering of the event&#39;s time. SortBy can be introduced later on. (default to ‘ASC’)

  • :username (String)

    The username that did the actions.

  • :verb (String)

    The HTTP verb corresponding to the action.

  • :uri (String)

    The request uri.

Returns:

  • (Array<(Array<Event>, Integer, Hash)>)

    Array<Event> data, response status code and response headers



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/pnap_audit_api/api/events_api.rb', line 49

def events_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.events_get ...'
  end
  allowable_values = ["ASC", "DESC"]
  if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
    fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
  end
  allowable_values = ["POST", "PUT", "PATCH", "DELETE"]
  if @api_client.config.client_side_validation && opts[:'verb'] && !allowable_values.include?(opts[:'verb'])
    fail ArgumentError, "invalid value for \"verb\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/events'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'username'] = opts[:'username'] if !opts[:'username'].nil?
  query_params[:'verb'] = opts[:'verb'] if !opts[:'verb'].nil?
  query_params[:'uri'] = opts[:'uri'] if !opts[:'uri'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Event>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OAuth2']

  new_options = opts.merge(
    :operation => :"EventsApi.events_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EventsApi#events_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end