Class EquinixClient

java.lang.Object
com.eqixiac.equinix.EquinixClient
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
CustomerPortal, Fabric, IAM, IBXSmartView, InternetAccess, NetworkEdge, Projects, STS

public class EquinixClient extends Object implements Closeable
The base class for all Equinix SDK domain entry points.

This class provides common functionality shared by all domain clients including OAuth2 authentication, HTTP client management, and resource lifecycle. Domain-specific entry points (Fabric, NetworkEdge, CustomerPortal, etc.) extend this class and add their own resource accessors.

Authentication is handled automatically on the first API call, using OAuth2 client credentials or, for the BearerTokenProvider constructors, a token the caller supplies (for example an STS-issued access-policy token, which IAM project-scoped endpoints require). The client can also be explicitly authenticated using authenticate(). An HTTP 401 on an authenticated call discards the token, obtains a new one once and replays the call once.

Hook for domain entry points: a domain class offers bearer-token construction by delegating to EquinixClient(BearerTokenProvider) or EquinixClient(BearerTokenProvider, EquinixConfig), for example public IAM(BearerTokenProvider p) { super(p); appendApiParams(); }.

Implements Closeable to properly release HTTP connections when the client is no longer needed.

Usage

// Domain clients extend EquinixClient
Fabric fabric = new Fabric(credentials);

// Optional: explicitly authenticate before making calls
fabric.authenticate();

// Use try-with-resources for proper cleanup
try (Fabric fabric = new Fabric(credentials)) {
    List<Port> ports = fabric.ports().list();
}
Author:
ianjones
See Also:
  • Field Details

    • equinixClient

      protected final EquinixClient equinixClient
    • autoLoadMetros

      protected final boolean autoLoadMetros
      Whether an explicit authenticate() should eagerly load the metro catalog. Set from EquinixConfig.isAutoLoadMetros(); false for a shared-core domain client, whose owning Equinix session drives metro auto-loading instead. Only acted on by domains with a metro catalog (Fabric).
    • peeringDbApiKey

      protected final String peeringDbApiKey
      The PeeringDB API key configured via EquinixConfig.getPeeringDbApiKey(), or null when none was configured. Consumed by the Peering Intelligence entry points (Fabric.peeringIntelligence(), Design.peeringIntelligence()); unused by other domains.
    • enrichMetroRegistry

      protected final boolean enrichMetroRegistry
      Whether the metro registry should be enriched with per-IBX detail from EIA. Set from EquinixConfig.isEnrichMetroRegistry(); only acted on by domains with a metro catalog (Fabric).
  • Constructor Details

    • EquinixClient

      public EquinixClient(EquinixCredentials equinixCredentials)
      Creates a new Equinix client using the provided credentials. Authentication occurs automatically on the first API call.
      Parameters:
      equinixCredentials - the OAuth2 credentials for authenticating with Equinix APIs
    • EquinixClient

      public EquinixClient(EquinixCredentials equinixCredentials, boolean isSandBoxed)
      Creates a new Equinix client with optional sandbox mode.
      Parameters:
      equinixCredentials - the OAuth2 credentials for authenticating with Equinix APIs
      isSandBoxed - true to use the sandbox environment for testing; false for production
    • EquinixClient

      public EquinixClient(EquinixCredentials equinixCredentials, EquinixConfig config)
      Creates a new Equinix client with explicit EquinixConfig options.
      Parameters:
      equinixCredentials - the OAuth2 credentials for authenticating with Equinix APIs
      config - the construction-time options
    • EquinixClient

      public EquinixClient(EquinixCredentialsProvider credentialsProvider)
      Creates a new Equinix client that resolves its credentials through the given provider. Authentication occurs automatically on the first API call, consulting the provider each time (including re-auth on expiry) so credentials can be rotated at runtime.
      Parameters:
      credentialsProvider - supplies the OAuth2 credentials for authenticating with Equinix APIs
    • EquinixClient

      public EquinixClient(EquinixCredentialsProvider credentialsProvider, boolean isSandBoxed)
      Creates a new Equinix client over a custom credentials provider, with optional sandbox mode.
      Parameters:
      credentialsProvider - supplies the OAuth2 credentials for authenticating with Equinix APIs
      isSandBoxed - true to use the sandbox environment for testing; false for production
    • EquinixClient

      public EquinixClient(EquinixCredentialsProvider credentialsProvider, EquinixConfig config)
      Canonical constructor: creates a new Equinix client over a credentials provider with explicit EquinixConfig options. All other public constructors funnel through this one.
      Parameters:
      credentialsProvider - supplies the OAuth2 credentials for authenticating with Equinix APIs
      config - the construction-time options
    • EquinixClient

      public EquinixClient(BearerTokenProvider bearerTokenProvider)
      Creates a new Equinix client that signs every request with tokens from the given provider instead of OAuth2 client credentials (see BearerTokenProvider).
      Parameters:
      bearerTokenProvider - supplies the bearer tokens
    • EquinixClient

      public EquinixClient(BearerTokenProvider bearerTokenProvider, EquinixConfig config)
      Creates a new Equinix client over a bearer-token provider with explicit EquinixConfig options.
      Parameters:
      bearerTokenProvider - supplies the bearer tokens
      config - the construction-time options
  • Method Details

    • authenticate

      public void authenticate() throws EquinixClientException
      Explicitly obtains a token from the configured source (an OAuth2 client-credentials mint, or the BearerTokenProvider) and stores it for subsequent API calls. This is optional - authentication occurs automatically on the first API call if not called explicitly.
      Throws:
      EquinixClientException - if authentication fails due to invalid credentials or network errors
    • core

      protected Core core()
      Returns the internal core client for authentication and platform-level operations. This is used internally by domain clients and is not typically called directly.
      Returns:
      the Core client for core platform operations
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException