Method: Wavefront::Validators#wf_alert_id?

Defined in:
lib/wavefront-sdk/validators.rb

#wf_alert_id?(id) ⇒ Boolean

Ensure the given argument is a valid Wavefront alert ID. Alerts are identified by the epoch-nanosecond at which they were created.

Parameters:

  • id (String)

    the alert ID to validate

Returns:

  • (Boolean)

    True if the alert ID is valid

Raises:

  • Wavefront::Exception::InvalidAlertId if the alert ID is not valid



227
228
229
230
231
232
# File 'lib/wavefront-sdk/validators.rb', line 227

def wf_alert_id?(id)
  id = id.to_s if id.is_a?(Numeric)
  return true if id.is_a?(String) && id.match(/^\d{13}$/)

  raise Wavefront::Exception::InvalidAlertId, id
end