-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d08edf0
Showing
37 changed files
with
696 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ignore_checks: | ||
- E3034 # Template too short |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Feature Branch | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- feature/* | ||
- fix/* | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
steps: | ||
- name: Setup job workspace | ||
uses: ServerlessOpsIO/gha-setup-workspace@v1 | ||
|
||
- name: Setup Python environment | ||
uses: ServerlessOpsIO/gha-setup-python@v1 | ||
with: | ||
python_version: '3.13' | ||
|
||
- name: Run tests | ||
run: pipenv run test-unit | ||
|
||
- name: Assume AWS credentials | ||
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1 | ||
with: | ||
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }} | ||
|
||
- name: Install AWS SAM | ||
uses: aws-actions/setup-sam@v2 | ||
|
||
- name: Validate template | ||
run: sam validate --lint | ||
|
||
- name: Build deployment artifact | ||
run: sam build | ||
|
||
- name: Store artifacts | ||
uses: ServerlessOpsIO/gha-store-artifacts@v1 | ||
with: | ||
use_aws_sam: true | ||
|
||
deploy: | ||
needs: | ||
- build | ||
|
||
environment: production | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
steps: | ||
- name: Setup job workspace | ||
uses: ServerlessOpsIO/gha-setup-workspace@v1 | ||
with: | ||
checkout_artifact: true | ||
|
||
- name: Assume AWS credentials | ||
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1 | ||
with: | ||
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }} | ||
deploy_aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }} | ||
|
||
- name: Deploy via AWS SAM | ||
uses: ServerlessOpsIO/gha-deploy-aws-sam@v1 | ||
with: | ||
aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }} | ||
env_json: ${{ toJson(env) }} | ||
secrets_json: ${{ toJson(secrets) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Main | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
steps: | ||
- name: Setup job workspace | ||
uses: ServerlessOpsIO/gha-setup-workspace@v1 | ||
|
||
- name: Setup Python environment | ||
uses: ServerlessOpsIO/gha-setup-python@v1 | ||
with: | ||
python_version: '3.13' | ||
|
||
- name: Run tests | ||
run: pipenv run test-unit | ||
|
||
- name: Assume AWS credentials | ||
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1 | ||
with: | ||
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }} | ||
|
||
- name: Install AWS SAM | ||
uses: aws-actions/setup-sam@v2 | ||
|
||
- name: Validate template | ||
run: sam validate --lint | ||
|
||
- name: Build deployment artifact | ||
run: sam build | ||
|
||
- name: Store artifacts | ||
uses: ServerlessOpsIO/gha-store-artifacts@v1 | ||
with: | ||
use_aws_sam: true | ||
|
||
deploy: | ||
needs: | ||
- build | ||
|
||
environment: production | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
steps: | ||
- name: Setup job workspace | ||
uses: ServerlessOpsIO/gha-setup-workspace@v1 | ||
with: | ||
checkout_artifact: true | ||
|
||
- name: Assume AWS credentials | ||
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1 | ||
with: | ||
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }} | ||
deploy_aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }} | ||
|
||
- name: Deploy via AWS SAM | ||
uses: ServerlessOpsIO/gha-deploy-aws-sam@v1 | ||
with: | ||
aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }} | ||
env_json: ${{ toJson(env) }} | ||
secrets_json: ${{ toJson(secrets) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Dev | ||
.mypy_cache/ | ||
|
||
# pyenv / environments | ||
.python-version | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# IDE | ||
.settings/ | ||
.project | ||
.pydevproject | ||
.vscode/ | ||
*.code-workspace | ||
.idea/ | ||
|
||
# Mac Cruft | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# IDE | ||
.vscode | ||
!.vscode/launch.json | ||
!.vscode/tasks.json | ||
|
||
# AWS SAM | ||
.aws-sam/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
|
||
[requires] | ||
python_version = "3.13" | ||
|
||
[packages] | ||
common = {editable = true, path = "src/common"} | ||
aws-lambda-powertools = "*" | ||
|
||
[dev-packages] | ||
boto3-stubs = { extras = [ "sns", ], version = "*"} | ||
cfn-lint = "*" | ||
flake8 = "*" | ||
genson = "*" | ||
jsonschema = "*" | ||
json2python-models = "*" | ||
moto = { extras = [ "sns", ], version = "*"} | ||
mypy = "*" | ||
pylint = "*" | ||
pytest = "*" | ||
pytest-cov = "*" | ||
pytest-flake8 = "*" | ||
pytest-mock = "*" | ||
pytest-mypy = "*" | ||
pytest-pylint = "*" | ||
tox = "*" | ||
|
||
[scripts] | ||
test = "pytest -vv --cov src --cov-report term-missing --cov-fail-under 95 tests" | ||
test-unit = "pytest -vv --cov src --cov-report term-missing --cov-fail-under 95 tests/unit" | ||
test-int = "pytest -vv --cov src --cov-report term-missing --cov-fail-under 95 tests/integration" | ||
test-ete = "pytest -vv --cov src --cov-report term-missing --cov-fail-under 95 tests/ete" | ||
flake8 = "pytest -vv --flake8" | ||
pylint = "pytest -vv --pylint" | ||
mypy = "pytest -vv --mypy" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# backstage / backstage-aws-resource-collector | ||
|
||
Collect resources from AWS accounts | ||
|
||
|
||
## New Project Getting Started | ||
This repository was generated from a template intended to get a new API up and running quickly. This section will cover different aspects of the newly created project as well as areas that may need to be modified to meet the specific needs of a new project. | ||
|
||
|
||
### Code | ||
When starting a new project the first place to start with adapting the code to meet the needs of a new project is the [`src/common/common/model/.py`](src/common/common/model/.py) file. This file contains interfaces for data and DDB table items. | ||
|
||
Start by modifying the dataclasses to match the shape of your data. Optionally you can choose to replace that interface with one from another module if you're working with a pre-existing data model. The existing interface definition was chosen simply to make the project work out of the box. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Component | ||
metadata: | ||
name: backstage-aws-resource-collector | ||
description: Collect resources from AWS accounts | ||
annotations: | ||
github.com/project-slug: ServerlessOpsIO/backstage-aws-resource-collector | ||
spec: | ||
type: api | ||
lifecycle: production | ||
owner: group:backstage | ||
system: system:backstage | ||
providesApis: | ||
- resource:backstage-aws-resource-collector | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
{ | ||
"Domain": "devtools", | ||
"System": "backstage", | ||
"Component": $env.GITHUB_REPOSITORY_NAME_PART_SLUG_CS, | ||
"CodeBranch": $env.GITHUB_REF_SLUG_CS | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"org:domain": "devtools", | ||
"org:system": "backstage", | ||
"org:component": $env.GITHUB_REPOSITORY_NAME_PART_SLUG_CS | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Event", | ||
"type": "object", | ||
"properties": {}, | ||
"additionalProperties": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"version": "0", | ||
"id": "bb675cb9-4cf4-4e6e-8a2e-9f17d21465d8", | ||
"detail-type": "Scheduled Event", | ||
"source": "aws.scheduler", | ||
"account": "123456789012", | ||
"time": "2024-12-13T22:46:36Z", | ||
"region": "us-east-1", | ||
"resources": [ | ||
"arn:aws:scheduler:us-east-1:123456789012:schedule/default/ScheduledProcessorFunctionSchedule" | ||
], | ||
"detail": "{}" | ||
} |
Oops, something went wrong.