-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
(feat) CloudFormation AWS::ApiGateway::Methods and AWS::ApiGateway::Resources support #1247
(feat) CloudFormation AWS::ApiGateway::Methods and AWS::ApiGateway::Resources support #1247
Conversation
…ider Modularize RestApi code
The Api object now contains a list of routes and the attributes associated with it. The rest of the code is also managed in terms of routes/endpoints. This will allow for easy extensability if the Apis will grouped into different sections
…ures Restructure the information Api has the way it passed through
…ksrivat/aws-sam-cli into feature/cloud_formation_stage_support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Looks like flake8 isn't happy. Can you address that as well, so we can make sure make pr passes and touched/new files have good tests coverage?
|
||
Parameters | ||
---------- | ||
logical_id : str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: keep the order they are defined in the function.
|
||
resource_path = "" | ||
if isinstance(resource_id, string_types): | ||
resource = resources.get(resource_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would help in being more explicit about what resource this is. It took me awhile to understand what was going on here. Maybe a comment above the if isinstance
would be helpful to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if instance can be removed once we merge in the intrinsic pr since the Refs will resolve to a string.
if resource: | ||
resource_path = self.resolve_resource_path(resources, resource, "") | ||
else: | ||
resource_path = resource_id # In this case, the path was resolved to a string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment right? This line gets executed if resource is falsey, not that the path was resolved to a string. This assigns the resource_path to be the resource_id, but should be the root path then right? Sorry having a hard time following this path right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the comment to reflect it. This comment is referring to the case that is a ref of a raw resolved string such as { "Fn::GetAtt": ["MyRestApi", "RootResourceId"] }
@@ -0,0 +1,127 @@ | |||
AWSTemplateFormatVersion: '2010-09-09' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume once the intrinsics PR gets merged and integrated, you will add some testdata and integ tests for resource and methods that are defined with intrinsics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ye. A lot of the code resource and methods is based on intrinsic references. When that is merged, all the tests will be updated to use intrinsics.
HttpMethod: "GET" | ||
Integration: | ||
Uri: | ||
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${WhatFunction.Arn}/invocations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the Uri is defined just by a string instead of an Intrinsic Fn::Sub?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't really matter because all properties will be resolved using intrinsics
@viksrivat Looks like |
Issue #, if available:
Description of changes:
Extends of #1239 to support AWS::ApiGateway::Resources
Checklist:
make pr
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.