Name | gcp-secret-manager-cli JSON |
Version |
0.0.2
JSON |
| download |
home_page | None |
Summary | A command-line tool for managing GCP Secret Manager |
upload_time | 2024-12-12 16:08:52 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT |
keywords |
cli
gcp
secret-manager
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# GCP Secret Manager CLI
### gcp-secret-manager-cli (0.0.2)
A command-line interface tool for managing secrets in Google Cloud Platform's Secret Manager service with support for bulk operations using environment files.
# Features
1. List Management
- List all secrets in your GCP project
- Filter secrets by prefix
- Display creation timestamps in local timezone
2. Secret Operations
- Add/update secrets individually
- Retrieve a single secret value
- Bulk import from environment files
- Support for environment prefixes
3. Removal Capabilities
- Delete individual secrets
- Batch deletion by prefix
- Force deletion option
4. Rich Terminal Interface
- Progress indicators
- Color-coded outputs
- Operation summaries
- Interactive confirmations
# Installation
```bash
$ pip install gcp-secret-manager-cli
```
### Prerequisites
- Python >=3.8
- GCP project with Secret Manager API enabled
- Configured GCP credentials
# Configuration
Create a `.env` file in your project root:
```plaintext
PROJECT_ID=your-gcp-project-id # Required: Your GCP Project ID
TZ=Asia/Taipei # Optional: Timezone for timestamps (default: UTC)
```
# Usage
The CLI provides two command aliases:
- `gcp-secrets`: Full command name
- `sm`: Short alias (Secret Manager)
## Command Overview
```bash
❯ sm
🔐 Secret Manager CLI Tool
```
### Environment Settings
Place the following variables in the .env file to reduce the number of commands needed when using the CLI.
| Setting | Description |
|------------|-----------------------------------------------|
| PROJECT_ID | GCP Project ID for Secret Manager operations |
| TZ | Timezone for displaying timestamps (default: UTC) |
### Available Commands
| Command | Description |
|--------------|--------------------------------|
| add | Add secrets from file or command line |
| remove (rm) | Remove secrets by prefix or key |
| list (ls) | List all secrets |
| get | Get single secret |
### Usage Examples
#### Project Configuration
```bash
# If .env file does not have PROJECT_ID configured
$ sm list -P PROJECT_ID # Specify PROJECT_ID
```
#### Adding Secrets
```bash
# From environment file
$ sm add -e # Add from default .env file
$ sm add -e .env.dev # Add from specific env file
$ sm add -e .env.dev -p DEV_ # Add with prefix
# Single secret
$ sm add DB_URL "mysql://localhost" # Add single secret
```
#### Removing Secrets
```bash
# From environment file
$ sm remove -e # Remove from default .env file
$ sm remove -e .env.dev # Remove from specific env file
# By prefix or key
$ sm remove -p DEV_ # Remove by prefix
$ sm remove DB_URL # Remove single secret
$ sm rm -f -p TEST_ # Force remove by prefix without confirmation
```
#### Listing Secrets
```bash
$ sm list # List all secrets
$ sm list -p DEV_ # List secrets with prefix
$ sm ls -p TEST_ # List secrets with prefix (alias)
```
#### Retrieving Secret Value
```bash
$ sm get DB_URL # Get single secret value
```
## Command Options
### Global Options
- `-P, --project-id`: Override GCP project ID
- `--version`: Show version
### Add Command
- `-e, --env-file`: Source env file
- `-p, --prefix`: Add prefix to secret names
- `KEY VALUE`: Add single secret
### Remove Command
- `-e, --env-file`: Remove from env file
- `-p, --prefix`: Remove by prefix
- `-f, --force`: Skip confirmation
- `KEY`: Remove single secret
### List Command
- `-p, --prefix`: Filter secrets by prefix
### Get Command
- `KEY`: Retrieve single secret value
# Development
### Setup
```bash
git clone https://github.com/TaiwanBigdata/gcp-secret-manager-cli.git
cd gcp-secret-manager-cli
python -m venv env
source env/bin/activate # Linux/Mac
pip install -e .
```
# Dependencies
### Core
- google-api-core>=2.23.0
- google-cloud-secret-manager>=2.21.1
- rich>=13.9.4
- click>=8.1.7
- python-dotenv>=1.0.1
# License
This project is licensed under the MIT License.
# Environment Variables
| Variable Name | Description |
| --- | --- |
| PROJECT_ID | GCP Project ID |
| TZ | Timezone |
# Project Structure
```
gcp-secret-manager-cli/
├── .gitignore
├── LICENSE
├── README.md
├── pyproject.toml
├── readgen.toml
├── requirements.txt
└── src/
└── gcp_secret_manager_cli/
├── __main__.py
├── cli.py
├── core/
│ ├── client.py
│ └── manager.py
└── utils/
├── console.py
└── env.py
```
---
> This document was automatically generated by ReadGen.
Raw data
{
"_id": null,
"home_page": null,
"name": "gcp-secret-manager-cli",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "cli, gcp, secret-manager",
"author": null,
"author_email": "Albert Liu <dreamerhyde@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/e0/fd/44ef970e880432a7aecccba08bdca56897f15a12bda08320c86f8a2042a2/gcp_secret_manager_cli-0.0.2.tar.gz",
"platform": null,
"description": "# GCP Secret Manager CLI \n### gcp-secret-manager-cli (0.0.2)\nA command-line interface tool for managing secrets in Google Cloud Platform's Secret Manager service with support for bulk operations using environment files.\n\n# Features\n1. List Management\n - List all secrets in your GCP project\n - Filter secrets by prefix\n - Display creation timestamps in local timezone\n\n2. Secret Operations\n - Add/update secrets individually\n - Retrieve a single secret value\n - Bulk import from environment files\n - Support for environment prefixes\n \n3. Removal Capabilities\n - Delete individual secrets\n - Batch deletion by prefix\n - Force deletion option\n\n4. Rich Terminal Interface\n - Progress indicators\n - Color-coded outputs\n - Operation summaries\n - Interactive confirmations\n\n# Installation\n```bash\n$ pip install gcp-secret-manager-cli\n```\n\n### Prerequisites\n- Python >=3.8\n- GCP project with Secret Manager API enabled\n- Configured GCP credentials\n\n# Configuration\nCreate a `.env` file in your project root:\n```plaintext\nPROJECT_ID=your-gcp-project-id # Required: Your GCP Project ID\nTZ=Asia/Taipei # Optional: Timezone for timestamps (default: UTC)\n```\n\n# Usage\nThe CLI provides two command aliases:\n- `gcp-secrets`: Full command name\n- `sm`: Short alias (Secret Manager)\n\n## Command Overview\n```bash\n\u276f sm\n\ud83d\udd10 Secret Manager CLI Tool\n```\n\n### Environment Settings\nPlace the following variables in the .env file to reduce the number of commands needed when using the CLI.\n| Setting | Description |\n|------------|-----------------------------------------------|\n| PROJECT_ID | GCP Project ID for Secret Manager operations |\n| TZ | Timezone for displaying timestamps (default: UTC) |\n\n### Available Commands\n| Command | Description |\n|--------------|--------------------------------|\n| add | Add secrets from file or command line |\n| remove (rm) | Remove secrets by prefix or key |\n| list (ls) | List all secrets |\n| get | Get single secret |\n\n### Usage Examples\n\n#### Project Configuration\n```bash\n# If .env file does not have PROJECT_ID configured\n$ sm list -P PROJECT_ID # Specify PROJECT_ID\n```\n\n#### Adding Secrets\n```bash\n# From environment file\n$ sm add -e # Add from default .env file\n$ sm add -e .env.dev # Add from specific env file\n$ sm add -e .env.dev -p DEV_ # Add with prefix\n\n# Single secret\n$ sm add DB_URL \"mysql://localhost\" # Add single secret\n```\n\n#### Removing Secrets\n```bash\n# From environment file\n$ sm remove -e # Remove from default .env file\n$ sm remove -e .env.dev # Remove from specific env file\n\n# By prefix or key\n$ sm remove -p DEV_ # Remove by prefix\n$ sm remove DB_URL # Remove single secret\n$ sm rm -f -p TEST_ # Force remove by prefix without confirmation\n```\n\n#### Listing Secrets\n```bash\n$ sm list # List all secrets\n$ sm list -p DEV_ # List secrets with prefix\n$ sm ls -p TEST_ # List secrets with prefix (alias)\n```\n\n#### Retrieving Secret Value\n```bash\n$ sm get DB_URL # Get single secret value\n```\n\n## Command Options\n### Global Options\n- `-P, --project-id`: Override GCP project ID\n- `--version`: Show version\n\n### Add Command\n- `-e, --env-file`: Source env file\n- `-p, --prefix`: Add prefix to secret names\n- `KEY VALUE`: Add single secret\n\n### Remove Command\n- `-e, --env-file`: Remove from env file\n- `-p, --prefix`: Remove by prefix\n- `-f, --force`: Skip confirmation\n- `KEY`: Remove single secret\n\n### List Command\n- `-p, --prefix`: Filter secrets by prefix\n\n### Get Command\n- `KEY`: Retrieve single secret value\n\n# Development\n### Setup\n```bash\ngit clone https://github.com/TaiwanBigdata/gcp-secret-manager-cli.git\ncd gcp-secret-manager-cli\npython -m venv env\nsource env/bin/activate # Linux/Mac\npip install -e .\n```\n\n# Dependencies\n### Core\n- google-api-core>=2.23.0\n- google-cloud-secret-manager>=2.21.1\n- rich>=13.9.4\n- click>=8.1.7\n- python-dotenv>=1.0.1\n\n# License\nThis project is licensed under the MIT License.\n# Environment Variables\n| Variable Name | Description |\n| --- | --- |\n| PROJECT_ID | GCP Project ID |\n| TZ | Timezone |\n# Project Structure\n```\ngcp-secret-manager-cli/\n\u251c\u2500\u2500 .gitignore\n\u251c\u2500\u2500 LICENSE\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 pyproject.toml\n\u251c\u2500\u2500 readgen.toml\n\u251c\u2500\u2500 requirements.txt\n\u2514\u2500\u2500 src/\n \u2514\u2500\u2500 gcp_secret_manager_cli/\n \u251c\u2500\u2500 __main__.py\n \u251c\u2500\u2500 cli.py\n \u251c\u2500\u2500 core/\n \u2502 \u251c\u2500\u2500 client.py\n \u2502 \u2514\u2500\u2500 manager.py\n \u2514\u2500\u2500 utils/\n \u251c\u2500\u2500 console.py\n \u2514\u2500\u2500 env.py\n```\n\n\n---\n> This document was automatically generated by ReadGen.",
"bugtrack_url": null,
"license": "MIT",
"summary": "A command-line tool for managing GCP Secret Manager",
"version": "0.0.2",
"project_urls": {
"Documentation": "https://github.com/yourusername/gcp-secret-manager-cli#readme",
"Homepage": "https://github.com/yourusername/gcp-secret-manager-cli",
"Repository": "https://github.com/yourusername/gcp-secret-manager-cli.git"
},
"split_keywords": [
"cli",
" gcp",
" secret-manager"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "52cdf6757a916432f773cb132d1df0f499d369b1221a7664ada5d9b3ef3ac71d",
"md5": "9fefcd015e1d5071392c713338e2dfc7",
"sha256": "f528493ffca3c47c6d1ae65eafb4ebae7411bf3518a642910d4c43f6a9230138"
},
"downloads": -1,
"filename": "gcp_secret_manager_cli-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9fefcd015e1d5071392c713338e2dfc7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 14339,
"upload_time": "2024-12-12T16:08:50",
"upload_time_iso_8601": "2024-12-12T16:08:50.501838Z",
"url": "https://files.pythonhosted.org/packages/52/cd/f6757a916432f773cb132d1df0f499d369b1221a7664ada5d9b3ef3ac71d/gcp_secret_manager_cli-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e0fd44ef970e880432a7aecccba08bdca56897f15a12bda08320c86f8a2042a2",
"md5": "d72bea50c86407ddbe46218b3e6e4adb",
"sha256": "1221505f02e7676ef3f22863a81f00ba5c6df6af7a40de9f0cddb8e2f0921839"
},
"downloads": -1,
"filename": "gcp_secret_manager_cli-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "d72bea50c86407ddbe46218b3e6e4adb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12308,
"upload_time": "2024-12-12T16:08:52",
"upload_time_iso_8601": "2024-12-12T16:08:52.910731Z",
"url": "https://files.pythonhosted.org/packages/e0/fd/44ef970e880432a7aecccba08bdca56897f15a12bda08320c86f8a2042a2/gcp_secret_manager_cli-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-12 16:08:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "gcp-secret-manager-cli#readme",
"github_not_found": true,
"lcname": "gcp-secret-manager-cli"
}