@Override
    public String invoke() throws AmbariException {
      CredentialStoreType credentialStoreType = getCredentialStoreType(properties);

      validateForCreateOrModify(credentialStoreType);

      String clusterName = getClusterName(properties);
      String alias = getAlias(properties);

      if (credentialStoreService.containsCredential(clusterName, alias)) {
        throw new DuplicateResourceException("A credential with the alias of " + alias + " already exists");
      }

      credentialStoreService.setCredential(clusterName, alias, createCredential(properties), credentialStoreType);
      return alias;
    }
CreateResourcesCommand implements a Command that performs the steps to create a new credential
resources and store the data into the persisted or temporary credential stores, as indicated.
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CredentialResourceProvider.java