class Runcible::Resources::ConsumerGroup

@see docs.pulpproject.org/dev-guide/integration/rest-api/consumer/group/index.html

Public Instance Methods

associate(id, criteria) click to toggle source

Associates Consumers with a Consumer Group

@param [String] id the ID of the consumer group @param [Hash] criteria criteria based on Mongo syntax representing consumers to associate @return [RestClient::Response]

# File lib/runcible/resources/consumer_group.rb, line 47
def associate(id, criteria)
  call(:post, path(id) + 'actions/associate/', :payload => {:required => criteria})
end
create(id, optional = {}) click to toggle source

Creates a Consumer Group

@param [String] id the ID of the consumer @param [Hash] optional container for all optional parameters @return [RestClient::Response]

# File lib/runcible/resources/consumer_group.rb, line 21
def create(id, optional = {})
  required = required_params(binding.send(:local_variables), binding)
  call(:post, path, :payload => { :required => required, :optional => optional })
end
delete(id) click to toggle source

Deletes a Consumer Group

@param [String] id the ID of the consumer group @return [RestClient::Response]

# File lib/runcible/resources/consumer_group.rb, line 38
def delete(id)
  call(:delete, path(id))
end
install_units(id, units, options = {}) click to toggle source

Install a set of units to a Consumer Group

@param [String] id the ID of the consumer group @param [Array] units array of units to install @param [Hash] options hash of install options @return [RestClient::Response]

# File lib/runcible/resources/consumer_group.rb, line 66
def install_units(id, units, options = {})
  required = required_params(binding.send(:local_variables), binding, ['id'])
  call(:post, path("#{id}/actions/content/install"), :payload => { :required => required })
end
path(id = nil) click to toggle source

Generates the API path for Consumer Groups

@param [String] id the ID of the consumer group @return [String] the consumer group path, may contain the id if passed

# File lib/runcible/resources/consumer_group.rb, line 11
def path(id = nil)
  groups = 'consumer_groups/'
  id.nil? ? groups : groups + "#{id}/"
end
retrieve(id) click to toggle source

Retrieves a Consumer Group

@param [String] id the ID of the consumer group @return [RestClient::Response]

# File lib/runcible/resources/consumer_group.rb, line 30
def retrieve(id)
  call(:get, path(id))
end
unassociate(id, criteria) click to toggle source

Unassociates Consumers with a Consumer Group

@param [String] id the ID of the consumer group @param [Hash] criteria criteria based on Mongo syntax representing consumers ta unassociate @return [RestClient::Response]

# File lib/runcible/resources/consumer_group.rb, line 56
def unassociate(id, criteria)
  call(:post, path(id) + 'actions/unassociate/', :payload => {:required => criteria})
end
uninstall_units(id, units, options = {}) click to toggle source

Uninstall a set of units from a Consumer Group

@param [String] id the ID of the consumer group @param [Array] units array of units to uninstall @param [Hash] options hash of uninstall options @return [RestClient::Response]

# File lib/runcible/resources/consumer_group.rb, line 88
def uninstall_units(id, units, options = {})
  required = required_params(binding.send(:local_variables), binding, ['id'])
  call(:post, path("#{id}/actions/content/uninstall"), :payload => { :required => required })
end
update_units(id, units, options = {}) click to toggle source

Update a set of units on a Consumer Group

@param [String] id the ID of the consumer group @param [Array] units array of units to update @param [Hash] options hash of update options @return [RestClient::Response]

# File lib/runcible/resources/consumer_group.rb, line 77
def update_units(id, units, options = {})
  required = required_params(binding.send(:local_variables), binding, ['id'])
  call(:post, path("#{id}/actions/content/update"), :payload => { :required => required })
end