class Runcible::Resources::Consumer
@see docs.pulpproject.org/dev-guide/integration/rest-api/consumer/index.html
Public Class Methods
Generates the API path for Consumers
@param [String] id the ID of the consumer @return [String] the consumer path, may contain the id if passed
# File lib/runcible/resources/consumer.rb, line 9 def self.path(id = nil) id.nil? ? 'consumers/' : "consumers/#{id}/" end
Public Instance Methods
retrieve the applicability for some set of consumers
@param [Hash] options hash representing criteria @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 170 def applicability(options = {}) call(:post, path + 'content/applicability/', :payload => { :required => options }) end
Bind a consumer to a repository for a given distributor
@param [String] id the ID of the consumer @param [String] repo_id the ID of the repository @param [String] distributor_id the ID of the distributor @param [Hash] optional optional parameters @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 100 def bind(id, repo_id, distributor_id, optional = {}) required = required_params(binding.send(:local_variables), binding, ['id']) call(:post, path("#{id}/bindings/"), :payload => { :required => required, :optional => optional }) end
Creates a consumer
@param [String] id the ID of the consumer @param [Hash] optional container for all optional parameters @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 18 def create(id, optional = {}) required = required_params(binding.send(:local_variables), binding) call(:post, path, :payload => { :required => required, :optional => optional }) end
Deletes a consumer
@param [String] id the id of the consumer @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 51 def delete(id) call(:delete, path(id)) end
Install a set of units onto a consumer
@param [String] id the ID of the consumer @param [Array] units array of units to install @param [Hash] options hash of install options @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 121 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
(Re)Generate applicability for some set of consumers
@param [Hash] options payload representing criteria @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 152 def regenerate_applicability(options = {}) call(:post, path('actions/content/regenerate_applicability/'), :payload => { :required => options}) end
(Re)Generate applicability for a single consumer. This does not cause a pulp lock, see pulp.plan.io/issues/1173#note-12
@param [String] id the ID of the consumer @param [Hash] options payload representing criteria @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 162 def regenerate_applicability_by_id(id, options = {}) call(:post, path(id) + 'actions/content/regenerate_applicability/', :payload => { :required => options}) end
Retrieves a consumer
@param [String] id the ID of the consumer @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 27 def retrieve(id = nil) call(:get, path(id)) end
Retrieves all consumers
@return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 34 def retrieve_all retrieve end
Retrieve a consumer binding
@param [String] id the ID of the consumer @param [String] repo_id the ID of the repository @param [String] distributor_id the ID of the distributor @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 81 def retrieve_binding(id, repo_id, distributor_id) call(:get, path("#{id}/bindings/#{repo_id}/#{distributor_id}")) end
Retrieve all consumer bindings
@param [String] id the ID of the consumer @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 89 def retrieve_bindings(id) call(:get, path("#{id}/bindings/")) end
Retrieve a consumer profile
@param [String] id the ID of the consumer @param [String] content_type the content type @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 71 def retrieve_profile(id, content_type) call(:get, path("#{id}/profiles/#{content_type}/")) end
Unbind a consumer to a repository for a given distributor
@param [String] id the ID of the consumer @param [String] repo_id the ID of the repository @param [String] distributor_id the ID of the distributor @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 111 def unbind(id, repo_id, distributor_id) call(:delete, path("#{id}/bindings/#{repo_id}/#{distributor_id}")) end
Uninstall a set of units from a consumer
@param [String] id the ID of the consumer @param [Array] units array of units to uninstall @param [Hash] options hash of uninstall options @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 143 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
Updates a consumer
@param [String] id the ID of the consumer @param [Hash] optional container for all optional parameters @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 43 def update(id, optional = {}) call(:put, path(id), :payload => { :delta => optional }) end
Update a set of units on a consumer
@param [String] id the ID of the consumer @param [Array] units array of units to update @param [Hash] options hash of update options @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 132 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
Create consumer profile
@param [String] id the ID of the consumer @param [String] content_type the content type @param [Hash] profile hash representing the consumer profile @return [RestClient::Response]
# File lib/runcible/resources/consumer.rb, line 61 def upload_profile(id, content_type, profile) required = required_params(binding.send(:local_variables), binding, ['id']) call(:post, path("#{id}/profiles/"), :payload => { :required => required }) end