Class OteAccountBuilder

java.lang.Object
google.registry.model.OteAccountBuilder

public final class OteAccountBuilder extends Object
Class to help build and persist all the OT&E entities in the database.

This includes the TLDs (Registries), Registrars, and the RegistrarContacts that can access the web console.

This class is basically a "builder" for the parameters needed to generate the OT&E entities. Nothing is created until you call buildAndPersist().

Usage example:


 OteAccountBuilder.forRegistrarId("example")
     .addContact("contact@email.com") // OPTIONAL
     .setPassword("password") // OPTIONAL
     .setCertificateHash(certificateHash) // OPTIONAL
     .setIpAllowList(ImmutableList.of("1.1.1.1", "2.2.2.0/24")) // OPTIONAL
     .buildAndPersist();
 
  • Field Details

    • DEFAULT_BILLING_ACCOUNT_MAP

      public static final com.google.common.collect.ImmutableMap<org.joda.money.CurrencyUnit,String> DEFAULT_BILLING_ACCOUNT_MAP
      The default billing account map applied to all OT&E registrars.

      This contains dummy values for USD and JPY so that OT&E registrars can be granted access to all existing TLDs in sandbox. Note that OT&E is only on sandbox and thus these dummy values will never be used in production (the only environment where real invoicing takes place).

  • Method Details

    • forRegistrarId

      public static OteAccountBuilder forRegistrarId(String baseRegistrarId)
      Creates an OteAccountBuilder for the given base client ID.
      Parameters:
      baseRegistrarId - the base registrar ID which will help name all the entities we create. Normally is the same as the "prod" ID designated for this registrar.
    • setReplaceExisting

      public OteAccountBuilder setReplaceExisting(boolean replaceExisting)
      Set whether to replace any conflicting existing entities.

      If true, any existing entity that conflicts with the entities we want to create will be replaced with the newly created data.

      If false, encountering an existing entity that conflicts with one we want to create will throw an exception during buildAndPersist().

      NOTE that if we fail, no entities are created (the creation is atomic).

      Default is false (failing if entities exist)

    • addContact

      public OteAccountBuilder addContact(String email)
      Adds a RegistrarContact with Web Console access.

      NOTE: can be called more than once, adding multiple contacts. Each contact will have access to all OT&E Registrars.

      Parameters:
      email - the contact/login email that will have web-console access to all the Registrars. Must be from "our G Suite domain".
    • setPassword

      public OteAccountBuilder setPassword(String password)
      Sets the EPP login password for all the OT&E Registrars.
    • setCertificate

      public OteAccountBuilder setCertificate(String asciiCert, org.joda.time.DateTime now)
      Sets the client certificate to all the OT&E Registrars.
    • setIpAllowList

      public OteAccountBuilder setIpAllowList(Collection<String> ipAllowList)
      Sets the IP allow list to all the OT&E Registrars.
    • buildAndPersist

      public com.google.common.collect.ImmutableMap<String,String> buildAndPersist()
      Persists all the OT&E entities to the database.
      Returns:
      map from the new clientIds created to the new TLDs they have access to. Can be used to go over all the newly created Registrars / Registries / RegistrarContacts if any post-creation work is needed.
    • getRegistrarIdToTldMap

      public com.google.common.collect.ImmutableMap<String,String> getRegistrarIdToTldMap()
      Return map from the OT&E registrarIds we will create to the new TLDs they will have access to.
    • createRegistrarIdToTldMap

      public static com.google.common.collect.ImmutableMap<String,String> createRegistrarIdToTldMap(String baseRegistrarId)
      Returns the registrar IDs of the OT&E, with the TLDs each has access to.
    • getBaseRegistrarId

      public static String getBaseRegistrarId(String oteRegistrarId)
      Returns the base registrar ID that corresponds to a given OT&E registrar ID.