private void validateForCreateOrModify(CredentialStoreType credentialStoreType) throws IllegalArgumentException {
    if (!credentialStoreService.isInitialized(credentialStoreType)) {
      if (CredentialStoreType.PERSISTED == credentialStoreType) {
        // Throw IllegalArgumentException to cause a 400 error to be returned...
        throw new IllegalArgumentException("Credentials cannot be stored in Ambari's persistent secure " +
            "credential store since secure persistent storage has not yet be configured.  " +
            "Use ambari-server setup-security to enable this feature.");
      } else if (CredentialStoreType.TEMPORARY == credentialStoreType) {
        // Throw IllegalArgumentException to cause a 400 error to be returned...
        throw new IllegalArgumentException("Credentials cannot be stored in Ambari's temporary secure " +
            "credential store since secure temporary storage has not yet be configured.");
      }
    }
  }
Validates that the CredentialStoreService is available and has been initialized to support the
requested persisted or temporary storage facility.

@param credentialStoreType a CredentialStoreType indicating which credential store facility to use
@throws IllegalArgumentException if the requested facility has not been initialized
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CredentialResourceProvider.java