Class: ZabbixManager::ValueMaps
- Defined in:
- lib/zabbix_manager/classes/valuemaps.rb
Instance Method Summary collapse
-
#create_or_update(data) ⇒ Integer
Create or update Item object using Zabbix API.
-
#get_or_create(data) ⇒ Integer
Get or Create ValueMap object using Zabbix API.
-
#identify ⇒ String
The id field name used for identifying specific ValueMap objects via Zabbix API.
-
#key ⇒ String
The key field name used for ValueMap objects via Zabbix API.
-
#method_name ⇒ String
The method name used for interacting with ValueMaps via Zabbix API.
Methods inherited from Basic
#add, #all, #create, #create_raw, #default_options, #delete, #delete_raw, #destroy, #dump_by_id, #get, #get_full_data, #get_hostgroup_ids, #get_id, #get_or_create_hostgroups, #get_raw, #hash_equals?, #initialize, #keys, #log, #merge_params, #mojo_update, #normalize_array, #normalize_hash, #parse_keys, #symbolize_keys, #update, #update_raw
Constructor Details
This class inherits a constructor from ZabbixManager::Basic
Instance Method Details
#create_or_update(data) ⇒ Integer
Create or update Item object using Zabbix API
47 48 49 50 |
# File 'lib/zabbix_manager/classes/valuemaps.rb', line 47 def create_or_update(data) valuemapid = get_id(name: data[:name]) valuemapid ? update(data.merge(valuemapids: [:valuemapid])) : create(data) end |
#get_or_create(data) ⇒ Integer
Get or Create ValueMap object using Zabbix API
32 33 34 35 36 37 38 39 |
# File 'lib/zabbix_manager/classes/valuemaps.rb', line 32 def get_or_create(data) log "[DEBUG] Call get_or_create with parameters: #{data.inspect}" unless (id = get_id(valuemapids: data[:valuemapids])) id = create(data) end id end |
#identify ⇒ String
The id field name used for identifying specific ValueMap objects via Zabbix API
22 23 24 |
# File 'lib/zabbix_manager/classes/valuemaps.rb', line 22 def identify "name" end |
#key ⇒ String
The key field name used for ValueMap objects via Zabbix API
15 16 17 |
# File 'lib/zabbix_manager/classes/valuemaps.rb', line 15 def key "valuemapid" end |
#method_name ⇒ String
The method name used for interacting with ValueMaps via Zabbix API
8 9 10 |
# File 'lib/zabbix_manager/classes/valuemaps.rb', line 8 def method_name "valuemap" end |