Skip to main content
logoTetrate Service BridgeVersion: next

API

An API resource defines an OpenAPI specification that can be used by gateways to validate incoming requests.

The following API resource example validates incoming requests for certain hostnames and optional paths.

apiVersion: api.tsb.tetrate.io/v2
kind: API
metadata:
organization: myorg
tenant: mycompany
workspace: myapp
name: example-api
spec:
openapi: |

The following gateway definition references the previous API to perform its validations for incoming requests.
```yaml
apiVersion: gateway.tsb.tetrate.io/v2
kind: Gateway
metadata:
organization: myorg
tenant: mycompany
workspace: myapp
name: example-gateway
spec:
workloadSelector:
namespace: ns1
labels:
app: gateway
http:
- name: bookinfo
port: 443
hostname: bookinfo.com
tls:
mode: SIMPLE
secretName: bookinfo-certs
routing:
rules:
- route:
serviceDestination:
host: ns1/productpage.ns1.svc.cluster.local
openapi:
api: organizations/myorg/tenants/mycompany/workspaces/myapp/apis/example-api
validation:
enabled: true

API

An API object defines an OpenAPI specification that can be used by gateways to validate incoming requests.

FieldDescriptionValidation Rule

openapi

string
REQUIRED
The raw OpenAPI spec for this API.

string = {
  min_len: 1
}