This page describes how to manage service configurations using Service Infrastructure.
A service configuration is a specification that describes different aspects of a managed service.
The Service Management API methods typically involved in managing service configurations are:
- Using
services.configs.createorservices.configs.submitto submit service configurations. - Using
services.configs.listandservices.configs.getto retrieve service configurations. - Using
services.generateConfigReportto get a change report between two service configurations.
Before you begin
To run the examples in this guide, make sure you first follow the instructions to complete the initial setup in Getting Started with the Service Management API.
Submitting service configuration source files
To update your service configuration, you need to submit a list of service configuration source files to the Service Management API, and the server will compile them into a validated service configuration.
The source files can have the following formats:
- OpenAPI v2
- Protocol Buffers descriptor
google.api.Servicein JSON or YAML format
The Service Management API does not take .proto files, you need to
generate protobuf descriptors from your .proto files before submitting them.
You can use use the following command to generate the descriptor files:
$ protoc hello.proto --include_source_info --include_imports --descriptor_set_out=service.descriptors *.proto
The recommended way to submit service configuration source files is to use the gcloud CLI.
$ gcloud auth login
$ gcloud endpoints services deploy [a list of service configuration source files]
You can also call the Service Management API directly to submit source
files. For example, if you have this OpenAPI definition (hello.json):
{
"swagger": "2.0",
"info": {
"title": "Hello Endpoints API.",
"description": "Hello Endpoints API.",
"version": "v1"
},
"host": "endpointsapis.appspot.com",
"schemes": ["https"],
"paths": {
"/v1/hello": {
"get": {
"tags": ["endpointsapis"],
"operationId": "GetHello",
"description": "Returns \"Hello\" with given name in the response.",
"parameters": [
{
"name": "name",
"description": "Name to be greeted.",
"in": "query",
"type": "string"
}
],
"responses": {
"default": {
"description": "Successful operation",
"schema": {
"$ref": "#/definitions/GetHelloResponse"
}
}
}
}
}
},
"definitions": {
"GetHelloResponse": {