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.
4954 4955 4956 4957 4958 4959 4960 4961 |
# File 'lib/svc.rb', line 4954 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.
4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 |
# File 'lib/svc.rb', line 4964 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.
5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 |
# File 'lib/svc.rb', line 5058 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.
4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 |
# File 'lib/svc.rb', line 4994 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.
5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 |
# File 'lib/svc.rb', line 5087 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.
5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 |
# File 'lib/svc.rb', line 5028 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 |