class SDM::AccountAttachments

AccountAttachments assign an account to a role or composite role.

Public Class Methods

new(host, insecure, parent) click to toggle source
# File lib/svc.rb, line 29
def initialize(host, insecure, parent)
    begin
        if insecure
            @stub = V1::AccountAttachments::Stub.new(host, :this_channel_is_insecure)
        else
            cred = GRPC::Core::ChannelCredentials.new()
            @stub = V1::AccountAttachments::Stub.new(host, cred)
        end
    rescue => exception
        raise Plumbing::convert_error_to_porcelain(exception)
    end
    @parent = parent
end

Public Instance Methods

create( account_attachment \ , deadline:nil) click to toggle source

Create registers a new AccountAttachment.

# File lib/svc.rb, line 43
        def create(
account_attachment \
,
 deadline:nil)
            req = V1::AccountAttachmentCreateRequest.new()
                        
            req.account_attachment = Plumbing::convert_account_attachment_to_plumbing(account_attachment)
            tries = 0
            plumbing_response = nil
            loop do
                begin
                    plumbing_response = @stub.create(req, metadata: @parent.get_metadata('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.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)
            resp.account_attachment = Plumbing::convert_account_attachment_to_porcelain(plumbing_response.account_attachment)
            resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
            resp
        end
delete( id \ , deadline:nil) click to toggle source

Delete removes a AccountAttachment by ID.

# File lib/svc.rb, line 105
        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.get_metadata('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.meta = Plumbing::convert_delete_response_metadata_to_porcelain(plumbing_response.meta)
            resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
            resp
        end
get( id \ , deadline:nil) click to toggle source

Get reads one AccountAttachment by ID.

# File lib/svc.rb, line 74
        def get(
id \
,
 deadline:nil)
            req = V1::AccountAttachmentGetRequest.new()
                        
            req.id = (id)
            tries = 0
            plumbing_response = nil
            loop do
                begin
                    plumbing_response = @stub.get(req, metadata: @parent.get_metadata('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.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)
            resp.account_attachment = Plumbing::convert_account_attachment_to_porcelain(plumbing_response.account_attachment)
            resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
            resp
        end
list( filter \ , *args, deadline:nil) click to toggle source

List gets a list of AccountAttachments matching a given set of criteria.

# File lib/svc.rb, line 135
        def list(
filter \
,
*args,
 deadline:nil)
            req = V1::AccountAttachmentListRequest.new()
            req.meta = V1::ListRequestMetadata.new()
            page_size_option = @parent._test_options['PageSize']
            if page_size_option.is_a? Integer
                req.meta.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.get_metadata('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.account_attachments.each do |plumbing_item|
                        g.yield Plumbing::convert_account_attachment_to_porcelain(plumbing_item)
                    end
                    break if plumbing_response.meta.next_cursor == ""
                    req.meta.cursor = plumbing_response.meta.next_cursor
                end
            }
            resp
        end