create

Use greymatter create to create a specific object in the Grey Matter mesh. Objects can be zone, proxy, domain, route, shared_rules, cluster, catalog_zone, and catalog_cluster.

Usage

greymatter create <object type> [flags]

Sample Usage

Create from JSON File

Resources can be created directly from files on disk through shell redirects like shown below. Using the file domain-catalog.json with the following content:

{
  "domain_key": "domain-catalog",
  "force_https": true,
  "gzip_enabled": false,
  "name": "*",
  "port": 10808,
  "zone_key": "zone-default-zone"
}

greymatter create domain < domain-catalog.json will create the domain object from the given spec.

$ ./greymatter create domain < domain-catalog.json
{
  "aliases": null,
  "checksum": "27f6729b9e28ca28a903fa669a5764f7c0655d6995a69dc17973032fe1372cec",
  "cors_config": null,
  "custom_headers": null,
  "domain_key": "domain-catalog",
  "force_https": true,
  "gzip_enabled": false,
  "name": "*",
  "port": 10808,
  "redirects": null,
  "zone_key": "zone-default-zone"
}

Interactive Editor

By setting the EDITOR environment variable, the greymatter tool will open the editor of choice and let the user create the object directly.

If a default object (in this case a listener) is not set, the editor of choice will contain an empty json object {}; otherwise it will contain a skeleton listener object that looks something like the following indicating the fields that can be set:

There are a few option to set default objects. Take a listener, for instance, you can set a listener template with one of the two flags below:

Typically, the mesh will have a listener called default which will be used as a template by default without any flags. You can confirm this by running greymatter get listener default. If you get an 400 error message when running the command, it will need to be set up by creating a default listener just like any other listeners.

Another way to do this is by copying from an existing listener. Say there is an existing listener whose key is listener-slo - you can create a new listener by duplicating this listener and changing fields necessary by running:

Key is a unique field, so trying to save without changing a key after duplicating will result in a duplicate key error.

Help

To list available commands run with the global help flag:

Questions

circle-check

Last updated

Was this helpful?