Skip to content

Commit

Permalink
PR(ACP-DOCS): Make Docs For ACP Specific CLI CMDs
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzadlone committed Feb 29, 2024
1 parent fa39547 commit 54146a9
Show file tree
Hide file tree
Showing 3 changed files with 180 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docs/cli/defradb_client_acp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## defradb client acp

Interact with the access control system of a DefraDB node

### Synopsis

Interact with the access control system of a DefraDB node

### Options

```
-h, --help help for acp
```

### Options inherited from parent commands

```
--allowed-origins stringArray List of origins to allow for CORS requests
--logformat string Log format to use. Options are csv, json (default "csv")
--loglevel string Log level to use. Options are debug, info, error, fatal (default "info")
--lognocolor Disable colored log output
--logoutput string Log output path (default "stderr")
--logtrace Include stacktrace in error and fatal logs
--max-txn-retries int Specify the maximum number of retries per transaction (default 5)
--no-p2p Disable the peer-to-peer network synchronization system
--p2paddr strings Listen addresses for the p2p network (formatted as a libp2p MultiAddr) (default [/ip4/127.0.0.1/tcp/9171])
--peers stringArray List of peers to connect to
--privkeypath string Path to the private key for tls
--pubkeypath string Path to the public key for tls
--rootdir string Directory for persistent data (default: $HOME/.defradb)
--store string Specify the datastore to use (supported: badger, memory) (default "badger")
--tx uint Transaction ID
--url string URL of HTTP endpoint to listen on or connect to (default "127.0.0.1:9181")
--valuelogfilesize int Specify the datastore value log file size (in bytes). In memory size will be 2*valuelogfilesize (default 1073741824)
```

### SEE ALSO

* [defradb client](defradb_client.md) - Interact with a DefraDB node
* [defradb client acp policy](defradb_client_acp_policy.md) - Interact with the acp policy features of DefraDB instance

41 changes: 41 additions & 0 deletions docs/cli/defradb_client_acp_policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## defradb client acp policy

Interact with the acp policy features of DefraDB instance

### Synopsis

Interact with the acp policy features of DefraDB instance

### Options

```
-h, --help help for policy
```

### Options inherited from parent commands

```
--allowed-origins stringArray List of origins to allow for CORS requests
--logformat string Log format to use. Options are csv, json (default "csv")
--loglevel string Log level to use. Options are debug, info, error, fatal (default "info")
--lognocolor Disable colored log output
--logoutput string Log output path (default "stderr")
--logtrace Include stacktrace in error and fatal logs
--max-txn-retries int Specify the maximum number of retries per transaction (default 5)
--no-p2p Disable the peer-to-peer network synchronization system
--p2paddr strings Listen addresses for the p2p network (formatted as a libp2p MultiAddr) (default [/ip4/127.0.0.1/tcp/9171])
--peers stringArray List of peers to connect to
--privkeypath string Path to the private key for tls
--pubkeypath string Path to the public key for tls
--rootdir string Directory for persistent data (default: $HOME/.defradb)
--store string Specify the datastore to use (supported: badger, memory) (default "badger")
--tx uint Transaction ID
--url string URL of HTTP endpoint to listen on or connect to (default "127.0.0.1:9181")
--valuelogfilesize int Specify the datastore value log file size (in bytes). In memory size will be 2*valuelogfilesize (default 1073741824)
```

### SEE ALSO

* [defradb client acp](defradb_client_acp.md) - Interact with the access control system of a DefraDB node
* [defradb client acp policy add](defradb_client_acp_policy_add.md) - Add new policy

98 changes: 98 additions & 0 deletions docs/cli/defradb_client_acp_policy_add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
## defradb client acp policy add

Add new policy

### Synopsis

Add new policy

Terminology:
- 'DPI' means 'DefraDB Policy Interface'.
- 'Permissioned Schema' means to have a policy on the schema: @policy(id:".." resource: "..")

Requirements:
- Must provide a valid [TODO-ACP Insert agreed upon name with bruno] signature identity.
- ACP module must be available (i.e. ACP not disabled).
- Policy specified must be a valid policy (but DPI compliance is not necessary).
- Policy specified must be in a valid JSON or YAML format (detected automatically).

Notes:
- A non-DPI policy is be accepted (will be registered with acp module).
- But only a valid DPI policyID & resource can be specified on a schema.
- DPI validation happens when attempting to add a permissioned schema.
- If DPI validation fails while adding schema, the schema is rejected.

Example: add from an argument string:
defradb client acp policy add -i cosmos1f2djr7dl9vhrk3twt3xwqp09nhtzec9mdkf70j '
description: A Valid DefraDB Policy Interface

actor:
name: actor

resources:
users:
permissions:
read:
expr: owner + reader
write:
expr: owner

relations:
owner:
types:
- actor
reader:
types:
- actor
'

Example: add from file:
defradb client acp policy add -i cosmos17r39df0hdcrgnmmw4mvu7qgk5nu888c7uvv37y -f policy.yml

Example: add from file, verbose flags:
defradb client acp policy add --identity cosmos1kpw734v54g0t0d8tcye8ee5jc3gld0tcr2q473 --file policy.yml

Example: add from stdin:
cat policy.yml | defradb client acp policy add -

Learn more about the DefraDB Policy Interface [TODO-ACP insert DPI Instruction link]


```
defradb client acp policy add [-i --identity] [policy] [flags]
```

### Options

```
-f, --file string File to load a policy from
-h, --help help for add
-i, --identity string [Required] Signature identity of the creator
```

### Options inherited from parent commands

```
--allowed-origins stringArray List of origins to allow for CORS requests
--logformat string Log format to use. Options are csv, json (default "csv")
--loglevel string Log level to use. Options are debug, info, error, fatal (default "info")
--lognocolor Disable colored log output
--logoutput string Log output path (default "stderr")
--logtrace Include stacktrace in error and fatal logs
--max-txn-retries int Specify the maximum number of retries per transaction (default 5)
--no-p2p Disable the peer-to-peer network synchronization system
--p2paddr strings Listen addresses for the p2p network (formatted as a libp2p MultiAddr) (default [/ip4/127.0.0.1/tcp/9171])
--peers stringArray List of peers to connect to
--privkeypath string Path to the private key for tls
--pubkeypath string Path to the public key for tls
--rootdir string Directory for persistent data (default: $HOME/.defradb)
--store string Specify the datastore to use (supported: badger, memory) (default "badger")
--tx uint Transaction ID
--url string URL of HTTP endpoint to listen on or connect to (default "127.0.0.1:9181")
--valuelogfilesize int Specify the datastore value log file size (in bytes). In memory size will be 2*valuelogfilesize (default 1073741824)
```

### SEE ALSO

* [defradb client acp policy](defradb_client_acp_policy.md) - Interact with the acp policy features of DefraDB instance

0 comments on commit 54146a9

Please sign in to comment.