You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ko...@apache.org on 2013/10/22 07:13:22 UTC

git commit: updated refs/heads/master to 54e365d

Updated Branches:
  refs/heads/master 1ff5994a1 -> 54e365d00


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 <ko...@apache.org>

Conflicts:
	api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/54e365d0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/54e365d0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/54e365d0

Branch: refs/heads/master
Commit: 54e365d00b5ae504c59c025b37387b9c9d166422
Parents: 1ff5994
Author: Harikrishna Patnala <ha...@citrix.com>
Authored: Mon Oct 21 10:44:24 2013 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Tue Oct 22 10:43:00 2013 +0530

----------------------------------------------------------------------
 .../command/user/ssh/CreateSSHKeyPairCmd.java   |  6 +--
 .../api/response/CreateSSHKeyPairResponse.java  | 41 ++++++++++++++++++++
 .../api/response/SSHKeyPairResponse.java        | 16 --------
 3 files changed, 44 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54e365d0/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
index 6f1a081..e36bd73 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
@@ -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);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54e365d0/api/src/org/apache/cloudstack/api/response/CreateSSHKeyPairResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/CreateSSHKeyPairResponse.java b/api/src/org/apache/cloudstack/api/response/CreateSSHKeyPairResponse.java
new file mode 100644
index 0000000..e247fb4
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/CreateSSHKeyPairResponse.java
@@ -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;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54e365d0/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java b/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java
index 2791853..e102bab 100644
--- a/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java
@@ -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;
-    }
-
 }