Sha256: e61db2bac52276d84a18fd6d5414d7ca9606936a5aae90b8742ed196fddc7cad

Contents?: true

Size: 1.07 KB

Versions: 15

Compression:

Stored size: 1.07 KB

Contents

# Detects route to changes
class Jets::Cfn::Resource::ApiGateway::RestApi::Routes::Change
  class To < Base
    def changed?
      deployed_routes.each do |deployed_route|
        next if deployed_route.engine   # skip engine routes
        next if deployed_route.internal # skip internal routes

        new_route = find_comparable_route(deployed_route)
        next unless new_route

        if new_route.to != deployed_route.to
          # change in already deployed route has been detected, requires bluegreen deploy
          return true
        end
      end
      false # Reaching here means no routes have been changed in a way that requires a bluegreen deploy
    end

    # Find a route that has the same path and method. This is a comparable route
    # Then we will compare the to or controller action to see if an already
    # deployed route has been changed.
    def find_comparable_route(deployed_route)
      new_routes.find do |new_route|
        new_route.path == deployed_route.path &&
        new_route.http_method == deployed_route.http_method
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jets-5.0.13 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.12 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.11 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.10 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.9 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.8 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.7 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.6 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.5 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.4 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.3 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.2 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.1 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.0 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb
jets-5.0.0.beta1 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/to.rb