You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/04 11:02:55 UTC

[6/55] [abbrv] api_refactor: rename sg to securitygroup

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/73d1099c/api/src/org/apache/cloudstack/api/user/sg/command/RevokeSecurityGroupIngressCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/user/sg/command/RevokeSecurityGroupIngressCmd.java b/api/src/org/apache/cloudstack/api/user/sg/command/RevokeSecurityGroupIngressCmd.java
deleted file mode 100644
index 668b9e2..0000000
--- a/api/src/org/apache/cloudstack/api/user/sg/command/RevokeSecurityGroupIngressCmd.java
+++ /dev/null
@@ -1,109 +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 org.apache.cloudstack.api.user.sg.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.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.network.security.SecurityGroup;
-import com.cloud.user.Account;
-
-@Implementation(responseObject = SuccessResponse.class, description = "Deletes a particular ingress rule from this security group")
-public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(RevokeSecurityGroupIngressCmd.class.getName());
-
-    private static final String s_name = "revokesecuritygroupingress";
-
-    // ///////////////////////////////////////////////////
-    // ////////////// API parameters /////////////////////
-    // ///////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="security_group_rule")
-    @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "The ID of the ingress rule")
-    private Long id;
-
-    // ///////////////////////////////////////////////////
-    // ///////////////// Accessors ///////////////////////
-    // ///////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    // ///////////////////////////////////////////////////
-    // ///////////// API Implementation///////////////////
-    // ///////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    public static String getResultObjectName() {
-        return "revokesecuritygroupingress";
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        SecurityGroup group = _entityMgr.findById(SecurityGroup.class, getId());
-        if (group != null) {
-            return group.getAccountId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_SECURITY_GROUP_REVOKE_INGRESS;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return "revoking ingress rule id: " + getId();
-    }
-
-    @Override
-    public void execute() {
-        boolean result = _securityGroupService.revokeSecurityGroupIngress(this);
-        if (result) {
-            SuccessResponse response = new SuccessResponse(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to revoke security group ingress rule");
-        }
-    }
-
-    @Override
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.SecurityGroup;
-    }
-
-    @Override
-    public Long getInstanceId() {
-        return getId();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/73d1099c/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index eb00651..f7ce43b 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -272,13 +272,13 @@ enableStorageMaintenance=com.cloud.api.commands.PreparePrimaryStorageForMaintena
 cancelStorageMaintenance=com.cloud.api.commands.CancelPrimaryStorageMaintenanceCmd;1
 
 #### security group commands
-createSecurityGroup=org.apache.cloudstack.api.user.sg.command.CreateSecurityGroupCmd;15
-deleteSecurityGroup=org.apache.cloudstack.api.user.sg.command.DeleteSecurityGroupCmd;15
-authorizeSecurityGroupIngress=org.apache.cloudstack.api.user.sg.command.AuthorizeSecurityGroupIngressCmd;15
-revokeSecurityGroupIngress=org.apache.cloudstack.api.user.sg.command.RevokeSecurityGroupIngressCmd;15
-authorizeSecurityGroupEgress=org.apache.cloudstack.api.user.sg.command.AuthorizeSecurityGroupEgressCmd;15
-revokeSecurityGroupEgress=org.apache.cloudstack.api.user.sg.command.RevokeSecurityGroupEgressCmd;15
-listSecurityGroups=org.apache.cloudstack.api.user.sg.command.ListSecurityGroupsCmd;15
+createSecurityGroup=org.apache.cloudstack.api.user.securitygroup.command.CreateSecurityGroupCmd;15
+deleteSecurityGroup=org.apache.cloudstack.api.user.securitygroup.command.DeleteSecurityGroupCmd;15
+authorizeSecurityGroupIngress=org.apache.cloudstack.api.user.securitygroup.command.AuthorizeSecurityGroupIngressCmd;15
+revokeSecurityGroupIngress=org.apache.cloudstack.api.user.securitygroup.command.RevokeSecurityGroupIngressCmd;15
+authorizeSecurityGroupEgress=org.apache.cloudstack.api.user.securitygroup.command.AuthorizeSecurityGroupEgressCmd;15
+revokeSecurityGroupEgress=org.apache.cloudstack.api.user.securitygroup.command.RevokeSecurityGroupEgressCmd;15
+listSecurityGroups=org.apache.cloudstack.api.user.securitygroup.command.ListSecurityGroupsCmd;15
 
 #### vm group commands
 createInstanceGroup=org.apache.cloudstack.api.user.vmgroup.command.CreateVMGroupCmd;15

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/73d1099c/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java b/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java
index 40826c9..be8635c 100755
--- a/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java
+++ b/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java
@@ -36,7 +36,7 @@ import java.util.concurrent.TimeUnit;
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
-import org.apache.cloudstack.api.user.sg.command.*;
+import org.apache.cloudstack.api.user.securitygroup.command.*;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.log4j.Logger;
 
@@ -45,11 +45,7 @@ import com.cloud.agent.api.NetworkRulesSystemVmCommand;
 import com.cloud.agent.api.SecurityGroupRulesCmd;
 import com.cloud.agent.api.SecurityGroupRulesCmd.IpPortAndProto;
 import com.cloud.agent.manager.Commands;
-import org.apache.cloudstack.api.user.sg.command.AuthorizeSecurityGroupEgressCmd;
-import org.apache.cloudstack.api.user.sg.command.CreateSecurityGroupCmd;
-import org.apache.cloudstack.api.user.sg.command.DeleteSecurityGroupCmd;
-import org.apache.cloudstack.api.user.sg.command.ListSecurityGroupsCmd;
-import org.apache.cloudstack.api.user.sg.command.RevokeSecurityGroupEgressCmd;
+import org.apache.cloudstack.api.user.securitygroup.command.RevokeSecurityGroupEgressCmd;
 import com.cloud.configuration.Config;
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.domain.dao.DomainDao;