Skip to content

Commit 272a67e

Browse files
committed
CLOUDSTACK-8793 Added project id to create vpn customer gateway, and to the impl of list vpn connections and list vpn customer gateways
1 parent 2ce5a0c commit 272a67e

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
package org.apache.cloudstack.api.command.user.vpn;
1818

1919
import org.apache.log4j.Logger;
20-
2120
import org.apache.cloudstack.api.APICommand;
2221
import org.apache.cloudstack.api.ApiConstants;
2322
import org.apache.cloudstack.api.ApiErrorCode;
2423
import org.apache.cloudstack.api.BaseAsyncCmd;
2524
import org.apache.cloudstack.api.Parameter;
2625
import org.apache.cloudstack.api.ServerApiException;
26+
import org.apache.cloudstack.api.BaseCmd.CommandType;
2727
import org.apache.cloudstack.api.response.DomainResponse;
28+
import org.apache.cloudstack.api.response.ProjectResponse;
2829
import org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse;
2930
import org.apache.cloudstack.context.CallContext;
3031

@@ -84,6 +85,10 @@ public class CreateVpnCustomerGatewayCmd extends BaseAsyncCmd {
8485
+ "gateway associated with the account for the specified domain.")
8586
private Long domainId;
8687

88+
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class,
89+
description = "create site-to-site VPN customer gateway for the project")
90+
private Long projectId;
91+
8792
/////////////////////////////////////////////////////
8893
/////////////////// Accessors ///////////////////////
8994
/////////////////////////////////////////////////////
@@ -132,6 +137,10 @@ public Long getDomainId() {
132137
return domainId;
133138
}
134139

140+
public Long getProjectId() {
141+
return projectId;
142+
}
143+
135144
/////////////////////////////////////////////////////
136145
/////////////// API Implementation///////////////////
137146
/////////////////////////////////////////////////////
@@ -143,7 +152,7 @@ public String getCommandName() {
143152

144153
@Override
145154
public long getEntityOwnerId() {
146-
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true);
155+
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
147156
if (accountId == null) {
148157
accountId = CallContext.current().getCallingAccount().getId();
149158
}

server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ public Pair<List<? extends Site2SiteCustomerGateway>, Integer> searchForCustomer
583583

584584
Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean,
585585
ListProjectResourcesCriteria>(domainId, isRecursive, null);
586-
_accountMgr.buildACLSearchParameters(caller, id, accountName, null, permittedAccounts, domainIdRecursiveListProject, listAll, false);
586+
_accountMgr.buildACLSearchParameters(caller, id, accountName, cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, listAll, false);
587587
domainId = domainIdRecursiveListProject.first();
588588
isRecursive = domainIdRecursiveListProject.second();
589589
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.third();
@@ -673,7 +673,7 @@ public Pair<List<? extends Site2SiteVpnConnection>, Integer> searchForVpnConnect
673673

674674
Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean,
675675
ListProjectResourcesCriteria>(domainId, isRecursive, null);
676-
_accountMgr.buildACLSearchParameters(caller, id, accountName, null, permittedAccounts, domainIdRecursiveListProject, listAll, false);
676+
_accountMgr.buildACLSearchParameters(caller, id, accountName, cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, listAll, false);
677677
domainId = domainIdRecursiveListProject.first();
678678
isRecursive = domainIdRecursiveListProject.second();
679679
ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.third();

0 commit comments

Comments
 (0)