diff options
| author | Alex <git@ajschof.me> | 2024-08-20 15:25:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-20 15:25:58 +0100 |
| commit | a393d59e052d3a37d66f7a657a15cad1d486e3b1 (patch) | |
| tree | 671b2817d4576abd1132aded13f25ba545beff90 | |
| parent | c5d4d95851c88ddf4f73d41c0f88ff844b3ed197 (diff) | |
| parent | 53686e2e466bc38f65da15ec617b43e43a1af9f7 (diff) | |
| download | de-project-bentley-a393d59e052d3a37d66f7a657a15cad1d486e3b1.tar.gz de-project-bentley-a393d59e052d3a37d66f7a657a15cad1d486e3b1.zip | |
Merge pull request #75 from ajschofield/alex/repo-tidy-up
pr: tidy-up repository & remove unused files
| -rw-r--r-- | Makefile | 80 | ||||
| -rw-r--r-- | src/secrets_manager.py | 49 | ||||
| -rw-r--r-- | test.py | 0 |
3 files changed, 0 insertions, 129 deletions
diff --git a/Makefile b/Makefile deleted file mode 100644 index 077cd98..0000000 --- a/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -############################################## -# # -# MAKEFILE TO BUILD THE PROJECT # -# # -############################################## - -PROJECT_NAME = de-project-bentley -REGION = eu-west-2 -PYTHON_INTERPRETER = python -WD=$(shell pwd) -PYTHONPATH=${WD} -SHELL := /bin/bash -PROFILE = default -PIP:=pip - -## PYTHON INTERPRETER ENVIRONMENT -create-environment: - @echo ">>> About to create environment: $(PROJECT_NAME)..." - @echo ">>> check python3 version" - ( \ - $(PYTHON_INTERPRETER) --version; \ - ) - @echo ">>> Setting up VirtualEnv." - ( \ - $(PIP) install -q virtualenv virtualenvwrapper; \ - virtualenv venv --python=$(PYTHON_INTERPRETER); \ - ) - -ACTIVATE_ENV := source venv/bin/activate - -# Execute python related functionalities from within the project's environment -define execute_in_env - $(ACTIVATE_ENV) && $1 -endef - -## Build the environment requirements -requirements: create-environment - $(call execute_in_env, $(PIP) install -r ./requirements.txt) - -# Set Up -## Install bandit -bandit: - $(call execute_in_env, $(PIP) install bandit) - -## Install safety -safety: - $(call execute_in_env, $(PIP) install safety) - -## Install black -black: - $(call execute_in_env, $(PIP) install black) - -## Install coverage -coverage: - $(call execute_in_env, $(PIP) install coverage) - -## Set up dev requirements (bandit, safety, black) -dev-setup: bandit safety black coverage - -# Build / Run - -## Run the security test (bandit + safety) -security-test: - $(call execute_in_env, safety check -r ./requirements.txt) - $(call execute_in_env, bandit -lll */*.py *c/*/*.py) - -## Run the black code check -run-black: - $(call execute_in_env, black ./src/*/*.py ./test/*/*.py) - -## Run the unit tests -unit-test: - $(call execute_in_env, PYTHONPATH=${PYTHONPATH} pytest -v) - -## Run the coverage check -check-coverage: - $(call execute_in_env, PYTHONPATH=${PYTHONPATH} pytest --cov=src test/) - -## Run all checks -run-checks: security-test run-black unit-test check-coverage diff --git a/src/secrets_manager.py b/src/secrets_manager.py deleted file mode 100644 index 3484688..0000000 --- a/src/secrets_manager.py +++ /dev/null @@ -1,49 +0,0 @@ -import boto3 -from botocore.exceptions import ClientError -import json - - -def sm_client(): - sm_client = boto3.client("secretsmanager") - yield sm_client - - -def create_secret( - sm_client, secret_name, cohort_id, user, password, host, database, port -): - secret = { - "cohort_id": cohort_id, - "user": user, - "password": password, - "host": host, - "database": database, - "port": port, - } - - response = sm_client.create_secret( - Name=secret_name, SecretString=json.dumps(secret) - ) - - print(response) - return response - - -def list_secret(sm_client): - response = sm_client.list_secrets() - secret_dict = response["SecretList"] - secret_names = [] - for items in secret_dict: - secret_names.append(items["Name"]) - print(f"{len(secret_names)} secret(s) available") - for name in secret_names: - print(name) - return secret_names - - -def retrieve_secrets(sm_client): - response = sm_client.get_secrets() - - -# retrieve secret -# so lambda can access totesy db -# so lambda connect to the db and then retrieve the data diff --git a/test.py b/test.py deleted file mode 100644 index e69de29..0000000 --- a/test.py +++ /dev/null |
