Method: Wavefront::Validators#wf_tag?

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

#wf_tag?(*tags) ⇒ Boolean

Ensure one, or an array, of tags are valid. These tags are used as source tags, or tags for maintenance windows etc. They can contain letters, numbers, -, _ and :, and must be less than 256 characters long

Parameters:

Returns:

  • (Boolean)

    True if all tags are valid

Raises:

  • Wavefront::Exception::InvalidTag



140
141
142
143
144
145
146
147
148
# File 'lib/wavefront-sdk/validators.rb', line 140

def wf_tag?(*tags)
  Array(*tags).each do |tag|
    unless tag.is_a?(String) && tag.size < 255 && tag =~ /^[\w:\-.]+$/
      raise Wavefront::Exception::InvalidTag, tag
    end
  end

  true
end