class Canistor::Storage::Bucket::Settings
Stores settings for the bucket.
+allow_access_keys+: Allow full access to the bucket using these access keys. +replicate_to+: Replicate all updates to the bucket to this bucket. +versioned+: Use versioning on the bucket.
Public Class Methods
new(settings = {})
click to toggle source
# File lib/canistor/storage/bucket/settings.rb, line 13 def initialize(settings = {}) clear update(settings) end
Public Instance Methods
access_keys()
click to toggle source
# File lib/canistor/storage/bucket/settings.rb, line 31 def access_keys @access_keys end
allow_access_keys(access_key_ids)
click to toggle source
# File lib/canistor/storage/bucket/settings.rb, line 43 def allow_access_keys(access_key_ids) @access_keys.merge(access_key_ids) end
clear()
click to toggle source
# File lib/canistor/storage/bucket/settings.rb, line 75 def clear @access_keys = Set.new @replicates_to = [] @versioned = false end
replicate_to(replicates_to)
click to toggle source
# File lib/canistor/storage/bucket/settings.rb, line 51 def replicate_to(replicates_to) @replicates_to = replicates_to end
replicate_to_buckets()
click to toggle source
# File lib/canistor/storage/bucket/settings.rb, line 55 def replicate_to_buckets return [] unless replicated? @replicates_to.map do |location| if bucket = Canistor.store.dig(*location.split(':')) bucket else raise( Canistor::ConfigurationError, "Can't locate bucket `#{location}' when trying to replicate " \ "object. Please make sure the replication location is in the " \ "form of region:bucket and configured in Canistor." ) end end end
replicated?()
click to toggle source
# File lib/canistor/storage/bucket/settings.rb, line 47 def replicated? @replicates_to && !@replicates_to.empty? end
replicates_to()
click to toggle source
# File lib/canistor/storage/bucket/settings.rb, line 35 def replicates_to @replicates_to end
update(settings)
click to toggle source
# File lib/canistor/storage/bucket/settings.rb, line 18 def update(settings) case settings # Old style setup allowed settings to be an array of allowed access # keys. when Set, Array allow_access_keys(settings) else settings.each do |name, value| public_send("#{name}", value) end end end
versioned(versioned)
click to toggle source
# File lib/canistor/storage/bucket/settings.rb, line 71 def versioned(versioned) @versioned = versioned end
versioned?()
click to toggle source
# File lib/canistor/storage/bucket/settings.rb, line 39 def versioned? !!@versioned end