mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Adds RESTlike methods to Plan of Planning service
Adds destroy, save, create and update methods to Plan model of OpenStack Planning service.
This commit is contained in:
parent
e4547ad987
commit
5c8457d7e0
2 changed files with 39 additions and 0 deletions
|
@ -52,6 +52,29 @@ module Fog
|
|||
def remove_role(role_uuid)
|
||||
service.remove_role_from_plan(uuid, role_uuid)
|
||||
end
|
||||
|
||||
def destroy
|
||||
requires :uuid
|
||||
service.delete_plan(uuid)
|
||||
true
|
||||
end
|
||||
|
||||
def save
|
||||
requires :name
|
||||
identity ? update : create
|
||||
end
|
||||
|
||||
def create
|
||||
requires :name
|
||||
merge_attributes(service.create_plan(self.attributes).body)
|
||||
self
|
||||
end
|
||||
|
||||
def update(parameters=nil)
|
||||
requires :uuid
|
||||
merge_attributes(service.patch_plan(uuid, parameters).body)
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,5 +31,21 @@ Shindo.tests("Fog::Openstack[:planning] | plan", ['openstack']) do
|
|||
tests('#remove_role').succeeds do
|
||||
@instance.remove_role(@role['uuid'])
|
||||
end
|
||||
|
||||
tests('#save').succeeds do
|
||||
@instance.save
|
||||
end
|
||||
|
||||
tests('#update').succeeds do
|
||||
@instance.update
|
||||
end
|
||||
|
||||
tests('#destroy').succeeds do
|
||||
@instance.destroy
|
||||
end
|
||||
|
||||
tests('#create').succeeds do
|
||||
@instance.create
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue