Class OteAccountBuilder


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

    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 Summary

      Fields 
      Modifier and Type Field Description
      static com.google.common.collect.ImmutableMap<org.joda.money.CurrencyUnit,​java.lang.String> DEFAULT_BILLING_ACCOUNT_MAP
      The default billing account map applied to all OT&E registrars.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      OteAccountBuilder addContact​(java.lang.String email)
      Adds a RegistrarContact with Web Console access.
      com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> buildAndPersist()
      Persists all the OT&E entities to the database.
      static com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> createRegistrarIdToTldMap​(java.lang.String baseRegistrarId)
      Returns the registrar IDs of the OT&E, with the TLDs each has access to.
      static OteAccountBuilder forRegistrarId​(java.lang.String baseRegistrarId)
      Creates an OteAccountBuilder for the given base client ID.
      static java.lang.String getBaseRegistrarId​(java.lang.String oteRegistrarId)
      Returns the base registrar ID that corresponds to a given OT&E registrar ID.
      com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> getRegistrarIdToTldMap()
      Return map from the OT&E registrarIds we will create to the new TLDs they will have access to.
      OteAccountBuilder setCertificate​(java.lang.String asciiCert, org.joda.time.DateTime now)
      Sets the client certificate to all the OT&E Registrars.
      OteAccountBuilder setIpAllowList​(java.util.Collection<java.lang.String> ipAllowList)
      Sets the IP allow list to all the OT&E Registrars.
      OteAccountBuilder setPassword​(java.lang.String password)
      Sets the EPP login password for all the OT&E Registrars.
      OteAccountBuilder setReplaceExisting​(boolean replaceExisting)
      Set whether to replace any conflicting existing entities.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_BILLING_ACCOUNT_MAP

        public static final com.google.common.collect.ImmutableMap<org.joda.money.CurrencyUnit,​java.lang.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 Detail

      • forRegistrarId

        public static OteAccountBuilder forRegistrarId​(java.lang.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​(java.lang.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 email that will have web-console access to all the Registrars. Must be from "our G Suite domain" (we have to be able to get its GaeUserId)
      • setPassword

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

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

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

        public com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.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<java.lang.String,​java.lang.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<java.lang.String,​java.lang.String> createRegistrarIdToTldMap​(java.lang.String baseRegistrarId)
        Returns the registrar IDs of the OT&E, with the TLDs each has access to.
      • getBaseRegistrarId

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