Loading...
Loading...
Manage Tencent Cloud EdgeOne (CDN + edge security). Use when the user asks to: list zones, purge CDN cache (URL / prefix / hostname / all), prefetch URLs to warm edges, check purge / prefetch task status, manage acceleration domains, list / create / delete EdgeOne DNS records, inspect WAF / security configuration. Backed by the official tencentcloud-sdk-python TEO client.
npx skill4agent add acedatacloud/skills tencentcloud-edgeoneSetup: See tencentcloud authentication. The SDK reads/TENCENTCLOUD_SECRET_IDfrom env. EdgeOne is global —TENCENTCLOUD_SECRET_KEYis fine.Region=""
scripts/edgeone.pyEO=$SKILL_DIR/scripts/edgeone.py
python3 $EO zones # list zones
python3 $EO zone zone-xxxxxxxx # one zone's details
python3 $EO domains zone-xxxxxxxx # acceleration domains
python3 $EO purge zone-xxxxxxxx --urls https://hub.example.com/index.html
python3 $EO purge zone-xxxxxxxx --prefixes https://hub.example.com/assets/
python3 $EO purge zone-xxxxxxxx --hosts hub.example.com
python3 $EO purge zone-xxxxxxxx --all # nuclear
python3 $EO prefetch zone-xxxxxxxx --urls https://hub.example.com/ https://hub.example.com/chat
python3 $EO purge-tasks zone-xxxxxxxx --status processing
python3 $EO prefetch-tasks zone-xxxxxxxx
python3 $EO dns zone-xxxxxxxx # EdgeOne DNS records
python3 $EO dns-create zone-xxxxxxxx --name sub --type CNAME --content origin.example.com
python3 $EO dns-delete zone-xxxxxxxx <record-id>
python3 $EO security zone-xxxxxxxx # WAF / security cfg
python3 $EO waf zone-xxxxxxxxpurge-tasks --status processingpip install tencentcloud-sdk-pythonimport os
from tencentcloud.common import credential
from tencentcloud.teo.v20220901 import teo_client, models
cred = credential.EnvironmentVariableCredential().get_credential()
client = teo_client.TeoClient(cred, "")req = models.DescribeZonesRequest()
req.Limit = 100
resp = client.DescribeZones(req)
for z in resp.Zones:
print(z.ZoneId, z.ZoneName, z.Status, z.Type)Zone IDs look like. Thezone-xxxxxxxxis the apex domain (e.g.ZoneName).acedata.cloud
req = models.DescribeAccelerationDomainsRequest()
req.ZoneId = "zone-xxxxxxxx"
req.Limit = 100
resp = client.DescribeAccelerationDomains(req)
for d in resp.AccelerationDomains:
print(d.DomainName, d.DomainStatus, d.OriginDetail.OriginType)req = models.CreatePurgeTaskRequest()
req.ZoneId = "zone-xxxxxxxx"
req.Type = "purge_url"
req.Targets = [
"https://hub.example.com/index.html",
"https://hub.example.com/assets/main.css",
]
resp = client.CreatePurgeTask(req)
print("Task:", resp.JobId)req = models.CreatePurgeTaskRequest()
req.ZoneId = "zone-xxxxxxxx"
req.Type = "purge_host"
req.Targets = ["hub.example.com"]
client.CreatePurgeTask(req)req = models.CreatePurgeTaskRequest()
req.ZoneId = "zone-xxxxxxxx"
req.Type = "purge_prefix"
req.Targets = ["https://hub.example.com/assets/"]
client.CreatePurgeTask(req)# Confirm with the user — this re-fetches every cached object on next request,
# spiking origin load.
req = models.CreatePurgeTaskRequest()
req.ZoneId = "zone-xxxxxxxx"
req.Type = "purge_all"
client.CreatePurgeTask(req)req = models.CreatePrefetchTaskRequest()
req.ZoneId = "zone-xxxxxxxx"
req.Targets = [
"https://hub.example.com/",
"https://hub.example.com/chat",
]
resp = client.CreatePrefetchTask(req)
print("Task:", resp.JobId)req = models.DescribePurgeTasksRequest()
req.ZoneId = "zone-xxxxxxxx"
req.Limit = 50
# Optional: req.Filters = [{"Name": "job-id", "Values": ["<job-id>"]}]
resp = client.DescribePurgeTasks(req)
for t in resp.Tasks:
print(t.JobId, t.Type, t.Status, t.CreateTime)
# Same shape for DescribePrefetchTasksreq = models.DescribeDnsRecordsRequest()
req.ZoneId = "zone-xxxxxxxx"
req.Limit = 100
resp = client.DescribeDnsRecords(req)
for r in resp.DnsRecords:
print(r.RecordId, r.Name, r.Type, r.Content)req = models.CreateDnsRecordRequest()
req.ZoneId = "zone-xxxxxxxx"
req.Name = "sub.example.com"
req.Type = "CNAME"
req.Content = "origin.example.com"
req.TTL = 600
client.CreateDnsRecord(req)req = models.DeleteDnsRecordsRequest()
req.ZoneId = "zone-xxxxxxxx"
req.RecordIds = ["<record-id>"]
client.DeleteDnsRecords(req)| Type | When to use | Caveat |
|---|---|---|
| Specific page / asset changed | Most surgical; up to 1000 URLs per call |
| A directory of assets changed ( | Treats target as a prefix match |
| Full site deployment | Affects everything on the hostname |
| Emergency / major migration | All cache for the zone — origin spike inevitable |
# 1. Purge the hostname so users get the new bundle
client.CreatePurgeTask(models.CreatePurgeTaskRequest(
ZoneId="zone-xxxxxxxx",
Type="purge_host",
Targets=["hub.example.com"],
))
# 2. Prefetch the most-trafficked routes so edge cache is warm
client.CreatePrefetchTask(models.CreatePrefetchTaskRequest(
ZoneId="zone-xxxxxxxx",
Targets=[
"https://hub.example.com/",
"https://hub.example.com/chat",
"https://hub.example.com/login",
],
))
# 3. Watch for completion (typically 30s – 2min)
import time
while True:
resp = client.DescribePurgeTasks(models.DescribePurgeTasksRequest(
ZoneId="zone-xxxxxxxx",
Filters=[{"Name": "status", "Values": ["processing"]}],
))
if not resp.Tasks:
print("All purge tasks done.")
break
print(f"{len(resp.Tasks)} tasks still processing...")
time.sleep(15)purge_all