Skip to content

An SDK for interacting with the Vantage API, works with various Vantage API endpoints, provides type safety via codegen Pydantic classes and manages pagination

License

Notifications You must be signed in to change notification settings

block/client-for-vantage

Client for Vantage

Python 3.10 Python 3.11 Python 3.12

This SDK is a Python client built around the Vantage API, providing a streamlined interface to work with numerous API endpoints. It leverages asynchronous programming and concurrency to efficiently handle data retrieval across multiple pages, significantly reducing wait times through parallel request processing. It also provides comprehensive type support through Pydantic 2.0 BaseModels, which were generated by parsing the API's OpenAPI spec. This ensures type safety and provides excellent IDE autocompletion while maintaining strict validation of request and response data - no need to constantly refer to the API documentation.

Usage

Install the library

uv add client-for-vantage

Inititate the SDK

from vantage_sdk import VantageSDK
from vantage_sdk.models import CreateCostReport

vantage = VantageSDK(vantage_api_key)

cost_report = CreateCostReport(
    title="Test Cost Report",
    workspace_token="workspace_abcdef123456",
    groupings="provider,service,region",
    filter="costs.provider = 'aws'",
    saved_filter_tokens=["sf_1", "sf_2"],
    business_metric_tokens_with_metadata=[business_metric_1, business_metric_2],
    folder_token="folder_abcdef123456",
    settings=settings,
    previous_period_start_date="2024-01-01",
    previous_period_end_date="2024-01-31",
    start_date="2024-02-01",
    end_date="2024-02-28",
    date_interval=DateInterval.this_month,
    chart_type=ChartType.line,
    date_bin=DateBin.cumulative
)

response = vantage.create_cost_report(cost_report)

Supported Endpoints

This SDK supports all endpoints from the Vantage API. While comprehensive test coverage exists for most endpoints, some endpoints have limited test coverage due to various constraints.

Endpoints with Testing Limitations

The following endpoints are available but should be used with caution as they have limited automated test coverage:

  • Anomaly Alerts: API access is limited as these can only be created via the UI
  • Billing Rules: Requires special enterprise permissions
  • Managed Accounts: Requires special enterprise permissions
  • Resources: Performance issues with bulk operations
  • Tags: Limited test coverage
  • Unit Costs: Requires actual cost data for exports
  • User Feedback: Limited testing to avoid creating test data in production
  • Workspaces: Limited testing to avoid affecting production workspaces

Contributing

See CONTRIBUTORS.md for development setup, testing guidelines, and instructions for regenerating models.

About

An SDK for interacting with the Vantage API, works with various Vantage API endpoints, provides type safety via codegen Pydantic classes and manages pagination

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published