require_relative '../../../../../gen/Design.ORiN3.Common/V1/orin3_common_pb' require_relative '../../../../../gen/Message.ORiN3.Provider/V1/orin3_resource_opener_pb' require_relative '../../../../../gen/Message.ORiN3.Provider/V1/orin3_resource_opener_services_pb' require_relative '../../../../../gen/Message.ORiN3.Provider/V1/orin3_child_creator_pb' require_relative '../../../../../gen/Message.ORiN3.Provider/V1/orin3_child_creator_services_pb' require_relative '../../../../../gen/Message.ORiN3.Provider/V1/orin3_variable_pb' require_relative '../../../../../gen/Message.ORiN3.Provider/V1/orin3_variable_services_pb' require_relative '../message_client_error' require_relative 'orin3_base_object' require_relative 'orin3_variable' require_relative 'orin3_child_creator' require_relative 'orin3_resource_opener' module O3P include Message::ORiN3::Provider::V1::AutoGenerated end module O3 include Design::ORiN3::Common::V1::AutoGenerated include Message::ORiN3::Provider::V1::AutoGenerated::ResourceOpener include Message::ORiN3::Provider::V1::AutoGenerated::ChildCreator include Message::ORiN3::Provider::V1::AutoGenerated::Variable end module Grpc module Client module ORiN3 module Provider class ORiN3Controller < ORiN3BaseObject include ORiN3ChildCreator include ORiN3ResourceOpener attr_reader :created_datetime def initialize(channel, internal_id, created_datetime) @created_datetime = created_datetime super(channel, internal_id) end def connect(argument = nil) argument = argument.nil? ? {} : argument open(argument) end def disconnect(argument = nil) argument = argument.nil? ? {} : argument close(argument) end def create_controller(name, type_name, option) begin controller = O3::ControllerCreatorService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel) request = O3::CreateControllerRequest.new(common: O3P::CommonRequest.new, parent_id: @internal_id, name: name, type_name: type_name, option: option) response = controller.create_controller(request) if (response.common.result_code != :SUCCEEDED) raise MessageClientError.new(response.common.result_code, response.common.detail) end return ORiN3Controller.new(@channel, response.id, response.created_datetime) rescue MessageClientError raise rescue StandardError => e raise MessageClientError.new(e) end end end end end end end