├── .gitignore ├── .yardopts ├── Gemfile ├── MIT-LICENSE ├── README.rdoc ├── Rakefile ├── bin └── generate.rb ├── doc ├── ForemanApi.html ├── ForemanApi │ ├── Resources.html │ └── Resources │ │ ├── Architecture.html │ │ ├── Audit.html │ │ ├── AuthSourceLdap.html │ │ ├── Autosign.html │ │ ├── Bookmark.html │ │ ├── CommonParameter.html │ │ ├── ComputeResource.html │ │ ├── ConfigTemplate.html │ │ ├── Dashboard.html │ │ ├── Domain.html │ │ ├── Environment.html │ │ ├── FactValue.html │ │ ├── Home.html │ │ ├── Host.html │ │ ├── HostClass.html │ │ ├── Hostgroup.html │ │ ├── HostgroupClass.html │ │ ├── Image.html │ │ ├── Interface.html │ │ ├── Location.html │ │ ├── LookupKey.html │ │ ├── Medium.html │ │ ├── Model.html │ │ ├── OperatingSystem.html │ │ ├── Organization.html │ │ ├── OsDefaultTemplate.html │ │ ├── OverrideValue.html │ │ ├── Parameter.html │ │ ├── Plugin.html │ │ ├── Ptable.html │ │ ├── Puppetclass.html │ │ ├── Report.html │ │ ├── Role.html │ │ ├── Setting.html │ │ ├── SmartClassParameter.html │ │ ├── SmartProxy.html │ │ ├── SmartVariable.html │ │ ├── Statistic.html │ │ ├── Subnet.html │ │ ├── Task.html │ │ ├── TemplateCombination.html │ │ ├── TemplateKind.html │ │ ├── User.html │ │ └── Usergroup.html ├── _index.html ├── class_list.html ├── css │ ├── common.css │ ├── full_list.css │ └── style.css ├── file.MIT-LICENSE.html ├── file.README.html ├── file_list.html ├── frames.html ├── index.html ├── js │ ├── app.js │ ├── full_list.js │ └── jquery.js ├── method_list.html └── top-level-namespace.html ├── foreman_api.gemspec ├── lib ├── foreman_api.rb └── foreman_api │ ├── base.rb │ ├── config.yml │ ├── documentation.json │ ├── generator │ ├── base.rb │ └── template │ │ └── resource.rb.tt │ ├── resources │ ├── architecture.rb │ ├── audit.rb │ ├── auth_source_ldap.rb │ ├── autosign.rb │ ├── bookmark.rb │ ├── common_parameter.rb │ ├── compute_resource.rb │ ├── config_template.rb │ ├── dashboard.rb │ ├── domain.rb │ ├── environment.rb │ ├── fact_value.rb │ ├── home.rb │ ├── host.rb │ ├── host_class.rb │ ├── hostgroup.rb │ ├── hostgroup_class.rb │ ├── image.rb │ ├── interface.rb │ ├── location.rb │ ├── lookup_key.rb │ ├── medium.rb │ ├── model.rb │ ├── operating_system.rb │ ├── organization.rb │ ├── os_default_template.rb │ ├── override_value.rb │ ├── parameter.rb │ ├── plugin.rb │ ├── ptable.rb │ ├── puppetclass.rb │ ├── report.rb │ ├── role.rb │ ├── setting.rb │ ├── smart_class_parameter.rb │ ├── smart_proxy.rb │ ├── smart_variable.rb │ ├── statistic.rb │ ├── subnet.rb │ ├── task.rb │ ├── template_combination.rb │ ├── template_kind.rb │ ├── user.rb │ └── usergroup.rb │ ├── rest_client_oauth.rb │ └── version.rb └── pkg └── foreman_api-0.1.10.gem /.gitignore: -------------------------------------------------------------------------------- 1 | .yardoc 2 | Gemfile.lock 3 | .idea 4 | .ruby-version 5 | .ruby-gemset 6 | .rvmrc 7 | -------------------------------------------------------------------------------- /.yardopts: -------------------------------------------------------------------------------- 1 | lib/foreman_api/resources/*.rb 2 | - 3 | README.rdoc 4 | MIT-LICENSE 5 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gemspec 4 | 5 | group :generator do 6 | gem 'actionpack' 7 | gem 'activesupport' 8 | gem 'thor' 9 | gem 'yard' 10 | gem 'htmlentities' 11 | end 12 | -------------------------------------------------------------------------------- /MIT-LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2012 Red Hat, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | = Foreman API bindings for Ruby 2 | 3 | == NOTE 4 | 5 | Alternatively, you may want to take a look at {apipie-bindings}[https://github.com/Apipie/apipie-bindings]. It is the replacement for foreman_api that is used in the Foreman CLI. It has more frequent releases. Additional info at {apipie-bindings}[http://rubydoc.info/github/Apipie/apipie-bindings/frames/file/README.md]. 6 | 7 | == Summary 8 | 9 | Usage: 10 | 11 | require 'foreman_api' 12 | require 'logger' # optional 13 | 14 | architectures = ForemanApi::Resources::Architecture.new( 15 | { 16 | :logger => Logger.new(STDOUT), # optional 17 | :base_url => 'http://foreman-url', 18 | :username => 'admin', 19 | :password => 'changeme' 20 | }) 21 | 22 | puts architectures.index.inspect 23 | 24 | == Description 25 | 26 | This gem contains Foreman API bindings for the Ruby language. The 27 | bindings are generated from API documentation using 28 | {Apidoc}[https://github.com/Pajk/apipie-rails] tool. 29 | 30 | The bindings brings support for new versioned API which is not 31 | complete yet. The number of supported controllers is limited but more 32 | are coming soon. 33 | 34 | === Regenerating bindings 35 | 36 | The code for generating the bindings is a part of this repo. The 37 | generator needs a running Foreman instance to load the apidoc.json. 38 | 39 | Usage: 40 | 41 | bin/generate.rb -h 42 | Script for generating API bindings for Foreman API from Apipie docs. 43 | -u, --url FOREMAN_APIDOC_URL By default http://localhost:3000/apidoc 44 | -h, --help 45 | 46 | Only files under +lib/foreman_api/resources+ are touched by the generator. 47 | 48 | === Authentication 49 | 50 | Foreman API uses OAuth for authentication, you need to provide url, key and 51 | secret. Also, it is required to provide user which will be used for the request 52 | if oauth_map_users setting in the Foreman instance is set, otherwise 401 error 53 | will occur and Foreman log will state "users mapping error". 54 | 55 | When setting base_url make sure it *does not* include trailing slash, otherwise 56 | request can be refused with 401. 57 | 58 | require 'foreman_api' 59 | 60 | architectures = ForemanApi::Resources::Architecture.new( 61 | { 62 | :base_url => 'http://foreman-url', 63 | :oauth => { 64 | :consumer_key => 'katello', 65 | :consumer_secret => "shhhh" 66 | } 67 | },{ 68 | :headers => { 69 | :foreman_user => "admin", 70 | } 71 | }) 72 | 73 | puts architectures.index.inspect 74 | 75 | == License 76 | 77 | The bindings are released under MIT license 78 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | -------------------------------------------------------------------------------- /bin/generate.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'optparse' 4 | $:.unshift(File.expand_path("../../lib", __FILE__)) 5 | 6 | options = {:foreman_apidoc_url => "http://localhost:3000/apidoc"} 7 | 8 | OptionParser.new do |opts| 9 | opts.banner = < 3 | 4 | 5 | 6 | 7 | Module: ForemanApi 8 | 9 | — Documentation by YARD 0.8.7 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 63 | 64 | 65 | 66 |

Module: ForemanApi 67 | 68 | 69 | 70 |

71 | 72 |
73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 |
Defined in:
82 |
lib/foreman_api/resources/user.rb,
83 | lib/foreman_api/resources/home.rb,
lib/foreman_api/resources/task.rb,
lib/foreman_api/resources/role.rb,
lib/foreman_api/resources/host.rb,
lib/foreman_api/resources/image.rb,
lib/foreman_api/resources/model.rb,
lib/foreman_api/resources/audit.rb,
lib/foreman_api/resources/medium.rb,
lib/foreman_api/resources/plugin.rb,
lib/foreman_api/resources/domain.rb,
lib/foreman_api/resources/ptable.rb,
lib/foreman_api/resources/report.rb,
lib/foreman_api/resources/subnet.rb,
lib/foreman_api/resources/setting.rb,
lib/foreman_api/resources/autosign.rb,
lib/foreman_api/resources/bookmark.rb,
lib/foreman_api/resources/location.rb,
lib/foreman_api/resources/usergroup.rb,
lib/foreman_api/resources/hostgroup.rb,
lib/foreman_api/resources/parameter.rb,
lib/foreman_api/resources/statistic.rb,
lib/foreman_api/resources/dashboard.rb,
lib/foreman_api/resources/interface.rb,
lib/foreman_api/resources/fact_value.rb,
lib/foreman_api/resources/host_class.rb,
lib/foreman_api/resources/lookup_key.rb,
lib/foreman_api/resources/smart_proxy.rb,
lib/foreman_api/resources/puppetclass.rb,
lib/foreman_api/resources/environment.rb,
lib/foreman_api/resources/architecture.rb,
lib/foreman_api/resources/organization.rb,
lib/foreman_api/resources/template_kind.rb,
lib/foreman_api/resources/override_value.rb,
lib/foreman_api/resources/smart_variable.rb,
lib/foreman_api/resources/hostgroup_class.rb,
lib/foreman_api/resources/config_template.rb,
lib/foreman_api/resources/auth_source_ldap.rb,
lib/foreman_api/resources/operating_system.rb,
lib/foreman_api/resources/common_parameter.rb,
lib/foreman_api/resources/compute_resource.rb,
lib/foreman_api/resources/os_default_template.rb,
lib/foreman_api/resources/template_combination.rb,
lib/foreman_api/resources/smart_class_parameter.rb
84 |
85 | 86 |
87 |
88 | 89 |

Defined Under Namespace

90 |

91 | 92 | 93 | Modules: Resources 94 | 95 | 96 | 97 | 98 |

99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 |
109 | 110 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /doc/ForemanApi/Resources/Autosign.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | Class: ForemanApi::Resources::Autosign 8 | 9 | — Documentation by YARD 0.8.7 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 63 | 64 | 65 | 66 |

Class: ForemanApi::Resources::Autosign 67 | 68 | 69 | 70 |

71 | 72 |
73 | 74 |
Inherits:
75 |
76 | Base 77 | 78 |
    79 |
  • Object
  • 80 | 81 | 82 | 83 | 84 | 85 |
86 | show all 87 | 88 |
89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 |
Defined in:
99 |
lib/foreman_api/resources/autosign.rb
100 | 101 |
102 |
103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 |

113 | Class Method Summary 114 | (collapse) 115 |

116 | 117 | 142 | 143 |

144 | Instance Method Summary 145 | (collapse) 146 |

147 | 148 | 175 | 176 | 177 | 178 | 179 | 180 |
181 |

Class Method Details

182 | 183 | 184 |
185 |

186 | 187 | + (Object) doc 188 | 189 | 190 | 191 | 192 | 193 |

194 | 195 | 203 | 210 | 211 |
196 |
197 | 
198 | 
199 | 4
200 | 5
201 | 6
202 |
204 |
# File 'lib/foreman_api/resources/autosign.rb', line 4
205 | 
206 | def self.doc
207 |   @doc ||= ForemanApi.doc['resources']["autosign"]
208 | end
209 |
212 |
213 | 214 |
215 | 216 |
217 |

Instance Method Details

218 | 219 | 220 |
221 |

222 | 223 | - (Array) index(params = {}, headers = {}) 224 | 225 | 226 | 227 | 228 | 229 |

230 |
231 | 232 |

Returns First item: parsed data; second item: raw body

233 | 234 | 235 |
236 |
237 |
238 |

Parameters:

239 |
    240 | 241 |
  • 242 | 243 | params 244 | 245 | 246 | (Hash) 247 | 248 | 249 | (defaults to: {}) 250 | 251 | 252 | — 253 |
    254 |

    a hash of params to be passed to the service

    255 |
    256 | 257 |
  • 258 | 259 |
  • 260 | 261 | headers 262 | 263 | 264 | (Hash) 265 | 266 | 267 | (defaults to: {}) 268 | 269 | 270 | — 271 |
    272 |

    additional http headers

    273 |
    274 | 275 |
  • 276 | 277 |
278 | 279 |

Returns:

280 |
    281 | 282 |
  • 283 | 284 | 285 | (Array) 286 | 287 | 288 | 289 | — 290 |
    291 |

    First item: parsed data; second item: raw body

    292 |
    293 | 294 |
  • 295 | 296 |
297 | 298 |
299 | 300 | 308 | 315 | 316 |
301 |
302 | 
303 | 
304 | 12
305 | 13
306 | 14
307 |
309 |
# File 'lib/foreman_api/resources/autosign.rb', line 12
310 | 
311 | def index(params = {}, headers = {})
312 |   perform_call(__method__, params, headers)
313 | end
314 |
317 |
318 | 319 |
320 | 321 |
322 | 323 | 328 | 329 | 330 | -------------------------------------------------------------------------------- /doc/ForemanApi/Resources/Plugin.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | Class: ForemanApi::Resources::Plugin 8 | 9 | — Documentation by YARD 0.8.7 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 63 | 64 | 65 | 66 |

Class: ForemanApi::Resources::Plugin 67 | 68 | 69 | 70 |

71 | 72 |
73 | 74 |
Inherits:
75 |
76 | Base 77 | 78 |
    79 |
  • Object
  • 80 | 81 | 82 | 83 | 84 | 85 |
86 | show all 87 | 88 |
89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 |
Defined in:
99 |
lib/foreman_api/resources/plugin.rb
100 | 101 |
102 |
103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 |

113 | Class Method Summary 114 | (collapse) 115 |

116 | 117 | 142 | 143 |

144 | Instance Method Summary 145 | (collapse) 146 |

147 | 148 | 175 | 176 | 177 | 178 | 179 | 180 |
181 |

Class Method Details

182 | 183 | 184 |
185 |

186 | 187 | + (Object) doc 188 | 189 | 190 | 191 | 192 | 193 |

194 | 195 | 203 | 210 | 211 |
196 |
197 | 
198 | 
199 | 4
200 | 5
201 | 6
202 |
204 |
# File 'lib/foreman_api/resources/plugin.rb', line 4
205 | 
206 | def self.doc
207 |   @doc ||= ForemanApi.doc['resources']["plugins"]
208 | end
209 |
212 |
213 | 214 |
215 | 216 |
217 |

Instance Method Details

218 | 219 | 220 |
221 |

222 | 223 | - (Array) index(params = {}, headers = {}) 224 | 225 | 226 | 227 | 228 | 229 |

230 |
231 | 232 |

Returns First item: parsed data; second item: raw body

233 | 234 | 235 |
236 |
237 |
238 |

Parameters:

239 |
    240 | 241 |
  • 242 | 243 | params 244 | 245 | 246 | (Hash) 247 | 248 | 249 | (defaults to: {}) 250 | 251 | 252 | — 253 |
    254 |

    a hash of params to be passed to the service

    255 |
    256 | 257 |
  • 258 | 259 |
  • 260 | 261 | headers 262 | 263 | 264 | (Hash) 265 | 266 | 267 | (defaults to: {}) 268 | 269 | 270 | — 271 |
    272 |

    additional http headers

    273 |
    274 | 275 |
  • 276 | 277 |
278 | 279 |

Returns:

280 |
    281 | 282 |
  • 283 | 284 | 285 | (Array) 286 | 287 | 288 | 289 | — 290 |
    291 |

    First item: parsed data; second item: raw body

    292 |
    293 | 294 |
  • 295 | 296 |
297 | 298 |
299 | 300 | 308 | 315 | 316 |
301 |
302 | 
303 | 
304 | 12
305 | 13
306 | 14
307 |
309 |
# File 'lib/foreman_api/resources/plugin.rb', line 12
310 | 
311 | def index(params = {}, headers = {})
312 |   perform_call(__method__, params, headers)
313 | end
314 |
317 |
318 | 319 |
320 | 321 |
322 | 323 | 328 | 329 | 330 | -------------------------------------------------------------------------------- /doc/ForemanApi/Resources/Statistic.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | Class: ForemanApi::Resources::Statistic 8 | 9 | — Documentation by YARD 0.8.7 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 63 | 64 | 65 | 66 |

Class: ForemanApi::Resources::Statistic 67 | 68 | 69 | 70 |

71 | 72 |
73 | 74 |
Inherits:
75 |
76 | Base 77 | 78 |
    79 |
  • Object
  • 80 | 81 | 82 | 83 | 84 | 85 |
86 | show all 87 | 88 |
89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 |
Defined in:
99 |
lib/foreman_api/resources/statistic.rb
100 | 101 |
102 |
103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 |

113 | Class Method Summary 114 | (collapse) 115 |

116 | 117 | 142 | 143 |

144 | Instance Method Summary 145 | (collapse) 146 |

147 | 148 | 175 | 176 | 177 | 178 | 179 | 180 |
181 |

Class Method Details

182 | 183 | 184 |
185 |

186 | 187 | + (Object) doc 188 | 189 | 190 | 191 | 192 | 193 |

194 | 195 | 203 | 210 | 211 |
196 |
197 | 
198 | 
199 | 4
200 | 5
201 | 6
202 |
204 |
# File 'lib/foreman_api/resources/statistic.rb', line 4
205 | 
206 | def self.doc
207 |   @doc ||= ForemanApi.doc['resources']["statistics"]
208 | end
209 |
212 |
213 | 214 |
215 | 216 |
217 |

Instance Method Details

218 | 219 | 220 |
221 |

222 | 223 | - (Array) index(params = {}, headers = {}) 224 | 225 | 226 | 227 | 228 | 229 |

230 |
231 | 232 |

Returns First item: parsed data; second item: raw body

233 | 234 | 235 |
236 |
237 |
238 |

Parameters:

239 |
    240 | 241 |
  • 242 | 243 | params 244 | 245 | 246 | (Hash) 247 | 248 | 249 | (defaults to: {}) 250 | 251 | 252 | — 253 |
    254 |

    a hash of params to be passed to the service

    255 |
    256 | 257 |
  • 258 | 259 |
  • 260 | 261 | headers 262 | 263 | 264 | (Hash) 265 | 266 | 267 | (defaults to: {}) 268 | 269 | 270 | — 271 |
    272 |

    additional http headers

    273 |
    274 | 275 |
  • 276 | 277 |
278 | 279 |

Returns:

280 |
    281 | 282 |
  • 283 | 284 | 285 | (Array) 286 | 287 | 288 | 289 | — 290 |
    291 |

    First item: parsed data; second item: raw body

    292 |
    293 | 294 |
  • 295 | 296 |
297 | 298 |
299 | 300 | 308 | 315 | 316 |
301 |
302 | 
303 | 
304 | 12
305 | 13
306 | 14
307 |
309 |
# File 'lib/foreman_api/resources/statistic.rb', line 12
310 | 
311 | def index(params = {}, headers = {})
312 |   perform_call(__method__, params, headers)
313 | end
314 |
317 |
318 | 319 |
320 | 321 |
322 | 323 | 328 | 329 | 330 | -------------------------------------------------------------------------------- /doc/ForemanApi/Resources/Task.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | Class: ForemanApi::Resources::Task 8 | 9 | — Documentation by YARD 0.8.7 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 63 | 64 | 65 | 66 |

Class: ForemanApi::Resources::Task 67 | 68 | 69 | 70 |

71 | 72 |
73 | 74 |
Inherits:
75 |
76 | Base 77 | 78 |
    79 |
  • Object
  • 80 | 81 | 82 | 83 | 84 | 85 |
86 | show all 87 | 88 |
89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 |
Defined in:
99 |
lib/foreman_api/resources/task.rb
100 | 101 |
102 |
103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 |

113 | Class Method Summary 114 | (collapse) 115 |

116 | 117 | 142 | 143 |

144 | Instance Method Summary 145 | (collapse) 146 |

147 | 148 | 175 | 176 | 177 | 178 | 179 | 180 |
181 |

Class Method Details

182 | 183 | 184 |
185 |

186 | 187 | + (Object) doc 188 | 189 | 190 | 191 | 192 | 193 |

194 | 195 | 203 | 210 | 211 |
196 |
197 | 
198 | 
199 | 4
200 | 5
201 | 6
202 |
204 |
# File 'lib/foreman_api/resources/task.rb', line 4
205 | 
206 | def self.doc
207 |   @doc ||= ForemanApi.doc['resources']["tasks"]
208 | end
209 |
212 |
213 | 214 |
215 | 216 |
217 |

Instance Method Details

218 | 219 | 220 |
221 |

222 | 223 | - (Array) index(params = {}, headers = {}) 224 | 225 | 226 | 227 | 228 | 229 |

230 |
231 | 232 |

Returns First item: parsed data; second item: raw body

233 | 234 | 235 |
236 |
237 |
238 |

Parameters:

239 |
    240 | 241 |
  • 242 | 243 | params 244 | 245 | 246 | (Hash) 247 | 248 | 249 | (defaults to: {}) 250 | 251 | 252 | — 253 |
    254 |

    a hash of params to be passed to the service

    255 |
    256 | 257 |
  • 258 | 259 |
  • 260 | 261 | headers 262 | 263 | 264 | (Hash) 265 | 266 | 267 | (defaults to: {}) 268 | 269 | 270 | — 271 |
    272 |

    additional http headers

    273 |
    274 | 275 |
  • 276 | 277 |
278 | 279 | 280 | 281 | 282 |

Options Hash (params):

283 |
    284 | 285 |
  • 286 | id 287 | (Object) 288 | 289 | 290 | 291 | 292 | —
    293 |

    Part of /api/orchestration/:id/tasks path

    294 |
    295 | 296 |
  • 297 | 298 |
299 | 300 | 301 | 302 | 303 |

Returns:

304 |
    305 | 306 |
  • 307 | 308 | 309 | (Array) 310 | 311 | 312 | 313 | — 314 |
    315 |

    First item: parsed data; second item: raw body

    316 |
    317 | 318 |
  • 319 | 320 |
321 | 322 |
323 | 324 | 332 | 339 | 340 |
325 |
326 | 
327 | 
328 | 13
329 | 14
330 | 15
331 |
333 |
# File 'lib/foreman_api/resources/task.rb', line 13
334 | 
335 | def index(params = {}, headers = {})
336 |   perform_call(__method__, params, headers)
337 | end
338 |
341 |
342 | 343 |
344 | 345 |
346 | 347 | 352 | 353 | 354 | -------------------------------------------------------------------------------- /doc/css/common.css: -------------------------------------------------------------------------------- 1 | /* Override this file with custom rules */ -------------------------------------------------------------------------------- /doc/css/full_list.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; 4 | font-size: 13px; 5 | height: 101%; 6 | overflow-x: hidden; 7 | } 8 | 9 | h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } 10 | .clear { clear: both; } 11 | #search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } 12 | #content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } 13 | #full_list { padding: 0; list-style: none; margin-left: 0; } 14 | #full_list ul { padding: 0; } 15 | #full_list li { padding: 5px; padding-left: 12px; margin: 0; font-size: 1.1em; list-style: none; } 16 | #noresults { padding: 7px 12px; } 17 | #content.insearch #noresults { margin-left: 7px; } 18 | ul.collapsed ul, ul.collapsed li { display: none; } 19 | ul.collapsed.search_uncollapsed { display: block; } 20 | ul.collapsed.search_uncollapsed li { display: list-item; } 21 | li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } 22 | li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } 23 | li { color: #888; cursor: pointer; } 24 | li.deprecated { text-decoration: line-through; font-style: italic; } 25 | li.r1 { background: #f0f0f0; } 26 | li.r2 { background: #fafafa; } 27 | li:hover { background: #ddd; } 28 | li small:before { content: "("; } 29 | li small:after { content: ")"; } 30 | li small.search_info { display: none; } 31 | a:link, a:visited { text-decoration: none; color: #05a; } 32 | li.clicked { background: #05a; color: #ccc; } 33 | li.clicked a:link, li.clicked a:visited { color: #eee; } 34 | li.clicked a.toggle { opacity: 0.5; background-position: bottom right; } 35 | li.collapsed.clicked a.toggle { background-position: top right; } 36 | #search input { border: 1px solid #bbb; -moz-border-radius: 3px; -webkit-border-radius: 3px; } 37 | #nav { margin-left: 10px; font-size: 0.9em; display: none; color: #aaa; } 38 | #nav a:link, #nav a:visited { color: #358; } 39 | #nav a:hover { background: transparent; color: #5af; } 40 | .frames #nav span:after { content: ' | '; } 41 | .frames #nav span:last-child:after { content: ''; } 42 | 43 | .frames #content h1 { margin-top: 0; } 44 | .frames li { white-space: nowrap; cursor: normal; } 45 | .frames li small { display: block; font-size: 0.8em; } 46 | .frames li small:before { content: ""; } 47 | .frames li small:after { content: ""; } 48 | .frames li small.search_info { display: none; } 49 | .frames #search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } 50 | .frames #content.insearch #search { background-position: center right; } 51 | .frames #search input { width: 110px; } 52 | .frames #nav { display: block; } 53 | 54 | #full_list.insearch li { display: none; } 55 | #full_list.insearch li.found { display: list-item; padding-left: 10px; } 56 | #full_list.insearch li a.toggle { display: none; } 57 | #full_list.insearch li small.search_info { display: block; } 58 | -------------------------------------------------------------------------------- /doc/file.MIT-LICENSE.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | File: MIT-LICENSE 8 | 9 | — Documentation by YARD 0.8.7 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 61 | 62 | 63 | 64 |
65 |

Copyright 2012 Red Hat, Inc.

66 | 67 |

Permission is hereby granted, free of charge, to any person obtaining a 68 | copy of this software and associated documentation files (the “Software”), 69 | to deal in the Software without restriction, including without limitation 70 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 71 | and/or sell copies of the Software, and to permit persons to whom the 72 | Software is furnished to do so, subject to the following conditions:

73 | 74 |

The above copyright notice and this permission notice shall be included in 75 | all copies or substantial portions of the Software.

76 | 77 |

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 78 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 79 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 80 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 81 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 82 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 83 | DEALINGS IN THE SOFTWARE.

84 |
85 | 86 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /doc/file.README.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | File: README 8 | 9 | — Documentation by YARD 0.8.7 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 61 | 62 | 63 | 64 |
65 |

Foreman API bindings for Ruby

66 | 67 |

Summary

68 | 69 |

Usage:

70 | 71 |
require 'foreman_api'
 72 | require 'logger' # optional
 73 | 
 74 | architectures = ForemanApi::Resources::Architecture.new(
 75 |   {
 76 |     :logger => Logger.new(STDOUT), # optional
 77 |     :base_url => 'http://foreman-url', 
 78 |     :username => 'admin', 
 79 |     :password => 'changeme'
 80 |   })
 81 | 
 82 | puts architectures.index.inspect
 83 | 
84 | 85 |

Description

86 | 87 |

This gem contains Foreman API bindings for the Ruby language. The bindings 88 | are generated from API documentation using Apidoc tool.

90 | 91 |

The bindings brings support for new versioned API which is not complete 92 | yet. The number of supported controllers is limited but more are coming 93 | soon.

94 | 95 |

Regenerating bindings

96 | 97 |

The code for generating the bindings is a part of this repo. The generator 98 | needs a running Foreman instance to load the apidoc.json.

99 | 100 |

Usage:

101 | 102 |
bin/generate.rb -h
103 | Script for generating API bindings for Foreman API from Apipie docs.
104 |     -u, --url FOREMAN_APIDOC_URL     By default http://localhost:3000/apidoc
105 |     -h, --help
106 | 107 |

Only files under lib/foreman_api/resources are touched by the 108 | generator.

109 | 110 |

Authentication

111 | 112 |

Foreman API uses OAuth for authentication, you need to provide url, key and 113 | secret. Also, it is required to provide user which will be used for the 114 | request if oauth_map_users setting in the Foreman instance is set, 115 | otherwise 401 error will occur and Foreman log will state “users mapping 116 | error”.

117 | 118 |

When setting base_url make sure it *does not* include trailing slash, 119 | otherwise request can be refused with 401.

120 | 121 |
require 'foreman_api'
122 | 
123 | architectures = ForemanApi::Resources::Architecture.new(
124 |   {
125 |     :base_url => 'http://foreman-url', 
126 |     :oauth => {
127 |       :consumer_key    => 'katello',
128 |       :consumer_secret => "shhhh" 
129 |     }
130 |   },{
131 |     :headers => {
132 |       :foreman_user => "admin",
133 |     }
134 |   })
135 | 
136 | puts architectures.index.inspect
137 | 
138 | 139 |

License

140 | 141 |

The bindings are released under MIT license

142 |
143 | 144 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /doc/file_list.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | File List 19 | 20 | 21 | 22 | 28 |
29 |

File List

30 | 45 | 46 | 47 | 57 |
58 | 59 | 60 | -------------------------------------------------------------------------------- /doc/frames.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | Documentation by YARD 0.8.7 8 | 9 | 22 | 28 | 29 | -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | File: README 8 | 9 | — Documentation by YARD 0.8.7 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 61 | 62 | 63 | 64 |
65 |

Foreman API bindings for Ruby

66 | 67 |

Summary

68 | 69 |

Usage:

70 | 71 |
require 'foreman_api'
 72 | require 'logger' # optional
 73 | 
 74 | architectures = ForemanApi::Resources::Architecture.new(
 75 |   {
 76 |     :logger => Logger.new(STDOUT), # optional
 77 |     :base_url => 'http://foreman-url', 
 78 |     :username => 'admin', 
 79 |     :password => 'changeme'
 80 |   })
 81 | 
 82 | puts architectures.index.inspect
 83 | 
84 | 85 |

Description

86 | 87 |

This gem contains Foreman API bindings for the Ruby language. The bindings 88 | are generated from API documentation using Apidoc tool.

90 | 91 |

The bindings brings support for new versioned API which is not complete 92 | yet. The number of supported controllers is limited but more are coming 93 | soon.

94 | 95 |

Regenerating bindings

96 | 97 |

The code for generating the bindings is a part of this repo. The generator 98 | needs a running Foreman instance to load the apidoc.json.

99 | 100 |

Usage:

101 | 102 |
bin/generate.rb -h
103 | Script for generating API bindings for Foreman API from Apipie docs.
104 |     -u, --url FOREMAN_APIDOC_URL     By default http://localhost:3000/apidoc
105 |     -h, --help
106 | 107 |

Only files under lib/foreman_api/resources are touched by the 108 | generator.

109 | 110 |

Authentication

111 | 112 |

Foreman API uses OAuth for authentication, you need to provide url, key and 113 | secret. Also, it is required to provide user which will be used for the 114 | request if oauth_map_users setting in the Foreman instance is set, 115 | otherwise 401 error will occur and Foreman log will state “users mapping 116 | error”.

117 | 118 |

When setting base_url make sure it *does not* include trailing slash, 119 | otherwise request can be refused with 401.

120 | 121 |
require 'foreman_api'
122 | 
123 | architectures = ForemanApi::Resources::Architecture.new(
124 |   {
125 |     :base_url => 'http://foreman-url', 
126 |     :oauth => {
127 |       :consumer_key    => 'katello',
128 |       :consumer_secret => "shhhh" 
129 |     }
130 |   },{
131 |     :headers => {
132 |       :foreman_user => "admin",
133 |     }
134 |   })
135 | 
136 | puts architectures.index.inspect
137 | 
138 | 139 |

License

140 | 141 |

The bindings are released under MIT license

142 |
143 | 144 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /doc/js/app.js: -------------------------------------------------------------------------------- 1 | function createSourceLinks() { 2 | $('.method_details_list .source_code'). 3 | before("[View source]"); 4 | $('.toggleSource').toggle(function() { 5 | $(this).parent().nextAll('.source_code').slideDown(100); 6 | $(this).text("Hide source"); 7 | }, 8 | function() { 9 | $(this).parent().nextAll('.source_code').slideUp(100); 10 | $(this).text("View source"); 11 | }); 12 | } 13 | 14 | function createDefineLinks() { 15 | var tHeight = 0; 16 | $('.defines').after(" more..."); 17 | $('.toggleDefines').toggle(function() { 18 | tHeight = $(this).parent().prev().height(); 19 | $(this).prev().show(); 20 | $(this).parent().prev().height($(this).parent().height()); 21 | $(this).text("(less)"); 22 | }, 23 | function() { 24 | $(this).prev().hide(); 25 | $(this).parent().prev().height(tHeight); 26 | $(this).text("more..."); 27 | }); 28 | } 29 | 30 | function createFullTreeLinks() { 31 | var tHeight = 0; 32 | $('.inheritanceTree').toggle(function() { 33 | tHeight = $(this).parent().prev().height(); 34 | $(this).parent().toggleClass('showAll'); 35 | $(this).text("(hide)"); 36 | $(this).parent().prev().height($(this).parent().height()); 37 | }, 38 | function() { 39 | $(this).parent().toggleClass('showAll'); 40 | $(this).parent().prev().height(tHeight); 41 | $(this).text("show all"); 42 | }); 43 | } 44 | 45 | function fixBoxInfoHeights() { 46 | $('dl.box dd.r1, dl.box dd.r2').each(function() { 47 | $(this).prev().height($(this).height()); 48 | }); 49 | } 50 | 51 | function searchFrameLinks() { 52 | $('.full_list_link').click(function() { 53 | toggleSearchFrame(this, $(this).attr('href')); 54 | return false; 55 | }); 56 | } 57 | 58 | function toggleSearchFrame(id, link) { 59 | var frame = $('#search_frame'); 60 | $('#search a').removeClass('active').addClass('inactive'); 61 | if (frame.attr('src') == link && frame.css('display') != "none") { 62 | frame.slideUp(100); 63 | $('#search a').removeClass('active inactive'); 64 | } 65 | else { 66 | $(id).addClass('active').removeClass('inactive'); 67 | frame.attr('src', link).slideDown(100); 68 | } 69 | } 70 | 71 | function linkSummaries() { 72 | $('.summary_signature').click(function() { 73 | document.location = $(this).find('a').attr('href'); 74 | }); 75 | } 76 | 77 | function framesInit() { 78 | if (hasFrames) { 79 | document.body.className = 'frames'; 80 | $('#menu .noframes a').attr('href', document.location); 81 | window.top.document.title = $('html head title').text(); 82 | } 83 | else { 84 | $('#menu .noframes a').text('frames').attr('href', framesUrl); 85 | } 86 | } 87 | 88 | function keyboardShortcuts() { 89 | if (window.top.frames.main) return; 90 | $(document).keypress(function(evt) { 91 | if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return; 92 | if (typeof evt.target !== "undefined" && 93 | (evt.target.nodeName == "INPUT" || 94 | evt.target.nodeName == "TEXTAREA")) return; 95 | switch (evt.charCode) { 96 | case 67: case 99: $('#class_list_link').click(); break; // 'c' 97 | case 77: case 109: $('#method_list_link').click(); break; // 'm' 98 | case 70: case 102: $('#file_list_link').click(); break; // 'f' 99 | default: break; 100 | } 101 | }); 102 | } 103 | 104 | function summaryToggle() { 105 | $('.summary_toggle').click(function() { 106 | if (localStorage) { 107 | localStorage.summaryCollapsed = $(this).text(); 108 | } 109 | $('.summary_toggle').each(function() { 110 | $(this).text($(this).text() == "collapse" ? "expand" : "collapse"); 111 | var next = $(this).parent().parent().nextAll('ul.summary').first(); 112 | if (next.hasClass('compact')) { 113 | next.toggle(); 114 | next.nextAll('ul.summary').first().toggle(); 115 | } 116 | else if (next.hasClass('summary')) { 117 | var list = $('