Quickstart

This guide will help you get started with the Amorphic SDK quickly using the enhanced wrapper classes.

Installation

Install the Amorphic SDK using pip:

pip install amorphic-sdk wheel file

Basic Usage

The Amorphic SDK provides wrapper classes that simplify authentication and provide enhanced functionality. Here’s how to get started:

import os
import certifi
from openapi_client.amorphic_api_client import AmorphicApiClient
from openapi_client.api.datasets_api import DatasetsApi

# Set up environment variables
os.environ['API_GW_URL'] = 'https://your-amorphic-instance.com/api'
os.environ['ROLE_ID'] = 'your-role-id'
os.environ['PAT_TOKEN'] = 'your-personal-access-token'

# Create authenticated client using wrapper class
client = AmorphicApiClient.create_with_auth(
    host=os.getenv('API_GW_URL'),
    role_id=os.getenv('ROLE_ID'),
    ssl_ca_cert=certifi.where(),
    debug=False,
    aws_profile=None,
    env_var='PAT_TOKEN'
)

# Create the datasets API instance
datasets_api = DatasetsApi(client)

# Example: List datasets
try:
    datasets = datasets_api.search_datasets(role_id=os.getenv('ROLE_ID'))
    print(f"Found {len(datasets)} datasets")
except Exception as e:
    print(f"Error: {e}")

Authentication Options

The wrapper class supports multiple authentication methods. Here are the most common ones:

Environment Variable (Recommended for local development):

client = AmorphicApiClient.create_with_auth(
    host="https://your-instance.amorphic.com/api",
    role_id="your-role-id",
    ssl_ca_cert=certifi.where(),
    debug=False,
    aws_profile=None,
    env_var='PAT_TOKEN'
)

AWS SSM Parameter Store:

client = AmorphicApiClient.create_with_auth(
    host="https://your-instance.amorphic.com/api",
    role_id="your-role-id",
    ssl_ca_cert=certifi.where(),
    debug=False,
    aws_profile='myprofile',
    ssm_parameter='/myapp/api/token'
)

For additional authentication methods and configuration options, refer to the AmorphicApiClient documentation.

Discovery and Help

Use the built-in help system to explore available APIs:

from openapi_client.help import HelpCommand

# Create help instance
help_cmd = HelpCommand()

# List all available APIs
help_cmd.list_apis()

# Get details about a specific API
help_cmd.show_api_details('DatasetsApi')

# Describe a specific method
help_cmd.describe_api_method('DatasetsApi', 'create_dataset')

For detailed information about the help system and its capabilities, refer to the HelpCommand documentation.

Benefits of Using Wrapper Classes

  • Simplified Authentication: Automatic token management from multiple sources

  • Discovery Tools: Built-in help system to explore APIs and methods

Next Steps