Sha256: 7aa85129508b7a37469ede3369fd5e0c5729070b70b11b8fcbfaaa9f2dc7c29b
Contents?: true
Size: 1.72 KB
Versions: 2
Compression:
Stored size: 1.72 KB
Contents
require 'fog' require 'retries' module SimpleDeploy class AWS class SimpleDB include Helpers def initialize @config = SimpleDeploy.config @connect = Fog::AWS::SimpleDB.new connection_args end def retry_options {:max_retries => 3, :rescue => Excon::Errors::ServiceUnavailable, :base_sleep_seconds => 10, :max_sleep_seconds => 60} end def domains with_retries(retry_options) do @connect.list_domains.body['Domains'] end end def domain_exists?(domain) domains.include? domain end def create_domain(domain) with_retries(retry_options) do @connect.create_domain(domain) unless domain_exists?(domain) end end def put_attributes(domain, key, attributes, options) with_retries(retry_options) do @connect.put_attributes domain, key, attributes, options end end def select(query) options = { 'ConsistentRead' => true } data = {} next_token = nil while true options.merge! 'NextToken' => next_token chunk = with_retries(retry_options) do @connect.select(query, options).body end data.merge! chunk['Items'] next_token = chunk['NextToken'] break unless next_token end data end def delete(domain, key) with_retries(retry_options) do @connect.delete_attributes domain, key end end def delete_items(domain, key, attributes) with_retries(retry_options) do @connect.delete_attributes domain, key, attributes end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
simple_deploy-0.10.2 | lib/simple_deploy/aws/simpledb.rb |
simple_deploy-0.10.1 | lib/simple_deploy/aws/simpledb.rb |