Method: OpenC3::MicroserviceModel#initialize

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

#initialize(name:, folder_name: nil, cmd: [], work_dir: '.', ports: [], env: {}, topics: [], target_names: [], options: [], container: nil, updated_at: nil, plugin: nil, needs_dependencies: false, scope:) ⇒ MicroserviceModel

Create a microservice model to be deployed to S3



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/openc3/models/microservice_model.rb', line 80

def initialize(
  name:,
  folder_name: nil,
  cmd: [],
  work_dir: '.',
  ports: [],
  env: {},
  topics: [],
  target_names: [],
  options: [],
  container: nil,
  updated_at: nil,
  plugin: nil,
  needs_dependencies: false,
  scope:
)
  parts = name.split("__")
  if parts.length != 3
    raise "name '#{name}' must be formatted as SCOPE__TYPE__NAME"
  end
  if parts[0] != scope
    raise "name '#{name}' scope '#{parts[0]}' doesn't match scope parameter '#{scope}'"
  end

  super(PRIMARY_KEY, name: name, updated_at: updated_at, plugin: plugin, scope: scope)
  @folder_name = folder_name
  @cmd = cmd
  @work_dir = work_dir
  @ports = ports
  @env = env
  @topics = topics
  @target_names = target_names
  @options = options
  @container = container
  @needs_dependencies = needs_dependencies
end