cookbook 'webhooks', '~> 0.2.0'
webhooks (6) Versions 0.2.0 Follow1
LWRP Providers for API Calls
cookbook 'webhooks', '~> 0.2.0', :supermarket
knife supermarket install webhooks
knife supermarket download webhooks
Webhooks Cookbook
<br />
Maybe you are using Chef-Solo and need an API to store node configuration or other configuration values. Maybe you just want to access an API for whatever reason. Maybe you don't need this because you are using Chef-Server. I found a use for it, maybe you can to!
Supported Platforms
Debian(6.x+), Ubuntu(10.04+)
CentOS(6.x+), RedHat, Fedora(20+)Tested Against
Debian 6.x and above
Ubuntu 10.04 and above
CenOS 6.x and above
Fedora 20Planned Improvements
0.1.2 - Enable Proxy
No additional cookboks are required.
<br />
<br />
<br />
Attributes
webhooks::default
<br />
<table>
<tr>
<th>Key</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><tt>["webhooks"]["get_response"]</tt></td>
<td>String</td>
<td>Store GET Response and Parse it Later.</td>
<td><tt>Nil</tt></td>
</tr>
<tr>
<td><tt>["webhooks"]["post_response"]</tt></td>
<td>String</td>
<td>Store POST Response and Parse it Later.</td>
<td><tt>Nil</tt></td>
</tr>
<tr>
<td><tt>["webhooks"]["put_response"]</tt></td>
<td>String</td>
<td>Store PUT Response and Parse it Later.</td>
<td><tt>Nil</tt></td>
</tr>
<tr>
<td><tt>["webhooks"]["response_code"]</tt></td>
<td>String</td>
<td>Store Response Code.</td>
<td><tt>Nil</tt></td>
</tr>
<tr>
<td><tt>["webhooks"]["response_message"]</tt></td>
<td>String</td>
<td>Store Response Message.</td>
<td><tt>Nil</tt></td>
</tr>
</table>
<br />
<br />
<br />
Resource/Provider
webhooks_request
<br />
Actions
- :get
- :post
- :put <br /> <br /> ### Attribute Parameters
#Default name for operation. Not used for other than resource name.
attribute :operation_name, :name_attribute => true, :kind_of => String, :required => true
#Base Required Options
attribute :uri, :kind_of => String, :required => true, :default => nil
attribute :uri_port, :kind_of => Integer, :required => false, :default => 80
attribute :expected_response_codes, :kind_of => Array, :required => false, :default => [200]
attribute :follow_redirect, :kind_of => [ TrueClass, FalseClass ], :default => false
attribute :read_timeout, :kind_of => Integer, :required => false, :default => 60
attribute :use_ssl, :kind_of => [ TrueClass, FalseClass ], :default => false
attribute :ssl_validation, :kind_of => [ TrueClass, FalseClass ], :default => true
attribute :post_data, :kind_of => Hash, :required => false, :default => nil
attribute :header_data, :kind_of => Hash, :required => false, :default => nil
attribute :save_response, :kind_of => [ TrueClass, FalseClass ], :default => true
attribute :post_json, :kind_of => [ TrueClass, FalseClass ], :default => false
attribute :post_xml, :kind_of => [ TrueClass, FalseClass ], :default => false
#Basic Authentication
attribute :use_basic_auth, :kind_of => [ TrueClass, FalseClass ], :default => false
attribute :basic_auth_username, :kind_of => String, :required => false, :default => nil
attribute :basic_auth_password, :kind_of => String, :required => false, :default => nil
#Proxy Options
attribute :use_proxy, :kind_of => [ TrueClass, FalseClass ], :default => false
attribute :proxy_address, :kind_of => String, :required => false, :default => nil
attribute :proxy_port, :kind_of => Integer, :required => false, :default => nil
attribute :proxy_username, :kind_of => String, :required => false, :default => nil
attribute :proxy_password, :kind_of => String, :required => false, :default => nil
<br />
<br />
Example
webhooks_request "Test Get" do
uri "s1n4l2z.runscope.net/"
use_ssl true
expected_response_codes [ 200, 201 ]
action :get
end
webhooks_request "Test Post" do
uri "s1n4l2z.runscope.net/gethosts?api_key=123"
use_ssl true
post_json true
post_data (
{ 'value1' => '1', 'value2' => '2'}
)
header_data (
{ 'header1' => '1', 'header2' => '2', 'User-Agent' => 'Mozilla/5.0'}
)
expected_response_codes [ 200, 201 ]
action :post
end
<br />
<br />
<br />
Recipe Usage
N/A NONE
<br />
<br />
<br />
License and Authors
Authors: Brian Stajkowski
Copyright 2014 Brian Stajkowski
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
webhooks CHANGELOG
0.2.0
- stajkowski - Added to attributes default["webhooks"]["response_code"] and default["webhooks"]["response_message"] to capture request response codes and messages. Fixed ###.new URI parameter passing for requests that do not contain a parameter.
0.1.3
- stajkowski - Fixed URI parse for parameters. Now you can include www.mysite.com/gethosts?api_key=123 URL parameters and they will be passed. Added post_json option to post post_data as json; default is set to false but just enable with true. Moved the entire implementation to a Library WebhooksNS into Chef::Provider::LWRP and Chef::Recipe so you can access in either an LWRP or Recipe by WebhooksNS.execute_request
The defaults of the method follow the defaults of the LWRP Resource so if you don't include a parameter then it will default to what is described for the LWRP Resource. Please see the Provider on how to use
this Library; basically, you get the full response back and can use it how you please.
0.1.25
- stajkowski - Fix ssl validation disable. Also adjusted exception message and exit status.
0.1.2
- stajkowski - Add ssl_validation attribute. It is set to enable by default; disable it for self signed certs.
0.1.1
- stajkowski - Fix Documentation
0.1.0
- stajkowski - Initial release of webhooks
Collaborator Number Metric
0.2.0 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.2.0 failed this metric
FC064: Ensure issues_url is set in metadata: webhooks/metadata.rb:1
FC065: Ensure source_url is set in metadata: webhooks/metadata.rb:1
FC066: Ensure chef_version is set in metadata: webhooks/metadata.rb:1
FC069: Ensure standardized license defined in metadata: webhooks/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: webhooks/metadata.rb:1
FC072: Metadata should not contain "attribute" keyword: webhooks/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: webhooks/providers/request.rb:14
FC085: Resource using new_resource.updated_by_last_action to converge resource: webhooks/providers/request.rb:29
FC085: Resource using new_resource.updated_by_last_action to converge resource: webhooks/providers/request.rb:44
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.2.0 passed this metric
Testing File Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.2.0 failed this metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.2.0 failed this metric
FC064: Ensure issues_url is set in metadata: webhooks/metadata.rb:1
FC065: Ensure source_url is set in metadata: webhooks/metadata.rb:1
FC066: Ensure chef_version is set in metadata: webhooks/metadata.rb:1
FC069: Ensure standardized license defined in metadata: webhooks/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: webhooks/metadata.rb:1
FC072: Metadata should not contain "attribute" keyword: webhooks/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: webhooks/providers/request.rb:14
FC085: Resource using new_resource.updated_by_last_action to converge resource: webhooks/providers/request.rb:29
FC085: Resource using new_resource.updated_by_last_action to converge resource: webhooks/providers/request.rb:44
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.2.0 passed this metric
Testing File Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.2.0 failed this metric
FC065: Ensure source_url is set in metadata: webhooks/metadata.rb:1
FC066: Ensure chef_version is set in metadata: webhooks/metadata.rb:1
FC069: Ensure standardized license defined in metadata: webhooks/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: webhooks/metadata.rb:1
FC072: Metadata should not contain "attribute" keyword: webhooks/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: webhooks/providers/request.rb:14
FC085: Resource using new_resource.updated_by_last_action to converge resource: webhooks/providers/request.rb:29
FC085: Resource using new_resource.updated_by_last_action to converge resource: webhooks/providers/request.rb:44
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
0.2.0 passed this metric
Testing File Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.2.0 failed this metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number