class Matterhorn::Endpoint::Acl
Matterhorn::Endpoint::Acl
===¶ ↑
Public Instance Methods
create(name, acl)
click to toggle source
Create a new acl with name and acl list.
# File lib/matterhorn/endpoint/acl.rb, line 14 def create(name, acl) ret_acl = false begin split_response http_endpoint_client.post( "acl-manager/acl", { 'name' => name.to_s, 'acl' => acl.to_json } ) ret_acl = JSON.parse(response_body) rescue => ex exception_handler('create', ex, { 400 => "Unable to parse the ACL!", 409 => "An ACL with the same name[#{name}] already exists!" } ) end ret_acl end
delete(acl_id)
click to toggle source
————————————————————————————- delete —
# File lib/matterhorn/endpoint/acl.rb, line 89 def delete(acl_id) done = false begin split_response http_endpoint_client.delete( "acl-manager/acl/#{acl_id}" ) done = true rescue => ex exception_handler('create', ex, { 404 => "The Acl[#{acl_id}] has not been found!", 409 => "The Acl[#{acl_id}] could not be deleted, there are still references on it!" } ) end done end
get(acl_id)
click to toggle source
# File lib/matterhorn/endpoint/acl.rb, line 49 def get(acl_id) acl = {} begin split_response http_endpoint_client.get( "acl-manager/acl/#{acl_id}" ) acl = JSON.parse(response_body) rescue => ex exception_handler('index', ex, { 404 => "The Acl[#{acl_id}] has not been found!" } ) end acl end
index()
click to toggle source
————————————————————————————— read —
# File lib/matterhorn/endpoint/acl.rb, line 35 def index acls = {} begin split_response http_endpoint_client.get( "acl-manager/acl/acls.json" ) acls = JSON.parse(response_body) rescue => ex exception_handler('index', ex, {}) end acls end
update(acl_id, name, acl)
click to toggle source
————————————————————————————- update —
# File lib/matterhorn/endpoint/acl.rb, line 68 def update(acl_id, name, acl) ret_acl = false begin split_response http_endpoint_client.put( "acl-manager/acl/#{acl_id}", { 'name' => name.to_s, 'acl' => acl.to_json } ) ret_acl = JSON.parse(response_body) rescue => ex exception_handler('create', ex, { 400 => "Unable to parse the ACL!", 404 => "The Acl[#{acl_id}] has not been found!" } ) end ret_acl end