Handling tokens

Every action in tsuru requires a token. If you need to do some kind ofautomation, instead of setting a user token, you can create a team token.

To create a team token, use the token create command:

  1. $ tsuru token create --id my-ci-token --team myteam \
  2. --description "CI token" --expires 48h
  3. Token "my-ci-token" created: b3bc4ded93dd9a799874b564835d362aa1274be0e9511f29d3f78dc8517af176

The expires flag is optional. By default, team tokens don’t expire.

Now you can set new permissions to this token with role assign command:

  1. $ tsuru role assign deployer my-ci-token
  2. Role successfully assigned!

This example assumes a role called deployer was previously created. A usercan only add permissions that he owns himself.

To list all team tokens you have permission to see, use token list command:

  1. $ tsuru token list
  2. +-------------+--------+-------------+-------------------------+----------------------------------+----------------------------------------------------+-----------------+
  3. | Token ID | Team | Description | Creator | Timestamps | Value | Roles |
  4. +-------------+--------+-------------+-------------------------+----------------------------------+----------------------------------------------------+-----------------+
  5. | my-ci-token | myteam | CI token | me@example.com | Created At: 19 Sep 18 11:42 -03 | b3bc4ded93dd9a799874b564835d362aa1274be0e9511f29d | deployer() |
  6. | | | | | Expires At: - | 3f78dc8517af176 | |
  7. | | | | | Last Access: - | | |
  8. +-------------+--------+-------------+-------------------------+----------------------------------+----------------------------------------------------+-----------------+

Now you can use the token in Value column above to make deploys to appsowned by myteam team.

原文: https://docs.tsuru.io/1.6/using/team-tokens.html