def action(action_name, path = "/", options = {})
      retries = 0

      begin
        # If options given in place of path assume /
        options, path = path, "/" if path.is_a?(Hash) && options.empty?
        request(:post, path, {}, options.merge("Action" => action_name)).response.tap do |response|
          unless response.success?
            element = response.doc.xpath("//Error")
            raise AwsActionError.new(element.xpath("Type").text, element.xpath("Code").text, element.xpath("Message").text, response.http_response.status)
          end
        end
      rescue AwsActionError => e
        if retries < 2 && (500..599).include?(e.status.to_i)
          retries += 1
          retry
        else
          raise e
        end
      end
    end
def action(action_name, path = "/", options = {})
      retries = 0

      begin
        # If options given in place of path assume /
        options, path = path, "/" if path.is_a?(Hash) && options.empty?
        request(:post, path, {}, options.merge("Action" => action_name)).response.tap do |response|
          unless response.success?
            element = response.doc.xpath("//Error")
            raise AwsActionError.new(element.xpath("Type").text, element.xpath("Code").text, element.xpath("Message").text, response.http_response.status)
          end
        end
      rescue AwsActionError => e
        if retries < 2 && (500..599).include?(e.status.to_i)
          retries += 1
          retry
        else
          raise e
        end
      end
    end
Call an AWS API with the given name at the given path. An optional hash
 of options can be passed as arguments for the API call.

 @note The API call will be automatically retried *once* if the returned status code is
   in the 500 range.

 @param [String] action_name
 @param [String] path
 @param [Hash] options
 @return [AwsResponse]
 @raise [AwsActionError] if the response is not successful. AWS error
   information can be extracted from the exception.