Class: Fog::OpenStack::Identity::V3::Domains
- Inherits:
-
Collection
- Object
- Collection
- Collection
- Fog::OpenStack::Identity::V3::Domains
show all
- Defined in:
- lib/fog/openstack/identity/v3/models/domains.rb
Instance Attribute Summary
Attributes inherited from Collection
#response
Instance Method Summary
collapse
Methods inherited from Collection
#get, #load_response, #summary
Instance Method Details
#all(options = {}) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/fog/openstack/identity/v3/models/domains.rb', line 11
def all(options = {})
if service.openstack_cache_ttl > 0
cached_domain, expires = Fog::OpenStack::Identity::V3::Domain.cache[{:token => service.auth_token,
:options => options}]
return cached_domain if cached_domain && expires > Time.now
end
domain_to_cache = load_response(service.list_domains(options), 'domains')
if service.openstack_cache_ttl > 0
cache = Fog::OpenStack::Identity::V3::Domain.cache
cache[{:token => service.auth_token, :options => options}] = [domain_to_cache,
Time.now + service.openstack_cache_ttl]
Fog::OpenStack::Identity::V3::Domain.cache = cache
end
domain_to_cache
end
|
#auth_domains(options = {}) ⇒ Object
32
33
34
|
# File 'lib/fog/openstack/identity/v3/models/domains.rb', line 32
def auth_domains(options = {})
load(service.auth_domains(options).body['domains'])
end
|
#create(attributes) ⇒ Object
28
29
30
|
# File 'lib/fog/openstack/identity/v3/models/domains.rb', line 28
def create(attributes)
super(attributes)
end
|
#destroy(id) ⇒ Object
55
56
57
58
|
# File 'lib/fog/openstack/identity/v3/models/domains.rb', line 55
def destroy(id)
domain = find_by_id(id)
domain.destroy
end
|
#find_by_id(id) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/fog/openstack/identity/v3/models/domains.rb', line 36
def find_by_id(id)
if service.openstack_cache_ttl > 0
cached_domain, expires = Fog::OpenStack::Identity::V3::Domain.cache[{:token => service.auth_token,
:id => id}]
return cached_domain if cached_domain && expires > Time.now
end
domain_hash = service.get_domain(id).body['domain']
domain_to_cache = Fog::OpenStack::Identity::V3::Domain.new(
domain_hash.merge(:service => service)
)
if service.openstack_cache_ttl > 0
cache = Fog::OpenStack::Identity::V3::Domain.cache
cache[{:token => service.auth_token, :id => id}] = [domain_to_cache, Time.now + service.openstack_cache_ttl]
Fog::OpenStack::Identity::V3::Domain.cache = cache
end
domain_to_cache
end
|