Sha256: e524a3fa0e89cfeb0b8f8fe25eecd1a367d54252f6a131283bbf0391c5fcf1d3

Contents?: true

Size: 1.04 KB

Versions: 10

Compression:

Stored size: 1.04 KB

Contents

module ThreeScaleToolbox
  module Commands
    module ServiceCommand
      module CopyCommand
        class CopyServiceProxyTask
          include Task

          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

          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

          def source_proxy
            @source_proxy ||= source.proxy
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
3scale_toolbox-1.0.1 lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb
3scale_toolbox-1.0.0 lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb
3scale_toolbox-0.20.0 lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb
3scale_toolbox-0.19.3 lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb
3scale_toolbox-0.19.2 lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb
3scale_toolbox-0.19.1 lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb
3scale_toolbox-0.19.0 lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb
3scale_toolbox-0.18.3 lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb
3scale_toolbox-0.18.2 lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb
3scale_toolbox-0.18.0 lib/3scale_toolbox/commands/service_command/copy_command/copy_service_proxy_task.rb