Class Equinix
java.lang.Object
com.eqixiac.equinix.Equinix
- All Implemented Interfaces:
Closeable, AutoCloseable
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 Summary
ConstructorsConstructorDescriptionEquinix(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).Equinix(BearerTokenProvider bearerTokenProvider, EquinixConfig config) Opens a bearer-token session with explicitEquinixConfigoptions.Equinix(EquinixCredentials credentials) Opens a session against the production environment.Equinix(EquinixCredentials credentials, boolean isSandBoxed) Opens a session, optionally against the sandbox environment.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.Equinix(EquinixCredentialsProvider credentialsProvider, boolean isSandBoxed) Opens a session over a custom credentials provider, optionally against the sandbox environment.Equinix(EquinixCredentialsProvider credentialsProvider, EquinixConfig config) Opens a session over a custom credentials provider with explicitEquinixConfigoptions.Equinix(EquinixCredentials credentials, EquinixConfig config) Opens a session with explicitEquinixConfigoptions (sandbox, retry, metro auto-loading). -
Method Summary
Modifier and TypeMethodDescriptionExplicitly performs OAuth2 authentication, warming the session's shared token.voidclose()design()fabric()iam()The live metro catalogue - every metro with its IBXs, coordinates, region, and inter-metro latencies - keyed byMetroId.projects()Rebuilds themetroRegistry()from a fresh Metros API call, picking up any metros added since it was last loaded.sts()
-
Constructor Details
-
Equinix
Opens a session against the production environment.- Parameters:
credentials- the OAuth2 credentials shared by every client in this session
-
Equinix
Opens a session, optionally against the sandbox environment.- Parameters:
credentials- the OAuth2 credentials shared by every client in this sessionisSandBoxed-trueto use the sandbox environment;falsefor production
-
Equinix
Opens a session with explicitEquinixConfigoptions (sandbox, retry, metro auto-loading).- Parameters:
credentials- the OAuth2 credentials shared by every client in this sessionconfig- the construction-time options
-
Equinix
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
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 sessionisSandBoxed-trueto use the sandbox environment;falsefor production
-
Equinix
Opens a session over a custom credentials provider with explicitEquinixConfigoptions. WhenEquinixConfig.isAutoLoadMetros()is set (the default),authenticate()eagerly loads the shared metro catalogue.- Parameters:
credentialsProvider- supplies the OAuth2 credentials shared by every client in this sessionconfig- the construction-time options
-
Equinix
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
Opens a bearer-token session with explicitEquinixConfigoptions.- Parameters:
bearerTokenProvider- supplies the bearer tokens shared by every client in this sessionconfig- the construction-time options
-
-
Method Details
-
fabric
-
networkEdge
-
customerPortal
-
ibxSmartView
-
internetAccess
-
projects
-
iam
-
sts
-
design
- Returns:
- the value-add design facade (Metro Optimizer, Deployment Wizard, Peering Intelligence, Savings, TCO) over this session's shared Fabric client
-
metroRegistry
The live metro catalogue - every metro with its IBXs, coordinates, region, and inter-metro latencies - keyed byMetroId. 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 onauthenticate()whenEquinixConfig.isAutoLoadMetros()is set (the default), otherwise lazily on first access.- Returns:
- the shared metro registry
-
reloadMetroRegistry
Rebuilds themetroRegistry()from a fresh Metros API call, picking up any metros added since it was last loaded.- Returns:
- the refreshed metro registry
-
authenticate
Explicitly performs OAuth2 authentication, warming the session's shared token. Optional - authentication otherwise happens automatically on the first API call. WhenEquinixConfig.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
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-