Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Faraday middleware for AWS Signature Version 4.

License

Notifications You must be signed in to change notification settings

winebarrel/faraday_middleware-aws-signers-v4

Repository files navigation

FaradayMiddleware::AwsSignersV4

Faraday middleware for AWS Signature Version 4.

Gem Version Build Status Coverage Status

Currently developing new gem to support aws-sdk-v3.

PLEASE USE faraday_middleware-aws-sigv4.

see https://github.com/winebarrel/faraday_middleware-aws-sigv4

Installation

Add this line to your application's Gemfile:

gem 'faraday_middleware-aws-signers-v4'

And then execute:

$ bundle

Or install it yourself as:

$ gem install faraday_middleware-aws-signers-v4

Usage

require 'faraday_middleware'
require 'faraday_middleware/aws_signers_v4'
require 'pp'

conn = Faraday.new(url: 'https://apigateway.us-east-1.amazonaws.com') do |faraday|
  faraday.request :aws_signers_v4,
    credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']),
    # If you use the credentials file:
    #credentials: Aws::SharedCredentials.new.credentials,
    service_name: 'apigateway',
    region: 'us-east-1'

  faraday.response :json, :content_type => /\bjson\b/
  faraday.response :raise_error

  faraday.adapter Faraday.default_adapter
end

res = conn.get '/account'
pp res.body
# => {"accountUpdate"=>
#      {"name"=>nil,
#       "template"=>false,
#       "templateSkipList"=>nil,
#       "title"=>nil,
#       "updateAccountInput"=>nil},
#     "cloudwatchRoleArn"=>nil,
#     "self"=>
#      {"__type"=>
#        "GetAccountRequest:http://internal.amazon.com/coral/com.amazonaws.backplane.controlplane/",
#       "name"=>nil,
#       "template"=>false,
#       "templateSkipList"=>nil,
#       "title"=>nil},
#     "throttleSettings"=>{"burstLimit"=>1000, "rateLimit"=>500.0}}

About

Faraday middleware for AWS Signature Version 4.

Resources

License

Stars

Watchers

Forks

Packages

No packages published