Class: ClowderCommonRuby::ObjectStoreConfig

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/clowder-common-ruby/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ ObjectStoreConfig

Returns a new instance of ObjectStoreConfig.



316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/clowder-common-ruby/types.rb', line 316

def initialize(attributes)
  super
  raise 'The input argument (attributes) must be a hash' if (!attributes || !attributes.is_a?(Hash))

  attributes = attributes.each_with_object({}) do |(k, v), h|
    warn "The input [#{k}] is invalid" unless valid_keys.include?(k.to_sym)
    h[k.to_sym] = v
  end

  @buckets = []
  attributes.fetch(:buckets, []).each do |attr|
    @buckets << ObjectStoreBucket.new(attr)
  end
end

Instance Attribute Details

#bucketsObject

Returns the value of attribute buckets.



314
315
316
# File 'lib/clowder-common-ruby/types.rb', line 314

def buckets
  @buckets
end

Instance Method Details

#valid_keysObject



331
332
333
334
335
336
337
338
339
340
# File 'lib/clowder-common-ruby/types.rb', line 331

def valid_keys
  [].tap do |keys|
    keys << :buckets
    keys << :accessKey
    keys << :secretKey
    keys << :hostname
    keys << :port
    keys << :tls
  end
end