You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "the ID of the domain where the account exists")
58
+
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "The UUID of the domain where the account exists")
58
59
privateLongdomainId;
59
60
60
-
@Parameter(name = ApiConstants.NEW_NAME, type = CommandType.STRING, required = true, description = "new name for the account")
61
+
@Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "The UUID of the dynamic role to set for the account")
62
+
privateLongroleId;
63
+
64
+
@Parameter(name = ApiConstants.NEW_NAME, type = CommandType.STRING, description = "New name for the account")
61
65
privateStringnewName;
62
66
63
67
@Parameter(name = ApiConstants.NETWORK_DOMAIN,
64
68
type = CommandType.STRING,
65
69
description = "Network domain for the account's networks; empty string will update domainName with NULL value")
66
70
privateStringnetworkDomain;
67
71
68
-
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
72
+
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "Details for the account used to store specific parameters")
* <li>If a pair of keys is provided, we validate to see if there is an user already using the provided API key. If there is someone else using, we throw an {@link InvalidParameterValueException} because two users cannot have the same API key.
if (duplicateAcccount != null && duplicateAcccount.getId() != account.getId()) {
1720
-
thrownewInvalidParameterValueException(
1721
-
"There already exists an account with the name:" + newAccountName + " in the domain:" + domainId + " with existing account id:" + duplicateAcccount.getId());
1726
+
if(newAccountName != null) {
1727
+
1728
+
if (newAccountName.isEmpty()) {
1729
+
thrownewInvalidParameterValueException("The new account name for account '" + account.getUuid() + "' " +
1730
+
"within domain '" + domainId + "' is empty string. Account will be not renamed.");
1731
+
}
1732
+
1733
+
// check if the new proposed account name is absent in the domain
if (existingAccount != null && existingAccount.getId() != account.getId()) {
1736
+
thrownewInvalidParameterValueException("The account with the proposed name '" +
1737
+
newAccountName + "' exists in the domain '" +
1738
+
domainId + "' with existing account id '" + existingAccount.getId() + "'");
1739
+
}
1740
+
1741
+
acctForUpdate.setAccountName(newAccountName);
1722
1742
}
1723
1743
1724
1744
if (networkDomain != null && !networkDomain.isEmpty()) {
1725
1745
if (!NetUtils.verifyDomainName(networkDomain)) {
1726
-
thrownewInvalidParameterValueException(
1727
-
"Invalid network domain. Total length shouldn't exceed 190 chars. Each domain label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', "
1746
+
thrownewInvalidParameterValueException("Invalid network domain or format. " +
1747
+
"Total length shouldn't exceed 190 chars. Every domain part must be between 1 and 63 " +
1748
+
"characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', "
1728
1749
+ "and the hyphen ('-'); can't start or end with \"-\"");
0 commit comments