Class: AFCLIExport::Export

Inherits:
VMC::CLI
  • Object
show all
Defined in:
lib/export-af-cli-plugin/plugin.rb

Instance Method Summary collapse

Instance Method Details

#bind_servicesObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/export-af-cli-plugin/plugin.rb', line 11

def bind_services
  src_app = input[:src_app]
  fail "No services to bind." if src_app.services.empty?

  dest_app = input[:dest_app]

  src_app.services.each do |service|
    with_progress("Binding service #{c(service.name, :name)} to #{c(dest_app.name, :name)}") do |s|
      if dest_app.binds?(service)
        s.skip do
          err "App #{b(dest_app.name)} already binds #{b(service.name)}."
        end
      else
        dest_app.bind(service)
      end
    end
  end
end

#export_serviceObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/export-af-cli-plugin/plugin.rb', line 34

def export_service
  service = input[:export_service]

  export_info =
    with_progress("Exporting service #{c(service.name, :name)}") do
      client.export_service(service.name)
    end

  line unless quiet?

  line "#{c(service.name, :name)} exported to: #{export_info[:uri]}"
end

#import_serviceObject



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/export-af-cli-plugin/plugin.rb', line 52

def import_service
  service = input[:import_service]
  url = input[:url]

  import_info =
    with_progress("Importing data to service #{c(service.name, :name)}") do
      client.import_service(service.name, url)
    end

  line unless quiet?

  line "Data imported to #{c(service.name, :name)} successfully "
end