sparkleformation / sparkle_formation

Ruby orchestration templating library built with unicorns and rainbows
http://www.sparkleformation.io
Apache License 2.0
222 stars 47 forks source link

Disable camelcase conversion for specific hashes #253

Closed kavinash-athena closed 2 years ago

kavinash-athena commented 5 years ago

Hi, I have been trying to setup an AWS::Event::Rule where one of it properties EventPattern requires the keys to start with small letters as in

{
  "detail-type": "EC2 Instance State-change Notification",
  "source": "aws.ec2",
  "detail": {
    "state": "terminated"
  }
}

Since sparkle formation has an automatic conversion of hash keys to CamelCases, this does not work as expected for me. Is there a way I can achieve this? Please find the sparkleformation code below

        eureka_ecs_event_pattern = {
        'detail-type' => ["ECS Task State Change", "ECS Container Instance State Change"],
            'source' => ["aws.ecs"],
            'detail' => {
                'clusterArn' => _gatewayjava_cluster_arn
            }
        }   
webframp commented 5 years ago

@kavinash-athena have you tried the camel_keys_set!(:auto_disable) option mentioned here? https://www.sparkleformation.io/docs/sparkle_formation/sparkleformation-dsl.html#key-alteration

        eureka_ecs_event_pattern = {
                camel_keys_set!(:auto_disable)
        'detail-type' => ["ECS Task State Change", "ECS Container Instance State Change"],
            'source' => ["aws.ecs"],
            'detail' => {
                'clusterArn' => _gatewayjava_cluster_arn
            }
        }   

@chrisroberts can help with more specific syntax issues

kavinash-athena commented 5 years ago

I got this working looking up a similar thread in your issue list, thanks @webframp