class Fog::Identity::OpenStack::V3::Domains

Public Instance Methods

all(options = {}) click to toggle source
# File lib/fog/openstack/models/identity_v3/domains.rb, line 14
def all(options = {})
  cached_domain, expires = @@cache[{token: service.auth_token, options: options}]
  return cached_domain if cached_domain && expires > Time.now
  domain_to_cache = load_response(service.list_domains(options), 'domains')
  @@cache[{token: service.auth_token, options: options}] = domain_to_cache, Time.now + 30 # 30-second TTL
  return domain_to_cache
end
auth_domains(options = {}) click to toggle source
# File lib/fog/openstack/models/identity_v3/domains.rb, line 27
def auth_domains(options = {})
  load(service.auth_domains(options).body['domains'])
end
create(attributes) click to toggle source
Calls superclass method
# File lib/fog/openstack/models/identity_v3/domains.rb, line 22
def create(attributes)
  @@cache.clear if @@cache
  super(attributes)
end
destroy(id) click to toggle source
# File lib/fog/openstack/models/identity_v3/domains.rb, line 41
def destroy(id)
  @@cache.clear if @@cache
  domain = self.find_by_id(id)
  domain.destroy
end
find_by_id(id) click to toggle source
# File lib/fog/openstack/models/identity_v3/domains.rb, line 31
def find_by_id(id)
  cached_domain, expires = @@cache[{token: service.auth_token, id: id}]
  return cached_domain if cached_domain && expires > Time.now
  domain_hash = service.get_domain(id).body['domain']
  domain_to_cache = Fog::Identity::OpenStack::V3::Domain.new(
      domain_hash.merge(:service => service))
  @@cache[{token: service.auth_token, id: id}] = domain_to_cache, Time.now + 30 # 30-second TTL
  return domain_to_cache
end