Class: Fog::Models::ProfitBricks::Base
- Inherits:
-
Fog::Model
- Object
- Fog::Model
- Fog::Models::ProfitBricks::Base
show all
- Defined in:
- lib/fog/profitbricks/models/base.rb
Direct Known Subclasses
Compute::ProfitBricks::ContractResource, Compute::ProfitBricks::Datacenter, Compute::ProfitBricks::FirewallRule, Compute::ProfitBricks::Flavor, Compute::ProfitBricks::Group, Compute::ProfitBricks::Image, Compute::ProfitBricks::IpBlock, Compute::ProfitBricks::Lan, Compute::ProfitBricks::LoadBalancer, Compute::ProfitBricks::Location, Compute::ProfitBricks::Nic, Compute::ProfitBricks::Region, Compute::ProfitBricks::Request, Compute::ProfitBricks::Resource, Compute::ProfitBricks::Server, Compute::ProfitBricks::Share, Compute::ProfitBricks::Snapshot, Compute::ProfitBricks::User, Compute::ProfitBricks::Volume
Instance Method Summary
collapse
Instance Method Details
#failed? ⇒ Boolean
31
32
33
|
# File 'lib/fog/profitbricks/models/base.rb', line 31
def failed?
request_status(request_id) == 'FAILED'
end
|
#ready? ⇒ Boolean
27
28
29
|
# File 'lib/fog/profitbricks/models/base.rb', line 27
def ready?
request_status(request_id) == 'DONE'
end
|
#request_status(request_id) ⇒ Object
22
23
24
25
|
# File 'lib/fog/profitbricks/models/base.rb', line 22
def request_status(request_id)
request = service.requests.get_status(request_id)
request.status
end
|
#wait_for(timeout = Fog.timeout, interval = Fog.interval, &block) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/fog/profitbricks/models/base.rb', line 5
def wait_for(timeout = Fog.timeout, interval = Fog.interval, &block)
reload_has_succeeded = false
duration = Fog.wait_for(timeout, interval) do if ready?
reload_has_succeeded = true
instance_eval(&block)
else
false
end
end
if reload_has_succeeded
return duration else
raise Fog::Errors::Error, "Reload failed, #{self.class} #{identity} not present."
end
end
|