Module: Grpc::Client::ORiN3::Provider::ORiN3ChildCreator

Included in:
ORiN3Controller, ORiN3Module, ORiN3RootObject
Defined in:
lib/grpc/client/orin3/provider/orin3_child_creator.rb

Instance Method Summary collapse

Instance Method Details

#create_file(name, type_name, option) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/grpc/client/orin3/provider/orin3_child_creator.rb', line 53

def create_file(name, type_name, option)
  begin
    controller = O3::ChildCreatorService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel)
    request = O3::CreateFileRequest.new(common: O3P::CommonRequest.new, parent_id: @internal_id, name: name, type_name: type_name, option: option)
    response = controller.create_file(request)
    if (response.common.result_code != :SUCCEEDED)
      raise MessageClientError.new(response.common.result_code, response.common.detail)
    end
    return ORiN3File.new(@channel, response.file_id, response.created_datetime)
  rescue MessageClientError
    raise
  rescue StandardError => e
    raise MessageClientError.new(e)
  end  
end

#create_job(name, type_name, option) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/grpc/client/orin3/provider/orin3_child_creator.rb', line 37

def create_job(name, type_name, option)
  begin
    controller = O3::ChildCreatorService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel)
    request = O3::CreateJobRequest.new(common: O3P::CommonRequest.new, parent_id: @internal_id, name: name, type_name: type_name, option: option)
    response = controller.create_job(request)
    if (response.common.result_code != :SUCCEEDED)
      raise MessageClientError.new(response.common.result_code, response.common.detail)
    end
    return ORiN3Job.new(@channel, response.job_id, response.created_datetime)
  rescue MessageClientError
    raise
  rescue StandardError => e
    raise MessageClientError.new(e)
  end  
end

#create_module(name, type_name, option) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/grpc/client/orin3/provider/orin3_child_creator.rb', line 85

def create_module(name, type_name, option)
  begin
    controller = O3::ChildCreatorService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel)
    request = O3::CreateModuleRequest.new(common: O3P::CommonRequest.new, parent_id: @internal_id, name: name, type_name: type_name, option: option)
    response = controller.create_module(request)
    if (response.common.result_code != :SUCCEEDED)
      raise MessageClientError.new(response.common.result_code, response.common.detail)
    end
    return ORiN3Module.new(@channel, response.module_id, response.created_datetime)
  rescue MessageClientError
    raise
  rescue StandardError => e
    raise MessageClientError.new(e)
  end  
end

#create_stream(name, type_name, option) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/grpc/client/orin3/provider/orin3_child_creator.rb', line 69

def create_stream(name, type_name, option)
  begin
    controller = O3::ChildCreatorService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel)
    request = O3::CreateStreamRequest.new(common: O3P::CommonRequest.new, parent_id: @internal_id, name: name, type_name: type_name, option: option)
    response = controller.create_stream(request)
    if (response.common.result_code != :SUCCEEDED)
      raise MessageClientError.new(response.common.result_code, response.common.detail)
    end
    return ORiN3Stream.new(@channel, response.stream_id, response.created_datetime)
  rescue MessageClientError
    raise
  rescue StandardError => e
    raise MessageClientError.new(e)
  end  
end

#create_variable(name, type_name, option, value_type) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/grpc/client/orin3/provider/orin3_child_creator.rb', line 21

def create_variable(name, type_name, option, value_type)
  begin
    controller = O3::ChildCreatorService::Stub.new(nil, :this_channel_is_insecure, channel_override: @channel)
    request = O3::CreateVariableRequest.new(common: O3P::CommonRequest.new, parent_id: @internal_id, name: name, type_name: type_name, option: option, value_type: value_type)
    response = controller.create_variable(request)
    if (response.common.result_code != :SUCCEEDED)
      raise MessageClientError.new(response.common.result_code, response.common.detail)
    end
    return ORiN3Variable.new(@channel, response.variable_id, response.created_datetime, value_type)
  rescue MessageClientError
    raise
  rescue StandardError => e
    raise MessageClientError.new(e)
  end  
end