class Openstack::Client::Storage::ObjectStoreURL

Extracts the object store URL from cached payload mathing the specified region.

Attributes

authenticator[R]
container[R]
region[R]

Public Class Methods

new(authenticator:, container:, region:) click to toggle source
# File lib/openstack/client/storage/object_store_url.rb, line 17
def initialize(authenticator:, container:, region:)
  @authenticator = authenticator
  @container = container
  @region = region
  authenticate
end

Public Instance Methods

call() click to toggle source
# File lib/openstack/client/storage/object_store_url.rb, line 24
def call
  "#{regionized_object_store_url}/#{container}"
end

Private Instance Methods

catalog_collection() click to toggle source
# File lib/openstack/client/storage/object_store_url.rb, line 42
def catalog_collection
  read_from_cache.dig('body', 'token', 'catalog') || []
end
object_store_endpoints() click to toggle source
# File lib/openstack/client/storage/object_store_url.rb, line 36
def object_store_endpoints
  catalog_collection.find do |catalog|
    catalog.fetch('type') == 'object-store'
  end.fetch('endpoints', [])
end
regionized_object_store_url() click to toggle source
# File lib/openstack/client/storage/object_store_url.rb, line 30
def regionized_object_store_url
  object_store_endpoints.find do |endpoint|
    endpoint.fetch('region') == region
  end.fetch('url')
end