Class: Chef::Provider::HttpRequest
- Inherits:
-
Chef::Provider
- Object
- Chef::Provider
- Chef::Provider::HttpRequest
- Defined in:
- lib/chef/provider/http_request.rb
Instance Attribute Summary collapse
-
#rest ⇒ Object
Returns the value of attribute rest.
Attributes inherited from Chef::Provider
#current_resource, #new_resource, #run_context
Instance Method Summary collapse
-
#action_delete ⇒ Object
Send a DELETE request to @new_resource.url.
-
#action_get ⇒ Object
Send a GET request to @new_resource.url, with ?message=@new_resource.message.
-
#action_head ⇒ Object
Send a HEAD request to @new_resource.url, with ?message=@new_resource.message.
-
#action_post ⇒ Object
Send a POST request to @new_resource.url, with the message as the payload.
-
#action_put ⇒ Object
Send a PUT request to @new_resource.url, with the message as the payload.
- #load_current_resource ⇒ Object
Methods inherited from Chef::Provider
#action_nothing, build_from_file, #cookbook_name, #initialize, #node, #resource_collection
Methods included from Mixin::ConvertToClassName
#convert_to_class_name, #convert_to_snake_case, #filename_to_qualified_string, #snake_case_basename
Methods included from Mixin::RecipeDefinitionDSLCore
Methods included from Mixin::Language
#data_bag, #data_bag_item, #platform?, #search, #value_for_platform
Constructor Details
This class inherits a constructor from Chef::Provider
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Chef::Mixin::RecipeDefinitionDSLCore
Instance Attribute Details
#rest ⇒ Object
Returns the value of attribute rest.
25 26 27 |
# File 'lib/chef/provider/http_request.rb', line 25 def rest @rest end |
Instance Method Details
#action_delete ⇒ Object
Send a DELETE request to @new_resource.url
96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/chef/provider/http_request.rb', line 96 def action_delete body = @rest.run_request( :DELETE, @rest.create_url("#{@new_resource.url}"), @new_resource.headers, false, 10, false ) @new_resource.updated_by_last_action(true) Chef::Log.info("#{@new_resource} DELETE to #{@new_resource.url} successful") Chef::Log.debug("#{@new_resource} DELETE request response: #{body}") end |
#action_get ⇒ Object
Send a GET request to @new_resource.url, with ?message=@new_resource.message
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/chef/provider/http_request.rb', line 48 def action_get = (@new_resource.) body = @rest.run_request( :GET, @rest.create_url("#{@new_resource.url}?message=#{}"), @new_resource.headers, false, 10, false ) @new_resource.updated_by_last_action(true) Chef::Log.info("#{@new_resource} GET to #{@new_resource.url} successful") Chef::Log.debug("#{@new_resource} GET request response: #{body}") end |
#action_head ⇒ Object
Send a HEAD request to @new_resource.url, with ?message=@new_resource.message
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/chef/provider/http_request.rb', line 32 def action_head = (@new_resource.) modified = @rest.run_request( :HEAD, @rest.create_url("#{@new_resource.url}?message=#{}"), @new_resource.headers, false, 10, false ) @new_resource.updated_by_last_action(modified) Chef::Log.info("#{@new_resource} HEAD to #{@new_resource.url} successful") Chef::Log.debug("#{@new_resource} HEAD request response: #{modified}") end |
#action_post ⇒ Object
Send a POST request to @new_resource.url, with the message as the payload
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/chef/provider/http_request.rb', line 80 def action_post = (@new_resource.) body = @rest.run_request( :POST, @rest.create_url("#{@new_resource.url}"), @new_resource.headers, , 10, false ) @new_resource.updated_by_last_action(true) Chef::Log.info("#{@new_resource} POST to #{@new_resource.url} message: #{.inspect} successful") Chef::Log.debug("#{@new_resource} POST request response: #{body}") end |
#action_put ⇒ Object
Send a PUT request to @new_resource.url, with the message as the payload
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/chef/provider/http_request.rb', line 64 def action_put = (@new_resource.) body = @rest.run_request( :PUT, @rest.create_url("#{@new_resource.url}"), @new_resource.headers, , 10, false ) @new_resource.updated_by_last_action(true) Chef::Log.info("#{@new_resource} PUT to #{@new_resource.url} successful") Chef::Log.debug("#{@new_resource} PUT request response: #{body}") end |