Sha256: 6e7bdf31c93300d8e17d41d053aceb7caa14853fb020f3910ac11ab37d26f050

Contents?: true

Size: 1012 Bytes

Versions: 15

Compression:

Stored size: 1012 Bytes

Contents

class Jets::Cfn::Resource::ApiGateway::RestApi::Routes::Change
  class MediaTypes < Base
    def changed?
      current_binary_media_types != new_binary_media_types
    end

    def new_binary_media_types
      rest_api = Jets::Cfn::Resource::ApiGateway::RestApi.new
      rest_api.binary_media_types
    end
    memoize :new_binary_media_types

    def current_binary_media_types
      return nil unless parent_stack_exists?

      stack = cfn.describe_stacks(stack_name: parent_stack_name).stacks.first

      api_gateway_stack_arn = lookup(stack[:outputs], "ApiGateway")

      stack = cfn.describe_stacks(stack_name: api_gateway_stack_arn).stacks.first
      rest_api_id = lookup(stack[:outputs], "RestApi")

      resp = apigateway.get_rest_api(rest_api_id: rest_api_id)
      resp.binary_media_types
    end
    memoize :current_binary_media_types

    def parent_stack_exists?
      stack_exists?(parent_stack_name)
    end

    def parent_stack_name
      Jets::Names.parent_stack_name
    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/media_types.rb
jets-5.0.12 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.11 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.10 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.9 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.8 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.7 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.6 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.5 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.4 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.3 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.2 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.1 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.0 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb
jets-5.0.0.beta1 lib/jets/cfn/resource/api_gateway/rest_api/routes/change/media_types.rb