Sha256: 24989a9c8940eaa04fc5a81df3388db11bd950b3cec87f399a841618f9975ff5

Contents?: true

Size: 1.28 KB

Versions: 15

Compression:

Stored size: 1.28 KB

Contents

# Does not do full expansion, mainly a container that holds the definition and
# standardizes it without camelizing it.
class Jets::Cfn::Resource
  class Associated
    extend Memoist

    attr_reader :definition
    attr_accessor :multiple_resources
    def initialize(*definition)
      @definition = definition.flatten
      # Some associated resources require multiple resources for a single Lambda function. For
      # example `sqs_event` can create a `SQS::Queue` and `Lambda::EventSourceMapping`.  We set
      # a `multiple` flag so `add_logical_id_counter` can use it to avoid adding counter ids to
      # these type of resources. The `multiple` flag allows us to handle both:
      #
      #   1. Associated resources that contain multiple resources for a single Lambda function
      #   2. A single Lambda function with multiple events.  In this case, a counter is added
      #
      # Setting `multiple` to true means the counter id will not be added.
      @multiple_resources = false
    end

    def logical_id
      standardized.keys.first
    end

    def attributes
      standardized.values.first
    end

    def standardized
      standardizer = Standardizer.new(definition)
      standardizer.standarize(definition) # doesnt camelize keys yet
    end
    memoize :standardized
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

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