Class: ForemanResourceQuota::Api::V2::ResourceQuotasController

Inherits:
Api::V2::BaseController
  • Object
show all
Includes:
Api::Version2, Foreman::Controller::Parameters::ResourceQuota
Defined in:
app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb

Instance Method Summary collapse

Methods included from Foreman::Controller::Parameters::ResourceQuota

#resource_quota_params

Instance Method Details

#createObject



72
73
74
75
# File 'app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb', line 72

def create
  @resource_quota = ForemanResourceQuota::ResourceQuota.new(resource_quota_params)
  process_response @resource_quota.save
end

#destroyObject



86
87
88
# File 'app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb', line 86

def destroy
  process_response @resource_quota.destroy
end

#hostsObject



48
49
50
# File 'app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb', line 48

def hosts
  process_response @resource_quota.hosts
end

#indexObject



22
23
24
# File 'app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb', line 22

def index
  @resource_quotas = resource_scope_for_index
end

#missing_hostsObject



41
42
43
44
# File 'app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb', line 41

def missing_hosts
  @resource_quota.determine_utilization
  process_response @resource_quota
end

#resource_classObject



90
91
92
# File 'app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb', line 90

def resource_class
  ForemanResourceQuota::ResourceQuota
end

#showObject



28
29
# File 'app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb', line 28

def show
end

#updateObject



80
81
82
# File 'app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb', line 80

def update
  process_response @resource_quota.update(resource_quota_params)
end

#usergroupsObject



60
61
62
# File 'app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb', line 60

def usergroups
  process_response @resource_quota.usergroups
end

#usersObject



54
55
56
# File 'app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb', line 54

def users
  process_response @resource_quota.users
end

#utilizationObject



33
34
35
36
# File 'app/controllers/foreman_resource_quota/api/v2/resource_quotas_controller.rb', line 33

def utilization
  @resource_quota.determine_utilization
  process_response @resource_quota
end