prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  [E2503] fails incorrectly when intrinsic function used in Protocol value 
  *cfn-lint version: 0.4.2*
  
  *Description of issue.*
  
  This is valid, and conforms to the spec, but rule throws an error:
  
  ```yaml
  Parameters:
    TestParam:
      Type: String
      Default: TCP
  Conditions:
    TestCond: !Equals ['a', 'a']
  Resources:
    OpenShiftMasterELB:
      Type: AWS::ElasticLoadBalancing::LoadBalancer
      Properties:
        Subnets:
          - subnet-1234abcd
        SecurityGroups:
          - sg-1234abcd
        Listeners:
          # Fails on Protocol
          - InstancePort: '1'
            InstanceProtocol: !Ref TestParam
            LoadBalancerPort: '1'
            Protocol: !Ref TestParam
          # Also fails on Protocol
          - InstancePort: '2'
            InstanceProtocol: !If [TestCond, TCP, SSL]
            LoadBalancerPort: '2'
            Protocol: !If [TestCond, TCP, SSL]
          # Works
          - InstancePort: '3'
            InstanceProtocol: !If [TestCond, TCP, SSL]
            LoadBalancerPort: '3'
            Protocol: TCP
  ```
  
  </issue>
  <code>
  [start of src/cfnlint/rules/resources/elb/Elb.py]
  1 """
  2   Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3 
  4   Permission is hereby granted, free of charge, to any person obtaining a copy of this
  5   software and associated documentation files (the "Software"), to deal in the Software
  6   without restriction, including without limitation the rights to use, copy, modify,
  7   merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
  8   permit persons to whom the Software is furnished to do so.
  9 
  10   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  11   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  12   PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  13   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  14   OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  15   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16 """
  17 from cfnlint import CloudFormationLintRule
  18 from cfnlint import RuleMatch
  19 
  20 
  21 class Elb(CloudFormationLintRule):
  22     """Check if Elb Resource Properties"""
  23     id = 'E2503'
  24     shortdesc = 'Resource ELB Properties'
  25     description = 'See if Elb Resource Properties are set correctly \
  26 HTTPS has certificate HTTP has no certificate'
  27     source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html'
  28     tags = ['properties', 'elb']
  29 
  30     def match(self, cfn):
  31         """Check ELB Resource Parameters"""
  32 
  33         matches = list()
  34 
  35         results = cfn.get_resource_properties(['AWS::ElasticLoadBalancingV2::Listener'])
  36         for result in results:
  37             protocol = result['Value'].get('Protocol')
  38             if protocol:
  39                 if protocol not in ['HTTP', 'HTTPS', 'TCP']:
  40                     message = 'Protocol is invalid for {0}'
  41                     path = result['Path'] + ['Protocol']
  42                     matches.append(RuleMatch(path, message.format(('/'.join(result['Path'])))))
  43                 elif protocol in ['HTTPS']:
  44                     certificate = result['Value'].get('Certificates')
  45                     if not certificate:
  46                         message = 'Certificates should be specified when using HTTPS for {0}'
  47                         path = result['Path'] + ['Protocol']
  48                         matches.append(RuleMatch(path, message.format(('/'.join(result['Path'])))))
  49 
  50         results = cfn.get_resource_properties(['AWS::ElasticLoadBalancing::LoadBalancer', 'Listeners'])
  51         for result in results:
  52             if isinstance(result['Value'], list):
  53                 for index, listener in enumerate(result['Value']):
  54                     protocol = listener.get('Protocol')
  55                     if protocol:
  56                         if protocol not in ['HTTP', 'HTTPS', 'TCP', 'SSL']:
  57                             message = 'Protocol is invalid for {0}'
  58                             path = result['Path'] + [index, 'Protocol']
  59                             matches.append(RuleMatch(path, message.format(('/'.join(result['Path'])))))
  60                         elif protocol in ['HTTPS', 'SSL']:
  61                             certificate = listener.get('SSLCertificateId')
  62                             if not certificate:
  63                                 message = 'Certificates should be specified when using HTTPS for {0}'
  64                                 path = result['Path'] + [index, 'Protocol']
  65                                 matches.append(RuleMatch(path, message.format(('/'.join(result['Path'])))))
  66 
  67         return matches
  68
  [end of src/cfnlint/rules/resources/elb/Elb.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/cfnlint/rules/resources/elb/Elb.py b/src/cfnlint/rules/resources/elb/Elb.py
  --- a/src/cfnlint/rules/resources/elb/Elb.py
  +++ b/src/cfnlint/rules/resources/elb/Elb.py
  @@ -30,13 +30,21 @@
       def match(self, cfn):
           """Check ELB Resource Parameters"""
   
  +        def is_intrinsic(input_obj):
  +            """Checks if a given input looks like an intrinsic function"""
  +
  +            if isinstance(input_obj, dict) and len(input_obj) == 1:
  +                if list(input_obj.keys())[0] == 'Ref' or list(input_obj.keys())[0].startswith('Fn::'):
  +                    return True
  +            return False
  +
           matches = list()
   
           results = cfn.get_resource_properties(['AWS::ElasticLoadBalancingV2::Listener'])
           for result in results:
               protocol = result['Value'].get('Protocol')
               if protocol:
  -                if protocol not in ['HTTP', 'HTTPS', 'TCP']:
  +                if protocol not in ['HTTP', 'HTTPS', 'TCP'] and not is_intrinsic(protocol):
                       message = 'Protocol is invalid for {0}'
                       path = result['Path'] + ['Protocol']
                       matches.append(RuleMatch(path, message.format(('/'.join(result['Path'])))))
  @@ -53,7 +61,7 @@
                   for index, listener in enumerate(result['Value']):
                       protocol = listener.get('Protocol')
                       if protocol:
  -                        if protocol not in ['HTTP', 'HTTPS', 'TCP', 'SSL']:
  +                        if protocol not in ['HTTP', 'HTTPS', 'TCP', 'SSL'] and not is_intrinsic(protocol):
                               message = 'Protocol is invalid for {0}'
                               path = result['Path'] + [index, 'Protocol']
                               matches.append(RuleMatch(path, message.format(('/'.join(result['Path'])))))
  
verification_info: {"golden_diff": "diff --git a/src/cfnlint/rules/resources/elb/Elb.py b/src/cfnlint/rules/resources/elb/Elb.py\n--- a/src/cfnlint/rules/resources/elb/Elb.py\n+++ b/src/cfnlint/rules/resources/elb/Elb.py\n@@ -30,13 +30,21 @@\n     def match(self, cfn):\n         \"\"\"Check ELB Resource Parameters\"\"\"\n \n+        def is_intrinsic(input_obj):\n+            \"\"\"Checks if a given input looks like an intrinsic function\"\"\"\n+\n+            if isinstance(input_obj, dict) and len(input_obj) == 1:\n+                if list(input_obj.keys())[0] == 'Ref' or list(input_obj.keys())[0].startswith('Fn::'):\n+                    return True\n+            return False\n+\n         matches = list()\n \n         results = cfn.get_resource_properties(['AWS::ElasticLoadBalancingV2::Listener'])\n         for result in results:\n             protocol = result['Value'].get('Protocol')\n             if protocol:\n-                if protocol not in ['HTTP', 'HTTPS', 'TCP']:\n+                if protocol not in ['HTTP', 'HTTPS', 'TCP'] and not is_intrinsic(protocol):\n                     message = 'Protocol is invalid for {0}'\n                     path = result['Path'] + ['Protocol']\n                     matches.append(RuleMatch(path, message.format(('/'.join(result['Path'])))))\n@@ -53,7 +61,7 @@\n                 for index, listener in enumerate(result['Value']):\n                     protocol = listener.get('Protocol')\n                     if protocol:\n-                        if protocol not in ['HTTP', 'HTTPS', 'TCP', 'SSL']:\n+                        if protocol not in ['HTTP', 'HTTPS', 'TCP', 'SSL'] and not is_intrinsic(protocol):\n                             message = 'Protocol is invalid for {0}'\n                             path = result['Path'] + [index, 'Protocol']\n                             matches.append(RuleMatch(path, message.format(('/'.join(result['Path'])))))\n", "issue": "[E2503] fails incorrectly when intrinsic function used in Protocol value \n*cfn-lint version: 0.4.2*\r\n\r\n*Description of issue.*\r\n\r\nThis is valid, and conforms to the spec, but rule throws an error:\r\n\r\n```yaml\r\nParameters:\r\n  TestParam:\r\n    Type: String\r\n    Default: TCP\r\nConditions:\r\n  TestCond: !Equals ['a', 'a']\r\nResources:\r\n  OpenShiftMasterELB:\r\n    Type: AWS::ElasticLoadBalancing::LoadBalancer\r\n    Properties:\r\n      Subnets:\r\n        - subnet-1234abcd\r\n      SecurityGroups:\r\n        - sg-1234abcd\r\n      Listeners:\r\n        # Fails on Protocol\r\n        - InstancePort: '1'\r\n          InstanceProtocol: !Ref TestParam\r\n          LoadBalancerPort: '1'\r\n          Protocol: !Ref TestParam\r\n        # Also fails on Protocol\r\n        - InstancePort: '2'\r\n          InstanceProtocol: !If [TestCond, TCP, SSL]\r\n          LoadBalancerPort: '2'\r\n          Protocol: !If [TestCond, TCP, SSL]\r\n        # Works\r\n        - InstancePort: '3'\r\n          InstanceProtocol: !If [TestCond, TCP, SSL]\r\n          LoadBalancerPort: '3'\r\n          Protocol: TCP\r\n```\n", "before_files": [{"content": "\"\"\"\n  Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n\n  Permission is hereby granted, free of charge, to any person obtaining a copy of this\n  software and associated documentation files (the \"Software\"), to deal in the Software\n  without restriction, including without limitation the rights to use, copy, modify,\n  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n  permit persons to whom the Software is furnished to do so.\n\n  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\"\"\"\nfrom cfnlint import CloudFormationLintRule\nfrom cfnlint import RuleMatch\n\n\nclass Elb(CloudFormationLintRule):\n    \"\"\"Check if Elb Resource Properties\"\"\"\n    id = 'E2503'\n    shortdesc = 'Resource ELB Properties'\n    description = 'See if Elb Resource Properties are set correctly \\\nHTTPS has certificate HTTP has no certificate'\n    source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb-listener.html'\n    tags = ['properties', 'elb']\n\n    def match(self, cfn):\n        \"\"\"Check ELB Resource Parameters\"\"\"\n\n        matches = list()\n\n        results = cfn.get_resource_properties(['AWS::ElasticLoadBalancingV2::Listener'])\n        for result in results:\n            protocol = result['Value'].get('Protocol')\n            if protocol:\n                if protocol not in ['HTTP', 'HTTPS', 'TCP']:\n                    message = 'Protocol is invalid for {0}'\n                    path = result['Path'] + ['Protocol']\n                    matches.append(RuleMatch(path, message.format(('/'.join(result['Path'])))))\n                elif protocol in ['HTTPS']:\n                    certificate = result['Value'].get('Certificates')\n                    if not certificate:\n                        message = 'Certificates should be specified when using HTTPS for {0}'\n                        path = result['Path'] + ['Protocol']\n                        matches.append(RuleMatch(path, message.format(('/'.join(result['Path'])))))\n\n        results = cfn.get_resource_properties(['AWS::ElasticLoadBalancing::LoadBalancer', 'Listeners'])\n        for result in results:\n            if isinstance(result['Value'], list):\n                for index, listener in enumerate(result['Value']):\n                    protocol = listener.get('Protocol')\n                    if protocol:\n                        if protocol not in ['HTTP', 'HTTPS', 'TCP', 'SSL']:\n                            message = 'Protocol is invalid for {0}'\n                            path = result['Path'] + [index, 'Protocol']\n                            matches.append(RuleMatch(path, message.format(('/'.join(result['Path'])))))\n                        elif protocol in ['HTTPS', 'SSL']:\n                            certificate = listener.get('SSLCertificateId')\n                            if not certificate:\n                                message = 'Certificates should be specified when using HTTPS for {0}'\n                                path = result['Path'] + [index, 'Protocol']\n                                matches.append(RuleMatch(path, message.format(('/'.join(result['Path'])))))\n\n        return matches\n", "path": "src/cfnlint/rules/resources/elb/Elb.py"}]}