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-mesh, and catalog-service.

Usage

1
greymatter create <object type> [flags]
Copied!

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:
1
{
2
"domain_key": "domain-catalog",
3
"force_https": true,
4
"gzip_enabled": false,
5
"name": "*",
6
"port": 10808,
7
"zone_key": "zone-default-zone"
8
}
Copied!
greymatter create domain < domain-catalog.json will create the domain object from the given spec.
1
$ ./greymatter create domain < domain-catalog.json
2
{
3
"aliases": null,
4
"checksum": "27f6729b9e28ca28a903fa669a5764f7c0655d6995a69dc17973032fe1372cec",
5
"cors_config": null,
6
"custom_headers": null,
7
"domain_key": "domain-catalog",
8
"force_https": true,
9
"gzip_enabled": false,
10
"name": "*",
11
"port": 10808,
12
"redirects": null,
13
"zone_key": "zone-default-zone"
14
}
Copied!

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.
1
export EDITOR=vim
2
greymatter create listener
Copied!
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:
1
{
2
"access_loggers": {
3
"http_connection_loggers": {
4
"disabled": false,
5
"file_loggers": null,
6
"http_grpc_access_loggers": null
7
},
8
"http_upstream_loggers": {
9
"disabled": false,
10
"file_loggers": null,
11
"http_grpc_access_loggers": null
12
}
13
},
14
"active_http_filters": null,
15
"active_network_filters": null,
16
"checksum": "",
17
"delayed_close_timeout": "",
18
"domain_keys": null,
19
"drain_timeout": "",
20
"http2_protocol_options": null,
21
"http_filters": null,
22
"http_protocol_options": null,
23
"ip": "",
24
"listener_key": "default",
25
"name": "default",
26
"network_filters": null,
27
"port": 0,
28
"protocol": "",
29
"request_timeout": "",
30
"secret": {
31
"secret_key": "",
32
"secret_name": "",
33
"secret_validation_name": "",
34
"subject_names": null,
35
"ecdh_curves": null,
36
"set_current_client_cert_details": {
37
"uri": false
38
},
39
"checksum": ""
40
},
41
"stream_idle_timeout": "",
42
"tracing_config": null,
43
"use_remote_address": false,
44
"zone_key": "default"
45
}
Copied!
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:
1
--default-listener-key string the key that points to the listener object that should act as a template.
2
--default-object-key string the default key that points to the object that should act as a template. Precedence is given to specific object type defaults. (default "default")
Copied!
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:
1
greymatter create listener --default-listener-key listener-slo
Copied!
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:
1
greymatter create --help
Copied!

Questions

Need help with the CLI?
Create an account at Grey Matter Support to reach our team.
Last modified 1yr ago
Export as PDF
Copy link