Method: SDM::Roles#update

Defined in:
lib/svc.rb

#update(role, deadline: nil) ⇒ Object

Update patches a Role by ID.



1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
# File 'lib/svc.rb', line 1292

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.meta = Plumbing::(plumbing_response.meta)
  resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp
end