class SDM::Roles
Each user can be a member of one Role or composite role.
grant access to the combined resources associated with a set of child roles.
type of Role which have no resource associations of their own, but instead
list of resources which they grant access to. Composite roles are a special
Roles are tools for controlling user access to resources. Each Role holds a
def create(
def create( role, deadline: nil ) req = V1::RoleCreateRequest.new() req.role = Plumbing::role_to_plumbing(role) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.get_metadata("Roles.Create", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::error_to_porcelain(exception) end break end resp = RoleCreateResponse.new() resp.meta = Plumbing::create_response_metadata_to_porcelain(plumbing_response.meta) resp.role = Plumbing::role_to_porcelain(plumbing_response.role) resp.rate_limit = Plumbing::rate_limit_metadata_to_porcelain(plumbing_response.rate_limit) resp end
def delete(
def delete( id, deadline: nil ) req = V1::RoleDeleteRequest.new() req.id = id tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.get_metadata("Roles.Delete", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::error_to_porcelain(exception) end break end resp = RoleDeleteResponse.new() resp.meta = Plumbing::delete_response_metadata_to_porcelain(plumbing_response.meta) resp.rate_limit = Plumbing::rate_limit_metadata_to_porcelain(plumbing_response.rate_limit) resp end
def get(
def get( id, deadline: nil ) req = V1::RoleGetRequest.new() req.id = id tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get(req, metadata: @parent.get_metadata("Roles.Get", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::error_to_porcelain(exception) end break end resp = RoleGetResponse.new() resp.meta = Plumbing::get_response_metadata_to_porcelain(plumbing_response.meta) resp.role = Plumbing::role_to_porcelain(plumbing_response.role) resp.rate_limit = Plumbing::rate_limit_metadata_to_porcelain(plumbing_response.rate_limit) resp end
def initialize(host, insecure, parent)
def initialize(host, insecure, parent) begin if insecure @stub = V1::Roles::Stub.new(host, :this_channel_is_insecure) else cred = GRPC::Core::ChannelCredentials.new() @stub = V1::Roles::Stub.new(host, cred) end rescue => exception raise Plumbing::error_to_porcelain(exception) end @parent = parent end
def list(
def list( filter, *args, deadline: nil ) req = V1::RoleListRequest.new() req.meta = V1::ListRequestMetadata.new() page_size_option = @parent._test_options["PageSize"] if page_size_option.is_a? Integer req.meta.limit = page_size_option end req.filter = Plumbing::quote_filter_args(filter, *args) resp = Enumerator::Generator.new { |g| tries = 0 loop do begin plumbing_response = @stub.list(req, metadata: @parent.get_metadata("Roles.List", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::error_to_porcelain(exception) end tries = 0 plumbing_response.roles.each do |plumbing_item| g.yield Plumbing::role_to_porcelain(plumbing_item) end break if plumbing_response.meta.next_cursor == "" req.meta.cursor = plumbing_response.meta.next_cursor end } resp end
def update(
def update( role, deadline: nil ) req = V1::RoleUpdateRequest.new() req.role = Plumbing::role_to_plumbing(role) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.update(req, metadata: @parent.get_metadata("Roles.Update", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::error_to_porcelain(exception) end break end resp = RoleUpdateResponse.new() resp.meta = Plumbing::update_response_metadata_to_porcelain(plumbing_response.meta) resp.role = Plumbing::role_to_porcelain(plumbing_response.role) resp.rate_limit = Plumbing::rate_limit_metadata_to_porcelain(plumbing_response.rate_limit) resp end