Skip to content

Commit

Permalink
Documentation for API keys and env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleitnick committed Feb 9, 2023
1 parent 055c5d8 commit b39304e
Show file tree
Hide file tree
Showing 5 changed files with 290 additions and 266 deletions.
23 changes: 23 additions & 0 deletions docs/cli/cli-api-key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# API Key
`rbxcloud` requires a Roblox API key to function. These keys can be created and managed on the [Credentials](https://create.roblox.com/credentials) Roblox page. Remember to always keep these keys secret.

Roblox API keys will auto-expire if not used for over 60 days. Use the Credentials page to regenerate the key if this occurs.

## Security
As a general rule of practice for any API key:
- Use the least number of permissions as needed
- Keep the key in a secret location (e.g. GitHub Secrets, AWS Secrets Manager, etc.)
- Never commit a key to a source code repository
- Use as strict of a CIDR as possible
- Use an expiration date to force periodic key rollovers (must be manually regenerated)

### Handling Compromised Keys
If a key is suspected to have been compromised, use the Credentials page to immediately invalidate the key. This can be done by regenerating or deleting the key. Keys can also be disabled, but re-enabling the key will not change the key, thus is not a safe option to protect from a compromised key. If in doubt, regenerate the key.

### Storing Keys
There are many tools that can be used to securely store a key. GitHub has a Secrets page for each repository, which can then be used by GitHub Actions securely. AWS and GCP have a Secrets Manager service. Azure has the Key Vault service.

If a key must be located within a local repository's directory, be sure to add it to the `.gitignore` file. This is common in some `.env` file setups.

## Environment Variable
All CLI commands expect the `--api-key` parameter, but can also be set via the `RBXCLOUD_API_KEY` environment variable. With the environment variable set, the `--api-key` parameter can be left out.
276 changes: 138 additions & 138 deletions docs/cli/cli-datastore.md
Original file line number Diff line number Diff line change
@@ -1,138 +1,138 @@
# DataStore API

## List Stores
List all DataStores within a given experience.
```
USAGE:
rbxcloud datastore list-stores [OPTIONS] --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-c, --cursor <CURSOR> Cursor for the next set of data
-h, --help Print help information
-l, --limit <LIMIT> Maximum number of items to return
-p, --prefix <PREFIX> Return only DataStores with this prefix
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
```

## List Keys
List all keys within a given DataStore.
```
USAGE:
rbxcloud datastore list [OPTIONS] --datastore-name <DATASTORE_NAME> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-c, --cursor <CURSOR> Cursor for the next set of data
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-l, --limit <LIMIT> Maximum number of items to return
-o, --all-scopes If true, return keys from all scopes
-p, --prefix <PREFIX> Return only DataStores with this prefix
-s, --scope <SCOPE> DataStore scope
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
```

## List Key Versions
List all versions of the specified key.
```
USAGE:
rbxcloud datastore list-versions [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --sort-order <SORT_ORDER> --limit <LIMIT> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-c, --cursor <CURSOR> Cursor for the next set of data
-d, --datastore-name <DATASTORE_NAME> DataStore name
-e, --end-time <END_TIME> End time constraint (ISO UTC Datetime)
-h, --help Print help information
-k, --key <KEY> The key of the entry
-l, --limit <LIMIT> Maximum number of items to return
-o, --sort-order <SORT_ORDER> Sort order [possible values: ascending, descending]
-s, --scope <SCOPE> DataStore scope
-t, --start-time <START_TIME> Start time constraint (ISO UTC Datetime)
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
```

## Get Key
Get the entry value of a specific key.
```
USAGE:
rbxcloud datastore get [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-k, --key <KEY> The key of the entry
-s, --scope <SCOPE> DataStore scope
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
```

## Set Key
Set (or create) the entry value of a specific key.
```
USAGE:
rbxcloud datastore set [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --data <DATA> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-d, --datastore-name <DATASTORE_NAME> DataStore name
-D, --data <DATA> JSON-stringified data (up to 4MB)
-e, --exclusive-create Only create the entry if it does not exist
-h, --help Print help information
-i, --match-version <MATCH_VERSION> Only update if the current version matches this
-k, --key <KEY> The key of the entry
-s, --scope <SCOPE> DataStore scope
-t, --attributes <ATTRIBUTES> JSON-stringified attributes data
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
-U, --user-ids <USER_IDS> Comma-separated list of Roblox user IDs
```

## Increment Key
Increment (or create) the entry value of a specific key.
```
USAGE:
rbxcloud datastore increment [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --increment-by <INCREMENT_BY> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-i, --increment-by <INCREMENT_BY> The amount by which the entry should be incremented
-k, --key <KEY> The key of the entry
-s, --scope <SCOPE> DataStore scope
-t, --attributes <ATTRIBUTES> JSON-stringified attributes data
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
-U, --user-ids <USER_IDS> Comma-separated list of Roblox user IDs
```

## Delete Key
Delete the value of a specific key. Per Roblox's [documentation](https://create.roblox.com/docs/open-cloud/data-store-api#delete-entry), this creates a "tombstone" version for 30 days before being completely deleted.
```
USAGE:
rbxcloud datastore delete [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-k, --key <KEY> The key of the entry
-s, --scope <SCOPE> DataStore scope
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
```

## Get Key Version
Get a specific entry of a key given the version.
```
USAGE:
rbxcloud datastore get-version [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --version-id <VERSION_ID> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-i, --version-id <VERSION_ID> The version of the key
-k, --key <KEY> The key of the entry
-s, --scope <SCOPE> DataStore scope
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
```
# DataStore API

## List Stores
List all DataStores within a given experience.
```
USAGE:
rbxcloud datastore list-stores [OPTIONS] --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-c, --cursor <CURSOR> Cursor for the next set of data
-h, --help Print help information
-l, --limit <LIMIT> Maximum number of items to return
-p, --prefix <PREFIX> Return only DataStores with this prefix
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
```

## List Keys
List all keys within a given DataStore.
```
USAGE:
rbxcloud datastore list [OPTIONS] --datastore-name <DATASTORE_NAME> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-c, --cursor <CURSOR> Cursor for the next set of data
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-l, --limit <LIMIT> Maximum number of items to return
-o, --all-scopes If true, return keys from all scopes
-p, --prefix <PREFIX> Return only DataStores with this prefix
-s, --scope <SCOPE> DataStore scope
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
```

## List Key Versions
List all versions of the specified key.
```
USAGE:
rbxcloud datastore list-versions [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --sort-order <SORT_ORDER> --limit <LIMIT> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-c, --cursor <CURSOR> Cursor for the next set of data
-d, --datastore-name <DATASTORE_NAME> DataStore name
-e, --end-time <END_TIME> End time constraint (ISO UTC Datetime)
-h, --help Print help information
-k, --key <KEY> The key of the entry
-l, --limit <LIMIT> Maximum number of items to return
-o, --sort-order <SORT_ORDER> Sort order [possible values: ascending, descending]
-s, --scope <SCOPE> DataStore scope
-t, --start-time <START_TIME> Start time constraint (ISO UTC Datetime)
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
```

## Get Key
Get the entry value of a specific key.
```
USAGE:
rbxcloud datastore get [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-k, --key <KEY> The key of the entry
-s, --scope <SCOPE> DataStore scope
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
```

## Set Key
Set (or create) the entry value of a specific key.
```
USAGE:
rbxcloud datastore set [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --data <DATA> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-d, --datastore-name <DATASTORE_NAME> DataStore name
-D, --data <DATA> JSON-stringified data (up to 4MB)
-e, --exclusive-create Only create the entry if it does not exist
-h, --help Print help information
-i, --match-version <MATCH_VERSION> Only update if the current version matches this
-k, --key <KEY> The key of the entry
-s, --scope <SCOPE> DataStore scope
-t, --attributes <ATTRIBUTES> JSON-stringified attributes data
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
-U, --user-ids <USER_IDS> Comma-separated list of Roblox user IDs
```

## Increment Key
Increment (or create) the entry value of a specific key.
```
USAGE:
rbxcloud datastore increment [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --increment-by <INCREMENT_BY> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-i, --increment-by <INCREMENT_BY> The amount by which the entry should be incremented
-k, --key <KEY> The key of the entry
-s, --scope <SCOPE> DataStore scope
-t, --attributes <ATTRIBUTES> JSON-stringified attributes data
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
-U, --user-ids <USER_IDS> Comma-separated list of Roblox user IDs
```

## Delete Key
Delete the value of a specific key. Per Roblox's [documentation](https://create.roblox.com/docs/open-cloud/data-store-api#delete-entry), this creates a "tombstone" version for 30 days before being completely deleted.
```
USAGE:
rbxcloud datastore delete [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-k, --key <KEY> The key of the entry
-s, --scope <SCOPE> DataStore scope
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
```

## Get Key Version
Get a specific entry of a key given the version.
```
USAGE:
rbxcloud datastore get-version [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --version-id <VERSION_ID> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-i, --version-id <VERSION_ID> The version of the key
-k, --key <KEY> The key of the entry
-s, --scope <SCOPE> DataStore scope
-u, --universe-id <UNIVERSE_ID> Universe ID of the experience
```
Loading

0 comments on commit b39304e

Please sign in to comment.