Skip to content

Commit

Permalink
Merge "add configuration examples"
Browse files Browse the repository at this point in the history
  • Loading branch information
JLXIA authored and Gerrit Code Review committed Dec 17, 2019
2 parents ca9ffa9 + 01eaff8 commit 8bdac43
Show file tree
Hide file tree
Showing 12 changed files with 1,820 additions and 335 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ To find out more about building, running, and testing ESPv2:

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

## Examples

How to configure ESPv2? See [examples](/examples/README.md)

## Disclaimer

ESPv2 is in Beta currently.
Expand Down
26 changes: 26 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ESPv2 Configurations

This directory contains examples of how to configure ESPv2.

## Service Control

Includes how to configure Authorization by API Key, and Quota, controlled by ServiceControl filter.

* [Producer defined OpenAPI Specification](/service_control/openapi_swagger.json)

* [Google Cloud Endpoints generated Service configuration](
/service_control/service_config_generated.json
): Service configuration generated by ServiceManagement Service.
Can be accessible by running:

```
gcloud endpoints configs describe "${CONFIG_ID}" --project="${PROJECT}" \
--service="${SERVICE}" --format=json > service.json
```

* [ESPv2 generated Envoy configuration](
/service_control/envoy_config.json
): Equivalent Envoy static Bootstrap configuration.

## Dynamic Routing(TBD)

776 changes: 776 additions & 0 deletions examples/service_control/envoy_config.json

Large diffs are not rendered by default.

120 changes: 120 additions & 0 deletions examples/service_control/openapi_swagger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"swagger": "2.0",
"info": {
"description": "A simple Google Cloud Endpoints Bookstore API example.",
"title": "Bookstore",
"version": "1.0.0"
},
"host": "bookstore.endpoints.apiproxy-231719.cloud.goog",
"basePath": "/",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"https"
],
"paths": {
"/shelves": {
"get": {
"description": "Returns all shelves in the bookstore.",
"operationId": "listShelves",
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "List of shelves in the bookstore.",
"schema": {
"$ref": "#/definitions/listShelvesResponse"
}
}
},
"x-google-quota": {
"metricCosts": {
"read-requests": 1
}
},
"security": []
},
"post": {
"description": "Creates a new shelf in the bookstore.",
"operationId": "createShelf",
"parameters": [
{
"description": "A shelf resource to create.",
"in": "body",
"name": "shelf",
"required": true,
"schema": {
"$ref": "#/definitions/shelf"
}
}
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "A newly created shelf resource.",
"schema": {
"$ref": "#/definitions/shelf"
}
}
},
"security": [
{
"api_key": []
}
]
}
}
},
"definitions": {
"shelf": {
"properties": {
"name": {
"type": "string"
},
"theme": {
"type": "string"
}
},
"required": [
"name",
"theme"
]
}
},
"securityDefinitions": {
"api_key": {
"in": "query",
"name": "key",
"type": "apiKey"
}
},
"x-google-management": {
"metrics": [
{
"name": "read-requests",
"displayName": "Read requests",
"value_type": "INT64",
"metric_kind": "DELTA"
}
],
"quota": {
"limits": [
{
"name": "read-limit",
"metric": "read-requests",
"unit": "1/min/{project}",
"values": {
"STANDARD": 1000
}
}
]
}
}
}
Loading

0 comments on commit 8bdac43

Please sign in to comment.