Method: OpenC3::MicroserviceModel.handle_config

Defined in:
lib/openc3/models/microservice_model.rb

.handle_config(parser, keyword, parameters, plugin: nil, needs_dependencies: false, scope:) ⇒ Object

Called by the PluginModel to allow this class to validate it’s top-level keyword: “MICROSERVICE”



75
76
77
78
79
80
81
82
83
84
# File 'lib/openc3/models/microservice_model.rb', line 75

def self.handle_config(parser, keyword, parameters, plugin: nil, needs_dependencies: false, scope:)
  case keyword
  when 'MICROSERVICE'
    parser.verify_num_parameters(2, 2, "#{keyword} <Folder Name> <Name>")
    # Create name by adding scope and type 'USER' to indicate where this microservice came from
    return self.new(folder_name: parameters[0], name: "#{scope}__USER__#{parameters[1].upcase}", plugin: plugin, needs_dependencies: needs_dependencies, scope: scope)
  else
    raise ConfigParser::Error.new(parser, "Unknown keyword and parameters for Microservice: #{keyword} #{parameters.join(" ")}")
  end
end