Class ProviderRef

java.lang.Object
com.eqixiac.equinix.core.model.multicloud.ProviderRef
All Implemented Interfaces:
Comparable<ProviderRef>

public final class ProviderRef extends Object implements Comparable<ProviderRef>
A provider id from the Connection Coordinator specification: the {provider} segment of the resource name providers/{provider}.

Beta: derived from the open specification at commit bbfc763 (see the package documentation). The specification states that provider ids are centrally assigned and stored in its repository; at that commit no registry file exists and governance/IMPLEMENTERS.md lists no implementers.

Normalization

of(String) trims surrounding whitespace, removes one optional leading / and one optional providers/ prefix, and lower-cases the remainder with Locale.ROOT. Both spellings of the specification's ProviderSites.providerId field are accepted: its description gives the format providers/{provider} and its inline example uses the bare id. Two ProviderRefs are equal when their normalized ids are equal. toString() returns the normalized id.

Well-known constants

Well-known provider ids and their source
ConstantIdSource
AWSaws Specification, docs/Protocols.md: /providers/aws
GCPgcp Specification, docs/Protocols.md: /providers/gcp
OCIoci Unverified. Not present in the specification; chosen to equal CloudProviderType.ORACLE_CLOUD.shortCode()
AZUREazure Unverified. Not present in the specification; chosen to equal CloudProviderType.AZURE.shortCode()
EQUINIXequinix Unverified. Not present in the specification; Equinix has no CloudProviderType constant

Bridge from the Fabric cloud-provider enum

This type lives in core and does not reference any domain package. The Fabric enum com.eqixiac.equinix.fabric.model.implementation.cloud.CloudProviderType bridges to it through its shortCode() method:

ProviderRef aws = ProviderRef.of(CloudProviderType.AWS.shortCode());   // equals ProviderRef.AWS

shortCode() returns aws, azure, gcp, oci, ibm, alibaba and, for CloudProviderType.OTHER, the placeholder cloud. The last three produce a valid ProviderRef for which isWellKnown() is false; cloud does not identify a provider and must not be used to build a resource name.

Author:
ianjones
  • Field Details

    • RESOURCE_PREFIX

      public static final String RESOURCE_PREFIX
      The resource-name prefix of a provider: providers/.
      See Also:
    • AWS

      public static final ProviderRef AWS
      Amazon Web Services. Id aws, as written in the specification's docs/Protocols.md.
    • GCP

      public static final ProviderRef GCP
      Google Cloud. Id gcp, as written in the specification's docs/Protocols.md.
    • OCI

      public static final ProviderRef OCI
      Oracle Cloud Infrastructure. Id oci; unverified, see the class table.
    • AZURE

      public static final ProviderRef AZURE
      Microsoft Azure. Id azure; unverified, see the class table.
    • EQUINIX

      public static final ProviderRef EQUINIX
      Equinix. Id equinix; unverified, see the class table.
  • Method Details

    • of

      public static ProviderRef of(String idOrResourceName)
      Creates a ProviderRef from a provider id ("aws", " AWS ") or a provider resource name ("providers/aws", "/providers/aws").
      Parameters:
      idOrResourceName - the provider id or providers/{id} resource name
      Returns:
      the provider reference with a normalized, lower-case id
      Throws:
      NullPointerException - if idOrResourceName is null
      IllegalArgumentException - if the id is blank after normalization, or contains / or whitespace (for example a longer resource name such as providers/aws/environments/x)
    • id

      public String id()
      Returns:
      the normalized, lower-case provider id (for example aws)
    • resourceName

      public String resourceName()
      Returns:
      the specification resource name of this provider: providers/{id}
    • isWellKnown

      public boolean isWellKnown()
      Returns:
      true when this id equals one of the constants declared on this class. A false result does not mean the id is invalid; the specification assigns ids outside this SDK
    • compareTo

      public int compareTo(ProviderRef other)
      Orders by normalized id, lexicographically.
      Specified by:
      compareTo in interface Comparable<ProviderRef>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      the normalized id, identical to id()