class RoleBinding
Public Class Methods
new(namespace=nil)
click to toggle source
Calls superclass method
OcpApi::new
# File lib/base/v1/ocpapi/RoleBinding.rb, line 28 def initialize(namespace=nil) unless namespace.nil? super("rolebindings",namespace) @users = Array.new @subjects = Array.new @namespace = namespace else super("rolebindings") end end
Public Instance Methods
create_role_binding(user, role)
click to toggle source
# File lib/base/v1/ocpapi/RoleBinding.rb, line 39 def create_role_binding(user, role) data = create(create_body(user, role)) return data end
to_s()
click to toggle source
# File lib/base/v1/ocpapi/RoleBinding.rb, line 50 def to_s data = nil data = list return data end
update_role_binding(user, role)
click to toggle source
# File lib/base/v1/ocpapi/RoleBinding.rb, line 44 def update_role_binding(user, role) data = update(create_body(user, role), role) return data end
Private Instance Methods
create_body(user, role)
click to toggle source
# File lib/base/v1/ocpapi/RoleBinding.rb, line 58 def create_body(user, role) @users.push(user) subj = ObjectReference.new subj.kind = "User" subj.name = user @subjects << subj.get_hash roleRef = ObjectReference.new roleRef.name = role objMeta = ObjectMeta.new objMeta.name = role objMeta.namespace = @namespace objMeta.resourceversion = "1001" body = { 'metadata' => objMeta.get_hash, 'groupNames' => nil, 'userNames' => @users, 'subjects' => @subjects, 'roleRef' => roleRef.get_hash } return body end