Class: TogaiClient::EventManagementApi

Inherits:
Object
  • Object
show all
Defined in:
lib/togai_client/api/event_management_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ EventManagementApi

Returns a new instance of EventManagementApi.



19
20
21
# File 'lib/togai_client/api/event_management_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/togai_client/api/event_management_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#event_correction(action, opts = {}) ⇒ EventsCorrectionResponse

Correct an ingested event #### This API lets you to correct events. Available in both synchronous and asynchronous mode - Usages: Reduction of all usages associated with this event - Revenue: Reduction of all revenues associated with this event - Entitlements: Entitlements(Feature Credits) consumed by this event are granted back to the account. ### Possible Actions: - UNDO: Undo all usages, revenue and entitlements associated with an event - REDO: Performs UNDO and re-ingests the same event - REDO_EVENT: Performs UNDO and re-ingests the correction payload of the event

Parameters:

  • action (String)

    Action to perform in event correction

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

    the optional parameters

Options Hash (opts):

  • :require_confirmation (Boolean)

    Specifies whether to start a migration only after a confirmation

  • :event_correction_request (EventCorrectionRequest)

Returns:



29
30
31
32
# File 'lib/togai_client/api/event_management_api.rb', line 29

def event_correction(action, opts = {})
  data, _status_code, _headers = event_correction_with_http_info(action, opts)
  data
end

#event_correction_with_http_info(action, opts = {}) ⇒ Array<(EventsCorrectionResponse, Integer, Hash)>

Correct an ingested event #### This API lets you to correct events. Available in both synchronous and asynchronous mode - Usages: Reduction of all usages associated with this event - Revenue: Reduction of all revenues associated with this event - Entitlements: Entitlements(Feature Credits) consumed by this event are granted back to the account. ### Possible Actions: - UNDO: Undo all usages, revenue and entitlements associated with an event - REDO: Performs UNDO and re-ingests the same event - REDO_EVENT: Performs UNDO and re-ingests the correction payload of the event

Parameters:

  • action (String)

    Action to perform in event correction

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

    the optional parameters

Options Hash (opts):

  • :require_confirmation (Boolean)

    Specifies whether to start a migration only after a confirmation

  • :event_correction_request (EventCorrectionRequest)

Returns:

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

    EventsCorrectionResponse data, response status code and response headers



41
42
43
44
45
46
47
48
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
# File 'lib/togai_client/api/event_management_api.rb', line 41

def event_correction_with_http_info(action, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventManagementApi.event_correction ...'
  end
  # verify the required parameter 'action' is set
  if @api_client.config.client_side_validation && action.nil?
    fail ArgumentError, "Missing the required parameter 'action' when calling EventManagementApi.event_correction"
  end
  # verify enum value
  allowable_values = ["UNDO", "REDO", "REDO_EVENT"]
  if @api_client.config.client_side_validation && !allowable_values.include?(action)
    fail ArgumentError, "invalid value for \"action\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/events/correction'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'action'] = action
  query_params[:'require_confirmation'] = opts[:'require_confirmation'] if !opts[:'require_confirmation'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'event_correction_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'EventsCorrectionResponse'

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

  new_options = opts.merge(
    :operation => :"EventManagementApi.event_correction",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EventManagementApi#event_correction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_events(opts = {}) ⇒ GetEventsResponse

Get a list of usage events with multiple query options This API let’s you to fetch a list of events with multiple query parameters

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :next_token (String)

    Pagination token used as a marker to get records from next page.

  • :status (String)

    Filter option to filter by status.

  • :account_id (String)

    Filter option to filter based on account id.

  • :schema_name (String)

    Filter option to filter the events based on schema name.

  • :page_size (Integer)

    Maximum page size expected by client to return the record list. NOTE: Max page size cannot be more than 50. Also 50 is the default page size if no value is provided.

Returns:



110
111
112
113
# File 'lib/togai_client/api/event_management_api.rb', line 110

def get_events(opts = {})
  data, _status_code, _headers = get_events_with_http_info(opts)
  data
end

#get_events_with_http_info(opts = {}) ⇒ Array<(GetEventsResponse, Integer, Hash)>

Get a list of usage events with multiple query options This API let’s you to fetch a list of events with multiple query parameters

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :next_token (String)

    Pagination token used as a marker to get records from next page.

  • :status (String)

    Filter option to filter by status.

  • :account_id (String)

    Filter option to filter based on account id.

  • :schema_name (String)

    Filter option to filter the events based on schema name.

  • :page_size (Integer)

    Maximum page size expected by client to return the record list. NOTE: Max page size cannot be more than 50. Also 50 is the default page size if no value is provided.

Returns:

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

    GetEventsResponse data, response status code and response headers



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/togai_client/api/event_management_api.rb', line 124

def get_events_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventManagementApi.get_events ...'
  end
  # resource path
  local_var_path = '/events'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'nextToken'] = opts[:'next_token'] if !opts[:'next_token'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'account_id'] = opts[:'account_id'] if !opts[:'account_id'].nil?
  query_params[:'schema_name'] = opts[:'schema_name'] if !opts[:'schema_name'].nil?
  query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetEventsResponse'

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

  new_options = opts.merge(
    :operation => :"EventManagementApi.get_events",
    :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: EventManagementApi#get_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_single_event(event_id, opts = {}) ⇒ GetEventResponse

Get an event using event id Fetch details of a particular event using the event ID.

Parameters:

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

    the optional parameters

Returns:



178
179
180
181
# File 'lib/togai_client/api/event_management_api.rb', line 178

def get_single_event(event_id, opts = {})
  data, _status_code, _headers = get_single_event_with_http_info(event_id, opts)
  data
end

#get_single_event_with_http_info(event_id, opts = {}) ⇒ Array<(GetEventResponse, Integer, Hash)>

Get an event using event id Fetch details of a particular event using the event ID.

Parameters:

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

    the optional parameters

Returns:

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

    GetEventResponse data, response status code and response headers



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/togai_client/api/event_management_api.rb', line 188

def get_single_event_with_http_info(event_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventManagementApi.get_single_event ...'
  end
  # verify the required parameter 'event_id' is set
  if @api_client.config.client_side_validation && event_id.nil?
    fail ArgumentError, "Missing the required parameter 'event_id' when calling EventManagementApi.get_single_event"
  end
  if @api_client.config.client_side_validation && event_id.to_s.length > 50
    fail ArgumentError, 'invalid value for "event_id" when calling EventManagementApi.get_single_event, the character length must be smaller than or equal to 50.'
  end

  # resource path
  local_var_path = '/events/{event_id}'.sub('{' + 'event_id' + '}', CGI.escape(event_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetEventResponse'

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

  new_options = opts.merge(
    :operation => :"EventManagementApi.get_single_event",
    :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: EventManagementApi#get_single_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end