Sha256: f5104967a7a2e3d593f971e9ba1c6c39fe158d77c16cf87b12fc435ae9630f92

Contents?: true

Size: 1.38 KB

Versions: 80

Compression:

Stored size: 1.38 KB

Contents

module Katello
  module Resources
    module Candlepin
      class Pool < CandlepinResource
        extend PoolResource

        class << self
          def get_for_owner(owner_key, include_temporary_guests = false)
            url = "#{prefix}/owners/#{owner_key}/pools?add_future=true"
            url += "&attribute=unmapped_guests_only:!true" if include_temporary_guests
            pools_json = self.get(url, self.default_headers).body
            JSON.parse(pools_json)
          end

          def create(owner_key, attrs)
            pool = self.post("/candlepin/owners/#{owner_key}/pools", attrs.to_json, self.default_headers).body
            pool
          end

          def find(pool_id)
            begin
              pool_json = self.get(path(pool_id), self.default_headers).body
            rescue RestClient::ResourceNotFound
              raise Katello::Errors::CandlepinPoolGone
            end

            JSON.parse(pool_json).with_indifferent_access
          end

          def destroy(id)
            fail ArgumentError, "pool id has to be specified" unless id
            self.delete(path(id), self.default_headers).code.to_i
          end

          def consumer_uuids(pool_id)
            entitlement_json = self.get("#{path(pool_id)}/entitlements/consumer_uuids", self.default_headers).body
            JSON.parse(entitlement_json)
          end
        end
      end
    end
  end
end

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
katello-4.4.2.1 app/lib/katello/resources/candlepin/pool.rb
katello-4.4.2 app/lib/katello/resources/candlepin/pool.rb
katello-4.5.1 app/lib/katello/resources/candlepin/pool.rb
katello-4.6.0 app/lib/katello/resources/candlepin/pool.rb
katello-4.6.0.rc2 app/lib/katello/resources/candlepin/pool.rb
katello-4.6.0.rc1 app/lib/katello/resources/candlepin/pool.rb
katello-4.5.0 app/lib/katello/resources/candlepin/pool.rb
katello-4.5.0.rc2 app/lib/katello/resources/candlepin/pool.rb
katello-4.4.1 app/lib/katello/resources/candlepin/pool.rb
katello-4.5.0.rc1 app/lib/katello/resources/candlepin/pool.rb
katello-4.4.0.2 app/lib/katello/resources/candlepin/pool.rb
katello-4.4.0.1 app/lib/katello/resources/candlepin/pool.rb
katello-4.3.1 app/lib/katello/resources/candlepin/pool.rb
katello-4.4.0 app/lib/katello/resources/candlepin/pool.rb
katello-4.4.0.rc2 app/lib/katello/resources/candlepin/pool.rb
katello-4.4.0.rc1 app/lib/katello/resources/candlepin/pool.rb
katello-4.2.2 app/lib/katello/resources/candlepin/pool.rb
katello-4.3.0 app/lib/katello/resources/candlepin/pool.rb
katello-4.3.0.rc4 app/lib/katello/resources/candlepin/pool.rb
katello-4.3.0.rc3 app/lib/katello/resources/candlepin/pool.rb