Skip to content

Commit 353423a

Browse files
author
Alena Prokharchyk
committed
Merge branch 'master' into vpc
Conflicts: api/src/com/cloud/api/commands/ListFirewallRulesCmd.java api/src/com/cloud/api/response/FirewallResponse.java api/src/com/cloud/api/response/IPAddressResponse.java server/src/com/cloud/api/ApiDBUtils.java server/src/com/cloud/network/NetworkManagerImpl.java server/src/com/cloud/network/dao/FirewallRulesDaoImpl.java server/src/com/cloud/network/dao/NetworkDaoImpl.java server/src/com/cloud/server/ManagementServerImpl.java
2 parents d334297 + 85677b7 commit 353423a

359 files changed

Lines changed: 2404 additions & 4981 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/src/com/cloud/api/BaseListDomainResourcesCmd.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@
1818

1919
public abstract class BaseListDomainResourcesCmd extends BaseListCmd {
2020

21-
@Parameter(name = ApiConstants.LIST_ALL, type = CommandType.BOOLEAN, description = "If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
21+
@Parameter(name = ApiConstants.LIST_ALL, type = CommandType.BOOLEAN, description = "If set to false, " +
22+
"list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
2223
private Boolean listAll;
2324

2425
@IdentityMapper(entityTableName = "domain")
25-
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LONG, description = "list only resources belonging to the domain specified")
26+
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LONG, description = "list only resources" +
27+
" belonging to the domain specified")
2628
private Long domainId;
2729

28-
@Parameter(name = ApiConstants.IS_RECURSIVE, type = CommandType.BOOLEAN, description = "defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.")
30+
@Parameter(name = ApiConstants.IS_RECURSIVE, type = CommandType.BOOLEAN, description = "defaults to false," +
31+
" but if true, lists all resources from the parent specified by the domainId till leaves.")
2932
private Boolean recursive;
3033

3134
public boolean listAll() {

api/src/com/cloud/api/BaseListProjectAndAccountResourcesCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
public abstract class BaseListProjectAndAccountResourcesCmd extends BaseListAccountResourcesCmd {
2020

2121
@IdentityMapper(entityTableName = "projects")
22-
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.LONG, description = "list firewall rules by project")
22+
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.LONG, description = "list objects by project")
2323
private Long projectId;
2424

2525
public Long getProjectId() {
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2012 Citrix Systems, Inc. Licensed under the
2+
// Apache License, Version 2.0 (the "License"); you may not use this
3+
// file except in compliance with the License. Citrix Systems, Inc.
4+
// reserves all rights not expressly granted by the License.
5+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an "AS IS" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
//
12+
// Automatically generated by addcopyright.py at 04/03/2012
13+
package com.cloud.api;
14+
15+
import java.util.Collection;
16+
import java.util.HashMap;
17+
import java.util.Iterator;
18+
import java.util.Map;
19+
20+
import com.cloud.exception.InvalidParameterValueException;
21+
22+
/**
23+
* @author Alena Prokharchyk
24+
*/
25+
public abstract class BaseListTaggedResourcesCmd extends BaseListProjectAndAccountResourcesCmd{
26+
@Parameter(name = ApiConstants.TAGS, type = CommandType.MAP, description = "List resources by tags (key/value pairs)")
27+
private Map tags;
28+
29+
public Map<String, String> getTags() {
30+
Map<String, String> tagsMap = null;
31+
if (tags != null && !tags.isEmpty()) {
32+
tagsMap = new HashMap<String, String>();
33+
Collection<?> servicesCollection = tags.values();
34+
Iterator<?> iter = servicesCollection.iterator();
35+
while (iter.hasNext()) {
36+
HashMap<String, String> services = (HashMap<String, String>) iter.next();
37+
String key = services.get("key");
38+
String value = services.get("value");
39+
if (value == null) {
40+
throw new InvalidParameterValueException("No value is passed in for key " + key);
41+
}
42+
tagsMap.put(key, value);
43+
}
44+
}
45+
return tagsMap;
46+
}
47+
}

api/src/com/cloud/api/ResponseGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,10 @@ public interface ResponseGenerator {
300300

301301
/**
302302
* @param resourceTag
303+
* @param keyValueOnly TODO
303304
* @return
304305
*/
305-
ResourceTagResponse createResourceTagResponse(ResourceTag resourceTag);
306+
ResourceTagResponse createResourceTagResponse(ResourceTag resourceTag, boolean keyValueOnly);
306307

307308
Site2SiteVpnGatewayResponse createSite2SiteVpnGatewayResponse(Site2SiteVpnGateway result);
308309

api/src/com/cloud/api/commands/CreateTagsCmd.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
// Copyright 2012 Citrix Systems, Inc. Licensed under the
2-
// Apache License, Version 2.0 (the "License"); you may not use this
3-
// file except in compliance with the License. Citrix Systems, Inc.
4-
// reserves all rights not expressly granted by the License.
5-
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6-
// Unless required by applicable law or agreed to in writing, software
7-
// distributed under the License is distributed on an "AS IS" BASIS,
8-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9-
// See the License for the specific language governing permissions and
10-
// limitations under the License.
11-
//
12-
// Automatically generated by addcopyright.py at 04/03/2012
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http:www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
//
1318
package com.cloud.api.commands;
1419

1520
import java.util.Collection;

api/src/com/cloud/api/commands/DeleteTagsCmd.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
// Copyright 2012 Citrix Systems, Inc. Licensed under the
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http:www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
//
218
package com.cloud.api.commands;
319

420
import java.util.Collection;
@@ -17,7 +33,6 @@
1733
import com.cloud.api.ServerApiException;
1834
import com.cloud.api.response.SuccessResponse;
1935
import com.cloud.event.EventTypes;
20-
import com.cloud.server.ResourceTag;
2136
import com.cloud.server.ResourceTag.TaggedResourceType;
2237

2338
/**
@@ -28,7 +43,7 @@
2843
public class DeleteTagsCmd extends BaseAsyncCmd{
2944
public static final Logger s_logger = Logger.getLogger(DeleteTagsCmd.class.getName());
3045

31-
private static final String s_name = "deleteTagsresponse";
46+
private static final String s_name = "deletetagsresponse";
3247

3348
// ///////////////////////////////////////////////////
3449
// ////////////// API parameters /////////////////////

api/src/com/cloud/api/commands/ListFirewallRulesCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.apache.log4j.Logger;
2323

2424
import com.cloud.api.ApiConstants;
25-
import com.cloud.api.BaseListProjectAndAccountResourcesCmd;
25+
import com.cloud.api.BaseListTaggedResourcesCmd;
2626
import com.cloud.api.IdentityMapper;
2727
import com.cloud.api.Implementation;
2828
import com.cloud.api.Parameter;
@@ -31,7 +31,7 @@
3131
import com.cloud.network.rules.FirewallRule;
3232

3333
@Implementation(description="Lists all firewall rules for an IP address.", responseObject=FirewallResponse.class)
34-
public class ListFirewallRulesCmd extends BaseListProjectAndAccountResourcesCmd {
34+
public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd {
3535
public static final Logger s_logger = Logger.getLogger(ListFirewallRulesCmd.class.getName());
3636
private static final String s_name = "listfirewallrulesresponse";
3737

api/src/com/cloud/api/commands/ListIsosCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import com.cloud.api.ApiConstants;
2626
import com.cloud.api.BaseCmd.CommandType;
27-
import com.cloud.api.BaseListProjectAndAccountResourcesCmd;
27+
import com.cloud.api.BaseListTaggedResourcesCmd;
2828
import com.cloud.api.IdentityMapper;
2929
import com.cloud.api.Implementation;
3030
import com.cloud.api.Parameter;
@@ -37,7 +37,7 @@
3737
import com.cloud.utils.Pair;
3838

3939
@Implementation(description="Lists all available ISO files.", responseObject=TemplateResponse.class)
40-
public class ListIsosCmd extends BaseListProjectAndAccountResourcesCmd {
40+
public class ListIsosCmd extends BaseListTaggedResourcesCmd {
4141
public static final Logger s_logger = Logger.getLogger(ListIsosCmd.class.getName());
4242

4343
private static final String s_name = "listisosresponse";

api/src/com/cloud/api/commands/ListLoadBalancerRulesCmd.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
import org.apache.log4j.Logger;
2323

2424
import com.cloud.api.ApiConstants;
25-
import com.cloud.api.BaseCmd.CommandType;
26-
import com.cloud.api.BaseListProjectAndAccountResourcesCmd;
25+
import com.cloud.api.BaseListTaggedResourcesCmd;
2726
import com.cloud.api.IdentityMapper;
2827
import com.cloud.api.Implementation;
2928
import com.cloud.api.Parameter;
@@ -32,7 +31,7 @@
3231
import com.cloud.network.rules.LoadBalancer;
3332

3433
@Implementation(description = "Lists load balancer rules.", responseObject = LoadBalancerResponse.class)
35-
public class ListLoadBalancerRulesCmd extends BaseListProjectAndAccountResourcesCmd {
34+
public class ListLoadBalancerRulesCmd extends BaseListTaggedResourcesCmd {
3635
public static final Logger s_logger = Logger.getLogger(ListLoadBalancerRulesCmd.class.getName());
3736

3837
private static final String s_name = "listloadbalancerrulesresponse";

api/src/com/cloud/api/commands/ListNetworksCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.apache.log4j.Logger;
2323

2424
import com.cloud.api.ApiConstants;
25-
import com.cloud.api.BaseListProjectAndAccountResourcesCmd;
25+
import com.cloud.api.BaseListTaggedResourcesCmd;
2626
import com.cloud.api.IdentityMapper;
2727
import com.cloud.api.Implementation;
2828
import com.cloud.api.Parameter;
@@ -32,7 +32,7 @@
3232

3333

3434
@Implementation(description="Lists all available networks.", responseObject=NetworkResponse.class)
35-
public class ListNetworksCmd extends BaseListProjectAndAccountResourcesCmd {
35+
public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
3636
public static final Logger s_logger = Logger.getLogger(ListNetworksCmd.class.getName());
3737
private static final String _name = "listnetworksresponse";
3838

0 commit comments

Comments
 (0)