Class: ThreeScaleToolbox::Commands::ServiceCommand::CopyCommand::BumpProxyVersionTask

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service:) ⇒ BumpProxyVersionTask

Returns a new instance of BumpProxyVersionTask.



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

def initialize(service:)
  @service = service
end

Instance Attribute Details

#serviceObject (readonly)

Returns the value of attribute service.



6
7
8
# File 'lib/3scale_toolbox/commands/service_command/copy_command/bump_proxy_version_task.rb', line 6

def service
  @service
end

Instance Method Details

#callObject

bumps proxy config version to propagate proxy settings updates



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/3scale_toolbox/commands/service_command/copy_command/bump_proxy_version_task.rb', line 14

def call
  # Proxy update is the mechanism to increase version of the proxy,
  # Hence propagating (mapping rules, poicies, oidc, auth) update to
  # latest proxy config, making available to gateway.

  # Currently it is done always because mapping rules, at least, are always created
  # So they need to be propagated
  proxy_settings = {
    # Adding harmless attribute to avoid empty body
    # update_proxy cannot be done with empty body
    # and must be done to increase proxy version
    # If proxy settings have not been changed since last update,
    # this request will not have effect and proxy config version will not be bumped.
    service_id: service.id
  }

  service.update_proxy proxy_settings
end