Skip to content

Commit

Permalink
Rename "contactForm" labmda app into "landing".
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenchio committed Dec 27, 2024
1 parent 93a4ac4 commit 5863d9e
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ public
resources

__pycache__/
contact-form-handler.zip
contact-form-handler/dependencies/
lambda-functions.zip
lambda-functions/dependencies/
30 changes: 15 additions & 15 deletions cloudformation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,15 @@ Resources:
Properties:
CloudWatchRoleArn: !GetAtt ApiGatewayLoggingRole.Arn

ContactFormAPIGateway:
LandingAPIGateway:
Type: 'AWS::ApiGateway::RestApi'
DependsOn:
- ContactFormLambda
- ApiGatewayLoggingRole
Properties:
Name: ContactFormAPIGateway
Name: LandingAPIGateway
FailOnWarnings: 'true'
Description: 'Contact Form API Gateway'
Description: 'Landing API Gateway'
EndpointConfiguration:
Types:
- REGIONAL
Expand All @@ -190,8 +190,8 @@ Resources:
Properties:
AuthorizationType: NONE
HttpMethod: ANY
ResourceId: !GetAtt ContactFormAPIGateway.RootResourceId
RestApiId: !Ref ContactFormAPIGateway
ResourceId: !GetAtt LandingAPIGateway.RootResourceId
RestApiId: !Ref LandingAPIGateway
Integration:
IntegrationHttpMethod: POST
Type: AWS
Expand Down Expand Up @@ -224,8 +224,8 @@ Resources:
Properties:
AuthorizationType: NONE
HttpMethod: OPTIONS
ResourceId: !GetAtt ContactFormAPIGateway.RootResourceId
RestApiId: !Ref ContactFormAPIGateway
ResourceId: !GetAtt LandingAPIGateway.RootResourceId
RestApiId: !Ref LandingAPIGateway
Integration:
IntegrationResponses:
- StatusCode: 200
Expand All @@ -246,24 +246,24 @@ Resources:
method.response.header.Access-Control-Allow-Methods: true
method.response.header.Access-Control-Allow-Headers: true

ContactFormAPIDeployment:
LandingAPIDeployment:
Type: 'AWS::ApiGateway::Deployment'
DependsOn:
- ContactFormAPIMethod
Properties:
RestApiId: !Ref ContactFormAPIGateway
RestApiId: !Ref LandingAPIGateway

# Enable logging of all HTTP requests
ContactFormAPIStage:
LandingAPIStage:
Type: AWS::ApiGateway::Stage
Properties:
DeploymentId: !Ref ContactFormAPIDeployment
DeploymentId: !Ref LandingAPIDeployment
MethodSettings:
- HttpMethod: '*'
LoggingLevel: INFO
ResourcePath: /*
ResourcePath: '/contact'
DataTraceEnabled: true
RestApiId: !Ref ContactFormAPIGateway
RestApiId: !Ref LandingAPIGateway
StageName: !Ref apiGatewayStageName

# Create permission for API Gateway to invoke Lambda
Expand All @@ -273,9 +273,9 @@ Resources:
Action: lambda:InvokeFunction
FunctionName: !Ref ContactFormLambda
Principal: apigateway.amazonaws.com
SourceArn: !Sub 'arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${ContactFormAPIGateway}/*/*/'
SourceArn: !Sub 'arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${LandingAPIGateway}/*/*/'

Outputs:
ContactFormInvokeURL:
Value: !Sub 'https://${ContactFormAPIGateway}.execute-api.${AWS::Region}.amazonaws.com/${apiGatewayStageName}/'
Value: !Sub 'https://${LandingAPIGateway}.execute-api.${AWS::Region}.amazonaws.com/${apiGatewayStageName}/contact'
Description: URL for invoking the Contact Form API
2 changes: 1 addition & 1 deletion deploy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

AWS_ACCOUNT_ID = '063992876227'

PROJECT_NAME = 'contact-form'
PROJECT_NAME = 'landing'

CONTACT_FORM_FROM_EMAIL = '[email protected]'
CONTACT_FORM_TO_EMAIL = '[email protected]'
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "contact-form-handler"
name = "landing"
version = "0.1.0"
requires-python = "== 3.9.*"
dependencies = [
Expand Down
34 changes: 17 additions & 17 deletions contact-form-handler/uv.lock → lambda-functions/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exclude = [
".git",
".venv",
"node_modules",
"contact-form-handler/dependencies",
"lambda-functions/dependencies",
"public",
]

Expand All @@ -27,6 +27,6 @@ line_length = 80
lines_after_imports = 2
multi_line_output = 2
extend_skip = [
"contact-form-handler/dependencies",
"lambda-functions/dependencies",
"public",
]
8 changes: 4 additions & 4 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ def cli():
pass


@cli.command(help='Deploy the contact form handler to production')
@cli.command(help='Deploy the lambda functions to production')
@timing
def deploy_lambda():
package_path = Path('contact-form-handler')
package_path = Path('lambda-functions')
run(
'uv pip install '
f'--target {package_path / "dependencies"} '
f'-r {package_path / "pyproject.toml"}'
)
package_path = Path('contact-form-handler')
package_path = Path('lambda-functions')
package_deps_path = package_path / 'dependencies'
code_archive_name = 'contact-form-handler.zip'
code_archive_name = 'lambda-functions.zip'

run(f'zip -qr ../{code_archive_name} .', cwd=package_deps_path)
run(
Expand Down

0 comments on commit 5863d9e

Please sign in to comment.