Method: Compliance::API.profiles
- Defined in:
- lib/bundles/inspec-compliance/api.rb
.profiles(config) ⇒ Object
return all compliance profiles available for the user
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bundles/inspec-compliance/api.rb', line 25 def self.profiles(config) url = "#{config['server']}/user/compliance" # TODO, api should not be dependent on .supported? response = Compliance::HTTP.get(url, config['token'], config['insecure'], !config.supported?(:oidc)) data = response.body if !data.nil? profiles = JSON.parse(data) # iterate over profiles profiles.map do |owner, ps| ps.keys.map do |name| { org: owner, name: name } end end.flatten else [] end end |