Method: ATSD::EntityGroupsService#replace_entities

Defined in:
lib/atsd/services/entity_groups_service.rb

#replace_entities(entity_group, entities) ⇒ self

Note:

All existing entities that are not included in the collection will be removed. If the specified collection is empty, all entities are removed from the group (replace with empty collection).

Replace entities in the entity group with the specified collection.

Parameters:

Returns:

  • (self)

Raises:



132
133
134
135
136
137
138
139
140
141
# File 'lib/atsd/services/entity_groups_service.rb', line 132

def replace_entities(entity_group, entities)
  entity_group = name_for_entity_group(entity_group)
  entities = Utils.ensure_array(entities).map do |e|
    e = Entity.new(name: e) if e.is_a? String
    e = Entity.new(e) if e.is_a? Hash
    e = e.to_request_hash
  end
  @client.entity_groups_replace_entities(entity_group, entities)
  self
end