Class Equinix

java.lang.Object
com.eqixiac.equinix.Equinix
All Implemented Interfaces:
Closeable, AutoCloseable

public final class Equinix extends Object implements Closeable
A single Equinix session that owns one authenticated core client - a single OAuth token and a single HTTP connection pool - and vends every domain client over it. Use this when an application talks to more than one domain so they share the token and pool instead of each new Fabric(creds) / new NetworkEdge(creds) standing up its own (which would authenticate and pool independently).
try (Equinix eq = new Equinix(credentials)) {
    Fabric fabric       = eq.fabric();        // shares the session's token + pool
    NetworkEdge edge    = eq.networkEdge();    // ditto
    Design design       = eq.design();         // value-add engines over the shared Fabric
    // ... one token fetched, one pool, closed once when the session closes
}

Domain clients are created lazily and cached, so repeated accessor calls return the same instance. The session owns the shared core client; closing the session closes it. The individual domain clients obtained from a session do not close the shared core when their own close() is called.

The standalone new Fabric(credentials) (etc.) constructors remain for the common single-domain case; this session is purely additive.

  • Constructor Details

    • Equinix

      public Equinix(EquinixCredentials credentials)
      Opens a session against the production environment.
      Parameters:
      credentials - the OAuth2 credentials shared by every client in this session
    • Equinix

      public Equinix(EquinixCredentials credentials, boolean isSandBoxed)
      Opens a session, optionally against the sandbox environment.
      Parameters:
      credentials - the OAuth2 credentials shared by every client in this session
      isSandBoxed - true to use the sandbox environment; false for production
    • Equinix

      public Equinix(EquinixCredentials credentials, EquinixConfig config)
      Opens a session with explicit EquinixConfig options (sandbox, retry, metro auto-loading).
      Parameters:
      credentials - the OAuth2 credentials shared by every client in this session
      config - the construction-time options
    • Equinix

      public Equinix(EquinixCredentialsProvider credentialsProvider)
      Opens a session whose credentials are resolved through the given provider - consulted on each authentication, so the whole session (every domain client over the shared core) can rotate credentials at runtime.
      Parameters:
      credentialsProvider - supplies the OAuth2 credentials shared by every client in this session
    • Equinix

      public Equinix(EquinixCredentialsProvider credentialsProvider, boolean isSandBoxed)
      Opens a session over a custom credentials provider, optionally against the sandbox environment.
      Parameters:
      credentialsProvider - supplies the OAuth2 credentials shared by every client in this session
      isSandBoxed - true to use the sandbox environment; false for production
    • Equinix

      public Equinix(EquinixCredentialsProvider credentialsProvider, EquinixConfig config)
      Opens a session over a custom credentials provider with explicit EquinixConfig options. When EquinixConfig.isAutoLoadMetros() is set (the default), authenticate() eagerly loads the shared metro catalogue.
      Parameters:
      credentialsProvider - supplies the OAuth2 credentials shared by every client in this session
      config - the construction-time options
    • Equinix

      public Equinix(BearerTokenProvider bearerTokenProvider)
      Opens a session whose every domain client signs requests with tokens from the given provider instead of OAuth2 client credentials, for example an STS-issued access-policy token (which IAM project-scoped endpoints require).
      Parameters:
      bearerTokenProvider - supplies the bearer tokens shared by every client in this session
    • Equinix

      public Equinix(BearerTokenProvider bearerTokenProvider, EquinixConfig config)
      Opens a bearer-token session with explicit EquinixConfig options.
      Parameters:
      bearerTokenProvider - supplies the bearer tokens shared by every client in this session
      config - the construction-time options
  • Method Details

    • fabric

      public Fabric fabric()
    • networkEdge

      public NetworkEdge networkEdge()
    • customerPortal

      public CustomerPortal customerPortal()
    • ibxSmartView

      public IBXSmartView ibxSmartView()
    • internetAccess

      public InternetAccess internetAccess()
    • projects

      public Projects projects()
    • iam

      public IAM iam()
    • sts

      public STS sts()
    • design

      public Design design()
      Returns:
      the value-add design facade (Metro Optimizer, Deployment Wizard, Peering Intelligence, Savings, TCO) over this session's shared Fabric client
    • metroRegistry

      public MetroRegistry metroRegistry()
      The live metro catalogue - every metro with its IBXs, coordinates, region, and inter-metro latencies - keyed by MetroId. Sourced from the Fabric Metros API (the only catalogue with that depth) but surfaced here as a session-level, cross-domain concern; it shares this session's single Fabric cache. Loaded eagerly on authenticate() when EquinixConfig.isAutoLoadMetros() is set (the default), otherwise lazily on first access.
      Returns:
      the shared metro registry
    • reloadMetroRegistry

      public MetroRegistry reloadMetroRegistry()
      Rebuilds the metroRegistry() from a fresh Metros API call, picking up any metros added since it was last loaded.
      Returns:
      the refreshed metro registry
    • authenticate

      public Equinix authenticate() throws EquinixClientException
      Explicitly performs OAuth2 authentication, warming the session's shared token. Optional - authentication otherwise happens automatically on the first API call. When EquinixConfig.isAutoLoadMetros() is enabled (the default), this also eagerly loads the shared metro catalogue (fabric().metroRegistry()); the load is best-effort and does not fail authentication.
      Returns:
      this session, for chaining
      Throws:
      EquinixClientException - if authentication fails
    • close

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