如需部署 OpenAPI 文档,请运行 gcloud endpoints services deploy 命令。在您首次部署 OpenAPI 文档时,gcloud 命令会调用 Service Management API,以使用您在 OpenAPI 文档的 host 字段中指定的名称来创建一项托管式服务。Service Management 会自动分配配置 ID,该 ID 由日期戳后跟修订版本号组成。例如 2017-02-13r0。
如果在同一天再次部署服务配置,Service Management 将使配置 ID 中的修订版本号递增。如果在另一天再次部署服务配置,Service Management 会向配置 ID 分配新的日期戳,并会将修订版本号重置为 0。
Endpoints 使用 Service Management 来存储服务配置。Service Management 仅存储最新的 100 个服务配置。
本页面介绍如何查看服务名称和配置 ID。
Google Cloud console
- In the Google Cloud console, go to the Endpoints > Services page for your project.
- If you have more than one API, select an API from the list.
- Click the Deployment history tab.
The service name is displayed between the API name and the tabs, near the top-left side of the page. In the Service configuration deployments list, the configuration ID is displayed along with the date and the email address of the principal who deployed the configuration. The Service configuration deployments list displays the latest 100 configuration deployments. The most recent configuration is displayed at the top of the list.
gcloud
- Enter the following to display the project IDs for your
Google Cloud projects:
gcloud projects list
- Using the applicable project ID from the previous step, set the default
project to the one that your API is in:
gcloud config set project YOUR_PROJECT_ID
- Get a list of services in your project:
gcloud endpoints services list
- Using the applicable service name from the previous step, get a list of
configuration IDs for the service:
gcloud endpoints configs list --service=YOUR_SERVICE_NAME
For more information on the preceding commands, see the gcloud reference.
后续步骤
- 了解如何部署 OpenAPI 文档。
- 了解 Service Management API。