Class: SDM::RoleGrants
- Inherits:
-
Object
- Object
- SDM::RoleGrants
- Defined in:
- lib/svc.rb
Overview
RoleGrants represent relationships between composite roles and the roles that make up those composite roles. When a composite role is attached to another role, the permissions granted to members of the composite role are augmented to include the permissions granted to members of the attached role.
Instance Method Summary collapse
-
#create(role_grant, deadline: nil) ⇒ Object
Create registers a new RoleGrant.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a RoleGrant by ID.
-
#get(id, deadline: nil) ⇒ Object
Get reads one RoleGrant by ID.
-
#initialize(host, insecure, parent) ⇒ RoleGrants
constructor
A new instance of RoleGrants.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of RoleGrants matching a given set of criteria.
Constructor Details
#initialize(host, insecure, parent) ⇒ RoleGrants
Returns a new instance of RoleGrants.
992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 |
# File 'lib/svc.rb', line 992 def initialize(host, insecure, parent) begin if insecure @stub = V1::RoleGrants::Stub.new(host, :this_channel_is_insecure) else cred = GRPC::Core::ChannelCredentials.new() @stub = V1::RoleGrants::Stub.new(host, cred) end rescue => exception raise Plumbing::error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(role_grant, deadline: nil) ⇒ Object
Create registers a new RoleGrant.
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 |
# File 'lib/svc.rb', line 1007 def create( role_grant, deadline: nil ) req = V1::RoleGrantCreateRequest.new() req.role_grant = Plumbing::role_grant_to_plumbing(role_grant) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("RoleGrants.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 = RoleGrantCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.role_grant = Plumbing::role_grant_to_porcelain(plumbing_response.role_grant) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a RoleGrant by ID.
1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 |
# File 'lib/svc.rb', line 1067 def delete( id, deadline: nil ) req = V1::RoleGrantDeleteRequest.new() req.id = id tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("RoleGrants.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 = RoleGrantDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one RoleGrant by ID.
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 |
# File 'lib/svc.rb', line 1037 def get( id, deadline: nil ) req = V1::RoleGrantGetRequest.new() req.id = id tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get(req, metadata: @parent.("RoleGrants.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 = RoleGrantGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.role_grant = Plumbing::role_grant_to_porcelain(plumbing_response.role_grant) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of RoleGrants matching a given set of criteria.
1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 |
# File 'lib/svc.rb', line 1096 def list( filter, *args, deadline: nil ) req = V1::RoleGrantListRequest.new() req. = V1::ListRequestMetadata.new() page_size_option = @parent.["PageSize"] if page_size_option.is_a? Integer req..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.("RoleGrants.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.role_grants.each do |plumbing_item| g.yield Plumbing::role_grant_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |