mgraph-ai-service-cache-client 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mgraph-ai-service-cache-client might be problematic. Click here for more details.

@@ -0,0 +1,2 @@
1
+ package_name = 'mgraph_ai_service_cache_client'
2
+ path = __path__[0]
@@ -0,0 +1,6 @@
1
+ from mgraph_ai_service_cache_client import package_name
2
+
3
+ SERVICE_NAME = package_name
4
+ FAST_API__TITLE = "MGraph AI Service Cache Client"
5
+ FAST_API__DESCRIPTION = "Base template for MGraph-AI microservices"
6
+ LAMBDA_DEPENDENCIES__FAST_API_SERVERLESS = ['osbot-fast-api-serverless==v1.2.0']
@@ -0,0 +1,15 @@
1
+ from osbot_fast_api_serverless.fast_api.Serverless__Fast_API import Serverless__Fast_API
2
+ from mgraph_ai_service_cache_client.fast_api.routes.Routes__Info import Routes__Info
3
+ from mgraph_ai_service_cache_client.utils.Version import version__mgraph_ai_service_cache_client
4
+
5
+
6
+
7
+ class Cache_Client__Fast_API(Serverless__Fast_API):
8
+ title = "ASd" # FAST_API__TITLE
9
+ version = version__mgraph_ai_service_cache_client
10
+
11
+ def setup_routes(self):
12
+ self.add_routes(Routes__Info )
13
+
14
+
15
+
@@ -0,0 +1,26 @@
1
+ import os
2
+
3
+ if os.getenv('AWS_REGION'): # only execute if we are not running inside an AWS Lambda function
4
+
5
+ from osbot_aws.aws.lambda_.boto3__lambda import load_dependencies # using the lightweight file (which only has the boto3 calls required to load_dependencies)
6
+ LAMBDA_DEPENDENCIES = ['osbot-fast-api-serverless==v1.2.0']
7
+
8
+ load_dependencies(LAMBDA_DEPENDENCIES)
9
+
10
+ def clear_osbot_modules(): # todo: add this to load_dependencies method, since after it runs we don't need the osbot_aws.aws.lambda_.boto3__lambda
11
+ import sys
12
+ for module in list(sys.modules):
13
+ if module.startswith('osbot_aws'):
14
+ del sys.modules[module]
15
+
16
+ clear_osbot_modules()
17
+
18
+ from mgraph_ai_service_cache_client.fast_api.Cache_Client__Fast_API import Cache_Client__Fast_API
19
+
20
+ with Cache_Client__Fast_API() as _:
21
+ _.setup()
22
+ handler = _.handler()
23
+ app = _.app()
24
+
25
+ def run(event, context=None):
26
+ return handler(event, context)
@@ -0,0 +1,32 @@
1
+ from osbot_fast_api.api.routes.Fast_API__Routes import Fast_API__Routes
2
+ from mgraph_ai_service_cache_client.service.info.Service_Info import Service_Info
3
+
4
+ TAG__ROUTES_INFO = 'info'
5
+ ROUTES_PATHS__INFO = [ f'/{TAG__ROUTES_INFO}/health' ,
6
+ f'/{TAG__ROUTES_INFO}/server' ,
7
+ f'/{TAG__ROUTES_INFO}/status' ,
8
+ f'/{TAG__ROUTES_INFO}/versions']
9
+ ROUTES_INFO__HEALTH__RETURN_VALUE = {'status': 'ok'}
10
+
11
+ class Routes__Info(Fast_API__Routes):
12
+ tag : str = 'info'
13
+ service_info: Service_Info
14
+
15
+ def health(self):
16
+ return ROUTES_INFO__HEALTH__RETURN_VALUE
17
+
18
+ def server(self): # Get service versions
19
+ return self.service_info.server_info()
20
+
21
+ def status(self): # Get service status information
22
+ return self.service_info.service_info()
23
+
24
+ def versions(self): # Get service versions
25
+ return self.service_info.versions()
26
+
27
+
28
+ def setup_routes(self):
29
+ self.add_route_get(self.health )
30
+ self.add_route_get(self.server )
31
+ self.add_route_get(self.status )
32
+ self.add_route_get(self.versions)
@@ -0,0 +1,23 @@
1
+ from osbot_fast_api.utils.Fast_API__Server_Info import fast_api__server_info, Fast_API__Server_Info
2
+ from osbot_utils.type_safe.Type_Safe import Type_Safe
3
+ from mgraph_ai_service_cache_client.service.info.schemas.Schema__Service__Status import Schema__Service__Status, Enum__Service_Environment
4
+ from mgraph_ai_service_cache_client.service.info.schemas.Schema__Server__Versions import Schema__Server__Versions
5
+
6
+
7
+ class Service_Info(Type_Safe):
8
+
9
+ def environment(self): # Determine current environment
10
+ import os
11
+ if os.getenv('AWS_REGION'):
12
+ return Enum__Service_Environment.aws_lambda
13
+ else:
14
+ return Enum__Service_Environment.local
15
+
16
+ def service_info(self) -> Schema__Service__Status: # Get current service status
17
+ return Schema__Service__Status(environment = self.environment())
18
+
19
+ def versions(self):
20
+ return Schema__Server__Versions()
21
+
22
+ def server_info(self) -> Fast_API__Server_Info:
23
+ return fast_api__server_info
@@ -0,0 +1,6 @@
1
+ from enum import Enum
2
+
3
+
4
+ class Enum__Service_Environment(Enum):
5
+ aws_lambda : str = 'aws-lambda'
6
+ local : str = 'local'
@@ -0,0 +1,5 @@
1
+ from enum import Enum
2
+
3
+ class Enum__Service_Status(Enum):
4
+ operational : str = 'operational'
5
+ degraded : str = 'degraded'
@@ -0,0 +1,15 @@
1
+ from osbot_utils.type_safe.Type_Safe import Type_Safe
2
+ from osbot_utils.type_safe.primitives.domains.common.safe_str.Safe_Str__Version import Safe_Str__Version
3
+ from osbot_utils.utils.Version import Version as Version__OSBot_Utils
4
+ from osbot_aws.utils.Version import Version as Version__OSBot_AWS
5
+ from osbot_fast_api.utils.Version import version__osbot_fast_api
6
+ from osbot_fast_api_serverless.utils.Version import version__osbot_fast_api_serverless
7
+ from mgraph_ai_service_cache_client.utils.Version import version__mgraph_ai_service_cache_client
8
+
9
+
10
+ class Schema__Server__Versions(Type_Safe):
11
+ mgraph_ai_service_cache_client : Safe_Str__Version = version__mgraph_ai_service_cache_client
12
+ osbot_utils : Safe_Str__Version = Safe_Str__Version(Version__OSBot_Utils().value() )
13
+ osbot_aws : Safe_Str__Version = Safe_Str__Version(Version__OSBot_AWS ().value() )
14
+ osbot_fast_api : Safe_Str__Version = Safe_Str__Version(version__osbot_fast_api )
15
+ osbot_fast_api_serverless : Safe_Str__Version = Safe_Str__Version(version__osbot_fast_api_serverless)
@@ -0,0 +1,14 @@
1
+
2
+ from osbot_utils.type_safe.Type_Safe import Type_Safe
3
+ from osbot_utils.type_safe.primitives.domains.common.safe_str.Safe_Str__Version import Safe_Str__Version
4
+ from osbot_utils.type_safe.primitives.domains.identifiers.Safe_Id import Safe_Id
5
+ from mgraph_ai_service_cache_client.config import SERVICE_NAME
6
+ from mgraph_ai_service_cache_client.service.info.schemas.Enum__Service_Environment import Enum__Service_Environment
7
+ from mgraph_ai_service_cache_client.service.info.schemas.Enum__Service_Status import Enum__Service_Status
8
+ from mgraph_ai_service_cache_client.utils.Version import version__mgraph_ai_service_cache_client
9
+
10
+ class Schema__Service__Status(Type_Safe):
11
+ name : Safe_Id = Safe_Id(SERVICE_NAME)
12
+ version : Safe_Str__Version = version__mgraph_ai_service_cache_client
13
+ status : Enum__Service_Status = Enum__Service_Status.operational
14
+ environment : Enum__Service_Environment = Enum__Service_Environment.local
@@ -0,0 +1,21 @@
1
+ import mgraph_ai_service_cache_client
2
+ from osbot_utils.type_safe.primitives.domains.common.safe_str.Safe_Str__Version import Safe_Str__Version
3
+ from osbot_utils.type_safe.Type_Safe import Type_Safe
4
+ from osbot_utils.utils.Files import file_contents, path_combine
5
+
6
+
7
+ class Version(Type_Safe):
8
+
9
+ FILE_NAME_VERSION = 'version'
10
+
11
+ def path_code_root(self):
12
+ return mgraph_ai_service_cache_client.path
13
+
14
+ def path_version_file(self):
15
+ return path_combine(self.path_code_root(), self.FILE_NAME_VERSION)
16
+
17
+ def value(self):
18
+ version = file_contents(self.path_version_file()) or ""
19
+ return Safe_Str__Version(version)
20
+
21
+ version__mgraph_ai_service_cache_client = Version().value()
@@ -0,0 +1,20 @@
1
+ from osbot_fast_api_serverless.deploy.Deploy__Serverless__Fast_API import Deploy__Serverless__Fast_API
2
+ from mgraph_ai_service_cache_client.config import SERVICE_NAME, LAMBDA_DEPENDENCIES__FAST_API_SERVERLESS
3
+ from mgraph_ai_service_cache_client.fast_api.lambda_handler import run
4
+
5
+ class Deploy__Service(Deploy__Serverless__Fast_API):
6
+
7
+ def deploy_lambda(self):
8
+ with super().deploy_lambda() as _:
9
+ # Add any service-specific environment variables here
10
+ # Example: _.set_env_variable('BASE_API_KEY', get_env('BASE_API_KEY'))
11
+ return _
12
+
13
+ def handler(self):
14
+ return run
15
+
16
+ def lambda_dependencies(self):
17
+ return LAMBDA_DEPENDENCIES__FAST_API_SERVERLESS
18
+
19
+ def lambda_name(self):
20
+ return SERVICE_NAME
@@ -0,0 +1 @@
1
+ v0.1.2
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,346 @@
1
+ Metadata-Version: 2.1
2
+ Name: mgraph_ai_service_cache__client
3
+ Version: 0.1.2
4
+ Summary: MGraph-AI__Service__Cache__Client
5
+ Home-page: https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client
6
+ License: Apache 2.0
7
+ Author: Dinis Cruz
8
+ Author-email: dinis.cruz@owasp.org
9
+ Requires-Python: >=3.12,<4.0
10
+ Classifier: License :: Other/Proprietary License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Dist: osbot-fast-api-serverless
14
+ Project-URL: Repository, https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client
15
+ Description-Content-Type: text/markdown
16
+
17
+ # MGraph AI Service Cache Client
18
+
19
+ [![Current Release](https://img.shields.io/badge/release-v0.1.2-blue)](https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client/releases)
20
+ [![Python](https://img.shields.io/badge/python-3.12-blue)](https://www.python.org/downloads/)
21
+ [![FastAPI](https://img.shields.io/badge/FastAPI-0.116.1-009688)](https://fastapi.tiangolo.com/)
22
+ [![AWS Lambda](https://img.shields.io/badge/AWS-Lambda-orange)](https://aws.amazon.com/lambda/)
23
+ [![License](https://img.shields.io/badge/license-Apache%202.0-green)](LICENSE)
24
+ [![CI Pipeline - DEV](https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client/actions/workflows/ci-pipeline__dev.yml/badge.svg)](https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client/actions)
25
+
26
+ A production-ready FastAPI microservice template for building MGraph-AI services. This template provides a complete scaffold with CI/CD pipeline, AWS Lambda deployment, and type-safe architecture.
27
+
28
+ ## ๐ŸŽฏ Purpose
29
+
30
+ This repository serves as the base template for creating new MGraph-AI services. It includes:
31
+ - โœ… Complete FastAPI application structure
32
+ - โœ… Multi-stage CI/CD pipeline (dev, qa, prod)
33
+ - โœ… AWS Lambda deployment configuration
34
+ - โœ… Type-safe architecture using OSBot-Utils
35
+ - โœ… Comprehensive test coverage
36
+ - โœ… API key authentication
37
+ - โœ… Health check and monitoring endpoints
38
+
39
+ **Note**: This is a template repository. To create your own service, see [Creating Services from Template](docs/dev/non-functional-requirements/version-1_0_0/README.md).
40
+
41
+ ## ๐Ÿ“š Creating a New Service
42
+
43
+ To create a new service from this template, see [Creating Services from MGraph-AI__Service__Cache__Client](docs/dev/non-functional-requirements/version-1_0_0/README.md).
44
+
45
+ ## ๐Ÿš€ Features
46
+
47
+ - **Type-Safe Architecture**: Built on OSBot-Utils type safety framework
48
+ - **Multi-Stage Deployment**: Automated CI/CD pipeline for dev, QA, and production
49
+ - **AWS Lambda Ready**: Optimized for serverless deployment
50
+ - **API Key Authentication**: Secure access control
51
+
52
+ ## ๐Ÿ“‹ Table of Contents
53
+
54
+ - [Quick Start](#-quick-start)
55
+ - [Installation](#-installation)
56
+ - [API Documentation](#-api-documentation)
57
+ - [Configuration](#-configuration)
58
+ - [Development](#-development)
59
+ - [Testing](#-testing)
60
+ - [Deployment](#-deployment)
61
+ - [Security](#-security)
62
+ - [Contributing](#-contributing)
63
+ - [License](#-license)
64
+
65
+ ## ๐ŸŽฏ Quick Start
66
+
67
+ ### Local Development
68
+
69
+ ```bash
70
+ # Clone the repository
71
+ git clone https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client.git
72
+ cd MGraph-AI__Service__Cache__Client
73
+
74
+ # Install dependencies
75
+ pip install -r requirements-test.txt
76
+ pip install -e .
77
+
78
+ # Set environment variables
79
+ export FAST_API__AUTH__API_KEY__NAME="x-api-key"
80
+ export FAST_API__AUTH__API_KEY__VALUE="your-secret-key"
81
+
82
+ # Run locally
83
+ ./scripts/run-locally.sh
84
+ # or
85
+ uvicorn mgraph_ai_service_cache__client.fast_api.lambda_handler:app --reload --host 0.0.0.0 --port 10011
86
+ ```
87
+
88
+ ### Basic Usage
89
+
90
+ ```python
91
+ import requests
92
+
93
+ # Set up authentication
94
+ headers = {"x-api-key": "your-secret-key"}
95
+ base_url = "http://localhost:10011"
96
+
97
+ # Check service health
98
+ response = requests.get(f"{base_url}/health", headers=headers)
99
+ print(response.json())
100
+
101
+ # Get service info
102
+ response = requests.get(f"{base_url}/info/version", headers=headers)
103
+ print(response.json())
104
+ ```
105
+
106
+ ## ๐Ÿ“ฆ Installation
107
+
108
+ ### Prerequisites
109
+
110
+ - Python 3.12+
111
+ - AWS CLI (for deployment)
112
+ - Docker (for LocalStack testing)
113
+
114
+ ### Using Poetry
115
+
116
+ ```bash
117
+ # Install poetry if not already installed
118
+ pip install poetry
119
+
120
+ # Install dependencies
121
+ poetry install
122
+
123
+ # Activate virtual environment
124
+ poetry shell
125
+ ```
126
+
127
+ ### Using pip
128
+
129
+ ```bash
130
+ # Create virtual environment
131
+ python -m venv venv
132
+ source venv/bin/activate # On Windows: venv\Scripts\activate
133
+
134
+ # Install dependencies
135
+ pip install -r requirements-test.txt
136
+ pip install -e .
137
+ ```
138
+
139
+ ## ๐Ÿ“– API Documentation
140
+
141
+ ### Interactive API Documentation
142
+
143
+ Once the service is running, access the interactive API documentation at:
144
+ - Swagger UI: http://localhost:10011/docs
145
+ - ReDoc: http://localhost:10011/redoc
146
+
147
+ ### Endpoints Overview
148
+
149
+ #### Health Endpoints
150
+
151
+ | Endpoint | Method | Description |
152
+ |----------|--------|-------------|
153
+ | `/health` | GET | Service health check |
154
+ | `/health/detailed` | GET | Detailed health status |
155
+
156
+ #### Information Endpoints
157
+
158
+ | Endpoint | Method | Description |
159
+ |----------|--------|-------------|
160
+ | `/info/version` | GET | Get service version |
161
+ | `/info/status` | GET | Get service status |
162
+
163
+ ## โš™๏ธ Configuration
164
+
165
+ ### Environment Variables
166
+
167
+ | Variable | Description | Required | Default |
168
+ |----------|-------------|----------|---------|
169
+ | `FAST_API__AUTH__API_KEY__NAME` | Header name for API key | Yes | - |
170
+ | `FAST_API__AUTH__API_KEY__VALUE` | API key value | Yes | - |
171
+ | `AWS_REGION` | AWS region (triggers Lambda mode) | No | - |
172
+ | `DEBUG` | Enable debug logging | No | false |
173
+
174
+ ### Configuration File
175
+
176
+ Create a `.env` file for local development:
177
+
178
+ ```env
179
+ FAST_API__AUTH__API_KEY__NAME=x-api-key
180
+ FAST_API__AUTH__API_KEY__VALUE=development-key-12345
181
+ ```
182
+
183
+ ## ๐Ÿ› ๏ธ Development
184
+
185
+ ### Project Structure
186
+
187
+ ```
188
+ mgraph_ai_service_cache__client/
189
+ โ”œโ”€โ”€ fast_api/
190
+ โ”‚ โ”œโ”€โ”€ lambda_handler.py # AWS Lambda entry point
191
+ โ”‚ โ”œโ”€โ”€ Service__Fast_API.py # FastAPI application setup
192
+ โ”‚ โ””โ”€โ”€ routes/ # API endpoint definitions
193
+ โ”œโ”€โ”€ service/
194
+ โ”‚ โ””โ”€โ”€ info/ # Service information
195
+ โ”œโ”€โ”€ utils/
196
+ โ”‚ โ”œโ”€โ”€ deploy/ # Deployment utilities
197
+ โ”‚ โ””โ”€โ”€ Version.py # Version management
198
+ โ””โ”€โ”€ config.py # Service configuration
199
+ ```
200
+
201
+ ### Adding New Endpoints
202
+
203
+ 1. Create a new route class in `fast_api/routes/`:
204
+
205
+ ```python
206
+ from osbot_fast_api.api.Fast_API_Routes import Fast_API_Routes
207
+
208
+ class Routes__MyFeature(Fast_API_Routes):
209
+ tag = 'my-feature'
210
+
211
+ def my_endpoint(self, param: str = "default"):
212
+ return {"result": param}
213
+
214
+ def setup_routes(self):
215
+ self.add_route_get(self.my_endpoint)
216
+ ```
217
+
218
+ 2. Register in `Service__Fast_API`:
219
+
220
+ ```python
221
+ def setup_routes(self):
222
+ # ... existing routes
223
+ self.add_routes(Routes__MyFeature)
224
+ ```
225
+
226
+ ## ๐Ÿงช Testing
227
+
228
+ ### Running Tests
229
+
230
+ ```bash
231
+ # Run all tests
232
+ pytest
233
+
234
+ # Run with coverage
235
+ pytest --cov=mgraph_ai_service_cache__client
236
+
237
+ # Run specific test file
238
+ pytest tests/unit/fast_api/test_Service__Fast_API__client.py
239
+
240
+ # Run integration tests (requires LocalStack)
241
+ pytest tests/integration/
242
+ ```
243
+
244
+ ### Test Structure
245
+
246
+ ```
247
+ tests/
248
+ โ”œโ”€โ”€ unit/ # Unit tests
249
+ โ”‚ โ”œโ”€โ”€ fast_api/ # API tests
250
+ โ”‚ โ””โ”€โ”€ service/ # Service tests
251
+ โ””โ”€โ”€ deploy_aws/ # Deployment tests
252
+ ```
253
+
254
+ ## ๐Ÿš€ Deployment
255
+
256
+ ### AWS Lambda Deployment
257
+
258
+ The service includes automated deployment scripts for multiple environments:
259
+
260
+ ```bash
261
+ # Deploy to development
262
+ pytest tests/deploy_aws/test_Deploy__Service__to__dev.py
263
+
264
+ # Deploy to QA
265
+ pytest tests/deploy_aws/test_Deploy__Service__to__qa.py
266
+
267
+ # Deploy to production (manual trigger)
268
+ # Use GitHub Actions workflow
269
+ ```
270
+
271
+ ### CI/CD Pipeline
272
+
273
+ The project uses GitHub Actions for continuous deployment:
274
+
275
+ 1. **Development Branch** (`dev`)
276
+ - Runs tests with LocalStack
277
+ - Deploys to dev environment
278
+ - Increments minor version
279
+
280
+ 2. **Main Branch** (`main`)
281
+ - Runs comprehensive test suite
282
+ - Deploys to QA environment
283
+ - Increments major version
284
+
285
+ 3. **Production** (manual)
286
+ - Requires manual workflow trigger
287
+ - Deploys to production environment
288
+
289
+ ## ๐Ÿ”’ Security
290
+
291
+ ### Authentication
292
+
293
+ API key authentication is required for all endpoints:
294
+
295
+ ```python
296
+ headers = {"x-api-key": "your-secret-key"}
297
+ ```
298
+
299
+ ### Best Practices
300
+
301
+ 1. **Never commit secrets** - Use environment variables
302
+ 2. **Rotate API keys** - Regular key rotation
303
+ 3. **Use HTTPS** - Always encrypt in transit
304
+ 4. **Monitor access** - Log and audit API usage
305
+
306
+ ## ๐Ÿค Contributing
307
+
308
+ We welcome contributions! Please follow these steps:
309
+
310
+ 1. Fork the repository
311
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
312
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
313
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
314
+ 5. Open a Pull Request
315
+
316
+ ### Development Guidelines
317
+
318
+ - Write tests for new features
319
+ - Update documentation
320
+ - Follow existing code style
321
+ - Add type annotations
322
+ - Consider security implications
323
+
324
+ ## ๐Ÿ”— Related Projects
325
+
326
+ - [OSBot-Utils](https://github.com/owasp-sbot/OSBot-Utils) - Core utilities library
327
+ - [OSBot-AWS](https://github.com/owasp-sbot/OSBot-AWS) - AWS integration layer
328
+ - [OSBot-Fast-API](https://github.com/owasp-sbot/OSBot-Fast-API) - FastAPI utilities
329
+
330
+ ## ๐Ÿ“„ License
331
+
332
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
333
+
334
+ ## ๐Ÿ™ Acknowledgments
335
+
336
+ - Built with [FastAPI](https://fastapi.tiangolo.com/)
337
+ - Deployed on [AWS Lambda](https://aws.amazon.com/lambda/)
338
+
339
+ ## ๐Ÿ“ž Support
340
+
341
+ - ๐Ÿ› Issues: [GitHub Issues](https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client/issues)
342
+ - ๐Ÿ’ฌ Discussions: [GitHub Discussions](https://github.com/the-cyber-boardroom/MGraph-AI__Service__Cache__Client/discussions)
343
+
344
+ ---
345
+
346
+ Created and maintained by [The Cyber Boardroom](https://github.com/the-cyber-boardroom) team
@@ -0,0 +1,17 @@
1
+ mgraph_ai_service_cache_client/__init__.py,sha256=vV-3_LTA0gOaz_M_rug9AA7UQ6vMFo35MolQSywHS-4,74
2
+ mgraph_ai_service_cache_client/config.py,sha256=JmUXxVA2PmuPzv39_0751dswVYyUtrzAjVr1JFnso-s,356
3
+ mgraph_ai_service_cache_client/fast_api/Cache_Client__Fast_API.py,sha256=iYUqCYKemXJPpSVDYJ5VAxcAZEqMIK5Q6CaWZ5uSGPE,526
4
+ mgraph_ai_service_cache_client/fast_api/lambda_handler.py,sha256=hqBD4imnlACXdE7mFjUz7Q7OkxOoA1rk4blZ9HqsWaY,1001
5
+ mgraph_ai_service_cache_client/fast_api/routes/Routes__Info.py,sha256=4Qe67YJeS6vAaFPTrefVFRnbBu3XaHDN9joWs49i1_4,1353
6
+ mgraph_ai_service_cache_client/service/info/Service_Info.py,sha256=lTTZcqJ2cKjmtc1nulNKk77A1xz3zQWUG7EQsfh0ApQ,1154
7
+ mgraph_ai_service_cache_client/service/info/schemas/Enum__Service_Environment.py,sha256=x4B6kDwncyklQaEFf0kAGyY5LE0r9Ch3ww_EZmBUDP8,129
8
+ mgraph_ai_service_cache_client/service/info/schemas/Enum__Service_Status.py,sha256=15PehXAEwdvlG-axvTF-p8XYWklscLPucH1Ki2UrwTQ,129
9
+ mgraph_ai_service_cache_client/service/info/schemas/Schema__Server__Versions.py,sha256=SGXNdZT_hrel-QV0AoNBsP4D42vGHgVNijiwb9RmZGw,1384
10
+ mgraph_ai_service_cache_client/service/info/schemas/Schema__Service__Status.py,sha256=jlmwi37c1m_aDnKG7VMFzjoNbeb9AZNX45nVNksROrk,1127
11
+ mgraph_ai_service_cache_client/utils/Version.py,sha256=-iKgWjUzrm9eGMdLFsvKPuxZFckmfNE5Y5bw6vSydhY,797
12
+ mgraph_ai_service_cache_client/utils/deploy/Deploy__Service.py,sha256=iBqB4km1H3eHPXPfyh7UajjHMKom684S9ACGUa13vw4,816
13
+ mgraph_ai_service_cache_client/version,sha256=DbJRHyaaVDZLLGEBuP-r4piScs6LbHtBdjThjRMnVaI,7
14
+ mgraph_ai_service_cache_client-0.1.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
+ mgraph_ai_service_cache_client-0.1.2.dist-info/METADATA,sha256=EcQVBuPW5HmLg27sijBUC0F8HJVS8GUyoOMityVpSK0,9846
16
+ mgraph_ai_service_cache_client-0.1.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
17
+ mgraph_ai_service_cache_client-0.1.2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.9.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any