Skip to main content

AnsClient

Struct AnsClient 

Source
pub struct AnsClient { /* private fields */ }
Expand description

ANS Registry API client.

Provides methods for agent registration, certificate management, and agent discovery operations.

Implementations§

Source§

impl AnsClient

Source

pub fn builder() -> AnsClientBuilder

Create a new builder for constructing a client.

Source

pub fn new() -> Result<Self>

Create a client with default settings.

Uses https://api.godaddy.com as the base URL with no authentication.

Source

pub async fn register_agent( &self, request: &AgentRegistrationRequest, ) -> Result<RegistrationPending>

Register a new agent.

Returns the pending registration details including required next steps for completing registration (DNS configuration, domain validation, etc.).

§Errors
Source

pub async fn get_agent(&self, agent_id: &str) -> Result<AgentDetails>

Get agent details by ID.

§Errors
Source

pub async fn search_agents( &self, criteria: &SearchCriteria, limit: Option<u32>, offset: Option<u32>, ) -> Result<AgentSearchResponse>

Search for agents.

§Arguments
  • criteria - Search criteria (display name, host, version, protocol)
  • limit - Maximum results to return (1-100, default 20)
  • offset - Number of results to skip for pagination
Source

pub async fn resolve_agent( &self, agent_host: &str, version: &str, ) -> Result<AgentResolutionResponse>

Resolve an ANS name to agent details.

§Arguments
  • agent_host - The agent’s host domain
  • version - Version pattern (“*” for any, or semver range like “^1.0.0”)
Source

pub async fn verify_acme(&self, agent_id: &str) -> Result<AgentStatus>

Trigger ACME domain validation.

Call this after configuring the ACME challenge (DNS or HTTP).

§Errors
Source

pub async fn verify_dns(&self, agent_id: &str) -> Result<AgentStatus>

Verify DNS records are configured correctly.

Call this after configuring all required DNS records.

§Errors
Source

pub async fn get_server_certificates( &self, agent_id: &str, ) -> Result<Vec<CertificateResponse>>

Get server certificates for an agent.

Source

pub async fn get_identity_certificates( &self, agent_id: &str, ) -> Result<Vec<CertificateResponse>>

Get identity certificates for an agent.

Source

pub async fn submit_server_csr( &self, agent_id: &str, csr_pem: &str, ) -> Result<CsrSubmissionResponse>

Submit a server certificate CSR.

Source

pub async fn submit_identity_csr( &self, agent_id: &str, csr_pem: &str, ) -> Result<CsrSubmissionResponse>

Submit an identity certificate CSR.

Source

pub async fn get_csr_status( &self, agent_id: &str, csr_id: &str, ) -> Result<CsrStatusResponse>

Get CSR status.

Source

pub async fn revoke_agent( &self, agent_id: &str, reason: RevocationReason, comments: Option<&str>, ) -> Result<AgentRevocationResponse>

Revoke an agent.

This permanently revokes the agent’s certificates and marks the registration as revoked.

§Errors
Source

pub async fn get_events( &self, limit: Option<u32>, provider_id: Option<&str>, last_log_id: Option<&str>, ) -> Result<EventPageResponse>

Get paginated agent events.

This endpoint is used by Agent Host Providers (AHPs) to track agent registration events across the system.

§Arguments
  • limit - Maximum events to return (1-100)
  • provider_id - Filter by provider ID (optional)
  • last_log_id - Continuation token from previous response (for pagination)
§Example
use ans_client::AnsClient;

let client = AnsClient::builder()
    .base_url("https://api.godaddy.com")
    .api_key("key", "secret")
    .build()?;

// Get first page
let page1 = client.get_events(Some(50), None, None).await?;
for event in &page1.items {
    println!("{}: {} - {}", event.event_type, event.ans_name, event.agent_host);
}

// Get next page if available
if let Some(last_id) = page1.last_log_id {
    let page2 = client.get_events(Some(50), None, Some(&last_id)).await?;
}

Trait Implementations§

Source§

impl Clone for AnsClient

Source§

fn clone(&self) -> AnsClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AnsClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more