Class: ThreeScaleToolbox::Commands::ServiceCommand::CopyCommand::CopyServiceProxyTask

Inherits:
Object
  • Object
show all
Includes:
Task
Defined in:
lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb

Instance Attribute Summary

Attributes included from Task

#context

Instance Method Summary collapse

Methods included from Task

#activedocs_report, #delete_mapping_rules, #find_source_service, #force_delete_mapping_rules, #initialize, #logger, #option_target_system_name, #plans_report, #report, #source, #source_metrics_and_methods, #source_remote, #source_service_ref, #target, #target=, #target_metrics_and_methods, #target_remote

Instance Method Details

#callObject



8
9
10
11
12
# File 'lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb', line 8

def call
  target.update_proxy target_proxy_attrs
  target.update_oidc source.oidc if source.attrs['backend_version'] == 'oidc'
  logger.info "updated proxy of #{target.id} to match the original"
end

#source_proxyObject



25
26
27
# File 'lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb', line 25

def source_proxy
  @source_proxy ||= source.proxy
end

#target_proxy_attrsObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb', line 14

def target_proxy_attrs
  if source.attrs['deployment_option'] == 'hosted'
    # For services with "hosted" deployment config,
    # "Public Base URL" should not be copied, mainly because public base URL is self-assigned.
    # Two 3scale products (aka services) cannot be served using the same public base URL.
    source_proxy.dup.delete_if { |key, _v| %w[endpoint sandbox_endpoint].include? key }
  else
    source_proxy
  end
end