Updated Branches:
  refs/heads/api_refactoring feb342ad2 -> 99875a165

api_refactor: admin apis for vpc

Signed-off-by: Rohit Yadav <[email protected]>


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

Branch: refs/heads/api_refactoring
Commit: 99875a165fd5a6d48c2385b52250ec6b29f0ce51
Parents: dd5a36f
Author: Rohit Yadav <[email protected]>
Authored: Tue Dec 4 11:44:27 2012 -0800
Committer: Rohit Yadav <[email protected]>
Committed: Tue Dec 4 11:44:27 2012 -0800

----------------------------------------------------------------------
 .../cloud/api/commands/CreateVPCOfferingCmd.java   |  119 ---------------
 .../cloud/api/commands/DeleteVPCOfferingCmd.java   |   92 -----------
 .../cloud/api/commands/UpdateVPCOfferingCmd.java   |  111 --------------
 .../admin/vpc/command/CreateVPCOfferingCmd.java    |  119 +++++++++++++++
 .../admin/vpc/command/DeleteVPCOfferingCmd.java    |   92 +++++++++++
 .../admin/vpc/command/UpdateVPCOfferingCmd.java    |  111 ++++++++++++++
 client/tomcatconf/commands.properties.in           |    6 +-
 7 files changed, 325 insertions(+), 325 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/99875a16/api/src/com/cloud/api/commands/CreateVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/CreateVPCOfferingCmd.java 
b/api/src/com/cloud/api/commands/CreateVPCOfferingCmd.java
deleted file mode 100644
index 9ab3735..0000000
--- a/api/src/com/cloud/api/commands/CreateVPCOfferingCmd.java
+++ /dev/null
@@ -1,119 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.VpcOfferingResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.network.vpc.VpcOffering;
-import com.cloud.user.Account;
-
-@Implementation(description="Creates VPC offering", 
responseObject=VpcOfferingResponse.class)
-public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
-    public static final Logger s_logger = 
Logger.getLogger(CreateVPCOfferingCmd.class.getName());
-    private static final String _name = "createvpcofferingresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, 
description="the name of the vpc offering")
-    private String vpcOfferingName;
-
-    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, 
required=true, description="the display text of " +
-            "the vpc offering")
-    private String displayText;
-
-    @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, 
required=true, collectionType=CommandType.STRING,
-            description="services supported by the vpc offering")
-    private List<String> supportedServices;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getVpcOfferingName() {
-        return vpcOfferingName;
-    }
-
-    public String getDisplayText() {
-        return displayText;
-    }
-
-    public List<String> getSupportedServices() {
-        return supportedServices;
-    }
-
-
-    @Override
-    public void create() throws ResourceAllocationException {
-        VpcOffering vpcOff = 
_vpcService.createVpcOffering(getVpcOfferingName(), getDisplayText(), 
getSupportedServices());
-        if (vpcOff != null) {
-            this.setEntityId(vpcOff.getId());
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
create a VPC offering");
-        }
-    }
-
-    @Override
-    public void execute() {
-        VpcOffering vpc = _vpcService.getVpcOffering(this.getEntityId());
-        if (vpc != null) {
-            VpcOfferingResponse response = 
_responseGenerator.createVpcOfferingResponse(vpc);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
create VPC offering");
-        }
-    }
-
-    @Override
-    public String getEntityTable() {
-       return "vpc_offerings";
-    }
-
-    @Override
-    public String getEventType() {
-       return EventTypes.EVENT_VPC_OFFERING_CREATE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "creating VPC offering. Id: " + getEntityId();
-    }
-
-    @Override
-    public String getCommandName() {
-        return _name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-       return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/99875a16/api/src/com/cloud/api/commands/DeleteVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteVPCOfferingCmd.java 
b/api/src/com/cloud/api/commands/DeleteVPCOfferingCmd.java
deleted file mode 100644
index 2944cf3..0000000
--- a/api/src/com/cloud/api/commands/DeleteVPCOfferingCmd.java
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.user.Account;
-
-@Implementation(description="Deletes VPC offering", 
responseObject=SuccessResponse.class)
-public class DeleteVPCOfferingCmd extends BaseAsyncCmd{
-    public static final Logger s_logger = 
Logger.getLogger(DeleteVPCOfferingCmd.class.getName());
-    private static final String s_name = "deletevpcofferingresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="vpc_offerings")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, 
description="the ID of the VPC offering")
-    private Long id;
-
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public void execute(){
-        boolean result = _vpcService.deleteVpcOffering(getId());
-        if (result) {
-            SuccessResponse response = new SuccessResponse(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
delete VPC offering");
-        }
-    }
-
-    @Override
-    public String getEventType(){
-        return EventTypes.EVENT_VPC_OFFERING_DELETE;
-    }
-
-
-    @Override
-    public String getEventDescription() {
-        return "Deleting VPC offering id=" + getId();
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/99875a16/api/src/com/cloud/api/commands/UpdateVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateVPCOfferingCmd.java 
b/api/src/com/cloud/api/commands/UpdateVPCOfferingCmd.java
deleted file mode 100644
index fb4362e..0000000
--- a/api/src/com/cloud/api/commands/UpdateVPCOfferingCmd.java
+++ /dev/null
@@ -1,111 +0,0 @@
-// 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 com.cloud.api.commands;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.VpcOfferingResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.network.vpc.VpcOffering;
-import com.cloud.user.Account;
-
-@Implementation(description="Updates VPC offering", 
responseObject=VpcOfferingResponse.class)
-public class UpdateVPCOfferingCmd extends BaseAsyncCmd{
-    public static final Logger s_logger = 
Logger.getLogger(UpdateVPCOfferingCmd.class.getName());
-    private static final String _name = "updatevpcofferingresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="vpc_offerings")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the 
id of the VPC offering")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, 
description="the name of the VPC offering")
-    private String vpcOffName;
-
-    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, 
description="the display text of the VPC offering")
-    private String displayText;
-
-    @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, 
description="update state for the VPC offering; " +
-            "supported states - Enabled/Disabled")
-    private String state;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public String getVpcOfferingName() {
-        return vpcOffName;
-    }
-
-    public String getDisplayText() {
-        return displayText;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public String getState() {
-        return state;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-    @Override
-    public String getCommandName() {
-        return _name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-    @Override
-    public void execute(){
-        VpcOffering result = _vpcService.updateVpcOffering(getId(), 
getVpcOfferingName(), getDisplayText(), getState());
-        if (result != null) {
-            VpcOfferingResponse response = 
_responseGenerator.createVpcOfferingResponse(result);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
update VPC offering");
-        }
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VPC_OFFERING_UPDATE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "Updating VPC offering id=" + getId();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/99875a16/api/src/org/apache/cloudstack/api/admin/vpc/command/CreateVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/admin/vpc/command/CreateVPCOfferingCmd.java 
b/api/src/org/apache/cloudstack/api/admin/vpc/command/CreateVPCOfferingCmd.java
new file mode 100644
index 0000000..23d1d9b
--- /dev/null
+++ 
b/api/src/org/apache/cloudstack/api/admin/vpc/command/CreateVPCOfferingCmd.java
@@ -0,0 +1,119 @@
+// 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.admin.vpc.command;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.VpcOfferingResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.network.vpc.VpcOffering;
+import com.cloud.user.Account;
+
+@Implementation(description="Creates VPC offering", 
responseObject=VpcOfferingResponse.class)
+public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
+    public static final Logger s_logger = 
Logger.getLogger(CreateVPCOfferingCmd.class.getName());
+    private static final String _name = "createvpcofferingresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, 
description="the name of the vpc offering")
+    private String vpcOfferingName;
+
+    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, 
required=true, description="the display text of " +
+            "the vpc offering")
+    private String displayText;
+
+    @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, 
required=true, collectionType=CommandType.STRING,
+            description="services supported by the vpc offering")
+    private List<String> supportedServices;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getVpcOfferingName() {
+        return vpcOfferingName;
+    }
+
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    public List<String> getSupportedServices() {
+        return supportedServices;
+    }
+
+
+    @Override
+    public void create() throws ResourceAllocationException {
+        VpcOffering vpcOff = 
_vpcService.createVpcOffering(getVpcOfferingName(), getDisplayText(), 
getSupportedServices());
+        if (vpcOff != null) {
+            this.setEntityId(vpcOff.getId());
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
create a VPC offering");
+        }
+    }
+
+    @Override
+    public void execute() {
+        VpcOffering vpc = _vpcService.getVpcOffering(this.getEntityId());
+        if (vpc != null) {
+            VpcOfferingResponse response = 
_responseGenerator.createVpcOfferingResponse(vpc);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
create VPC offering");
+        }
+    }
+
+    @Override
+    public String getEntityTable() {
+       return "vpc_offerings";
+    }
+
+    @Override
+    public String getEventType() {
+       return EventTypes.EVENT_VPC_OFFERING_CREATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "creating VPC offering. Id: " + getEntityId();
+    }
+
+    @Override
+    public String getCommandName() {
+        return _name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+       return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/99875a16/api/src/org/apache/cloudstack/api/admin/vpc/command/DeleteVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/admin/vpc/command/DeleteVPCOfferingCmd.java 
b/api/src/org/apache/cloudstack/api/admin/vpc/command/DeleteVPCOfferingCmd.java
new file mode 100644
index 0000000..b929eff
--- /dev/null
+++ 
b/api/src/org/apache/cloudstack/api/admin/vpc/command/DeleteVPCOfferingCmd.java
@@ -0,0 +1,92 @@
+// 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.admin.vpc.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SuccessResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+
+@Implementation(description="Deletes VPC offering", 
responseObject=SuccessResponse.class)
+public class DeleteVPCOfferingCmd extends BaseAsyncCmd{
+    public static final Logger s_logger = 
Logger.getLogger(DeleteVPCOfferingCmd.class.getName());
+    private static final String s_name = "deletevpcofferingresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="vpc_offerings")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, 
description="the ID of the VPC offering")
+    private Long id;
+
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute(){
+        boolean result = _vpcService.deleteVpcOffering(getId());
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
delete VPC offering");
+        }
+    }
+
+    @Override
+    public String getEventType(){
+        return EventTypes.EVENT_VPC_OFFERING_DELETE;
+    }
+
+
+    @Override
+    public String getEventDescription() {
+        return "Deleting VPC offering id=" + getId();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/99875a16/api/src/org/apache/cloudstack/api/admin/vpc/command/UpdateVPCOfferingCmd.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/admin/vpc/command/UpdateVPCOfferingCmd.java 
b/api/src/org/apache/cloudstack/api/admin/vpc/command/UpdateVPCOfferingCmd.java
new file mode 100644
index 0000000..df40876
--- /dev/null
+++ 
b/api/src/org/apache/cloudstack/api/admin/vpc/command/UpdateVPCOfferingCmd.java
@@ -0,0 +1,111 @@
+// 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.admin.vpc.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.VpcOfferingResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.network.vpc.VpcOffering;
+import com.cloud.user.Account;
+
+@Implementation(description="Updates VPC offering", 
responseObject=VpcOfferingResponse.class)
+public class UpdateVPCOfferingCmd extends BaseAsyncCmd{
+    public static final Logger s_logger = 
Logger.getLogger(UpdateVPCOfferingCmd.class.getName());
+    private static final String _name = "updatevpcofferingresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="vpc_offerings")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the 
id of the VPC offering")
+    private Long id;
+
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, 
description="the name of the VPC offering")
+    private String vpcOffName;
+
+    @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, 
description="the display text of the VPC offering")
+    private String displayText;
+
+    @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, 
description="update state for the VPC offering; " +
+            "supported states - Enabled/Disabled")
+    private String state;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public String getVpcOfferingName() {
+        return vpcOffName;
+    }
+
+    public String getDisplayText() {
+        return displayText;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+    @Override
+    public String getCommandName() {
+        return _name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+    @Override
+    public void execute(){
+        VpcOffering result = _vpcService.updateVpcOffering(getId(), 
getVpcOfferingName(), getDisplayText(), getState());
+        if (result != null) {
+            VpcOfferingResponse response = 
_responseGenerator.createVpcOfferingResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to 
update VPC offering");
+        }
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VPC_OFFERING_UPDATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Updating VPC offering id=" + getId();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/99875a16/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in 
b/client/tomcatconf/commands.properties.in
index c1ddf39..0504b27 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -387,9 +387,9 @@ 
updateVPC=org.apache.cloudstack.api.user.vpc.command.UpdateVPCCmd;15
 restartVPC=org.apache.cloudstack.api.user.vpc.command.RestartVPCCmd;15
 
 #### VPC offering commands
-createVPCOffering=com.cloud.api.commands.CreateVPCOfferingCmd;1
-updateVPCOffering=com.cloud.api.commands.UpdateVPCOfferingCmd;1
-deleteVPCOffering=com.cloud.api.commands.DeleteVPCOfferingCmd;1
+createVPCOffering=org.apache.cloudstack.api.admin.vpc.command.CreateVPCOfferingCmd;1
+updateVPCOffering=org.apache.cloudstack.api.admin.vpc.command.UpdateVPCOfferingCmd;1
+deleteVPCOffering=org.apache.cloudstack.api.admin.vpc.command.DeleteVPCOfferingCmd;1
 
listVPCOfferings=org.apache.cloudstack.api.user.vpc.command.ListVPCOfferingsCmd;15
 
 #### Private gateway commands

Reply via email to