Skip to content

Commit 01eaff8

Browse files
committed
add configuration examples
Change-Id: If32575a1a7df2456d86fa2fc7dbbd12dbb905e21
1 parent e2251da commit 01eaff8

File tree

12 files changed

+1820
-335
lines changed

12 files changed

+1820
-335
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ To find out more about building, running, and testing ESPv2:
7979

8080
* [Run ESPv2 on Google GKE](/doc/esp-v2-on-k8s.md)
8181

82+
## Examples
83+
84+
How to configure ESPv2? See [examples](/examples/README.md)
85+
8286
## Disclaimer
8387

8488
ESPv2 is in Beta currently.

examples/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# ESPv2 Configurations
2+
3+
This directory contains examples of how to configure ESPv2.
4+
5+
## Service Control
6+
7+
Includes how to configure Authorization by API Key, and Quota, controlled by ServiceControl filter.
8+
9+
* [Producer defined OpenAPI Specification](/service_control/openapi_swagger.json)
10+
11+
* [Google Cloud Endpoints generated Service configuration](
12+
/service_control/service_config_generated.json
13+
): Service configuration generated by ServiceManagement Service.
14+
Can be accessible by running:
15+
16+
```
17+
gcloud endpoints configs describe "${CONFIG_ID}" --project="${PROJECT}" \
18+
--service="${SERVICE}" --format=json > service.json
19+
```
20+
21+
* [ESPv2 generated Envoy configuration](
22+
/service_control/envoy_config.json
23+
): Equivalent Envoy static Bootstrap configuration.
24+
25+
## Dynamic Routing(TBD)
26+

examples/service_control/envoy_config.json

+776
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"description": "A simple Google Cloud Endpoints Bookstore API example.",
5+
"title": "Bookstore",
6+
"version": "1.0.0"
7+
},
8+
"host": "bookstore.endpoints.apiproxy-231719.cloud.goog",
9+
"basePath": "/",
10+
"consumes": [
11+
"application/json"
12+
],
13+
"produces": [
14+
"application/json"
15+
],
16+
"schemes": [
17+
"https"
18+
],
19+
"paths": {
20+
"/shelves": {
21+
"get": {
22+
"description": "Returns all shelves in the bookstore.",
23+
"operationId": "listShelves",
24+
"produces": [
25+
"application/json"
26+
],
27+
"responses": {
28+
"200": {
29+
"description": "List of shelves in the bookstore.",
30+
"schema": {
31+
"$ref": "#/definitions/listShelvesResponse"
32+
}
33+
}
34+
},
35+
"x-google-quota": {
36+
"metricCosts": {
37+
"read-requests": 1
38+
}
39+
},
40+
"security": []
41+
},
42+
"post": {
43+
"description": "Creates a new shelf in the bookstore.",
44+
"operationId": "createShelf",
45+
"parameters": [
46+
{
47+
"description": "A shelf resource to create.",
48+
"in": "body",
49+
"name": "shelf",
50+
"required": true,
51+
"schema": {
52+
"$ref": "#/definitions/shelf"
53+
}
54+
}
55+
],
56+
"produces": [
57+
"application/json"
58+
],
59+
"responses": {
60+
"200": {
61+
"description": "A newly created shelf resource.",
62+
"schema": {
63+
"$ref": "#/definitions/shelf"
64+
}
65+
}
66+
},
67+
"security": [
68+
{
69+
"api_key": []
70+
}
71+
]
72+
}
73+
}
74+
},
75+
"definitions": {
76+
"shelf": {
77+
"properties": {
78+
"name": {
79+
"type": "string"
80+
},
81+
"theme": {
82+
"type": "string"
83+
}
84+
},
85+
"required": [
86+
"name",
87+
"theme"
88+
]
89+
}
90+
},
91+
"securityDefinitions": {
92+
"api_key": {
93+
"in": "query",
94+
"name": "key",
95+
"type": "apiKey"
96+
}
97+
},
98+
"x-google-management": {
99+
"metrics": [
100+
{
101+
"name": "read-requests",
102+
"displayName": "Read requests",
103+
"value_type": "INT64",
104+
"metric_kind": "DELTA"
105+
}
106+
],
107+
"quota": {
108+
"limits": [
109+
{
110+
"name": "read-limit",
111+
"metric": "read-requests",
112+
"unit": "1/min/{project}",
113+
"values": {
114+
"STANDARD": 1000
115+
}
116+
}
117+
]
118+
}
119+
}
120+
}

0 commit comments

Comments
 (0)