ocloud 0.1.0__tar.gz
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.
- ocloud-0.1.0/.gitignore +34 -0
- ocloud-0.1.0/CHANGELOG.md +28 -0
- ocloud-0.1.0/CODE_OF_CONDUCT.md +45 -0
- ocloud-0.1.0/CONTRIBUTING.md +50 -0
- ocloud-0.1.0/LICENSE +21 -0
- ocloud-0.1.0/PKG-INFO +175 -0
- ocloud-0.1.0/README.md +133 -0
- ocloud-0.1.0/SECURITY.md +23 -0
- ocloud-0.1.0/docs/architecture.md +32 -0
- ocloud-0.1.0/docs/authentication.md +23 -0
- ocloud-0.1.0/docs/examples.md +8 -0
- ocloud-0.1.0/docs/getting-started.md +39 -0
- ocloud-0.1.0/docs/installation.md +30 -0
- ocloud-0.1.0/docs/providers/aws.md +23 -0
- ocloud-0.1.0/docs/providers/azure.md +23 -0
- ocloud-0.1.0/docs/providers/gcp.md +19 -0
- ocloud-0.1.0/docs/security.md +18 -0
- ocloud-0.1.0/docs/testing.md +43 -0
- ocloud-0.1.0/docs/troubleshooting.md +21 -0
- ocloud-0.1.0/examples/aws/s3_acl.py +20 -0
- ocloud-0.1.0/examples/unified/storage_upload.py +21 -0
- ocloud-0.1.0/pyproject.toml +164 -0
- ocloud-0.1.0/src/ocloud/__init__.py +75 -0
- ocloud-0.1.0/src/ocloud/core/__init__.py +62 -0
- ocloud-0.1.0/src/ocloud/core/command.py +69 -0
- ocloud-0.1.0/src/ocloud/core/exceptions.py +310 -0
- ocloud-0.1.0/src/ocloud/core/executor.py +133 -0
- ocloud-0.1.0/src/ocloud/core/logging.py +155 -0
- ocloud-0.1.0/src/ocloud/core/result.py +132 -0
- ocloud-0.1.0/src/ocloud/core/validation.py +296 -0
- ocloud-0.1.0/src/ocloud/providers/__init__.py +13 -0
- ocloud-0.1.0/src/ocloud/providers/aws/__init__.py +11 -0
- ocloud-0.1.0/src/ocloud/providers/aws/auth.py +49 -0
- ocloud-0.1.0/src/ocloud/providers/aws/client.py +89 -0
- ocloud-0.1.0/src/ocloud/providers/aws/ec2.py +207 -0
- ocloud-0.1.0/src/ocloud/providers/aws/lambda_.py +294 -0
- ocloud-0.1.0/src/ocloud/providers/aws/s3.py +312 -0
- ocloud-0.1.0/src/ocloud/providers/azure/__init__.py +11 -0
- ocloud-0.1.0/src/ocloud/providers/azure/auth.py +49 -0
- ocloud-0.1.0/src/ocloud/providers/azure/blob.py +317 -0
- ocloud-0.1.0/src/ocloud/providers/azure/client.py +90 -0
- ocloud-0.1.0/src/ocloud/providers/azure/functions.py +236 -0
- ocloud-0.1.0/src/ocloud/providers/azure/vm.py +217 -0
- ocloud-0.1.0/src/ocloud/providers/gcp/__init__.py +11 -0
- ocloud-0.1.0/src/ocloud/providers/gcp/auth.py +56 -0
- ocloud-0.1.0/src/ocloud/providers/gcp/client.py +89 -0
- ocloud-0.1.0/src/ocloud/providers/gcp/compute.py +233 -0
- ocloud-0.1.0/src/ocloud/providers/gcp/functions.py +245 -0
- ocloud-0.1.0/src/ocloud/providers/gcp/storage.py +261 -0
- ocloud-0.1.0/src/ocloud/py.typed +0 -0
- ocloud-0.1.0/src/ocloud/unified/__init__.py +17 -0
- ocloud-0.1.0/src/ocloud/unified/cloud.py +67 -0
- ocloud-0.1.0/src/ocloud/unified/compute.py +97 -0
- ocloud-0.1.0/src/ocloud/unified/serverless.py +129 -0
- ocloud-0.1.0/src/ocloud/unified/storage.py +101 -0
- ocloud-0.1.0/tests/__init__.py +1 -0
- ocloud-0.1.0/tests/conftest.py +55 -0
- ocloud-0.1.0/tests/integration/__init__.py +1 -0
- ocloud-0.1.0/tests/integration/test_authentication.py +44 -0
- ocloud-0.1.0/tests/unit/__init__.py +1 -0
- ocloud-0.1.0/tests/unit/test_command.py +127 -0
- ocloud-0.1.0/tests/unit/test_exceptions.py +117 -0
- ocloud-0.1.0/tests/unit/test_executor.py +170 -0
- ocloud-0.1.0/tests/unit/test_provider_commands.py +300 -0
- ocloud-0.1.0/tests/unit/test_provider_repairs.py +120 -0
- ocloud-0.1.0/tests/unit/test_result.py +150 -0
- ocloud-0.1.0/tests/unit/test_unified_operations.py +95 -0
- ocloud-0.1.0/tests/unit/test_unified_routing.py +53 -0
- ocloud-0.1.0/tests/unit/test_validation.py +186 -0
ocloud-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.so
|
|
5
|
+
*.egg-info/
|
|
6
|
+
.pytest_cache/
|
|
7
|
+
.mypy_cache/
|
|
8
|
+
.ruff_cache/
|
|
9
|
+
.coverage
|
|
10
|
+
coverage.xml
|
|
11
|
+
htmlcov/
|
|
12
|
+
bandit-report.json
|
|
13
|
+
|
|
14
|
+
# Build artifacts
|
|
15
|
+
build/
|
|
16
|
+
dist/
|
|
17
|
+
|
|
18
|
+
# Environments
|
|
19
|
+
.venv/
|
|
20
|
+
venv/
|
|
21
|
+
.env
|
|
22
|
+
|
|
23
|
+
# IDE and operating system
|
|
24
|
+
.vscode/
|
|
25
|
+
.idea/
|
|
26
|
+
.DS_Store
|
|
27
|
+
Thumbs.db
|
|
28
|
+
|
|
29
|
+
# Cloud credentials and local configuration
|
|
30
|
+
.aws/
|
|
31
|
+
.azure/
|
|
32
|
+
.config/gcloud/
|
|
33
|
+
*.pem
|
|
34
|
+
*.key
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes are recorded here. OCloud follows [Semantic Versioning](https://semver.org/) and the [Keep a Changelog](https://keepachangelog.com/) format.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Documented Azure Functions invocation as unsupported in the CLI MVP. Azure CLI does not provide a generic function-invocation command; OCloud now raises `UnsupportedOperationError` instead of issuing a metadata request.
|
|
9
|
+
- Migrated GCP storage service commands from `gsutil` to `gcloud storage`.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Unit coverage for provider routing, command construction, CLI availability, timeout handling, temporary Lambda response files, and unified APIs.
|
|
13
|
+
- Project security policy, architecture and provider documentation, pre-commit configuration, CI, security scanning, and a manually dispatched Trusted Publishing release workflow.
|
|
14
|
+
|
|
15
|
+
## [0.1.0] - 2026-08-22
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- Synchronous command model, safe CLI executor, structured results, validation, and redacted logging.
|
|
19
|
+
- Provider clients for selected AWS S3/EC2/Lambda, Azure Blob Storage/VM/Functions, and GCP Cloud Storage/Compute Engine/Cloud Functions operations.
|
|
20
|
+
- Advanced provider-only raw CLI APIs using argument lists.
|
|
21
|
+
- A narrow unified `Cloud` facade for common storage, compute, and serverless lifecycle routing.
|
|
22
|
+
|
|
23
|
+
### Security
|
|
24
|
+
- No cloud credential storage or automatic cloud CLI installation.
|
|
25
|
+
- Shell-free subprocess execution, timeout handling, CLI discovery, and secret-redaction utilities.
|
|
26
|
+
|
|
27
|
+
### Verification status
|
|
28
|
+
- Unit tested with mocked CLIs; real-cloud integration testing has not been performed or claimed.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and maintainers pledge to make participation in the OCloud community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment include:
|
|
12
|
+
|
|
13
|
+
- Demonstrating empathy and kindness toward other people.
|
|
14
|
+
- Respecting differing opinions, viewpoints, and experiences.
|
|
15
|
+
- Giving and gracefully accepting constructive feedback.
|
|
16
|
+
- Accepting responsibility and apologizing to those affected by mistakes.
|
|
17
|
+
- Focusing on what is best for the overall community.
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
- Sexualized language, imagery, or attention; sexual advances of any kind.
|
|
22
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks.
|
|
23
|
+
- Public or private harassment.
|
|
24
|
+
- Publishing others' private information without explicit permission.
|
|
25
|
+
- Conduct that is reasonably considered inappropriate in a professional setting.
|
|
26
|
+
|
|
27
|
+
## Enforcement Responsibilities
|
|
28
|
+
|
|
29
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior. They may take appropriate and fair corrective action in response to behavior they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
Community leaders may remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that do not align with this Code of Conduct. Reasons for moderation decisions will be communicated when appropriate.
|
|
32
|
+
|
|
33
|
+
## Scope
|
|
34
|
+
|
|
35
|
+
This Code of Conduct applies within all community spaces and also applies when an individual is officially representing the OCloud community in public spaces.
|
|
36
|
+
|
|
37
|
+
## Enforcement
|
|
38
|
+
|
|
39
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainers through the repository's private security reporting channel. All complaints will be reviewed and investigated promptly and fairly.
|
|
40
|
+
|
|
41
|
+
Maintainers will respect the privacy and security of the reporter. A report may result in a private warning, a public warning, temporary restrictions, or permanent removal from community spaces, depending on the severity and pattern of behavior.
|
|
42
|
+
|
|
43
|
+
## Attribution
|
|
44
|
+
|
|
45
|
+
This Code of Conduct is adapted from the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Contributing to OCloud
|
|
2
|
+
|
|
3
|
+
Thank you for helping improve OCloud. By participating, you agree to the [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
4
|
+
|
|
5
|
+
## Development setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/THE-S0HAM/ocloud.git
|
|
9
|
+
cd ocloud
|
|
10
|
+
python -m venv .venv
|
|
11
|
+
# Windows PowerShell: .venv\Scripts\Activate.ps1
|
|
12
|
+
# POSIX: source .venv/bin/activate
|
|
13
|
+
python -m pip install -e ".[dev]"
|
|
14
|
+
pre-commit install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Cloud CLIs and cloud credentials are optional for unit testing. Do not add credentials, tokens, profiles, or cloud account IDs to commits, test fixtures, or examples.
|
|
18
|
+
|
|
19
|
+
## Required validation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
ruff format --check .
|
|
23
|
+
ruff check .
|
|
24
|
+
mypy src/ocloud
|
|
25
|
+
pytest --cov=ocloud --cov-report=term-missing
|
|
26
|
+
bandit -r src/ocloud -q
|
|
27
|
+
python -m build
|
|
28
|
+
python -m twine check dist/*
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Tests must validate commands, arguments, routing, results, errors, and security behavior. Unit tests must mock subprocess/CLI behavior and require no cloud account. Put real-cloud tests behind an explicit `integration` marker and document their setup.
|
|
32
|
+
|
|
33
|
+
## Design rules
|
|
34
|
+
|
|
35
|
+
- Use the shared command/result/executor layer; never add direct `subprocess` calls in services.
|
|
36
|
+
- Never use `shell=True` or construct a shell command string.
|
|
37
|
+
- Validate public input and return `CommandResult` for executed operations.
|
|
38
|
+
- Use OCloud exceptions for expected failures.
|
|
39
|
+
- Keep provider-specific concepts explicit rather than forcing false cross-cloud equivalence.
|
|
40
|
+
- Update user-facing documentation, examples, and `CHANGELOG.md` with public API changes.
|
|
41
|
+
|
|
42
|
+
## Pull requests
|
|
43
|
+
|
|
44
|
+
Use a focused branch and submit a PR that explains user impact, security implications, and validation performed. Do not commit generated `dist/`, coverage, or environment files. Maintainers review for correctness, security, API stability, documentation, and test quality before merge.
|
|
45
|
+
|
|
46
|
+
## Reporting issues
|
|
47
|
+
|
|
48
|
+
Use GitHub issues for reproducible bugs and feature proposals. Use the [private security reporting channel](SECURITY.md) for suspected vulnerabilities; do not disclose them publicly.
|
|
49
|
+
|
|
50
|
+
Contributions are licensed under the [MIT License](LICENSE).
|
ocloud-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OCloud Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ocloud-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: ocloud
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A production-grade Python library for unified cloud management across AWS, Azure, and GCP
|
|
5
|
+
Project-URL: Homepage, https://github.com/THE-S0HAM/ocloud
|
|
6
|
+
Project-URL: Repository, https://github.com/THE-S0HAM/ocloud
|
|
7
|
+
Project-URL: Documentation, https://github.com/THE-S0HAM/ocloud/tree/main/docs
|
|
8
|
+
Project-URL: Issues, https://github.com/THE-S0HAM/ocloud/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/THE-S0HAM/ocloud/blob/main/CHANGELOG.md
|
|
10
|
+
Author: OCloud Contributors
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: aws,azure,blob,cli,cloud,cloud-management,ec2,functions,gcp,lambda,s3,vm
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: System Administrators
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Natural Language :: English
|
|
20
|
+
Classifier: Operating System :: MacOS
|
|
21
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
22
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
23
|
+
Classifier: Programming Language :: Python :: 3
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
28
|
+
Classifier: Topic :: System :: Systems Administration
|
|
29
|
+
Classifier: Topic :: Utilities
|
|
30
|
+
Classifier: Typing :: Typed
|
|
31
|
+
Requires-Python: >=3.10
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: bandit==1.8.3; extra == 'dev'
|
|
34
|
+
Requires-Dist: build==1.2.2.post1; extra == 'dev'
|
|
35
|
+
Requires-Dist: mypy==1.15.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: pre-commit==4.1.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest-cov==7.1.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest==8.4.2; extra == 'dev'
|
|
39
|
+
Requires-Dist: ruff==0.9.10; extra == 'dev'
|
|
40
|
+
Requires-Dist: twine==7.0.0; extra == 'dev'
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
# OCloud
|
|
44
|
+
|
|
45
|
+
[](https://github.com/THE-S0HAM/ocloud/actions/workflows/ci.yml)
|
|
46
|
+
[](https://pypi.org/project/ocloud/)
|
|
47
|
+
[](LICENSE)
|
|
48
|
+
|
|
49
|
+
**OCloud** is a lightweight, synchronous Python library for managing selected AWS, Azure, and Google Cloud resources through their official CLI tools. It provides a typed provider API, a deliberately narrow unified API, structured command results, and an advanced provider-only raw CLI escape hatch.
|
|
50
|
+
|
|
51
|
+
## What OCloud does
|
|
52
|
+
|
|
53
|
+
- Runs only the official `aws`, `az`, and `gcloud` executables—no cloud SDK dependency or credential store.
|
|
54
|
+
- Safely invokes subprocesses with argument lists; it never uses `shell=True`.
|
|
55
|
+
- Captures redacted stdout, stderr, exit code, parsed JSON where applicable, and redacted command metadata.
|
|
56
|
+
- Provides storage, compute, and serverless lifecycle helpers for the documented MVP surface.
|
|
57
|
+
|
|
58
|
+
## Install and authenticate
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python -m pip install ocloud
|
|
62
|
+
aws configure # AWS users
|
|
63
|
+
az login # Azure users
|
|
64
|
+
gcloud auth login # Google Cloud users
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Install the provider CLI separately; OCloud does not install it. Python 3.10–3.13 is supported.
|
|
68
|
+
|
|
69
|
+
## Quick start
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from ocloud import AWS
|
|
73
|
+
|
|
74
|
+
aws = AWS()
|
|
75
|
+
aws.auth.check_status()
|
|
76
|
+
result = aws.s3.put_object_acl(
|
|
77
|
+
bucket="my-bucket",
|
|
78
|
+
key="path/to/file.pdf",
|
|
79
|
+
acl="public-read",
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
if result.success:
|
|
83
|
+
print(result.data)
|
|
84
|
+
else:
|
|
85
|
+
print(result.stderr)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Unified API
|
|
89
|
+
|
|
90
|
+
Use `Cloud` for operations with genuinely shared semantics. Provider-specific context remains explicit.
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from ocloud import Cloud
|
|
94
|
+
|
|
95
|
+
cloud = Cloud("aws")
|
|
96
|
+
result = cloud.storage.upload(
|
|
97
|
+
file="document.pdf",
|
|
98
|
+
bucket="my-bucket",
|
|
99
|
+
key="documents/document.pdf",
|
|
100
|
+
timeout=60,
|
|
101
|
+
)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Provider APIs
|
|
105
|
+
|
|
106
|
+
| Provider | Storage | Compute | Serverless |
|
|
107
|
+
| --- | --- | --- | --- |
|
|
108
|
+
| AWS | S3 upload/download/delete/list/exists/ACL | EC2 start/stop/restart/status | Lambda deploy/invoke/status/delete |
|
|
109
|
+
| Azure | Blob upload/download/delete/list/exists | VM start/stop/restart/status | Function App ZIP deploy; Function status/delete |
|
|
110
|
+
| GCP | Cloud Storage upload/download/delete/list/exists | Compute Engine start/stop/restart/status | Cloud Functions deploy/invoke/status/delete |
|
|
111
|
+
|
|
112
|
+
Azure Functions has no generic Azure CLI invocation command. OCloud explicitly raises `UnsupportedOperationError` for that operation rather than misrepresenting a metadata request as an invocation.
|
|
113
|
+
|
|
114
|
+
### Advanced raw CLI API
|
|
115
|
+
|
|
116
|
+
Use this only for provider operations not exposed by the MVP. It accepts arguments, not a shell string.
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from ocloud import AWS
|
|
120
|
+
|
|
121
|
+
result = AWS().raw(
|
|
122
|
+
"s3api", "put-object-acl", "--bucket", "my-bucket",
|
|
123
|
+
"--key", "path/to/file.pdf", "--acl", "public-read",
|
|
124
|
+
)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Results and errors
|
|
128
|
+
|
|
129
|
+
Every executed operation returns `CommandResult` with `success`, `returncode`, redacted `stdout`, redacted `stderr`, `data`, `command`, `provider`, and `operation`. The package raises OCloud-specific exceptions for unavailable CLIs, authentication checks, invalid parameters, unsupported operations, and timeouts.
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from ocloud import AWS, CLINotFoundError, OCloudTimeoutError
|
|
133
|
+
|
|
134
|
+
try:
|
|
135
|
+
result = AWS().s3.list("my-bucket", timeout=30)
|
|
136
|
+
except CLINotFoundError:
|
|
137
|
+
print("Install AWS CLI and ensure it is on PATH.")
|
|
138
|
+
except OCloudTimeoutError:
|
|
139
|
+
print("The provider command exceeded its timeout.")
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Security
|
|
143
|
+
|
|
144
|
+
Authentication stays in the official cloud CLI. OCloud has no credential database and redacts common secret patterns from command metadata and diagnostics. Use least-privilege cloud identities; avoid secrets in raw arguments. See [SECURITY.md](SECURITY.md) and [docs/security.md](docs/security.md).
|
|
145
|
+
|
|
146
|
+
## Development
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
python -m pip install -e ".[dev]"
|
|
150
|
+
pre-commit install
|
|
151
|
+
ruff format --check .
|
|
152
|
+
ruff check .
|
|
153
|
+
mypy src/ocloud
|
|
154
|
+
pytest --cov=ocloud --cov-report=term-missing
|
|
155
|
+
python -m build
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Unit tests use mocks and need no cloud account. The opt-in integration suite verifies only selected provider CLI authentication and performs no resource mutation; see [Testing](docs/testing.md).
|
|
159
|
+
|
|
160
|
+
## Documentation
|
|
161
|
+
|
|
162
|
+
- [Getting started](docs/getting-started.md)
|
|
163
|
+
- [Installation](docs/installation.md)
|
|
164
|
+
- [Authentication](docs/authentication.md)
|
|
165
|
+
- [Architecture](docs/architecture.md)
|
|
166
|
+
- [Testing](docs/testing.md)
|
|
167
|
+
- [Provider guides](docs/providers/)
|
|
168
|
+
- [Troubleshooting](docs/troubleshooting.md)
|
|
169
|
+
- [Contributing](CONTRIBUTING.md)
|
|
170
|
+
|
|
171
|
+
## Project status and roadmap
|
|
172
|
+
|
|
173
|
+
`0.1.0` is an alpha API. The repository has mocked unit coverage and successful package validation. AWS, Azure, and GCP CLI authentication were manually verified through OCloud on a Windows host; GCP validation used its SDK `bin` directory on `PATH` for the validation process. No cloud-resource integration validation has been performed. Planned work includes opt-in integration environments, stronger provider error classification, more services, native SDK adapters, and async execution.
|
|
174
|
+
|
|
175
|
+
OCloud is released under the [MIT License](LICENSE). See [CHANGELOG.md](CHANGELOG.md) for release history.
|
ocloud-0.1.0/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# OCloud
|
|
2
|
+
|
|
3
|
+
[](https://github.com/THE-S0HAM/ocloud/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/ocloud/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
**OCloud** is a lightweight, synchronous Python library for managing selected AWS, Azure, and Google Cloud resources through their official CLI tools. It provides a typed provider API, a deliberately narrow unified API, structured command results, and an advanced provider-only raw CLI escape hatch.
|
|
8
|
+
|
|
9
|
+
## What OCloud does
|
|
10
|
+
|
|
11
|
+
- Runs only the official `aws`, `az`, and `gcloud` executables—no cloud SDK dependency or credential store.
|
|
12
|
+
- Safely invokes subprocesses with argument lists; it never uses `shell=True`.
|
|
13
|
+
- Captures redacted stdout, stderr, exit code, parsed JSON where applicable, and redacted command metadata.
|
|
14
|
+
- Provides storage, compute, and serverless lifecycle helpers for the documented MVP surface.
|
|
15
|
+
|
|
16
|
+
## Install and authenticate
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
python -m pip install ocloud
|
|
20
|
+
aws configure # AWS users
|
|
21
|
+
az login # Azure users
|
|
22
|
+
gcloud auth login # Google Cloud users
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Install the provider CLI separately; OCloud does not install it. Python 3.10–3.13 is supported.
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from ocloud import AWS
|
|
31
|
+
|
|
32
|
+
aws = AWS()
|
|
33
|
+
aws.auth.check_status()
|
|
34
|
+
result = aws.s3.put_object_acl(
|
|
35
|
+
bucket="my-bucket",
|
|
36
|
+
key="path/to/file.pdf",
|
|
37
|
+
acl="public-read",
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
if result.success:
|
|
41
|
+
print(result.data)
|
|
42
|
+
else:
|
|
43
|
+
print(result.stderr)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Unified API
|
|
47
|
+
|
|
48
|
+
Use `Cloud` for operations with genuinely shared semantics. Provider-specific context remains explicit.
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from ocloud import Cloud
|
|
52
|
+
|
|
53
|
+
cloud = Cloud("aws")
|
|
54
|
+
result = cloud.storage.upload(
|
|
55
|
+
file="document.pdf",
|
|
56
|
+
bucket="my-bucket",
|
|
57
|
+
key="documents/document.pdf",
|
|
58
|
+
timeout=60,
|
|
59
|
+
)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Provider APIs
|
|
63
|
+
|
|
64
|
+
| Provider | Storage | Compute | Serverless |
|
|
65
|
+
| --- | --- | --- | --- |
|
|
66
|
+
| AWS | S3 upload/download/delete/list/exists/ACL | EC2 start/stop/restart/status | Lambda deploy/invoke/status/delete |
|
|
67
|
+
| Azure | Blob upload/download/delete/list/exists | VM start/stop/restart/status | Function App ZIP deploy; Function status/delete |
|
|
68
|
+
| GCP | Cloud Storage upload/download/delete/list/exists | Compute Engine start/stop/restart/status | Cloud Functions deploy/invoke/status/delete |
|
|
69
|
+
|
|
70
|
+
Azure Functions has no generic Azure CLI invocation command. OCloud explicitly raises `UnsupportedOperationError` for that operation rather than misrepresenting a metadata request as an invocation.
|
|
71
|
+
|
|
72
|
+
### Advanced raw CLI API
|
|
73
|
+
|
|
74
|
+
Use this only for provider operations not exposed by the MVP. It accepts arguments, not a shell string.
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from ocloud import AWS
|
|
78
|
+
|
|
79
|
+
result = AWS().raw(
|
|
80
|
+
"s3api", "put-object-acl", "--bucket", "my-bucket",
|
|
81
|
+
"--key", "path/to/file.pdf", "--acl", "public-read",
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Results and errors
|
|
86
|
+
|
|
87
|
+
Every executed operation returns `CommandResult` with `success`, `returncode`, redacted `stdout`, redacted `stderr`, `data`, `command`, `provider`, and `operation`. The package raises OCloud-specific exceptions for unavailable CLIs, authentication checks, invalid parameters, unsupported operations, and timeouts.
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from ocloud import AWS, CLINotFoundError, OCloudTimeoutError
|
|
91
|
+
|
|
92
|
+
try:
|
|
93
|
+
result = AWS().s3.list("my-bucket", timeout=30)
|
|
94
|
+
except CLINotFoundError:
|
|
95
|
+
print("Install AWS CLI and ensure it is on PATH.")
|
|
96
|
+
except OCloudTimeoutError:
|
|
97
|
+
print("The provider command exceeded its timeout.")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Security
|
|
101
|
+
|
|
102
|
+
Authentication stays in the official cloud CLI. OCloud has no credential database and redacts common secret patterns from command metadata and diagnostics. Use least-privilege cloud identities; avoid secrets in raw arguments. See [SECURITY.md](SECURITY.md) and [docs/security.md](docs/security.md).
|
|
103
|
+
|
|
104
|
+
## Development
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
python -m pip install -e ".[dev]"
|
|
108
|
+
pre-commit install
|
|
109
|
+
ruff format --check .
|
|
110
|
+
ruff check .
|
|
111
|
+
mypy src/ocloud
|
|
112
|
+
pytest --cov=ocloud --cov-report=term-missing
|
|
113
|
+
python -m build
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Unit tests use mocks and need no cloud account. The opt-in integration suite verifies only selected provider CLI authentication and performs no resource mutation; see [Testing](docs/testing.md).
|
|
117
|
+
|
|
118
|
+
## Documentation
|
|
119
|
+
|
|
120
|
+
- [Getting started](docs/getting-started.md)
|
|
121
|
+
- [Installation](docs/installation.md)
|
|
122
|
+
- [Authentication](docs/authentication.md)
|
|
123
|
+
- [Architecture](docs/architecture.md)
|
|
124
|
+
- [Testing](docs/testing.md)
|
|
125
|
+
- [Provider guides](docs/providers/)
|
|
126
|
+
- [Troubleshooting](docs/troubleshooting.md)
|
|
127
|
+
- [Contributing](CONTRIBUTING.md)
|
|
128
|
+
|
|
129
|
+
## Project status and roadmap
|
|
130
|
+
|
|
131
|
+
`0.1.0` is an alpha API. The repository has mocked unit coverage and successful package validation. AWS, Azure, and GCP CLI authentication were manually verified through OCloud on a Windows host; GCP validation used its SDK `bin` directory on `PATH` for the validation process. No cloud-resource integration validation has been performed. Planned work includes opt-in integration environments, stronger provider error classification, more services, native SDK adapters, and async execution.
|
|
132
|
+
|
|
133
|
+
OCloud is released under the [MIT License](LICENSE). See [CHANGELOG.md](CHANGELOG.md) for release history.
|
ocloud-0.1.0/SECURITY.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
Security fixes are applied to the latest released `0.x` version. OCloud is in active API development; upgrade promptly when a security release is published.
|
|
6
|
+
|
|
7
|
+
## Reporting a vulnerability
|
|
8
|
+
|
|
9
|
+
Do **not** open a public issue for a suspected vulnerability. Report it privately through the repository's [security advisory page](https://github.com/THE-S0HAM/ocloud/security/advisories/new). Include affected version, reproduction steps, impact, and any relevant logs with credentials removed.
|
|
10
|
+
|
|
11
|
+
Maintainers will acknowledge reports within 7 days, assess impact, and coordinate a fix and disclosure timeline with the reporter.
|
|
12
|
+
|
|
13
|
+
## Security model
|
|
14
|
+
|
|
15
|
+
OCloud delegates authentication to the official AWS, Azure, and Google Cloud CLIs. It does not store cloud credentials, tokens, or profiles; install and authenticate the provider CLI yourself.
|
|
16
|
+
|
|
17
|
+
Commands run with `subprocess.run()` using argument lists and never use `shell=True`. CLI executable discovery is performed with `shutil.which`. OCloud captures stdout, stderr, and exit status, applies caller-provided timeouts, and redacts common secret patterns before command metadata and diagnostic output are retained or logged.
|
|
18
|
+
|
|
19
|
+
Use least-privilege cloud identities, do not enable debug logs in untrusted log sinks, and avoid placing secrets in raw CLI arguments. Treat raw provider APIs as advanced functionality: they execute only the selected provider CLI, but the underlying cloud operation can still change or expose resources.
|
|
20
|
+
|
|
21
|
+
## Scope
|
|
22
|
+
|
|
23
|
+
Report vulnerabilities in OCloud source, release artifacts, GitHub Actions, and documentation that could cause insecure use. Cloud CLI and provider account issues should be reported to the relevant vendor.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
OCloud is a synchronous Python library that delegates cloud operations to officially supported provider CLIs. It keeps command construction separate from process execution so each layer remains testable and future adapters can replace the CLI boundary without changing public APIs.
|
|
4
|
+
|
|
5
|
+
## Layers
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
Public provider or Cloud API
|
|
9
|
+
-> input validation
|
|
10
|
+
-> provider service command construction
|
|
11
|
+
-> Command model
|
|
12
|
+
-> CLIExecutor
|
|
13
|
+
-> aws | az | gcloud
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`Command` contains the executable, argument list, provider, operation name, timeout, and optional environment overlay. `CLIExecutor` discovers executables safely, invokes `subprocess.run` without a shell, captures output, applies timeouts, and produces `CommandResult`.
|
|
17
|
+
|
|
18
|
+
## Result and errors
|
|
19
|
+
|
|
20
|
+
Every executed command returns `CommandResult` with raw stdout/stderr, return code, success flag, redacted command metadata, provider/operation metadata, and parsed JSON where output is JSON. Missing CLIs and timeouts raise OCloud exceptions because no useful result can exist.
|
|
21
|
+
|
|
22
|
+
Authentication is delegated to the CLI. `aws.auth.check_status()`, `azure.auth.check_status()`, and `gcp.auth.check_status()` run lightweight provider commands and raise `CLIAuthenticationError` on failure.
|
|
23
|
+
|
|
24
|
+
## Provider and unified APIs
|
|
25
|
+
|
|
26
|
+
Provider clients retain provider names and required context. The `Cloud` facade routes only common storage, compute, and lifecycle operations; provider-specific values such as Azure resource groups, storage accounts, GCP zones, and AWS IAM role ARNs remain explicit parameters.
|
|
27
|
+
|
|
28
|
+
Azure Functions deployment is Function App ZIP deployment. Generic Azure Function invocation is intentionally unsupported: Azure CLI has no generic function-invocation command, so OCloud raises `UnsupportedOperationError` rather than issuing a metadata query and calling it an invocation.
|
|
29
|
+
|
|
30
|
+
## Extension and async strategy
|
|
31
|
+
|
|
32
|
+
Service methods depend on `CLIExecutor`, not `subprocess` directly. A future SDK adapter can implement the same command/result boundary or a compatible provider service without rewriting the public API. The synchronous executor is isolated, so a future async executor can be introduced alongside it without changing validation or service semantics.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Authentication
|
|
2
|
+
|
|
3
|
+
OCloud delegates authentication to provider CLIs and never stores credentials or tokens.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
aws configure
|
|
7
|
+
az login
|
|
8
|
+
gcloud auth login
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Verify a configured identity without printing credentials:
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from ocloud import AWS, Azure, GCP
|
|
15
|
+
|
|
16
|
+
AWS().auth.check_status()
|
|
17
|
+
Azure().auth.check_status()
|
|
18
|
+
GCP().auth.check_status()
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Each method returns `True` when the underlying CLI verifies an identity and raises `CLIAuthenticationError` when authentication is unavailable or fails. `CLINotFoundError` indicates the provider CLI is not installed or not on `PATH`.
|
|
22
|
+
|
|
23
|
+
Use provider-supported mechanisms for profiles, subscriptions, projects, workload identity, and credential renewal. OCloud passes through the process environment only when a caller explicitly configures a command environment internally; it does not create a credential database.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
Examples require the corresponding official CLI to be installed and authenticated. They target real resources and may incur cloud-provider charges.
|
|
4
|
+
|
|
5
|
+
- [AWS S3 object ACL](../examples/aws/s3_acl.py)
|
|
6
|
+
- [AWS unified storage upload](../examples/unified/storage_upload.py)
|
|
7
|
+
|
|
8
|
+
Before running an example, replace placeholder resource names and review its cloud-side permission and access implications. In particular, `public-read` exposes an object publicly when the bucket and provider policy allow it.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Getting Started
|
|
2
|
+
|
|
3
|
+
OCloud wraps a deliberately small set of official cloud CLI operations. It is not a replacement for the full provider CLIs; use `raw()` for advanced provider commands.
|
|
4
|
+
|
|
5
|
+
## 1. Install prerequisites
|
|
6
|
+
|
|
7
|
+
Install OCloud and at least one official provider CLI. See [installation.md](installation.md).
|
|
8
|
+
|
|
9
|
+
## 2. Authenticate once
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
aws configure
|
|
13
|
+
# or: az login
|
|
14
|
+
# or: gcloud auth login
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 3. Verify the CLI and identity
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from ocloud import AWS
|
|
21
|
+
|
|
22
|
+
aws = AWS()
|
|
23
|
+
print(aws.is_available())
|
|
24
|
+
aws.auth.check_status()
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 4. Run an operation
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
result = aws.ec2.start_instance("i-0123456789abcdef0", timeout=60)
|
|
31
|
+
if not result.success:
|
|
32
|
+
raise RuntimeError(result.stderr)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Use provider clients when a provider needs native context. For example, Azure VM operations require a resource group and GCP Compute Engine operations require a zone.
|
|
36
|
+
|
|
37
|
+
## 5. Inspect the result
|
|
38
|
+
|
|
39
|
+
`CommandResult` preserves raw output and parsed JSON where CLI output is JSON. Command metadata is redacted before it is stored in the result.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
OCloud supports Python 3.10 through 3.13 and has no runtime Python dependencies.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
python -m pip install ocloud
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Install the official CLI for each provider you use; OCloud never installs these tools for you:
|
|
10
|
+
|
|
11
|
+
- AWS: [AWS CLI](https://aws.amazon.com/cli/)
|
|
12
|
+
- Azure: [Azure CLI](https://learn.microsoft.com/cli/azure/)
|
|
13
|
+
- Google Cloud: [Google Cloud CLI](https://cloud.google.com/sdk/docs/install)
|
|
14
|
+
|
|
15
|
+
Verify availability from Python before executing operations:
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from ocloud import AWS
|
|
19
|
+
|
|
20
|
+
aws = AWS()
|
|
21
|
+
if not aws.is_available():
|
|
22
|
+
raise RuntimeError("Install AWS CLI before continuing")
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For development:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
python -m pip install -e ".[dev]"
|
|
29
|
+
pre-commit install
|
|
30
|
+
```
|