mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[Openstack|Compute] Usage Requests
This commit is contained in:
parent
ed44c02742
commit
8974ff0de6
2 changed files with 49 additions and 0 deletions
24
lib/fog/openstack/requests/compute/get_usage.rb
Normal file
24
lib/fog/openstack/requests/compute/get_usage.rb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class OpenStack
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def get_usage(tenant_id, date_start, date_end)
|
||||||
|
# TODO: Handle nasty date formats
|
||||||
|
request(
|
||||||
|
:expects => [200, 203],
|
||||||
|
:method => 'GET',
|
||||||
|
:path => "os-simple-tenant-usage/#{tenant_id}?start=#{date_start.iso8601}&end=#{date_end.iso8601}"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
class Mock
|
||||||
|
|
||||||
|
# TODO: Mocks to go here
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
25
lib/fog/openstack/requests/compute/list_usage.rb
Normal file
25
lib/fog/openstack/requests/compute/list_usage.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class OpenStack
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def list_usage(date_start, date_end, detailed=false)
|
||||||
|
# TODO: Handle nasty date formats
|
||||||
|
detailed = (detailed ? "1" : "0")
|
||||||
|
request(
|
||||||
|
:expects => [200, 203],
|
||||||
|
:method => 'GET',
|
||||||
|
:path => "os-simple-tenant-usage?start=#{date_start.iso8601}&end=#{date_end.iso8601}&detailed=#{detailed}"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
class Mock
|
||||||
|
|
||||||
|
# TODO: Mocks to go here
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue