Class SavingsCalculator.Builder
java.lang.Object
com.eqixiac.equinix.design.value.savings.SavingsCalculator.Builder
- Enclosing class:
SavingsCalculator
Fluent configuration for a savings estimate, terminated by
calculate().
Setters validate eagerly (fail-fast IllegalArgumentExceptions), so a
mistake surfaces at the call site rather than as a wrong number later.
Defaults: 1000 Mbps bandwidth, EVPL_VC connection type,
Term.MONTH_12, egress volume 0 GB, no Cloud Router, and the standard
layered rate-card chain (live Equinix pricing, then bundled reference figures).
Cloud-to-cloud defaults: no peer cloud, path tier 1, AWS free tier not applied, reverse
volume equal to the forward volume.
Constraints that span two levers are checked at calculate(), because levers
may be set in any order: toRegion, pathTier, reverseEgress and
useAwsFreeTier(true) each require toCloud; toCloud requires
fromCloud and must differ from it; useAwsFreeTier(true) requires AWS as
one of the two clouds. Each violation is an IllegalArgumentException naming the
lever.
-
Method Summary
Modifier and TypeMethodDescriptionbandwidthMbps(int bandwidthMbps) Sets the interconnect bandwidth in Mbps (default 1000), which drives the Fabric connection price the egress saving is netted against.Runs the calculation.connectionType(ConnectionType connectionType) Sets the Fabric connection type priced for the interconnect (defaultEVPL_VC).Sets the currency every figure is compared in (default USD).currencyConverter(CurrencyConverter converter) Supplies a converter (for example a live FX feed) ranked below pinned rates and above the defaults.defaultRates(CurrencyConverter defaults) Replaces the default rate sources (live ECB rates, then the bundled table), for example withCurrencyConverters.bundledOnly()for an offline run.Sets the monthly cloud data-egress volume the estimate is built around (default 0).egressGigabytes(double gigabytes) Shorthand foregress(gigabytes, DataUnit.GIGABYTE).egressTerabytes(double terabytes) Shorthand foregress(terabytes, DataUnit.TERABYTE)(1 TB = 1000 GB).Pins exchange rates tocurrency(String); they take precedence over every other source.fromCloud(CloudProviderType provider) Sets the cloud provider the egress leaves - the provider whose internet and private egress rates are compared.includeCloudRouter(String packageCode) Adds a Fabric Cloud Router of the given package to the interconnect cost (none is included by default).Sets the provider region the egress originates in, in the provider's own region notation (e.g.pathTier(int pathTier) Sets the AWS connectivity-scope tier of the native link: 1 local (default), 2 regional, 3 continental, 4 long-haul, 5 maximum scope.Sets the rate card that prices both egress and Equinix interconnect resources.reverseEgress(double amount, DataUnit unit) Sets the monthly volume flowing from the peer cloud back tofromCloud.Sets the commitment term used for the term-aware rate lookups (defaultTerm.MONTH_12).toCloud(CloudProviderType provider) Declares the peer cloud.Sets the peer cloud's region in its own notation (e.g.useAwsFreeTier(boolean useAwsFreeTier) Opts in to the AWS free tier for the native link (one free tier-1 500 Mbps interconnect per AWS Region per generally-available provider).Sets the Equinix metro the interconnect lands in, used for metro-sensitive rate lookups.
-
Method Details
-
egress
Sets the monthly cloud data-egress volume the estimate is built around (default 0).- Parameters:
amount- the volume inunits per monthunit- the unit the amount is expressed in (decimal/SI conversions)- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if the amount is negative or not finite, or the unit is null
-
egressGigabytes
Shorthand foregress(gigabytes, DataUnit.GIGABYTE). -
egressTerabytes
Shorthand foregress(terabytes, DataUnit.TERABYTE)(1 TB = 1000 GB). -
fromCloud
Sets the cloud provider the egress leaves - the provider whose internet and private egress rates are compared.- Parameters:
provider- the cloud provider- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if the provider is null, or equals atoCloud(...)already set
-
toCloud
Declares the peer cloud. The estimate then carries aMulticloudPathComparison(internet, Equinix and native paths, both directions) and a break-even sustained rate. Beta.- Parameters:
provider- the cloud at the other end; must differ fromfromCloud(...)- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if the provider is null, or equals afromCloud(...)already set (the same check runs again atcalculate())
-
toRegion
Sets the peer cloud's region in its own notation (e.g."us-east4"). Optional. The bundled reference data uses it to select Google's transport location; with no region it prices a Google Cloud side at the North America location and says so.- Parameters:
region- the peer region identifier (may be null)- Returns:
- this builder for method chaining
-
pathTier
Sets the AWS connectivity-scope tier of the native link: 1 local (default), 2 regional, 3 continental, 4 long-haul, 5 maximum scope. An input, never derived: AWS publishes no path-to-tier table. Providers without a tier concept ignore it.- Parameters:
pathTier- the tier, 1-5- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if outside 1-5
-
useAwsFreeTier
Opts in to the AWS free tier for the native link (one free tier-1 500 Mbps interconnect per AWS Region per generally-available provider). Off by default and never inferred. When set but the request is ineligible, the listed rate applies and the comparison's notes say why.- Parameters:
useAwsFreeTier-trueto apply the free tier where eligible- Returns:
- this builder for method chaining
-
reverseEgress
Sets the monthly volume flowing from the peer cloud back tofromCloud. When not set, the cloud-to-cloud comparison assumes it equals the forward volume and says so in its notes.- Parameters:
amount- the volume inunits per monthunit- the unit the amount is expressed in (decimal/SI conversions)- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if the amount is negative or not finite, or the unit is null
-
inRegion
Sets the provider region the egress originates in, in the provider's own region notation (e.g."us-east-1","westeurope"). Optional: region-agnostic rate cards ignore it, but the provider-API adapters need it.- Parameters:
region- the provider region identifier (may be null for provider-wide rates)- Returns:
- this builder for method chaining
-
viaMetro
Sets the Equinix metro the interconnect lands in, used for metro-sensitive rate lookups. Omit the call entirely for a metro-agnostic estimate.- Parameters:
metro- the Equinix metro- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if the metro is null (omit the call instead)
-
bandwidthMbps
Sets the interconnect bandwidth in Mbps (default 1000), which drives the Fabric connection price the egress saving is netted against.- Parameters:
bandwidthMbps- the bandwidth in Mbps- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if not positive
-
connectionType
Sets the Fabric connection type priced for the interconnect (defaultEVPL_VC).- Parameters:
connectionType- the connection type- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if null
-
includeCloudRouter
Adds a Fabric Cloud Router of the given package to the interconnect cost (none is included by default). If the rate card cannot price the package - or prices it in a different currency from the connection - the interconnect figures stay partial (connection only),isEquinixPriced()flips false, and the estimate's disclaimer names the excluded router; the router is never silently dropped from an estimate reported as complete.- Parameters:
packageCode- the router package code (e.g."STANDARD")- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if the package code is null or blank
-
term
Sets the commitment term used for the term-aware rate lookups (defaultTerm.MONTH_12).- Parameters:
term- the commitment term- Returns:
- this builder for method chaining
- Throws:
IllegalArgumentException- if null
-
currency
Sets the currency every figure is compared in (default USD). Figures quoted in another currency are converted: rates pinned withexchangeRates, thencurrencyConverter, then live ECB reference rates (one call), then the SDK's bundled table. Only a currency no source covers is unpriced.- Parameters:
currency- ISO 4217 code- Returns:
- this builder for method chaining
-
exchangeRates
Pins exchange rates tocurrency(String); they take precedence over every other source.- Parameters:
rates- the rates, ornullfor none- Returns:
- this builder for method chaining
-
currencyConverter
Supplies a converter (for example a live FX feed) ranked below pinned rates and above the defaults.- Parameters:
converter- the converter, ornullfor none- Returns:
- this builder for method chaining
-
defaultRates
Replaces the default rate sources (live ECB rates, then the bundled table), for example withCurrencyConverters.bundledOnly()for an offline run.- Parameters:
defaults- the fallback converter, ornullfor the defaults- Returns:
- this builder for method chaining
-
rateCard
Sets the rate card that prices both egress and Equinix interconnect resources. When omitted, the standard layered chain (RateCard.standardChain(fabric)) applies: live Equinix Fabric pricing first, then the bundledReferenceRateCard, which also supplies indicative cloud-egress rates - so egress savings are computed out of the box with no card supplied. A supplied card replaces that chain entirely (it is not layered over the defaults); to keep the defaults as a fallback behind your own figures, passRateCard.layered(customCard, RateCard.standardChain(fabric)).- Parameters:
rateCard- the rate card to price with, ornullto use the standard chain- Returns:
- this builder for method chaining
-
calculate
Runs the calculation.- Returns:
- the savings estimate
- Throws:
IllegalArgumentException- if levers conflict:toRegion,pathTier,reverseEgressoruseAwsFreeTier(true)withouttoCloud;toCloudwithout, or equal to,fromCloud; oruseAwsFreeTier(true)when neither cloud is AWS
-