Class: DatadogAPIClient::V1::EventsAPI
- Inherits:
-
Object
- Object
- DatadogAPIClient::V1::EventsAPI
- Defined in:
- lib/datadog_api_client/v1/api/events_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_event(body, opts = {}) ⇒ EventCreateResponse
Post an event This endpoint allows you to post events to the stream.
-
#create_event_with_http_info(body, opts = {}) ⇒ Array<(EventCreateResponse, Integer, Hash)>
Post an event This endpoint allows you to post events to the stream.
-
#get_event(event_id, opts = {}) ⇒ EventResponse
Get an event This endpoint allows you to query for event details.
-
#get_event_with_http_info(event_id, opts = {}) ⇒ Array<(EventResponse, Integer, Hash)>
Get an event This endpoint allows you to query for event details.
-
#initialize(api_client = APIClient.default) ⇒ EventsAPI
constructor
A new instance of EventsAPI.
-
#list_events(start, _end, opts = {}) ⇒ EventListResponse
Query the event stream The event stream can be queried and filtered by time, priority, sources and tags.
-
#list_events_with_http_info(start, _end, opts = {}) ⇒ Array<(EventListResponse, Integer, Hash)>
Query the event stream The event stream can be queried and filtered by time, priority, sources and tags.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
20 21 22 |
# File 'lib/datadog_api_client/v1/api/events_api.rb', line 20 def api_client @api_client end |
Instance Method Details
#create_event(body, opts = {}) ⇒ EventCreateResponse
Post an event This endpoint allows you to post events to the stream. Tag them, set priority and event aggregate them with other events.
30 31 32 33 |
# File 'lib/datadog_api_client/v1/api/events_api.rb', line 30 def create_event(body, opts = {}) data, _status_code, _headers = create_event_with_http_info(body, opts) data end |
#create_event_with_http_info(body, opts = {}) ⇒ Array<(EventCreateResponse, Integer, Hash)>
Post an event This endpoint allows you to post events to the stream. Tag them, set priority and event aggregate them with other events.
40 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 |
# File 'lib/datadog_api_client/v1/api/events_api.rb', line 40 def create_event_with_http_info(body, opts = {}) if @api_client.config.unstable_operations.has_key?(:create_event) unstable_enabled = @api_client.config.unstable_operations[:create_event] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "create_event") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "create_event")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EventsAPI.create_event ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling EventsAPI.create_event" end # resource path local_var_path = '/api/v1/events' # 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']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'EventCreateResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth] = opts.merge( :operation => :create_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(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsAPI#create_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_event(event_id, opts = {}) ⇒ EventResponse
Get an event This endpoint allows you to query for event details. Note: If the event you’re querying contains markdown formatting of any kind, you may see characters such as ‘%`,`\`,`n` in your output.
105 106 107 108 |
# File 'lib/datadog_api_client/v1/api/events_api.rb', line 105 def get_event(event_id, opts = {}) data, _status_code, _headers = get_event_with_http_info(event_id, opts) data end |
#get_event_with_http_info(event_id, opts = {}) ⇒ Array<(EventResponse, Integer, Hash)>
Get an event This endpoint allows you to query for event details. Note: If the event you’re querying contains markdown formatting of any kind, you may see characters such as `%`,`\`,`n` in your output.
115 116 117 118 119 120 121 122 123 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/datadog_api_client/v1/api/events_api.rb', line 115 def get_event_with_http_info(event_id, opts = {}) if @api_client.config.unstable_operations.has_key?(:get_event) unstable_enabled = @api_client.config.unstable_operations[:get_event] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "get_event") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "get_event")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EventsAPI.get_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 EventsAPI.get_event" end # resource path local_var_path = '/api/v1/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']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'EventResponse' # auth_names auth_names = opts[:debug_auth_names] || [:AuthZ, :apiKeyAuth, :appKeyAuth] = opts.merge( :operation => :get_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsAPI#get_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_events(start, _end, opts = {}) ⇒ EventListResponse
Query the event stream The event stream can be queried and filtered by time, priority, sources and tags. Notes: - If the event you’re querying contains markdown formatting of any kind, you may see characters such as ‘%`,`\`,`n` in your output. - This endpoint returns a maximum of `1000` most recent results. To return additional results, identify the last timestamp of the last result and set that as the `end` query time to paginate the results. You can also use the page parameter to specify which set of `1000` results to return.
185 186 187 188 |
# File 'lib/datadog_api_client/v1/api/events_api.rb', line 185 def list_events(start, _end, opts = {}) data, _status_code, _headers = list_events_with_http_info(start, _end, opts) data end |
#list_events_with_http_info(start, _end, opts = {}) ⇒ Array<(EventListResponse, Integer, Hash)>
Query the event stream The event stream can be queried and filtered by time, priority, sources and tags. Notes: - If the event you’re querying contains markdown formatting of any kind, you may see characters such as `%`,`\`,`n` in your output. - This endpoint returns a maximum of `1000` most recent results. To return additional results, identify the last timestamp of the last result and set that as the `end` query time to paginate the results. You can also use the page parameter to specify which set of `1000` results to return.
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 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/datadog_api_client/v1/api/events_api.rb', line 202 def list_events_with_http_info(start, _end, opts = {}) if @api_client.config.unstable_operations.has_key?(:list_events) unstable_enabled = @api_client.config.unstable_operations[:list_events] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "list_events") else raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_events")) end end if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EventsAPI.list_events ...' end # verify the required parameter 'start' is set if @api_client.config.client_side_validation && start.nil? fail ArgumentError, "Missing the required parameter 'start' when calling EventsAPI.list_events" end # verify the required parameter '_end' is set if @api_client.config.client_side_validation && _end.nil? fail ArgumentError, "Missing the required parameter '_end' when calling EventsAPI.list_events" end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 2147483647 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling EventsAPI.list_events, must be smaller than or equal to 2147483647.' end # resource path local_var_path = '/api/v1/events' # query parameters query_params = opts[:query_params] || {} query_params[:'start'] = start query_params[:'end'] = _end query_params[:'priority'] = opts[:'priority'] if !opts[:'priority'].nil? query_params[:'sources'] = opts[:'sources'] if !opts[:'sources'].nil? query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil? query_params[:'unaggregated'] = opts[:'unaggregated'] if !opts[:'unaggregated'].nil? query_params[:'exclude_aggregate'] = opts[:'exclude_aggregate'] if !opts[:'exclude_aggregate'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].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] || 'EventListResponse' # auth_names auth_names = opts[:debug_auth_names] || [:AuthZ, :apiKeyAuth, :appKeyAuth] = opts.merge( :operation => :list_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: EventsAPI#list_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |