Revision ebecada6
Added by Tomer Brisker about 5 years ago
app/controllers/api/v2/base_controller.rb | ||
---|---|---|
resource_description do
|
||
api_version "v2"
|
||
app_info N_("Foreman API v2 is currently the default API version.")
|
||
param :location_id, Integer, :required => false, :desc => N_("Scope by locations") if SETTINGS[:locations_enabled]
|
||
param :organization_id, Integer, :required => false, :desc => N_("Scope by organizations") if SETTINGS[:organizations_enabled]
|
||
param :location_id, Integer, :required => false, :desc => N_("Scope by locations")
|
||
param :organization_id, Integer, :required => false, :desc => N_("Scope by organizations")
|
||
end
|
||
|
||
def_param_group :pagination do
|
||
... | ... | |
end
|
||
|
||
def_param_group :taxonomies do
|
||
param :location_ids, Array, :required => false, :desc => N_("REPLACE locations with given ids") if SETTINGS[:locations_enabled]
|
||
param :organization_ids, Array, :required => false, :desc => N_("REPLACE organizations with given ids.") if SETTINGS[:organizations_enabled]
|
||
param :location_ids, Array, :required => false, :desc => N_("REPLACE locations with given ids")
|
||
param :organization_ids, Array, :required => false, :desc => N_("REPLACE organizations with given ids.")
|
||
end
|
||
|
||
def_param_group :taxonomy_scope do
|
||
param :location_id, Integer, :required => false, :desc => N_("Scope by locations") if SETTINGS[:locations_enabled]
|
||
param :organization_id, Integer, :required => false, :desc => N_("Scope by organizations") if SETTINGS[:organizations_enabled]
|
||
param :location_id, Integer, :required => false, :desc => N_("Scope by locations")
|
||
param :organization_id, Integer, :required => false, :desc => N_("Scope by organizations")
|
||
end
|
||
|
||
def_param_group :template_import_options do
|
app/controllers/api/v2/hosts_controller.rb | ||
---|---|---|
def_param_group :host do
|
||
param :host, Hash, :required => true, :action_aware => true do
|
||
param :name, String, :required => true
|
||
param :location_id, :number, :required => true, :desc => N_("required if locations are enabled") if SETTINGS[:locations_enabled]
|
||
param :organization_id, :number, :required => true, :desc => N_("required if organizations are enabled") if SETTINGS[:organizations_enabled]
|
||
param :location_id, :number, :required => true
|
||
param :organization_id, :number, :required => true
|
||
param :environment_id, String, :desc => N_("required if host is managed and value is not inherited from host group")
|
||
param :ip, String, :desc => N_("not required if using a subnet with DHCP proxy")
|
||
param :mac, String, :desc => N_("required for managed host that is bare metal, not required if it's a virtual machine")
|
app/controllers/api/v2/users_controller.rb | ||
---|---|---|
param :description, String, :required => false
|
||
param :admin, :bool, :required => false, :desc => N_("is an admin account")
|
||
param :password, String, :desc => N_("Required unless user is in an external authentication source")
|
||
param :default_location_id, Integer if SETTINGS[:locations_enabled]
|
||
param :default_organization_id, Integer if SETTINGS[:organizations_enabled]
|
||
param :default_location_id, Integer
|
||
param :default_organization_id, Integer
|
||
param :auth_source_id, Integer, :required => true
|
||
param :timezone, ActiveSupport::TimeZone.all.map(&:name), :required => false, :desc => N_("User's timezone")
|
||
param :locale, FastGettext.available_locales, :required => false, :desc => N_("User's preferred locale")
|
app/views/api/v2/hosts/main.json.rabl | ||
---|---|---|
:compute_profile_id, :compute_profile_name, :capabilities, :provision_method,
|
||
:certname, :image_id, :image_name, :created_at, :updated_at,
|
||
:last_compile, :global_status, :global_status_label, :uptime_seconds
|
||
attributes :organization_id, :organization_name if SETTINGS[:organizations_enabled]
|
||
attributes :location_id, :location_name if SETTINGS[:locations_enabled]
|
||
attributes :organization_id, :organization_name
|
||
attributes :location_id, :location_name
|
||
|
||
# for compatibility, :puppet_status was moved to host statuses
|
||
attributes :configuration_status => :puppet_status
|
app/views/api/v2/taxonomies/children_nodes.json.rabl | ||
---|---|---|
if SETTINGS[:locations_enabled]
|
||
child :locations => :locations do
|
||
extends "api/v2/taxonomies/base"
|
||
end
|
||
child :locations => :locations do
|
||
extends "api/v2/taxonomies/base"
|
||
end
|
||
|
||
if SETTINGS[:organizations_enabled]
|
||
child :organizations => :organizations do
|
||
extends "api/v2/taxonomies/base"
|
||
end
|
||
child :organizations => :organizations do
|
||
extends "api/v2/taxonomies/base"
|
||
end
|
app/views/api/v2/users/main.json.rabl | ||
---|---|---|
|
||
node(:effective_admin) { |u| u.admin? }
|
||
|
||
if SETTINGS[:locations_enabled]
|
||
child :default_location => :default_location do
|
||
extends "api/v2/taxonomies/base", :taxonomy => :location
|
||
end
|
||
child :locations => :locations do
|
||
attributes :id, :name
|
||
end
|
||
child :default_location => :default_location do
|
||
extends "api/v2/taxonomies/base", :taxonomy => :location
|
||
end
|
||
child :locations => :locations do
|
||
attributes :id, :name
|
||
end
|
||
|
||
if SETTINGS[:organizations_enabled]
|
||
child :default_organization => :default_organization do
|
||
extends "api/v2/taxonomies/base"
|
||
end
|
||
child :organizations => :organizations do
|
||
attributes :id, :name
|
||
end
|
||
child :default_organization => :default_organization do
|
||
extends "api/v2/taxonomies/base"
|
||
end
|
||
child :organizations => :organizations do
|
||
attributes :id, :name
|
||
end
|
Also available in: Unified diff
Fixes #26508 - Remove taxonomy setting checks from api