27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/xapixctl/titan_cli.rb', line 27
def service(akoios_url)
url = URI.parse(akoios_url)
schema = JSON.parse(RestClient.get(File.join(url.to_s, 'spec'), params: { host: url.hostname }, headers: { accept: :json }))
patch_schema(schema)
connector_refs = import_swagger(File.basename(url.path), schema)
say "\n== Onboarding Connectors", :bold
connectors = match_connectors_to_action(connector_refs)
if connectors.empty?
warn "\nNo valid connectors for ML service detected, not building service."
exit 1
end
say "\n== Building Service", :bold
service_doc = build_service(schema.dig('info', 'title'), connectors)
res = prj_connection.apply(service_doc)
say "\ncreated / updated service #{res.first}"
end
|