Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apigateway resource, probable bug in https://github.com/k1LoW/awspec/blob/master/lib/awspec/type/apigateway.rb#L34 #523

Open
RamanVaskevich1984 opened this issue Aug 25, 2020 · 1 comment

Comments

@RamanVaskevich1984
Copy link

Probably there is a bug in apigateway resource type code https://github.com/k1LoW/awspec/blob/master/lib/awspec/type/apigateway.rb#L34.
According to AWS design there is no http_method for integration like 'AWS'.
'AWS' can be one of integration types for aws_api_gateway_integration.
That causes an error when running apigateway resource kitchen tests for:
have_integration_path
have_integration_method.

@glasswalk3r
Copy link
Contributor

@RamanVaskevich1984 , can you please provide references about AWS not being an integration method?

I found this document that provides AWS as one of the available integration methods:

Represents an HTTP, HTTP_PROXY, AWS, AWS_PROXY, or Mock integration.

The code seems to be wrong, specially because:

  • Doesn't check for other possibilities of integration methods;
  • Seems to be mixing the concepts of http_method and method_integration as described in the SDK page.
    def has_integration_path?(path)
      check_existence
      self.api_resources.each do |resource|
        next if resource.resource_methods.nil?
        resource.resource_methods.each do |_, method|
          if method.method_integration.http_method == 'AWS'
            aws_path = method.method_integration.uri.match(%r{(\/[^\?]+)\??.*$}).captures[0] # Matches for ARN type path
            return resource if aws_path == path
          end
          uri = Addressable::URI.parse(method.method_integration.uri)
          return resource if uri.path == path
        end
      end
      nil
    end

On the other hand, AWS is used in stub response from the AWS API (lib/awspec/stub/apigateway.rb), but I don't have an API Gateway available for validating the response neither the theory about how this is suppose to work.

Can you please shed some light on this @RamanVaskevich1984 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants