Class: SDM::AccountAttachments
- Inherits:
-
Object
- Object
- SDM::AccountAttachments
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
AccountAttachments assign an account to a role.
See AccountAttachment.
Instance Method Summary collapse
-
#create(account_attachment, deadline: nil) ⇒ Object
Create registers a new AccountAttachment.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a AccountAttachment by ID.
-
#get(id, deadline: nil) ⇒ Object
Get reads one AccountAttachment by ID.
-
#initialize(channel, parent) ⇒ AccountAttachments
constructor
A new instance of AccountAttachments.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of AccountAttachments matching a given set of criteria.
Constructor Details
#initialize(channel, parent) ⇒ AccountAttachments
Returns a new instance of AccountAttachments.
224 225 226 227 228 229 230 231 |
# File 'lib/svc.rb', line 224 def initialize(channel, parent) begin @stub = V1::AccountAttachments::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(account_attachment, deadline: nil) ⇒ Object
Create registers a new AccountAttachment.
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/svc.rb', line 234 def create( , deadline: nil ) req = V1::AccountAttachmentCreateRequest.new() req. = Plumbing::() tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("AccountAttachments.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 = AccountAttachmentCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a AccountAttachment by ID.
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/svc.rb', line 298 def delete( id, deadline: nil ) req = V1::AccountAttachmentDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("AccountAttachments.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 = AccountAttachmentDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one AccountAttachment by ID.
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/svc.rb', line 264 def get( id, deadline: nil ) req = V1::AccountAttachmentGetRequest.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.("AccountAttachments.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 = AccountAttachmentGetResponse.new() resp. = Plumbing::(plumbing_response.) 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 AccountAttachments matching a given set of criteria.
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/svc.rb', line 327 def list( filter, *args, deadline: nil ) req = V1::AccountAttachmentListRequest.new() req. = V1::ListRequestMetadata.new() page_size_option = @parent.["PageSize"] if page_size_option.is_a? Integer req..limit = page_size_option 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.("AccountAttachments.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..each do |plumbing_item| g.yield Plumbing::(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |