Class AzureRetailPricesRateCard

java.lang.Object
com.eqixiac.equinix.design.value.ratecard.provider.AzureRetailPricesRateCard
All Implemented Interfaces:
RateCard

public final class AzureRetailPricesRateCard extends Object implements RateCard
A RateCard that sources cloud-egress rates from the public Azure Retail Prices API (https://prices.azure.com/api/retail/prices). The API is unauthenticated, so this adapter needs no credentials.

It prices only data egress for CloudProviderType.AZURE; connection and cloud-router lookups return Optional.empty() (those are Equinix-side costs). It maps EgressPath.INTERNET to the Bandwidth service (data transfer out to the internet) and EgressPath.PRIVATE to the ExpressRoute service (metered egress over a dedicated interconnect). Every rate it returns is tagged PriceSource.PROVIDER_API.

The adapter is an opt-in, pluggable source: compose it into a precedence chain with RateCard.layered(RateCard...) (e.g. caller-supplied -> Equinix live -> provider APIs -> bundled reference). It is fault-tolerant - a network error, throttling, or an unrecognised response yields no rate rather than an exception, so a layered card falls back to the next source.

RateCard rates = RateCard.layered(
    EquinixRateCard.of(fabric),
    AzureRetailPricesRateCard.create(),
    ReferenceRateCard.standard());

Results are cached per lookup key for the adapter's lifetime, but only authoritative ones: a rate, or a genuinely empty result set from a fully-paginated response. A transport failure (network error, non-200, truncated pagination) is never cached - the next lookup retries, so a transient outage cannot pin "no rate" forever.

  • Field Details

    • DEFAULT_ENDPOINT

      public static final String DEFAULT_ENDPOINT
      The public Azure Retail Prices endpoint; the default for create(). Override via create(String) for a sovereign/government cloud, a proxy, or testing.
      See Also:
  • Method Details

    • create

      public static AzureRetailPricesRateCard create()
      Creates an adapter against the public Azure Retail Prices endpoint (DEFAULT_ENDPOINT). No credentials required.
      Returns:
      a new Azure pricing adapter
    • create

      public static AzureRetailPricesRateCard create(String endpoint)
      Creates an adapter against a custom Retail Prices endpoint - for an Azure sovereign/government cloud, a proxy, or testing.
      Parameters:
      endpoint - the full .../api/retail/prices URL
    • connection

      public Optional<PriceQuote> connection(ConnectionType type, int bandwidthMbps, MetroCode metro, Term term)
      Description copied from interface: RateCard
      Resolves the price of a single Fabric connection / virtual connection.

      Implementation contract. The matching strategy is implementation-specific, and a card whose data lacks an axis (metro, term, type) still returns its best figure - or empty - rather than failing; callers must not assume every card is sensitive to every parameter. Of the bundled cards: CustomRateCard resolves the most specific declared entry (exact metro+term down to metro/term-agnostic, then a declared default); EquinixRateCard matches bandwidth and type against the live catalogue, honours a requested metro strictly (a wrong-metro row is never returned), and prefers a term-matched row - a different-term row is only ever returned with a note naming the substitution; ReferenceRateCard matches on bandwidth alone (smallest tabulated tier at or above the request, linearly extrapolated with an EXTRAPOLATED note above the top tier) and ignores type, metro, and term entirely.

      Specified by:
      connection in interface RateCard
      Parameters:
      type - the connection type (e.g. EVPL_VC); may be null for any type
      bandwidthMbps - the provisioned bandwidth in Mbps
      metro - the metro the connection originates in (may be null if metro-agnostic)
      term - the commitment term (may be null if term-agnostic)
      Returns:
      the resolved quote, or Optional.empty() if this card cannot price the connection
    • cloudRouter

      public Optional<PriceQuote> cloudRouter(String packageCode, MetroCode metro, Term term)
      Description copied from interface: RateCard
      Resolves the price of a single Fabric Cloud Router instance.

      Implementation contract. As with RateCard.connection(ConnectionType, int, MetroCode, Term), matching is implementation-specific and cards without a metro/term axis return their best figure regardless. Of the bundled cards: CustomRateCard resolves the most specific declared (packageCode, metro, term) entry; EquinixRateCard matches the package code and metro structurally against the row's own descriptor (exact package equality, the row's own metro code) and prefers a term-matched row, labelling any term substitution; ReferenceRateCard ignores metro and term, and substitutes its STANDARD figure for an unlisted package with a note naming the substitution.

      Specified by:
      cloudRouter in interface RateCard
      Parameters:
      packageCode - the router package / tier code (e.g. "STANDARD"); may be null for any
      metro - the metro the router is deployed in (may be null if metro-agnostic)
      term - the commitment term (may be null if term-agnostic)
      Returns:
      the resolved quote, or Optional.empty() if this card cannot price the router
    • egress

      public Optional<EgressRate> egress(CloudProviderType provider, String region, EgressPath path, Term term)
      Description copied from interface: RateCard
      Resolves the per-GB data-egress rate for a cloud provider over a given path.

      Equinix does not sell cloud egress, so EquinixRateCard returns Optional.empty() here (the default); egress rates come from a CustomRateCard (your figures), a ReferenceRateCard (bundled indicative figures), or a provider-pricing-API card. The default returns empty so cards that do not model egress need not override it. Cards whose data has no region or term axis ignore those parameters - the custom and reference cards match on provider + path alone; only the provider-API adapters are region-sensitive.

      Specified by:
      egress in interface RateCard
      Parameters:
      provider - the cloud provider the data is leaving
      region - the provider region (may be null for a provider-wide rate)
      path - internet vs. private interconnect
      term - the commitment term (may be null; ignored by term-agnostic cards)
      Returns:
      the resolved egress rate, or Optional.empty() if this card cannot price it
    • source

      public PriceSource source()
      Description copied from interface: RateCard
      The dominant provenance of prices this card produces. Aggregating cards report PriceSource.COMPOSITE.
      Specified by:
      source in interface RateCard
      Returns:
      the price source