module ThreeScaleToolbox::Commands::BackendCommand::CopyCommand::Task

Attributes

context[R]

Public Class Methods

new(context) click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 8
def initialize(context)
  @context = context
end

Public Instance Methods

call() click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 12
def call
  run
end
delete_mapping_rules() click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 56
def delete_mapping_rules
  context.fetch(:delete_mapping_rules, false)
end
logger() click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 46
def logger
  context[:logger] ||= Logger.new($stdout).tap do |logger|
    logger.formatter = proc { |severity, datetime, progname, msg| "#{msg}\n" }
  end
end
option_target_system_name() click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 42
def option_target_system_name
  context[:option_target_system_name]
end
report() click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 52
def report
  context[:report] ||= {}
end
source_backend() click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 25
def source_backend
  context[:source_backend] ||= find_source_backend
end
source_backend_ref() click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 37
def source_backend_ref
  context[:source_backend_ref] ||= raise ThreeScaleToolbox::Error, 'Unexpected error. ' \
    'source_backend_ref not found'
end
source_remote() click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 29
def source_remote
  context[:source_remote]
end
target_backend() click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 20
def target_backend
  context[:target_backend] ||= raise ThreeScaleToolbox::Error, 'Unexpected error. ' \
    'Target backend should have been created or updated'
end
target_backend=(target) click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 16
def target_backend=(target)
  context[:target_backend] = target
end
target_remote() click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 33
def target_remote
  context[:target_remote]
end

Private Instance Methods

find_source_backend() click to toggle source
# File lib/3scale_toolbox/commands/backend_command/copy_command/task.rb, line 62
def find_source_backend
  Entities::Backend.find(remote: source_remote, ref: source_backend_ref).tap do |backend|
    raise ThreeScaleToolbox::Error, "Backend #{source_backend_ref} does not exist" if backend.nil?
  end
end