Quickstart Guide
Introduction
The Javelin CLI is a tool for interacting with the Javelin SDK. This guide will help you get started with installing and using the CLI to manage gateways, providers, and routes.
Installation
- Ensure Python is Installed: Python 3.10+ is required.
- Install Javelin SDK:
pip install javelin-sdk
Environment Setup
Before using the CLI, set up the required environment variables:
export JAVELIN_BASE_URL=your_base_url
export JAVELIN_API_KEY=your_api_key
- JAVELIN_BASE_URL: Set this to the base URL of your deployment (defaults to https://api-dev.javelin.live).
- JAVELIN_API_KEY: Please provide a valid Javelin API Key. When you sign into Javelin, you can find your API Key in the Account -> Developer settings.
Commands Overview
CLI Authentication
javelin auth
Gateway Management
-
Create a gateway:
javelin gateway create --name "example_gateway" --type "development" --enabled true --config '{"buid": "example_buid", "base_url": "https://api.example.com", "organization_id": "example_org_id", "system_namespace": "example_namespace"}'
-
List all gateways:
javelin gateway list
-
Get a specific gateway:
javelin gateway get --name "example_gateway"
-
Update a gateway:
javelin gateway update --name "example_gateway" --type "production" --config '{"buid": "new_buid", "base_url": "https://api.newexample.com"}'
-
Delete a gateway:
javelin gateway delete --name "example_gateway"
Provider Management
-
Create a provider:
javelin provider create --name "example_provider" --type "closed" --config '{"api_version": "v1", "deployment_name": "example_deployment", "organization": "example_org"}'
-
List all providers:
javelin provider list
-
Get a specific provider:
javelin provider get --name "example_provider"
-
Update a provider:
javelin provider update --name "example_provider" --config '{"api_base" "https://new-api.provider.com"}'
-
Delete a provider:
javelin provider delete --name "example_provider"
Route Management
-
Create a route:
javelin route create --name "example_route" --type "completion" --enabled true --models '[{"name": "model1", "provider": "provider1", "suffix": "suffix1"}, {"name": "model2", "provider": "provider2", "suffix": "suffix2"}]' --config '{"organization": "example_org", "owner": "owner1", "rate_limit": 1000, "retries": 3, "archive": true, "retention": 30, "budget": {"enabled": true, "weekly": 2500, "currency": "USD"}, "dlp": {"enabled": true, "strategy": "block", "action": "alert"}}'
-
List all routes:
javelin route list
-
Get a specific route:
javelin route get --name "example_route"
-
Update a route:
javelin route update --name "example_route" --config '{"rate_limit": 20, "budget": {"enabled": false}}'
-
Delete a route:
javelin route delete --name "example_route"
Secret Management
-
Create a secret:
javelin secret create --api_key "example_api_key" --api_key_secret_name "example_secret_name" --api_key_secret_key "example_secret_key" --provider_name "example_provider" --query_param_key "example_param_key" --header_key "example_header_key" --group "example_group" --enabled true
-
List all secrets:
javelin secret list
-
Update a secret:
javelin secret update --api_key "example_api_key" --api_key_secret_name "example_secret_name" --api_key_secret_key "new_secret_key" --enabled false
-
Delete a secret:
javelin secret delete --api_key "example_api_key" --provider_name "example_provider"
Template Management
-
Create a template:
javelin template create --name "example_template" --description "A template for testing" --type "inspect" --enabled true --models '[{"name": "Sensitive Data Protection", "provider": "Google Cloud", "suffix": ""}]' --config '{"infoTypes": [{"name": "Personal Identifier", "regex": "\b\d{3}-\d{2}-\d{4}\b"}], "likelihood": "Likely", "notify": true}'
-
List all templates:
javelin template list
-
Get a specific template:
javelin template get --name "example_template"
-
Update a template:
javelin template update --name "example_template" --description "Updated description"
-
Delete a template:
javelin template delete --name "example_template"