Package google.registry.tools
Class DomainLockUtils
- java.lang.Object
-
- google.registry.tools.DomainLockUtils
-
public final class DomainLockUtils extends java.lang.Object
Utility functions for validating and applyingRegistryLock
s.For both locks and unlocks, a lock must be requested via the createRegistry*Requst methods then verified through the verifyAndApply* methods. These methods will verify that the domain in question is in a lock/unlockable state and will return the lock object.
-
-
Constructor Summary
Constructors Constructor Description DomainLockUtils(StringGenerator stringGenerator, java.lang.String registryAdminRegistrarId, CloudTasksUtils cloudTasksUtils)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RegistryLock
administrativelyApplyLock(java.lang.String domainName, java.lang.String registrarId, java.lang.String registrarPocId, boolean isAdmin)
Creates and applies a lock in one step.RegistryLock
administrativelyApplyUnlock(java.lang.String domainName, java.lang.String registrarId, boolean isAdmin, java.util.Optional<org.joda.time.Duration> relockDuration)
Creates and applies an unlock in one step.void
enqueueDomainRelock(RegistryLock lock)
Enqueues a task to asynchronously re-lock a registry-locked domain after it was unlocked.void
enqueueDomainRelock(org.joda.time.Duration countdown, long lockRevisionId, int previousAttempts)
Enqueues a task to asynchronously re-lock a registry-locked domain after it was unlocked.RegistryLock
saveNewRegistryLockRequest(java.lang.String domainName, java.lang.String registrarId, java.lang.String registrarPocId, boolean isAdmin)
Creates and persists a lock request when requested by a user.RegistryLock
saveNewRegistryUnlockRequest(java.lang.String domainName, java.lang.String registrarId, boolean isAdmin, java.util.Optional<org.joda.time.Duration> relockDuration)
Creates and persists an unlock request when requested by a user.RegistryLock
verifyAndApplyLock(java.lang.String verificationCode, boolean isAdmin)
Verifies and applies the lock request previously requested by a user.RegistryLock
verifyAndApplyUnlock(java.lang.String verificationCode, boolean isAdmin)
Verifies and applies the unlock request previously requested by a user.
-
-
-
Constructor Detail
-
DomainLockUtils
@Inject public DomainLockUtils(@Named("base58StringGenerator") StringGenerator stringGenerator, @Config("registryAdminClientId") java.lang.String registryAdminRegistrarId, CloudTasksUtils cloudTasksUtils)
-
-
Method Detail
-
saveNewRegistryLockRequest
public RegistryLock saveNewRegistryLockRequest(java.lang.String domainName, java.lang.String registrarId, @Nullable java.lang.String registrarPocId, boolean isAdmin)
Creates and persists a lock request when requested by a user.The lock will not be applied until
verifyAndApplyLock(java.lang.String, boolean)
is called.
-
saveNewRegistryUnlockRequest
public RegistryLock saveNewRegistryUnlockRequest(java.lang.String domainName, java.lang.String registrarId, boolean isAdmin, java.util.Optional<org.joda.time.Duration> relockDuration)
Creates and persists an unlock request when requested by a user.The unlock will not be applied until
verifyAndApplyUnlock(java.lang.String, boolean)
is called.
-
verifyAndApplyLock
public RegistryLock verifyAndApplyLock(java.lang.String verificationCode, boolean isAdmin)
Verifies and applies the lock request previously requested by a user.
-
verifyAndApplyUnlock
public RegistryLock verifyAndApplyUnlock(java.lang.String verificationCode, boolean isAdmin)
Verifies and applies the unlock request previously requested by a user.
-
administrativelyApplyLock
public RegistryLock administrativelyApplyLock(java.lang.String domainName, java.lang.String registrarId, @Nullable java.lang.String registrarPocId, boolean isAdmin)
Creates and applies a lock in one step.This should only be used for admin actions, e.g. Nomulus tool commands or relocks. Note: in the case of relocks, isAdmin is determined by the previous lock.
-
administrativelyApplyUnlock
public RegistryLock administrativelyApplyUnlock(java.lang.String domainName, java.lang.String registrarId, boolean isAdmin, java.util.Optional<org.joda.time.Duration> relockDuration)
Creates and applies an unlock in one step.This should only be used for admin actions, e.g. Nomulus tool commands.
-
enqueueDomainRelock
public void enqueueDomainRelock(RegistryLock lock)
Enqueues a task to asynchronously re-lock a registry-locked domain after it was unlocked.Note: the relockDuration must be present on the lock object.
-
enqueueDomainRelock
public void enqueueDomainRelock(org.joda.time.Duration countdown, long lockRevisionId, int previousAttempts)
Enqueues a task to asynchronously re-lock a registry-locked domain after it was unlocked.
-
-