Class EquinixClient
- All Implemented Interfaces:
Closeable, AutoCloseable
- Direct Known Subclasses:
CustomerPortal, Fabric, IAM, IBXSmartView, InternetAccess, NetworkEdge, Projects, STS
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(); }.
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanWhether an explicitauthenticate()should eagerly load the metro catalog.protected final booleanWhether the metro registry should be enriched with per-IBX detail from EIA.protected final EquinixClientprotected final StringThe PeeringDB API key configured viaEquinixConfig.getPeeringDbApiKey(), ornullwhen none was configured. -
Constructor Summary
ConstructorsConstructorDescriptionEquinixClient(BearerTokenProvider bearerTokenProvider) Creates a new Equinix client that signs every request with tokens from the given provider instead of OAuth2 client credentials (seeBearerTokenProvider).EquinixClient(BearerTokenProvider bearerTokenProvider, EquinixConfig config) Creates a new Equinix client over a bearer-token provider with explicitEquinixConfigoptions.EquinixClient(EquinixCredentials equinixCredentials) Creates a new Equinix client using the provided credentials.EquinixClient(EquinixCredentials equinixCredentials, boolean isSandBoxed) Creates a new Equinix client with optional sandbox mode.EquinixClient(EquinixCredentialsProvider credentialsProvider) Creates a new Equinix client that resolves its credentials through the given provider.EquinixClient(EquinixCredentialsProvider credentialsProvider, boolean isSandBoxed) Creates a new Equinix client over a custom credentials provider, with optional sandbox mode.EquinixClient(EquinixCredentialsProvider credentialsProvider, EquinixConfig config) Canonical constructor: creates a new Equinix client over a credentials provider with explicitEquinixConfigoptions.EquinixClient(EquinixCredentials equinixCredentials, EquinixConfig config) Creates a new Equinix client with explicitEquinixConfigoptions. -
Method Summary
Modifier and TypeMethodDescriptionvoidExplicitly obtains a token from the configured source (an OAuth2 client-credentials mint, or theBearerTokenProvider) and stores it for subsequent API calls.voidclose()protected Corecore()Returns the internal core client for authentication and platform-level operations.
-
Field Details
-
equinixClient
-
autoLoadMetros
protected final boolean autoLoadMetrosWhether an explicitauthenticate()should eagerly load the metro catalog. Set fromEquinixConfig.isAutoLoadMetros();falsefor a shared-core domain client, whose owningEquinixsession drives metro auto-loading instead. Only acted on by domains with a metro catalog (Fabric). -
peeringDbApiKey
The PeeringDB API key configured viaEquinixConfig.getPeeringDbApiKey(), ornullwhen none was configured. Consumed by the Peering Intelligence entry points (Fabric.peeringIntelligence(),Design.peeringIntelligence()); unused by other domains. -
enrichMetroRegistry
protected final boolean enrichMetroRegistryWhether the metro registry should be enriched with per-IBX detail from EIA. Set fromEquinixConfig.isEnrichMetroRegistry(); only acted on by domains with a metro catalog (Fabric).
-
-
Constructor Details
-
EquinixClient
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
Creates a new Equinix client with optional sandbox mode.- Parameters:
equinixCredentials- the OAuth2 credentials for authenticating with Equinix APIsisSandBoxed-trueto use the sandbox environment for testing;falsefor production
-
EquinixClient
Creates a new Equinix client with explicitEquinixConfigoptions.- Parameters:
equinixCredentials- the OAuth2 credentials for authenticating with Equinix APIsconfig- the construction-time options
-
EquinixClient
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
Creates a new Equinix client over a custom credentials provider, with optional sandbox mode.- Parameters:
credentialsProvider- supplies the OAuth2 credentials for authenticating with Equinix APIsisSandBoxed-trueto use the sandbox environment for testing;falsefor production
-
EquinixClient
Canonical constructor: creates a new Equinix client over a credentials provider with explicitEquinixConfigoptions. All other public constructors funnel through this one.- Parameters:
credentialsProvider- supplies the OAuth2 credentials for authenticating with Equinix APIsconfig- the construction-time options
-
EquinixClient
Creates a new Equinix client that signs every request with tokens from the given provider instead of OAuth2 client credentials (seeBearerTokenProvider).- Parameters:
bearerTokenProvider- supplies the bearer tokens
-
EquinixClient
Creates a new Equinix client over a bearer-token provider with explicitEquinixConfigoptions.- Parameters:
bearerTokenProvider- supplies the bearer tokensconfig- the construction-time options
-
-
Method Details
-
authenticate
Explicitly obtains a token from the configured source (an OAuth2 client-credentials mint, or theBearerTokenProvider) 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
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-