Class: Katello::Api::V2::CapsuleContentController

Inherits:
ApiController
  • Object
show all
Defined in:
app/controllers/katello/api/v2/capsule_content_controller.rb

Instance Method Summary collapse

Methods inherited from ApiController

#full_result_response, #resource_class, #scoped_search

Methods included from Rendering

#respond_for_async, #respond_for_bulk_async, #respond_for_create, #respond_for_destroy, #respond_for_index, #respond_for_show, #respond_for_status, #respond_for_update, #respond_with_template, #respond_with_template_collection, #respond_with_template_resource, #try_specific_collection_template, #try_specific_resource_template

Methods included from Katello::Api::Version2

#api_version

Instance Method Details

#add_lifecycle_environmentObject



37
38
39
40
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 37

def add_lifecycle_environment
  capsule_content.add_lifecycle_environment(@environment)
  respond_for_lifecycle_environments_index(capsule_content.lifecycle_environments)
end

#available_lifecycle_environmentsObject



30
31
32
33
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 30

def available_lifecycle_environments
  environments = capsule_content.available_lifecycle_environments(params[:organization_id]).readable
  respond_for_lifecycle_environments_index(environments)
end

#cancel_syncObject



68
69
70
71
72
73
74
75
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 68

def cancel_sync
  tasks = capsule_content.cancel_sync
  if tasks.empty?
    render_message _('There\'s no running synchronization for this capsule.')
  else
    render_message _('Trying to cancel the synchronization...')
  end
end

#lifecycle_environmentsObject



23
24
25
26
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 23

def lifecycle_environments
  environments = capsule_content.lifecycle_environments(params[:organization_id]).readable
  respond_for_lifecycle_environments_index(environments)
end

#remove_lifecycle_environmentObject



44
45
46
47
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 44

def remove_lifecycle_environment
  capsule_content.remove_lifecycle_environment(@environment)
  respond_for_lifecycle_environments_index(capsule_content.lifecycle_environments)
end

#syncObject



52
53
54
55
56
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 52

def sync
  find_environment if params[:environment_id]
  task = async_task(::Actions::Katello::CapsuleContent::Sync, capsule_content, :environment => @environment)
  respond_for_async :resource => task
end

#sync_statusObject



61
62
63
64
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 61

def sync_status
  @capsule_content = capsule_content
  @lifecycle_environments = @capsule_content.lifecycle_environments(@organization)
end