ans-client
HTTP client for the ANS (Agent Name Service) Registry API.
Overview
This crate provides AnsClient for agent registration, certificate management, and discovery operations against the ANS Registration Authority API.
Quick Start
use ;
async
Authentication
Two authentication methods are supported:
// JWT for internal endpoints (ra.int.{env}.godaddy.com)
let client = builder
.jwt
.build?;
// API key for public gateway (api.{env}.godaddy.com)
let client = builder
.api_key
.build?;
API Operations
Registration
let endpoint = new
.with_transports;
let request = new
.with_description
.with_server_csr_pem;
let response = client.register_agent.await?;
Discovery
// Get agent by ID
let agent = client.get_agent.await?;
// Search agents
let mut criteria = default;
criteria.agent_host = Some;
let results = client.search_agents.await?;
// Resolve by host and version
let agent = client.resolve_agent.await?;
Certificates
let certs = client.get_server_certificates.await?;
let identity_certs = client.get_identity_certificates.await?;
Revocation
use RevocationReason;
client.revoke_agent.await?;
Events
let events = client.get_events.await?;
Builder Options
use Duration;
let client = builder
.base_url
.jwt
.timeout
.header // custom headers
.build?;
Error Handling
All methods return Result<T, ClientError>. HTTP errors are mapped to typed variants:
| Status | Error Variant |
|---|---|
| 400 | ClientError::InvalidRequest |
| 401 | ClientError::Unauthorized |
| 403 | ClientError::Forbidden |
| 404 | ClientError::NotFound |
| 409 | ClientError::Conflict |
| 422 | ClientError::UnprocessableEntity |
| 429 | ClientError::RateLimited |
| 5xx | ClientError::ServerError |
License
MIT