zed

module
v0.0.0-...-ea3d5c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2021 License: Apache-2.0

README

zed

Go Report Card GoDoc Lines of Code License IRC Channel

Note: The master branch may be in an unstable or even broken state during development. Please use [releases] instead of the master branch in order to get stable binaries.

A client for managing authzed or any API-compatible system from your command line.

Example Usage

Managing credentials

Configuring credentials is similar to kubeconfig in kubectl. If both $ZED_TENANT and $ZED_TOKEN are set, these values are used instead of the current context.

API Tokens are stored in the system keychain.

$ zed config set-token jimmy@authzed.com tu_zed_hanazawa_deadbeefdeadbeefdeadbeefdeadbeef
NAME             	ENDPOINT            	TOKEN     	MODIFIED
jimmy@authzed.com	grpc.authzed.com:443	<redacted>	now

$ zed config get-tokens
NAME             	ENDPOINT            	TOKEN     	MODIFIED
jimmy@authzed.com	grpc.authzed.com:443	<redacted>	2 minutes ago

Context data is stored in $XDG_CONFIG_HOME/zed falling back to ~/.zed if that environment variable is not set.

$ zed config set-context rbac rbac_example jimmy@authzed.com
NAME	TENANT      	TOKEN NAME       	ENDPOINT            	CURRENT
rbac	rbac_example	jimmy@authzed.com	grpc.authzed.com:443

$ zed config use-context rbac
NAME	TENANT      	TOKEN NAME       	ENDPOINT            	CURRENT
rbac	rbac_example	jimmy@authzed.com	grpc.authzed.com:443	true
Managing namespaces
$ zed describe document
rbac_example/document
 ├── writer
 └── reader
      └── union
           ├── _this
           └── TUPLE_OBJECT: writer

When piped or provided the --json flag, API responses are converted into JSON.

$ zed describe document | jq '.config.relation[0].name'
"writer"
Managing relationships
$ zed check user:tom document:firstdoc writer
true

$ zed check user:tom document:firstdoc writer | jq
{
  "isMember": true,
  "revision": {
    "token": "CAESAwiKBA=="
  }
}

$ zed check user:jimmy document:firstdoc writer
false

$ zed create user:jimmy document:firstdoc writer
CAESAwiLBA==

$ zed check user:jimmy document:firstdoc writer
true

$ zed delete user:jimmy document:firstdoc writer
CAESAwiMBA==

$ zed check user:jimmy document:firstdoc writer
false

Directories

Path Synopsis
cmd
zed command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL