Sha256: 7e592870e6c9dc49c1e2ca3876b91cd176008e0ea73204263d2cf5150cb368ea

Contents?: true

Size: 1.62 KB

Versions: 24

Compression:

Stored size: 1.62 KB

Contents

module Katello
  class Api::V2::ContentUploadsController < Api::V2::ApiController
    before_action :find_repository
    skip_before_action :check_content_type, :only => [:update]

    include ::Foreman::Controller::FilterParameters
    filter_parameters :content

    api :POST, "/repositories/:repository_id/content_uploads", N_("Create an upload request")
    param :repository_id, :number, :required => true, :desc => N_("repository id")
    def create
      render :json => pulp_content.create_upload_request
    end

    api :PUT, "/repositories/:repository_id/content_uploads/:id", N_("Upload a chunk of the file's content")
    param :repository_id, :number, :required => true, :desc => N_("Repository id")
    param :id, :number, :required => true, :desc => N_("Upload request id")
    param :offset, :number, :required => true, :desc => N_("The offset in the file where the content starts")
    param :content, File, :required => true, :desc => N_("The actual file contents")
    def update
      pulp_content.upload_bits(params[:id], params[:offset], params[:content])
      head :no_content
    end

    api :DELETE, "/repositories/:repository_id/content_uploads/:id", N_("Delete an upload request")
    param :repository_id, :number, :required => true, :desc => N_("Repository id")
    param :id, :number, :required => true, :desc => N_("Upload request id")
    def destroy
      pulp_content.delete_upload_request(params[:id])
      head :no_content
    end

    private

    def pulp_content
      Katello.pulp_server.resources.content
    end

    def find_repository
      @repository = Repository.find(params[:repository_id])
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
katello-3.6.0 app/controllers/katello/api/v2/content_uploads_controller.rb
katello-3.6.0.1.rc2 app/controllers/katello/api/v2/content_uploads_controller.rb
katello-3.6.0.rc2 app/controllers/katello/api/v2/content_uploads_controller.rb
katello-3.6.0.rc1 app/controllers/katello/api/v2/content_uploads_controller.rb