On-boarding New Users

In order to use the Streamlio Cloud, administrators should onboard new users and this page provides the steps to add new users into the system.

First, switch to using a admin user profile

streamlio config use <ADMIN_USER_PROFILE>

An administrator can create a role and token for a user using the following command

streamlio token create --role=<role>

A token will be returned

AccessorID: <ACCESSOR_ID>
Token: <TOKEN>

This token can be given to the user for use.

An administrator might now grant permissions for the role

pulsar-admin namespaces grant-permission <TENANT>/<NAMESPACE> \
--actions <ACTIONS> \
--role <ROLE>

End-to-end example

First, switch to using a admin user profile

streamlio config use <ADMIN_USER_PROFILE>

For this example, lets also create a test user

streamlio token create --role=test-user

A token will be returned

AccessorID: l7BqnIktc2pm3jkZXcWKQoEr
Token: s.H6qV93ndw7XO1hrD0L7wXc5k

Create a local profile for the user for ease of use

streamlio config create test-user-profile \
--address=https://pulsar:8080 \
--token=s.H6qV93ndw7XO1hrD0L7wXc5k \
--current=false

Then, create a tenant

pulsar-admin tenants create test-tenant

Also, create a namespace

pulsar-admin namespaces create test-tenant/test-ns

Next, grant a test user permissions

pulsar-admin namespaces grant-permission test-tenant/test-ns \
--actions produce,consume,functions \
--role test-user

Please note that functions create by a user inherits the permissions of that user. Thus, a user needs to have consume permissions for the input topic(s) of a function and produce permissions for the functions output topic(s)

Now, user test-user should have the permissions create functions as well as consume and produce in the namespace test-tenant/test-ns.

Switch to using the test-user profile

streamlio config use test-user-profile

Create a test function

pulsar-admin functions create \
--jar examples/api-examples.jar \
--classname org.apache.pulsar.functions.api.examples.ExclamationFunction \
--inputs persistent://test-tenant/test-ns/exclamation-input \
--output persistent://test-tenant/test-ns/exclamation-output \
--tenant test-tenant \
--namespace test-ns \
--name exclamation

Try trigger the function

pulsar-admin functions trigger \
--tenant test-tenant \
--namespace test-ns \
--name exclamation \
--trigger-value foo
foo!