Sha256: 4d664b49eb72114cbf857919c05a18ccfd5131a7c6be653c056b59b5c37c6f40

Contents?: true

Size: 1.93 KB

Versions: 1

Compression:

Stored size: 1.93 KB

Contents

module O3P
  include Message::ORiN3::Provider::V1::AutoGenerated
end

module O3
  include Design::ORiN3::Common::V1::AutoGenerated
  include Message::ORiN3::Provider::V1::AutoGenerated::ResourceOpener
end

module Grpc
  module Client
    module ORiN3
      module Provider
        module ORiN3ResourceOpener
          def open(argument = nil)
            argument = argument.nil? ? {} : argument
            begin
              resource_opener = O3::ResourceOpenerService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel)
              request = O3::OpenRequest.new(common: O3P::CommonRequest.new, id: @internal_id, argument: ORiN3BinaryConverter.from_dictionary_to_binary(argument))
              response = resource_opener.open(request)
              if (response.common.result_code != :SUCCEEDED)
                raise MessageClientError.new(response.common.result_code, response.common.detail)
              end
            rescue MessageClientError => ee
              raise
            rescue StandardError => e
              raise MessageClientError.new(e)
            end            
          end

          def close(argument = nil)
            argument = argument.nil? ? {} : argument
            begin
              resource_opener = O3::ResourceOpenerService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel)
              request = O3::CloseRequest.new(common: O3P::CommonRequest.new, id: @internal_id, argument: ORiN3BinaryConverter.from_dictionary_to_binary(argument))
              response = resource_opener.close(request)
              if (response.common.result_code != :SUCCEEDED)
                raise MessageClientError.new(response.common.result_code, response.common.detail)
              end
            rescue MessageClientError
              raise
            rescue StandardError => e
              raise MessageClientError.new(e)
            end            
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grpc-orin3-provider-1.0.0 lib/grpc/client/orin3/provider/orin3_resource_opener.rb