Class: SDM::AccountGrants
- Inherits:
-
Object
- Object
- SDM::AccountGrants
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
AccountGrants assign a resource directly to an account, giving the account the permission to connect to that resource.
See AccountGrant.
Instance Method Summary collapse
-
#create(account_grant, deadline: nil) ⇒ Object
Create registers a new AccountGrant.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a AccountGrant by ID.
-
#get(id, deadline: nil) ⇒ Object
Get reads one AccountGrant by ID.
-
#initialize(host, insecure, parent) ⇒ AccountGrants
constructor
A new instance of AccountGrants.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of AccountGrants matching a given set of criteria.
Constructor Details
#initialize(host, insecure, parent) ⇒ AccountGrants
Returns a new instance of AccountGrants.
180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/svc.rb', line 180 def initialize(host, insecure, parent) begin if insecure @stub = V1::AccountGrants::Stub.new(host, :this_channel_is_insecure) else cred = GRPC::Core::ChannelCredentials.new() @stub = V1::AccountGrants::Stub.new(host, cred) end rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(account_grant, deadline: nil) ⇒ Object
Create registers a new AccountGrant.
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/svc.rb', line 195 def create( account_grant, deadline: nil ) req = V1::AccountGrantCreateRequest.new() req.account_grant = Plumbing::convert_account_grant_to_plumbing(account_grant) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("AccountGrants.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 = AccountGrantCreateResponse.new() resp.account_grant = Plumbing::convert_account_grant_to_porcelain(plumbing_response.account_grant) resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a AccountGrant by ID.
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/svc.rb', line 255 def delete( id, deadline: nil ) req = V1::AccountGrantDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("AccountGrants.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 = AccountGrantDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one AccountGrant by ID.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/svc.rb', line 225 def get( id, deadline: nil ) req = V1::AccountGrantGetRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get(req, metadata: @parent.("AccountGrants.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 = AccountGrantGetResponse.new() resp.account_grant = Plumbing::convert_account_grant_to_porcelain(plumbing_response.account_grant) resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of AccountGrants matching a given set of criteria.
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/svc.rb', line 284 def list( filter, *args, deadline: nil ) req = V1::AccountGrantListRequest.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.("AccountGrants.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.account_grants.each do |plumbing_item| g.yield Plumbing::convert_account_grant_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |