CLOUDSTACK-4493: registerSSHKeyPair API doc contains wrong API response (private key) Changing the response object of register and list ssh keypairs APIs

Signed-off-by: Koushik Das <koushik@apache.org>

Conflicts:
	api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
This commit is contained in:
Harikrishna Patnala 2013-10-21 10:44:24 +05:30 committed by Koushik Das
parent 1ff5994a1c
commit 54e365d00b
3 changed files with 44 additions and 19 deletions

View File

@ -20,16 +20,16 @@ import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.CreateSSHKeyPairResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.SSHKeyPairResponse;
import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import com.cloud.user.SSHKeyPair;
@APICommand(name = "createSSHKeyPair", description="Create a new keypair and returns the private key", responseObject=SSHKeyPairResponse.class)
@APICommand(name = "createSSHKeyPair", description="Create a new keypair and returns the private key", responseObject=CreateSSHKeyPairResponse.class)
public class CreateSSHKeyPairCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateSSHKeyPairCmd.class.getName());
private static final String s_name = "createsshkeypairresponse";
@ -91,7 +91,7 @@ public class CreateSSHKeyPairCmd extends BaseCmd {
@Override
public void execute() {
SSHKeyPair r = _mgr.createSSHKeyPair(this);
SSHKeyPairResponse response = new SSHKeyPairResponse(r.getName(), r.getFingerprint(), r.getPrivateKey());
CreateSSHKeyPairResponse response = new CreateSSHKeyPairResponse(r.getName(), r.getFingerprint(), r.getPrivateKey());
response.setResponseName(getCommandName());
response.setObjectName("keypair");
this.setResponseObject(response);

View File

@ -0,0 +1,41 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.response;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class CreateSSHKeyPairResponse extends SSHKeyPairResponse {
@SerializedName("privatekey") @Param(description="Private key")
private String privateKey;
public CreateSSHKeyPairResponse() {}
public CreateSSHKeyPairResponse(String name, String fingerprint, String privateKey) {
super(name, fingerprint);
this.privateKey = privateKey;
}
public String getPrivateKey() {
return privateKey;
}
public void setPrivateKey(String privateKey) {
this.privateKey = privateKey;
}
}

View File

@ -30,19 +30,11 @@ public class SSHKeyPairResponse extends BaseResponse {
@SerializedName("fingerprint") @Param(description="Fingerprint of the public key")
private String fingerprint;
@SerializedName("privatekey") @Param(description="Private key")
private String privateKey;
public SSHKeyPairResponse() {}
public SSHKeyPairResponse(String name, String fingerprint) {
this(name, fingerprint, null);
}
public SSHKeyPairResponse(String name, String fingerprint, String privateKey) {
this.name = name;
this.fingerprint = fingerprint;
this.privateKey = privateKey;
}
public String getName() {
@ -61,12 +53,4 @@ public class SSHKeyPairResponse extends BaseResponse {
this.fingerprint = fingerprint;
}
public String getPrivateKey() {
return privateKey;
}
public void setPrivateKey(String privateKey) {
this.privateKey = privateKey;
}
}