Added README

This commit is contained in:
2026-02-13 22:52:32 +03:30
parent 751ae12b06
commit 72614b4158

184
README.md Normal file
View File

@@ -0,0 +1,184 @@
# ArvanCloud CDN CLI Tool
A lightweight Python CLI utility for managing DNS records and domains on **ArvanCloud CDN** via its public API.
Designed for **DevOps engineers**, SREs, and system administrators who need fast DNS automation directly from Linux CLI.
---
## 📦 Requirements
* Python 3.7+
* `requests` library
Install dependency:
```bash
pip install requests
```
---
## 📁 Project Structure
```
.
├── arvan_cdn_cli.py
└── README.md
```
---
# 🖥 How to Use as a Default Linux Command
Instead of running:
```bash
python arvan_cdn_cli.py ...
```
You can make it a global Linux command.
---
## Step 1 — Make Script Executable
Ensure the shebang exists at the top (already included):
```bash
#!/bin/python3
```
Make it executable:
```bash
chmod +x arvan_cdn_cli.py
```
---
## Step 2 — Move to System Path
Move the file to `/usr/local/bin`:
```bash
sudo mv arvan_cdn_cli.py /usr/local/bin/arvanctl
```
Now you can run it globally:
```bash
arvanctl cdn domains
```
---
## Optional: Verify PATH
Check if `/usr/local/bin` exists in PATH:
```bash
echo $PATH
```
If not, add it to `~/.bashrc`:
```bash
export PATH=$PATH:/usr/local/bin
```
Then reload:
```bash
source ~/.bashrc
```
---
# 📌 Usage
General syntax:
```bash
arvanctl cdn <resource> <action> [options]
```
---
# 🔹 Commands
## 1⃣ List All Domains
```bash
arvanctl cdn domains
```
Example Output:
```json
{
"example.com": {
"name": "example.com",
"status": "active"
}
}
```
---
## 2⃣ Create DNS Record
```bash
arvanctl cdn records create \
--domain example.com \
--name api \
--ip 192.168.1.10 \
--ttl 120 \
--cloud
```
### Parameters
| Parameter | Required | Default | Description |
| --------- | -------- | ------- | ------------------ |
| --domain | ✅ | - | Target domain |
| --name | ✅ | - | Record name |
| --type | ❌ | a | Record type |
| --ttl | ❌ | 120 | TTL value |
| --ip | ✅ | - | IP address |
| --cloud | ❌ | False | Enable Arvan proxy |
---
## 3⃣ Remove DNS Record
```bash
arvanctl cdn records remove \
--domain example.com \
--name api
```
---
## 4⃣ Update DNS Record
```bash
arvanctl cdn records update \
--domain example.com \
--name api \
--ip 192.168.1.20
```
> ⚠️ Update logic is partially implemented in current version.
---
# 🌐 API Endpoints Used
```
GET /cdn/4.0/domains
GET /cdn/4.0/domains/{domain}/dns-records
POST /cdn/4.0/domains/{domain}/dns-records
DELETE /cdn/4.0/domains/{domain}/dns-records/{id}
```