Class: SDM::Roles
Overview
A Role has a list of access rules which determine which Resources the members of the Role have access to. An Account can be a member of multiple Roles via AccountAttachments.
See Role.
Instance Method Summary collapse
-
#create(role, deadline: nil) ⇒ Object
Create registers a new Role.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a Role by ID.
-
#get(id, deadline: nil) ⇒ Object
Get reads one Role by ID.
-
#initialize(channel, parent) ⇒ Roles
constructor
A new instance of Roles.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Roles matching a given set of criteria.
-
#update(role, deadline: nil) ⇒ Object
Update replaces all the fields of a Role by ID.
Constructor Details
#initialize(channel, parent) ⇒ Roles
Returns a new instance of Roles.
4148 4149 4150 4151 4152 4153 4154 4155 |
# File 'lib/svc.rb', line 4148 def initialize(channel, parent) begin @stub = V1::Roles::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(role, deadline: nil) ⇒ Object
Create registers a new Role.
4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 |
# File 'lib/svc.rb', line 4158 def create( role, deadline: nil ) req = V1::RoleCreateRequest.new() req.role = Plumbing::convert_role_to_plumbing(role) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("Roles.Create", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = RoleCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a Role by ID.
4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 |
# File 'lib/svc.rb', line 4252 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.("Roles.Delete", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = RoleDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one Role by ID.
4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 |
# File 'lib/svc.rb', line 4188 def get( id, deadline: nil ) req = V1::RoleGetRequest.new() if not @parent.snapshot_time.nil? req. = V1::GetRequestMetadata.new() req..snapshot_at = @parent.snapshot_time end req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get(req, metadata: @parent.("Roles.Get", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = RoleGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Roles matching a given set of criteria.
4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 |
# File 'lib/svc.rb', line 4281 def list( filter, *args, deadline: nil ) req = V1::RoleListRequest.new() req. = V1::ListRequestMetadata.new() if @parent.page_limit > 0 req..limit = @parent.page_limit end if not @parent.snapshot_time.nil? req..snapshot_at = @parent.snapshot_time 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.("Roles.List", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end tries = 0 plumbing_response.roles.each do |plumbing_item| g.yield Plumbing::convert_role_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |
#update(role, deadline: nil) ⇒ Object
Update replaces all the fields of a Role by ID.
4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 |
# File 'lib/svc.rb', line 4222 def update( role, deadline: nil ) req = V1::RoleUpdateRequest.new() req.role = Plumbing::convert_role_to_plumbing(role) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.update(req, metadata: @parent.("Roles.Update", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = RoleUpdateResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role) resp end |