list

Use greymatter list to list objects and their configurations in the Grey Matter mesh. Objects can be zones, proxies, domains, routes, shared_rules, and clusters.

Usage

greymatter [GLOBAL OPTIONS] list [OPTIONS] <object type> [field_name=field_value]...

Sample Usage

$ greymatter list cluster
[info] 2019/07/10 03:24:43 Preferring --api.key for authentication
[
  {
    "cluster_key": "cluster-dashboard",
    "zone_key": "zone-default-zone",
    "name": "dashboard",
    "instances": [
      {
        "host": "dashboard",
        "port": 1337,
        "metadata": null
      }
    ],
    "circuit_breakers": null,
    "outlier_detection": null,
    "health_checks": null,
    "checksum": "52ff049a34702c34f5262d2be15e921b3a14ca6a2dc88849707035da8d7c6588"
  },
  {
    "cluster_key": "cluster-catalog",
    "zone_key": "zone-default-zone",
    "name": "catalog",
    "instances": [
      {
        "host": "catalog",
        "port": 8080,
        "metadata": null
      }
    ],
    "circuit_breakers": null,
    "outlier_detection": null,
    "health_checks": null,
    "checksum": "5dd9355e9ebbe59b7ef3782263f5ab58029eb2246114e39662dee65242bd69da"
  },
  {
    "cluster_key": "cluster-example-service",
    "zone_key": "zone-default-zone",
    "name": "example-service",
    "instances": [
      {
        "host": "example-service",
        "port": 3000,
        "metadata": null
      }
    ],
    "circuit_breakers": null,
    "outlier_detection": null,
    "health_checks": null,
    "checksum": "0508a23ae92afea8b5d6a3a9e8c9b3fce60f1f5e0a76c76412fa70ddc12d9304"
  }
]

Help

To list available commands run with the global help flag, greymatter list --help:

$ greymatter list --help
NAME
    list - list all of a particular object in the Grey Matter API

USAGE
    greymatter [GLOBAL OPTIONS] list [OPTIONS] <object type> [field_name=field_value]...

VERSION
    v1.2.1

DESCRIPTION
    object type is one of: zone, proxy, listener, domain, route, shared_rules, cluster

GLOBAL OPTIONS
    --api.header=header
            Specifies a custom header to send with every API request. Headers are given as
            name:value pairs. Leading and trailing whitespace will be stripped from the
            name and value. For multiple headers, this flag may be repeated or multiple
            headers can be delimited with commas.

    --api.host=host:port
            (default: localhost:80)
            The address (host:port) for API requests. If no port is given, it defaults to
            port 443 if --api.ssl is true and port 80 otherwise.

    --api.insecure
            (default: false)
            If true, don't validate server cert when using SSL for API requests

    --api.key=string
            (default: "none")
            [SENSITIVE] The auth key for API requests

    --api.prefix=value
            The url prefix for API requests. Forms the path part of <host>:<port><path>

    --api.ssl
            (default: true)
            If true, use SSL for API requests

    --api.sslCert=value
            Specifies the SSL cert to use for every API request.

    --api.sslKey=value
            Specifies the SSL key to use for every API request.

    --console.level=level
            (default: "info")
            (valid values: "debug", "info", "error", or "none")
            Selects the log level for console logs messages.

    --format=string
            (default: "json")
            The I/O format (json or yaml)

    --help  (default: false)
            Show a list of commands or help for one command

    --version
            (default: false)
            Print the version and exit

    Global options can also be configured via upper-case, underscore-delimited environment
    variables prefixed with "GREYMATTER_". For example, "--some-flag" becomes
    "GREYMATTER_SOME_FLAG". Command-line flags take precedence over environment variables.

OPTIONS
    --filter-slice-separator=string
            (default: ",")
            sets the delimiter used to indicate the boundary between elements when passing
            a list of values into a filter attribute that expects a slice.

    --format=string
            <format name> or +<format string>

            Some pre-defined format strings may be referenced by format name; if
            set this will override the more general json/yaml format flag. The available
            pre-defined formats vary based on the object type being listed:

                - shared_rules: summary
                - route: summary, path-only
                - user: summary
                - cluster: summary

            If a custom format is desired it may be specified by prefixing the string with
            '+'. Custom formatting is defined using golang template syntax (see
            https://golang.org/pkg/text/template). For the field reference for specific
            API objects, see the API Godoc (https://godoc.org/github.com/turbinelabs/api).

            EXAMPLE:

                > greymatter --api.key=$TBN_API_KEY list \
                  --format='+{{.Name}}{{range .Instances}}
                  {{.Host}}:{{.Port}}{{range .Metadata}}
                    {{.Key}}={{.Value}}{{end}}{{end}}' cluster

                local-demo-api-cluster
                  127.0.0.1:8080
                    stage=prod
                    version=blue
                  127.0.0.1:8081
                    stage=prod
                    version=green
                  127.0.0.1:8082
                    stage=dev
                    version=yellow
                local-demo-ui-cluster
                  127.0.0.1:8083
                    stage=prod

    --header=string
            Header used if a custom -format value is specified

    --help  (default: false)
            Show a list of commands or help for one command

    --show-filter-fields
            (default: false)
            Displays attributes that can be filtered when listing an object type. Each
            field is specified as a single argument of the format name=value.

            If an attribute expects a slice of values they may be specified as a
            comma-separated string (if commas are needed in the values see
            filter-slice-separator). If the attribute is a time then it should be
            specified as the number of milliseconds since the unix epoch. Boolean true
            values may be represented by true, t, yes, y, or 1, and is case insensitive.

    --version
            (default: false)
            Print the version and exit

    Options can also be configured via upper-case, underscore-delimited environment
    variables prefixed with "GREYMATTER_LIST_". For example, "--some-flag" becomes
    "GREYMATTER_LIST_SOME_FLAG". Command-line flags take precedence over environment
    variables.

Questions?

Last updated

Was this helpful?