# API

The Grey Matter Mesh is built out of a number of logical abstractions. The following table describes the logical abstractions, or objects, that make up the Grey Matter Mesh. The arrangement, connections, and configuration of these objects define the mesh and its behaviors.

![](https://2512473607-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LsNFVozLgvw3NDMzxBg%2F-M40dMNooUboAQoeOfYZ%2F-M40dNn9cKch3JLfiF0d%2Ffabric-cli-control-flow.png?generation=1585944302322628\&alt=media)

* [cluster](api/cluster)
* [domain](api/domain)
* [listener](api/listener)
* [proxy](api/proxy)
* [route](api/route)
* [shared\_rules](api/shared_rules)
* [zone](api/zone)

## Summary

| Object Name   | Description                                                                                                                                                             | Links To               | Links From                                             |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ------------------------------------------------------ |
| zone          | A logically isolated region of the mesh.  Zones are the highest level of organizational infrastructure. Zones contain all other objects.                                |                        | cluster, domain, listener, proxy, route, shared\_rules |
| domain        | The URL domains for which routes and clusters will be assigned within a proxy.  E.g. `www.deciphernow.com`, `localhost`, or `*`                                         | zone                   | listener, proxy, route                                 |
| listener      | The Envoy listener object that defines the host, port, and protocol for a proxy within the mesh.                                                                        | zone, domain           | proxy                                                  |
| proxy         | The Proxy object represents the aggregate objects that get mapped to each instance of the Grey Matter Proxy.                                                            | zone, domain, listener |                                                        |
| route         | A Route defines how a URL in a given domain is handled.  Route objects directly affect URI path matching, prefix rewriting, and redirects.                              | zone, domain           | shared\_rules                                          |
| shared\_rules | Shared\_rules define how requests are sent to clusters.  They can perform traffic splitting and shadowing.                                                              | zone                   | route                                                  |
| cluster       | Clusters represent collections of either hard-coded or discovered instances of a microservice.  Clusters handle health checks, circuit breaking, and outlier detection. | zone                   | shared\_rules                                          |

![](https://2512473607-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LsNFVozLgvw3NDMzxBg%2Fsync%2F6f4b295eba3f03bf629da54b6f37442731070c20.png?generation=1588255657733099\&alt=media)

## Detailed Descriptions

* [Zone](api/zone)
* [Listener](https://github.com/DecipherNow/gm-gitbook-sync/tree/b88085226e88844739eb923e6a3b5b82bf4294b6/usage/fabric/api/listener.md)
* [Proxy](api/proxy)
* [Domain](https://github.com/DecipherNow/gm-gitbook-sync/tree/b88085226e88844739eb923e6a3b5b82bf4294b6/usage/fabric/api/domain.md)
* [Route](https://github.com/DecipherNow/gm-gitbook-sync/tree/b88085226e88844739eb923e6a3b5b82bf4294b6/usage/fabric/api/route.md)
* [Shared Rules](https://github.com/DecipherNow/gm-gitbook-sync/tree/b88085226e88844739eb923e6a3b5b82bf4294b6/usage/fabric/api/shared_rules.md)
* [Cluster](https://github.com/DecipherNow/gm-gitbook-sync/tree/b88085226e88844739eb923e6a3b5b82bf4294b6/usage/fabric/api/cluster.md)

## Request Flow

1. **Listener**: A request from inside or outside the mesh is first sent to the host:port of a `listener`.
2. **Domain**: The request host:port is matched against the available domains, and redirected if need be, and sent to an attached set of `routes`.
3. **Route**: The request URI path portion is then passed through the `route` object for matching, rewriting, and redirecting to a `shared_rule`.
4. **Shared Rule**: The request is passed through the `shared_rules` to send, split, or shadow traffic to clusters.
5. **Cluster**: A `cluster` sends the final request to one of it's available instances; retrying and breaking connections as necessary.

![](https://2512473607-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LsNFVozLgvw3NDMzxBg%2F-M3fy5W4cXH0-uxjG9BB%2F-M3fy6dJwfZRGCJEGnGu%2Fflowchart.png?generation=1585580638590989\&alt=media)

## Nested Objects

Each API Objects discussed above is made up of individual fields and nested structures. Some structures are unique to a given object, but some are re-used across multiple places. These are discussed below.

* [constraint](api/domain/header_constraint)
* [match](api/route/match)
* [response\_data](api/route/response_data)
* [rule](api/route/rule)
