Skip to content
This repository was archived by the owner on Nov 14, 2024. It is now read-only.

Context_Handling

Alexis Lucattini edited this page Aug 23, 2021 · 4 revisions

Overview

This section entails:

  1. ica-add-access-token

    • Retrieves api-key from pass db
    • Requires project name and scope as input
    • Writes the access token to ~/.ica-ica-lazy/tokens/tokens.json
  2. ica-show-tokens

    • Provide a summary of the tokens (and when they're due to expire) in $HOME/.ica-ica-lazy/tokens/tokens.json
  3. ica-context-switcher

ica-add-access-token

Autocompletion: ✅

This command will update your token for a given project under ~/.ica-ica-lazy/tokens/tokens.json.
Pleas make sure you've read the Saving your api key section before trying.

To verify, you've successfully completed said section, please run pass /ica/api-keys/default-api-key. One would expect this to return your personal api key.

Options:

  • --project-name: The name of your project
  • --scope: Do you want to enter this context with 'admin' or 'read-only' privileges

Requirements:

  • curl
  • jq
  • pass

Environment vars:

  • ICA_BASE_URL

command-gif

ica-show-tokens

Autocompletion: N/A

Show existing tokens in tokens.json with scopes and expiry

Options:

  • --help: Show help page

command-gif

ica-context-switcher

Autocompletion: ✅

Update the ICA_ACCESS_TOKEN env var in your current terminal with that of a stored token under ~/.ica-ica-lazy/tokens/tokens.json.

You MUST have first added the token to the secret file with ica-add-access-token script.

Options:

  • --project-name: The name of your project
  • --scope: Do you want to enter this context with 'admin' or 'read-only' privileges

Requirements

  • curl
  • jq

command-gif

Extra Info

Using ica-context-switcher in a script:

ica-context-switcher is a function, NOT a script. That's how it's able to update your environment variable.
Whilst we can export a function in bash, there is no such concept for ZSH. This has some repercussions.

Next steps

Head to the Data Traversal page to start navigating the gds file system with gds-ls, gds-find and gds-view

Clone this wiki locally