Hi Michael,

I believe that you are seeing this error because the `cs_root_host`
Riak CS configuration option and `:host` (in the script's
configuration map) are not the same. Once you update `cs_root_host`,
make sure that you restart Riak CS for the changes to take effect.

--
Hector


On Mon, Apr 8, 2013 at 5:44 PM, Michael Holt <mah...@nla.com> wrote:
> There is an Nginx server acting as a proxy in front of Riak CS.
>
>
>
> There is not a problem listing all the users with
> Fog::RiakCS::Provisioning.new but usage (Fog::RiakCS::Usage.new) with the
> same configuration has an Access Denied error.
>
>
>
> --
>
> Michael Holt
>
>
>
> From: Tom Santero [mailto:tsant...@basho.com]
> Sent: Monday, April 08, 2013 5:41 PM
> To: Michael Holt
> Cc: riak-users@lists.basho.com
> Subject: Re: Using Fog with Ruby
>
>
>
> Hi Michael,
>
>
>
> You have port 80 listed in configuration, default port is 8080.
>
>
>
> Tom
>
> On Mon, Apr 8, 2013 at 5:35 PM, Michael Holt <mah...@nla.com> wrote:
>
> I have a small script that I am trying to set up that can read usage stats
> in Ruby Fog. The script is largely pieced together from examples from the
> Basho site and Fog github project. The script is below.
>
>
>
> The issue I am running into is the following error:
>
> <Error>
>
>                 <Code>AccessDenied</Code>
>
>                 <Message>Access Denied</Message>
>
>
> <Resource>/riak-cs/usage/OJIPWXM698VYGEMGZLIV/bx/20130401T000000Z/20130430T235959Z.abj.20130407T213209Z.20130408T213209Z</Resource>
>
>                 <RequestId></RequestId>
>
> </Error>
>
>
>
> The list user (users = provisioning.list_users.body) works. The key and
> secret is for the admin user.
>
>
>
> Why would I get an Access Denied for the admin user?
>
>
>
> --------------RUBY CODE-------------
>
> require 'rubygems'
>
> require 'fog'
>
>
>
> def show_usage(usage, key)
>
>         utilization = usage.get_usage(  "/usage/#{key}",
>
>                         :types          => [:access, :storage]
>
>                         )
>
>
>
>         objects = 0
>
>         bytes = 0
>
>
>
>         # Retrieve Storage information
>
>         utilization.body['Storage']['Samples'][0].each do |k,v|
>
>                 # Sum the # of objects and bytes stored from each user
> bucket for per tenant totals
>
>                 if v.is_a?(Hash) # To ignore StartTime & EndTime
>
>                         objects += v['Objects']
>
>                         bytes   += v['Bytes']
>
>                 end
>
>         end
>
>
>
>         puts "  showUsage objects:       #{objects}"
>
>         puts "  showUsage bytes:         #{bytes}"
>
> end
>
>
>
> configuration = {
>
>   :riakcs_access_key_id     => "OJIPWXM698VYGEMGZLIV",
>
>   :riakcs_secret_access_key => "fTbOq8WIBiHrUnHxBgRLDIOyo4yK2Qysrx3vjA==",
>
>   :host                     => 'localhost',
>
>   :port                     => 80,
>
>   :scheme                   => "http"
>
> }
>
>
>
> Excon.defaults[:ssl_verify_peer] = false
>
>
>
> # Requests for User Provision and Usage information
>
> provisioning = Fog::RiakCS::Provisioning.new(configuration)
>
> usage        = Fog::RiakCS::Usage.new(configuration)
>
>
>
>
>
> users = provisioning.list_users.body
>
>
>
> # The following block of code displays all available information for every
> user
>
> users.each do | user |
>
>
>
>   utilization =
> usage.get_usage("/usage/#{user['key_id']}/bx/20130401T000000Z/20130430T235959Z",
> :types => [:access, :storage])
>
>
>
>   puts
> "§=================================================================================§"
>
>   puts "  name:         #{user['name']}"
>
>   puts "  display_name: #{user['display_name']}"
>
>   puts "  email:        #{user['email']}"
>
>   puts "  id:           #{user['id']}"
>
>   puts "  key_id:       #{user['key_id']}"
>
>   puts "  key_secret:   #{user['key_secret']}"
>
>   puts "  status:       #{user['status']}"
>
>   show_usage usage, user['key_id']
>
> end
>
> puts
> "§=================================================================================§"
>
>
>
> --
>
> Michael Holt
>
>
>
>
> _______________________________________________
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
>
>
>
> --
> @tsantero
> Technical Evangelist
> Basho Technologies
> 347-571-3995
>
>
> _______________________________________________
> riak-users mailing list
> riak-users@lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to