Class: Katello::Api::V2::OrganizationsController

Inherits:
Api::V2::OrganizationsController
  • Object
show all
Includes:
ForemanTasks::Triggers, Rendering
Defined in:
app/controllers/katello/api/v2/organizations_controller.rb

Instance Method Summary collapse

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

Instance Method Details

#autoattach_subscriptionsObject



120
121
122
123
# File 'app/controllers/katello/api/v2/organizations_controller.rb', line 120

def autoattach_subscriptions
  task = async_task(::Actions::Katello::Organization::AutoAttachSubscriptions, @organization)
  respond_for_async :resource => task
end

#cancel_repo_discoverObject



104
105
106
107
# File 'app/controllers/katello/api/v2/organizations_controller.rb', line 104

def cancel_repo_discover
  task = @organization.cancel_repo_discovery
  respond_for_async :resource => task
end

#createObject



76
77
78
79
80
81
82
83
# File 'app/controllers/katello/api/v2/organizations_controller.rb', line 76

def create
  @organization = Organization.new(params[:organization])
  sync_task(::Actions::Katello::Organization::Create, @organization)
  @organization.reload
  respond_for_show :resource => @organization
rescue
  process_resource_error
end

#destroyObject



87
88
89
90
# File 'app/controllers/katello/api/v2/organizations_controller.rb', line 87

def destroy
  task = async_task(::Actions::Katello::Organization::Destroy, @organization, nil)
  respond_for_async :resource => task
end

#download_debug_certificateObject



111
112
113
114
115
116
117
# File 'app/controllers/katello/api/v2/organizations_controller.rb', line 111

def download_debug_certificate
  pem = @organization.debug_cert
  data = "#{ pem[:key] }\n\n#{ pem[:cert] }"
  send_data data,
            :filename => "#{ @organization.name }-key-cert.pem",
            :type => "application/text"
end

#indexObject



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

def index
  @render_template = 'katello/api/v2/organizations/index'
  super
end

#local_find_taxonomyObject



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

def local_find_taxonomy
  find_taxonomy
end

#redhat_providerObject



126
127
128
129
# File 'app/controllers/katello/api/v2/organizations_controller.rb', line 126

def redhat_provider
  respond_for_show(:resource => @organization.redhat_provider,
                   :resource_name => "providers")
end

#repo_discoverObject



95
96
97
98
99
# File 'app/controllers/katello/api/v2/organizations_controller.rb', line 95

def repo_discover
  fail _("url not defined.") if params[:url].blank?
  task = async_task(::Actions::Katello::Repository::Discover, params[:url])
  respond_for_async :resource => task
end

#showObject



51
52
53
54
# File 'app/controllers/katello/api/v2/organizations_controller.rb', line 51

def show
  @render_template = 'katello/api/v2/organizations/show'
  super
end

#updateObject



64
65
66
67
68
69
# File 'app/controllers/katello/api/v2/organizations_controller.rb', line 64

def update
  if params.key?(:redhat_repository_url)
    sync_task(::Actions::Katello::Provider::Update, @organization.redhat_provider, params)
  end
  super
end