本主题介绍如何删除 Apigee Hybrid 中的环境。请参阅环境和环境组简介。
如何删除环境
假设您有两个环境,即 test 和 prod。在您的替换文件中,定义可能如下所示:
... envs: - name: test serviceAccountPaths: synchronizer: "your_keypath/synchronizer-manager-service-account.json udca: "your_keypath/analytic-agent-service-account.json - name: prod serviceAccountPaths: synchronizer: "your_keypath/synchronizer-manager-service-account.json udca: "your_keypath/analytic-agent-service-account.json ...
要删除 prod 环境,请执行以下步骤:
- 获取 gcloud 身份验证凭据:
TOKEN=$(gcloud auth print-access-token)
- 从任何关联的环境组中删除环境(一次删除一个环境):
curl -X DELETE -H "Authorization: Bearer $TOKEN" \ "https://apigee.googleapis.com/v1/organizations/$ORG_NAME/envgroups/$ENV_GROUP/attachments/prod"
- 执行试运行以测试移除运行时组件的操作:
apigeectl delete -f overrides.yaml --env=prod --dry-run=true
- 如果试运行无错误,请移除运行时组件:
apigeectl delete -f overrides.yaml --env=prod
- 从管理层面删除环境:
curl -X DELETE -H "Authorization: Bearer $TOKEN" \ "https://apigee.googleapis.com/v1/organizations/$ORG_NAME/environments/prod"
- 打开替换文件并从
envs
和virtualhosts
中移除prod
环境定义,从而只保留 test 定义。例如:... envs: - name: test serviceAccountPaths: synchronizer: "your_keypath/synchronizer-manager-service-account.json udca: "your_keypath/analytic-agent-service-account.json ...
- 保存文件。