mirror of https://github.com/apache/cloudstack.git
api:rename RegisterCmd.java => RegisterUserKeyCmd.java (#12259)
This commit is contained in:
parent
e9900aba23
commit
8936e4c535
|
|
@ -25,7 +25,7 @@ import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||||
import org.apache.cloudstack.api.command.admin.account.CreateAccountCmd;
|
import org.apache.cloudstack.api.command.admin.account.CreateAccountCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.GetUserKeysCmd;
|
import org.apache.cloudstack.api.command.admin.user.GetUserKeysCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
|
import org.apache.cloudstack.api.command.admin.user.RegisterUserKeyCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
|
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
|
||||||
|
|
||||||
import com.cloud.dc.DataCenter;
|
import com.cloud.dc.DataCenter;
|
||||||
|
|
@ -95,7 +95,7 @@ public interface AccountService {
|
||||||
|
|
||||||
void markUserRegistered(long userId);
|
void markUserRegistered(long userId);
|
||||||
|
|
||||||
public String[] createApiKeyAndSecretKey(RegisterCmd cmd);
|
public String[] createApiKeyAndSecretKey(RegisterUserKeyCmd cmd);
|
||||||
|
|
||||||
public String[] createApiKeyAndSecretKey(final long userId);
|
public String[] createApiKeyAndSecretKey(final long userId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,14 @@ import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
import org.apache.cloudstack.api.response.RegisterResponse;
|
import org.apache.cloudstack.api.response.RegisterUserKeyResponse;
|
||||||
import org.apache.cloudstack.api.response.UserResponse;
|
import org.apache.cloudstack.api.response.UserResponse;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@APICommand(name = "getUserKeys",
|
@APICommand(name = "getUserKeys",
|
||||||
description = "This command allows the user to query the seceret and API keys for the account",
|
description = "This command allows the user to query the seceret and API keys for the account",
|
||||||
responseObject = RegisterResponse.class,
|
responseObject = RegisterUserKeyResponse.class,
|
||||||
requestHasSensitiveInfo = false,
|
requestHasSensitiveInfo = false,
|
||||||
responseHasSensitiveInfo = true,
|
responseHasSensitiveInfo = true,
|
||||||
authorized = {RoleType.User, RoleType.Admin, RoleType.DomainAdmin, RoleType.ResourceAdmin},
|
authorized = {RoleType.User, RoleType.Admin, RoleType.DomainAdmin, RoleType.ResourceAdmin},
|
||||||
|
|
@ -57,7 +57,7 @@ public class GetUserKeysCmd extends BaseCmd{
|
||||||
public void execute(){
|
public void execute(){
|
||||||
Pair<Boolean, Map<String, String>> keys = _accountService.getKeys(this);
|
Pair<Boolean, Map<String, String>> keys = _accountService.getKeys(this);
|
||||||
|
|
||||||
RegisterResponse response = new RegisterResponse();
|
RegisterUserKeyResponse response = new RegisterUserKeyResponse();
|
||||||
if(keys != null){
|
if(keys != null){
|
||||||
response.setApiKeyAccess(keys.first());
|
response.setApiKeyAccess(keys.first());
|
||||||
response.setApiKey(keys.second().get("apikey"));
|
response.setApiKey(keys.second().get("apikey"));
|
||||||
|
|
|
||||||
|
|
@ -22,17 +22,17 @@ import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
import org.apache.cloudstack.api.response.RegisterResponse;
|
import org.apache.cloudstack.api.response.RegisterUserKeyResponse;
|
||||||
import org.apache.cloudstack.api.response.UserResponse;
|
import org.apache.cloudstack.api.response.UserResponse;
|
||||||
|
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
|
|
||||||
@APICommand(name = "registerUserKeys",
|
@APICommand(name = "registerUserKeys",
|
||||||
responseObject = RegisterResponse.class,
|
responseObject = RegisterUserKeyResponse.class,
|
||||||
description = "This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user",
|
description = "This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user",
|
||||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
|
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
|
||||||
public class RegisterCmd extends BaseCmd {
|
public class RegisterUserKeyCmd extends BaseCmd {
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|
@ -81,7 +81,7 @@ public class RegisterCmd extends BaseCmd {
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
String[] keys = _accountService.createApiKeyAndSecretKey(this);
|
String[] keys = _accountService.createApiKeyAndSecretKey(this);
|
||||||
RegisterResponse response = new RegisterResponse();
|
RegisterUserKeyResponse response = new RegisterUserKeyResponse();
|
||||||
if (keys != null) {
|
if (keys != null) {
|
||||||
response.setApiKey(keys[0]);
|
response.setApiKey(keys[0]);
|
||||||
response.setSecretKey(keys[1]);
|
response.setSecretKey(keys[1]);
|
||||||
|
|
@ -23,7 +23,7 @@ import org.apache.cloudstack.api.BaseResponse;
|
||||||
|
|
||||||
import com.cloud.serializer.Param;
|
import com.cloud.serializer.Param;
|
||||||
|
|
||||||
public class RegisterResponse extends BaseResponse {
|
public class RegisterUserKeyResponse extends BaseResponse {
|
||||||
@SerializedName(ApiConstants.API_KEY)
|
@SerializedName(ApiConstants.API_KEY)
|
||||||
@Param(description = "the api key of the registered user", isSensitive = true)
|
@Param(description = "the api key of the registered user", isSensitive = true)
|
||||||
private String apiKey;
|
private String apiKey;
|
||||||
|
|
@ -37,7 +37,7 @@ import org.apache.cloudstack.acl.RoleType;
|
||||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||||
import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
|
import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
|
import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
|
import org.apache.cloudstack.api.command.admin.user.RegisterUserKeyCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
|
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
|
||||||
import org.apache.cloudstack.context.CallContext;
|
import org.apache.cloudstack.context.CallContext;
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ public class MockAccountManager extends ManagerBase implements AccountManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] createApiKeyAndSecretKey(RegisterCmd arg0) {
|
public String[] createApiKeyAndSecretKey(RegisterUserKeyCmd arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,7 @@ import org.apache.cloudstack.api.command.admin.user.GetUserKeysCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.ListUsersCmd;
|
import org.apache.cloudstack.api.command.admin.user.ListUsersCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.LockUserCmd;
|
import org.apache.cloudstack.api.command.admin.user.LockUserCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.MoveUserCmd;
|
import org.apache.cloudstack.api.command.admin.user.MoveUserCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
|
import org.apache.cloudstack.api.command.admin.user.RegisterUserKeyCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
|
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
|
import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.vlan.DedicatePublicIpRangeCmd;
|
import org.apache.cloudstack.api.command.admin.vlan.DedicatePublicIpRangeCmd;
|
||||||
|
|
@ -3931,7 +3931,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
||||||
cmdList.add(ListUsersCmd.class);
|
cmdList.add(ListUsersCmd.class);
|
||||||
cmdList.add(LockUserCmd.class);
|
cmdList.add(LockUserCmd.class);
|
||||||
cmdList.add(MoveUserCmd.class);
|
cmdList.add(MoveUserCmd.class);
|
||||||
cmdList.add(RegisterCmd.class);
|
cmdList.add(RegisterUserKeyCmd.class);
|
||||||
cmdList.add(UpdateUserCmd.class);
|
cmdList.add(UpdateUserCmd.class);
|
||||||
cmdList.add(CreateVlanIpRangeCmd.class);
|
cmdList.add(CreateVlanIpRangeCmd.class);
|
||||||
cmdList.add(UpdateVlanIpRangeCmd.class);
|
cmdList.add(UpdateVlanIpRangeCmd.class);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
|
import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.GetUserKeysCmd;
|
import org.apache.cloudstack.api.command.admin.user.GetUserKeysCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.MoveUserCmd;
|
import org.apache.cloudstack.api.command.admin.user.MoveUserCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
|
import org.apache.cloudstack.api.command.admin.user.RegisterUserKeyCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
|
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
|
||||||
import org.apache.cloudstack.api.response.UserTwoFactorAuthenticationSetupResponse;
|
import org.apache.cloudstack.api.response.UserTwoFactorAuthenticationSetupResponse;
|
||||||
import org.apache.cloudstack.auth.UserAuthenticator;
|
import org.apache.cloudstack.auth.UserAuthenticator;
|
||||||
|
|
@ -3129,7 +3129,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
||||||
@Override
|
@Override
|
||||||
@DB
|
@DB
|
||||||
@ActionEvent(eventType = EventTypes.EVENT_REGISTER_FOR_SECRET_API_KEY, eventDescription = "register for the developer API keys")
|
@ActionEvent(eventType = EventTypes.EVENT_REGISTER_FOR_SECRET_API_KEY, eventDescription = "register for the developer API keys")
|
||||||
public String[] createApiKeyAndSecretKey(RegisterCmd cmd) {
|
public String[] createApiKeyAndSecretKey(RegisterUserKeyCmd cmd) {
|
||||||
Account caller = getCurrentCallingAccount();
|
Account caller = getCurrentCallingAccount();
|
||||||
final Long userId = cmd.getId();
|
final Long userId = cmd.getId();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue