Skip to main content

Get

Print the NATS subjects that one osapi process needs.

It prints the least that the role can publish and subscribe to, with the streams and buckets of the config and the namespace of controller.nats. Give these to the NATS user of the role on a NATS server that osapi does not run. nsc is the flags of nsc add user or nsc edit user, for a server in operator mode. The embedded server applies them itself to a user with a role in nats.server.auth.users.

osapi nats permissions get [flags]

Examples​

osapi nats permissions get --role agent
osapi nats permissions get --role controller --json

Result​

The command prints:

$ osapi nats permissions get --role agent
NATS permissions:
  Role:              agent
  Namespace:         osapi
  Publish:           $JS.API.INFO, $KV.osapi-agent-registry.>, osapi.enroll.request
  Subscribe:         _INBOX.>, osapi.enroll.response.>
  Answers requests:  no
  nsc:               --allow-pub "$JS.API.INFO,$KV.osapi-agent-registry.>,osapi.enroll.request" --allow-sub "_INBOX.>,osapi.enroll.response.>"

With --json, the command prints:

{
"role": "agent",
"namespace": "osapi",
"publish": [
"$JS.API.INFO",
"$KV.osapi-agent-registry.\u003e",
"osapi.enroll.request"
],
"subscribe": ["_INBOX.\u003e", "osapi.enroll.response.\u003e"],
"responses": false,
"nsc": "--allow-pub \"$JS.API.INFO,$KV.osapi-agent-registry.\u003e,osapi.enroll.request\" --allow-sub \"_INBOX.\u003e,osapi.enroll.response.\u003e\""
}

Flags​

FlagDescriptionDefault
--roleThe osapi process: controller, agent, setup or join (required)

Global flags​

FlagDescriptionDefault
-d, --debugEnable or disable debug mode
-j, --jsonEnable JSON output
-f, --osapi-filePath to config file; without one at the default path, osapi runs on the defaults/etc/osapi/osapi.yaml

Output tells how the result is printed, and what --json gives.