You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ki...@apache.org on 2013/01/28 13:22:51 UTC
[45/50] [abbrv] git commit: Apply API refactoring changes. Make
changes to Regions API to work with new code
Apply API refactoring changes. Make changes to Regions API to work with new code
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/de20cb6c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/de20cb6c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/de20cb6c
Branch: refs/heads/regions
Commit: de20cb6c1a2e80a417c5fb7c66ab51ed6fe84faf
Parents: 1f57d92
Author: Kishan Kavala <ki...@cloud.com>
Authored: Fri Jan 25 18:45:01 2013 +0530
Committer: Kishan Kavala <ki...@cloud.com>
Committed: Fri Jan 25 18:45:01 2013 +0530
----------------------------------------------------------------------
api/src/com/cloud/api/commands/AddRegionCmd.java | 103 --
api/src/com/cloud/api/commands/FindAccountCmd.java | 77 -
api/src/com/cloud/api/commands/FindDomainCmd.java | 90 --
api/src/com/cloud/api/commands/FindUserCmd.java | 84 --
api/src/com/cloud/api/commands/ListRegionsCmd.java | 84 --
.../com/cloud/api/commands/RemoveRegionCmd.java | 73 -
.../com/cloud/api/commands/UpdateRegionCmd.java | 102 --
.../cloud/api/response/FindAccountResponse.java | 95 --
.../com/cloud/api/response/FindDomainResponse.java | 111 --
.../com/cloud/api/response/FindUserResponse.java | 189 ---
api/src/com/cloud/api/response/RegionResponse.java | 57 -
api/src/com/cloud/region/RegionService.java | 11 +-
api/src/com/cloud/user/DomainService.java | 2 +
.../apache/cloudstack/api/ResponseGenerator.java | 13 +-
.../api/command/admin/account/FindAccountCmd.java | 76 +
.../api/command/admin/domain/FindDomainCmd.java | 89 ++
.../api/command/admin/region/AddRegionCmd.java | 104 ++
.../api/command/admin/region/RemoveRegionCmd.java | 74 +
.../api/command/admin/region/UpdateRegionCmd.java | 103 ++
.../api/command/admin/user/FindUserCmd.java | 83 ++
.../api/command/user/region/ListRegionsCmd.java | 84 ++
.../api/response/FindAccountResponse.java | 106 ++
.../api/response/FindDomainResponse.java | 103 ++
.../cloudstack/api/response/FindUserResponse.java | 193 +++
.../cloudstack/api/response/RegionResponse.java | 59 +
server/src/com/cloud/api/ApiResponseHelper.java | 119 +--
server/src/com/cloud/api/ApiServer.java | 4 +-
server/src/com/cloud/api/MockApiServer.java | 1101 ++++++++-------
server/src/com/cloud/region/RegionManager.java | 4 +-
server/src/com/cloud/region/RegionManagerImpl.java | 12 +-
30 files changed, 1671 insertions(+), 1734 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/api/commands/AddRegionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/AddRegionCmd.java b/api/src/com/cloud/api/commands/AddRegionCmd.java
deleted file mode 100644
index f2fd91f..0000000
--- a/api/src/com/cloud/api/commands/AddRegionCmd.java
+++ /dev/null
@@ -1,103 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.RegionResponse;
-import com.cloud.region.Region;
-import com.cloud.user.Account;
-
-@Implementation(description="Adds a Region", responseObject=RegionResponse.class)
-public class AddRegionCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(AddRegionCmd.class.getName());
-
- private static final String s_name = "addregionresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="Id of the Region")
- private Integer id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="adds Region with this name")
- private String regionName;
-
- @Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, required=true, description="end_point of the Region")
- private String endPoint;
-
- @Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="API key")
- private String apiKey;
-
- @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="Secret Key")
- private String secretKey;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Integer getId() {
- return id;
- }
-
- public String getRegionName() {
- return regionName;
- }
-
- public String getEndPoint() {
- return endPoint;
- }
-
- public String getApiKey() {
- return apiKey;
- }
-
- public String getSecretKey() {
- return secretKey;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- Region region = _regionService.addRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey());
- if (region != null) {
- RegionResponse response = _responseGenerator.createRegionResponse(region);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Region");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/api/commands/FindAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/FindAccountCmd.java b/api/src/com/cloud/api/commands/FindAccountCmd.java
deleted file mode 100644
index 3c8610a..0000000
--- a/api/src/com/cloud/api/commands/FindAccountCmd.java
+++ /dev/null
@@ -1,77 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.FindAccountResponse;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.user.Account;
-
-@Implementation(description="Find account by ID", responseObject=FindAccountResponse.class)
-public class FindAccountCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(FindAccountCmd.class.getName());
-
- private static final String s_name = "findaccountresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="account")
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required=true, description = "Id of the account")
- private Long id;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return 0;
- }
-
- @Override
- public void execute(){
- Account result = _accountService.findAccount(getId());
- if(result != null){
- FindAccountResponse response = _responseGenerator.createFindAccountResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new InvalidParameterValueException("Account with specified Id does not exist");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/api/commands/FindDomainCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/FindDomainCmd.java b/api/src/com/cloud/api/commands/FindDomainCmd.java
deleted file mode 100644
index cb299d1..0000000
--- a/api/src/com/cloud/api/commands/FindDomainCmd.java
+++ /dev/null
@@ -1,90 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.FindDomainResponse;
-import com.cloud.domain.Domain;
-import com.cloud.exception.InvalidParameterValueException;
-
-@Implementation(description="Find account by ID", responseObject=FindDomainResponse.class)
-public class FindDomainCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(FindDomainCmd.class.getName());
-
- private static final String s_name = "finddomainresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "Id of the domain")
- private Long id;
-
- @Parameter(name = ApiConstants.DOMAIN, type = CommandType.STRING, description = "Path of the domain")
- private String domain;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- public String getDomain() {
- return domain;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return 0;
- }
-
- @Override
- public void execute(){
- Domain result = null;
- if(getId() != null){
- result = _domainService.getDomain(getId());
- } else if (getDomain() != null){
- result = _domainService.findDomainByPath(getDomain());
- }
-
- if(result != null){
- FindDomainResponse response = _responseGenerator.createFindDomainResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new InvalidParameterValueException("Domain with specified Id does not exist");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/api/commands/FindUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/FindUserCmd.java b/api/src/com/cloud/api/commands/FindUserCmd.java
deleted file mode 100644
index cd46ffd..0000000
--- a/api/src/com/cloud/api/commands/FindUserCmd.java
+++ /dev/null
@@ -1,84 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.IdentityMapper;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.FindUserResponse;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.user.User;
-
-@Implementation(description="Find user by name and domain", responseObject=FindUserResponse.class)
-public class FindUserCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(FindUserCmd.class.getName());
-
- private static final String s_name = "finduserresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="find user with specified username")
- private String username;
-
- @IdentityMapper(entityTableName="domain")
- @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LONG, required=true, description = "Domain the user belongs to")
- private Long domainId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getUserName() {
- return username;
- }
-
- public Long getDomainId() {
- return domainId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return 0;
- }
-
- @Override
- public void execute(){
- User result = _accountService.findUser(getUserName(), getDomainId());
- if(result != null){
- FindUserResponse response = _responseGenerator.createFindUserResponse(result);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new InvalidParameterValueException("User with specified name and domainId does not exist");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/api/commands/ListRegionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListRegionsCmd.java b/api/src/com/cloud/api/commands/ListRegionsCmd.java
deleted file mode 100644
index 53b7a6e..0000000
--- a/api/src/com/cloud/api/commands/ListRegionsCmd.java
+++ /dev/null
@@ -1,84 +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.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.api.BaseListCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.RegionResponse;
-import com.cloud.region.Region;
-
-@Implementation(description="Lists Regions", responseObject=RegionResponse.class)
-public class ListRegionsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListRegionsCmd.class.getName());
-
- private static final String s_name = "listregionsresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="List Region by region ID.")
- private Integer id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="List Region by region name.")
- private String domainName;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Integer getId() {
- return id;
- }
-
- public String getRegionName() {
- return domainName;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public void execute(){
- List<? extends Region> result = _regionService.listRegions(this);
- ListResponse<RegionResponse> response = new ListResponse<RegionResponse>();
- List<RegionResponse> regionResponses = new ArrayList<RegionResponse>();
- for (Region region : result) {
- RegionResponse regionResponse = _responseGenerator.createRegionResponse(region);
- regionResponse.setObjectName("region");
- regionResponses.add(regionResponse);
- }
-
- response.setResponses(regionResponses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/api/commands/RemoveRegionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RemoveRegionCmd.java b/api/src/com/cloud/api/commands/RemoveRegionCmd.java
deleted file mode 100644
index a42ce4b..0000000
--- a/api/src/com/cloud/api/commands/RemoveRegionCmd.java
+++ /dev/null
@@ -1,73 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.SuccessResponse;
-import com.cloud.user.Account;
-
-@Implementation(description="Removes specified region", responseObject=SuccessResponse.class)
-public class RemoveRegionCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(RemoveRegionCmd.class.getName());
- private static final String s_name = "updateregionresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="ID of the region to delete")
- private Integer id;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Integer 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 = _regionService.removeRegion(id);
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove region");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/api/commands/UpdateRegionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpdateRegionCmd.java b/api/src/com/cloud/api/commands/UpdateRegionCmd.java
deleted file mode 100644
index f1f1dba..0000000
--- a/api/src/com/cloud/api/commands/UpdateRegionCmd.java
+++ /dev/null
@@ -1,102 +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 com.cloud.api.ApiConstants;
-import com.cloud.api.BaseCmd;
-import com.cloud.api.Implementation;
-import com.cloud.api.Parameter;
-import com.cloud.api.ServerApiException;
-import com.cloud.api.response.RegionResponse;
-import com.cloud.region.Region;
-import com.cloud.user.Account;
-
-@Implementation(description="Updates a region", responseObject=RegionResponse.class)
-public class UpdateRegionCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(UpdateRegionCmd.class.getName());
- private static final String s_name = "updateregionresponse";
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="ID of region to update")
- private Integer id;
-
- @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="updates region with this name")
- private String regionName;
-
- @Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, description="updates region with this end point")
- private String endPoint;
-
- @Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="API key")
- private String apiKey;
-
- @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="Secret Key")
- private String secretKey;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Integer getId() {
- return id;
- }
-
- public String getRegionName() {
- return regionName;
- }
-
- public String getEndPoint() {
- return endPoint;
- }
-
- public String getApiKey() {
- return apiKey;
- }
-
- public String getSecretKey() {
- return secretKey;
- }
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
- public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-
- @Override
- public void execute(){
- Region region = _regionService.updateRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey());
- if (region != null) {
- RegionResponse response = _responseGenerator.createRegionResponse(region);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update Region");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/api/response/FindAccountResponse.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/response/FindAccountResponse.java b/api/src/com/cloud/api/response/FindAccountResponse.java
deleted file mode 100755
index bf79abd..0000000
--- a/api/src/com/cloud/api/response/FindAccountResponse.java
+++ /dev/null
@@ -1,95 +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.response;
-
-import java.util.List;
-import java.util.Map;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.serializer.Param;
-import com.cloud.utils.IdentityProxy;
-import com.google.gson.annotations.SerializedName;
-
-@SuppressWarnings("unused")
-public class FindAccountResponse extends BaseResponse {
- @SerializedName(ApiConstants.ID) @Param(description="the id of the account")
- private IdentityProxy id = new IdentityProxy("account");
-
- @SerializedName(ApiConstants.NAME) @Param(description="the name of the account")
- private String name;
-
- @SerializedName(ApiConstants.ACCOUNT_TYPE) @Param(description="account type (admin, domain-admin, user)")
- private Short accountType;
-
- @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="id of the Domain the account belongs too")
- private IdentityProxy domainId = new IdentityProxy("domain");
-
- @SerializedName(ApiConstants.DEFAULT_ZONE_ID) @Param(description="the default zone of the account")
- private IdentityProxy defaultZoneId = new IdentityProxy("data_center");
-
- @SerializedName(ApiConstants.STATE) @Param(description="the state of the account")
- private String state;
-
- @SerializedName(ApiConstants.NETWORK_DOMAIN) @Param(description="the network domain")
- private String networkDomain;
-
- @SerializedName(ApiConstants.ACCOUNT_DETAILS) @Param(description="details for the account")
- private Map<String, String> details;
-
- @SerializedName("regionId") @Param(description="source region id of the user")
- private int regionId;
-
- public void setId(Long id) {
- this.id.setValue(id);
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setAccountType(Short accountType) {
- this.accountType = accountType;
- }
-
- public void setDomainId(Long domainId) {
- this.domainId.setValue(domainId);
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public void setNetworkDomain(String networkDomain) {
- this.networkDomain = networkDomain;
- }
-
- public void setDetails(Map<String, String> details) {
- this.details = details;
- }
-
- public void setDefaultZone(Long defaultZoneId) {
- this.defaultZoneId.setValue(defaultZoneId);
- }
-
- public int getRegionId() {
- return regionId;
- }
-
- public void setRegionId(int regionId) {
- this.regionId = regionId;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/api/response/FindDomainResponse.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/response/FindDomainResponse.java b/api/src/com/cloud/api/response/FindDomainResponse.java
deleted file mode 100644
index befb632..0000000
--- a/api/src/com/cloud/api/response/FindDomainResponse.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.response;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.utils.IdentityProxy;
-import com.cloud.serializer.Param;
-import com.google.gson.annotations.SerializedName;
-
-public class FindDomainResponse extends BaseResponse {
- @SerializedName(ApiConstants.ID) @Param(description="the ID of the domain")
- private IdentityProxy id = new IdentityProxy("domain");
-
- @SerializedName(ApiConstants.NAME) @Param(description="the name of the domain")
- private String domainName;
-
- @SerializedName(ApiConstants.LEVEL) @Param(description="the level of the domain")
- private Integer level;
-
- @SerializedName("parentdomainid") @Param(description="the domain ID of the parent domain")
- private IdentityProxy parent = new IdentityProxy("domain");
-
- @SerializedName("haschild") @Param(description="whether the domain has one or more sub-domains")
- private boolean hasChild;
-
- @SerializedName(ApiConstants.NETWORK_DOMAIN) @Param(description="the network domain")
- private String networkDomain;
-
- @SerializedName(ApiConstants.PATH) @Param(description="the path of the domain")
- private String path;
-
- @SerializedName(ApiConstants.STATE) @Param(description="the state of the domain")
- private String state;
-
- @SerializedName("regionId") @Param(description="source region id of the user")
- private int regionId;
-
- public Long getId() {
- return id.getValue();
- }
-
- public void setId(Long id) {
- this.id.setValue(id);
- }
-
- public String getDomainName() {
- return domainName;
- }
-
- public void setDomainName(String domainName) {
- this.domainName = domainName;
- }
-
- public Integer getLevel() {
- return level;
- }
-
- public void setLevel(Integer level) {
- this.level = level;
- }
-
- public Long getParent() {
- return parent.getValue();
- }
-
- public void setParent(Long parent) {
- this.parent.setValue(parent);
- }
-
- public boolean getHasChild() {
- return hasChild;
- }
-
- public void setHasChild(boolean hasChild) {
- this.hasChild = hasChild;
- }
-
- public void setNetworkDomain(String networkDomain) {
- this.networkDomain = networkDomain;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public int getRegionId() {
- return regionId;
- }
-
- public void setRegionId(int regionId) {
- this.regionId = regionId;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/api/response/FindUserResponse.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/response/FindUserResponse.java b/api/src/com/cloud/api/response/FindUserResponse.java
deleted file mode 100644
index 3532f2c..0000000
--- a/api/src/com/cloud/api/response/FindUserResponse.java
+++ /dev/null
@@ -1,189 +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.response;
-
-import java.util.Date;
-
-import com.cloud.serializer.Param;
-import com.cloud.utils.IdentityProxy;
-import com.google.gson.annotations.SerializedName;
-
-public class FindUserResponse extends BaseResponse {
- @SerializedName("id") @Param(description="the user ID")
- private IdentityProxy id = new IdentityProxy("user");
-
- @SerializedName("username") @Param(description="the user name")
- private String username;
-
- @SerializedName("password") @Param(description="the password of the user")
- private String password;
-
- @SerializedName("firstname") @Param(description="the user firstname")
- private String firstname;
-
- @SerializedName("lastname") @Param(description="the user lastname")
- private String lastname;
-
- @SerializedName("accountId") @Param(description="the account ID of the user")
- private IdentityProxy accountId = new IdentityProxy("account");
-
- @SerializedName("email") @Param(description="the user email address")
- private String email;
-
- @SerializedName("state") @Param(description="the user state")
- private String state;
-
- @SerializedName("apikey") @Param(description="the api key of the user")
- private String apiKey;
-
- @SerializedName("secretkey") @Param(description="the secret key of the user")
- private String secretKey;
-
- @SerializedName("created") @Param(description="the date and time the user account was created")
- private Date created;
-
- @SerializedName("timezone") @Param(description="the timezone user was created in")
- private String timezone;
-
- @SerializedName("registrationtoken") @Param(description="the registration token")
- private String registrationToken;
-
- @SerializedName("registered") @Param(description="registration flag")
- boolean registered;
-
- @SerializedName("regionId") @Param(description="source region id of the user")
- private int regionId;
-
- public Long getId() {
- return id.getValue();
- }
-
- public void setId(Long id) {
- this.id.setValue(id);
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public String getFirstname() {
- return firstname;
- }
-
- public void setFirstname(String firstname) {
- this.firstname = firstname;
- }
-
- public String getLastname() {
- return lastname;
- }
-
- public void setLastname(String lastname) {
- this.lastname = lastname;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public Date getCreated() {
- return created;
- }
-
- public void setCreated(Date created) {
- this.created = created;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public String getTimezone() {
- return timezone;
- }
-
- public void setTimezone(String timezone) {
- this.timezone = timezone;
- }
-
- public String getApiKey() {
- return apiKey;
- }
-
- public void setApiKey(String apiKey) {
- this.apiKey = apiKey;
- }
-
- public String getSecretKey() {
- return secretKey;
- }
-
- public void setSecretKey(String secretKey) {
- this.secretKey = secretKey;
- }
- public Long getAccountId() {
- return accountId.getValue();
- }
-
- public void setAccountId(Long accountId) {
- this.accountId.setValue(accountId);
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getRegistrationToken() {
- return registrationToken;
- }
-
- public void setRegistrationToken(String registrationToken) {
- this.registrationToken = registrationToken;
- }
-
- public boolean isRegistered() {
- return registered;
- }
-
- public void setRegistered(boolean registered) {
- this.registered = registered;
- }
-
- public int getRegionId() {
- return regionId;
- }
-
- public void setRegionId(int regionId) {
- this.regionId = regionId;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/api/response/RegionResponse.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/response/RegionResponse.java b/api/src/com/cloud/api/response/RegionResponse.java
deleted file mode 100644
index 92f97c7..0000000
--- a/api/src/com/cloud/api/response/RegionResponse.java
+++ /dev/null
@@ -1,57 +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.response;
-
-import com.cloud.api.ApiConstants;
-import com.cloud.serializer.Param;
-import com.google.gson.annotations.SerializedName;
-
-public class RegionResponse extends BaseResponse {
- @SerializedName(ApiConstants.ID) @Param(description="the ID of the region")
- private Integer id;
-
- @SerializedName(ApiConstants.NAME) @Param(description="the name of the region")
- private String name;
-
- @SerializedName(ApiConstants.END_POINT) @Param(description="the end point of the region")
- private String endPoint;
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getEndPoint() {
- return endPoint;
- }
-
- public void setEndPoint(String endPoint) {
- this.endPoint = endPoint;
- }
-
- }
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/region/RegionService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/region/RegionService.java b/api/src/com/cloud/region/RegionService.java
index a10bcfa..ef4b5cb 100644
--- a/api/src/com/cloud/region/RegionService.java
+++ b/api/src/com/cloud/region/RegionService.java
@@ -18,11 +18,12 @@ package com.cloud.region;
import java.util.List;
-import com.cloud.api.commands.DeleteUserCmd;
-import com.cloud.api.commands.ListRegionsCmd;
-import com.cloud.api.commands.UpdateAccountCmd;
-import com.cloud.api.commands.UpdateDomainCmd;
-import com.cloud.api.commands.UpdateUserCmd;
+import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
+import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
+import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
+import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
+import org.apache.cloudstack.api.command.user.region.ListRegionsCmd;
+
import com.cloud.domain.Domain;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.ResourceUnavailableException;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/com/cloud/user/DomainService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/user/DomainService.java b/api/src/com/cloud/user/DomainService.java
index 1d207e7..9fca09d 100644
--- a/api/src/com/cloud/user/DomainService.java
+++ b/api/src/com/cloud/user/DomainService.java
@@ -20,6 +20,8 @@ import java.util.List;
import org.apache.cloudstack.api.command.admin.domain.ListDomainChildrenCmd;
import org.apache.cloudstack.api.command.admin.domain.ListDomainsCmd;
+import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
+
import com.cloud.domain.Domain;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.utils.Pair;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/org/apache/cloudstack/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index d0be69c..e380642 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -39,6 +39,9 @@ import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.DomainRouterResponse;
import org.apache.cloudstack.api.response.EventResponse;
import org.apache.cloudstack.api.response.ExtractResponse;
+import org.apache.cloudstack.api.response.FindAccountResponse;
+import org.apache.cloudstack.api.response.FindDomainResponse;
+import org.apache.cloudstack.api.response.FindUserResponse;
import org.apache.cloudstack.api.response.FirewallResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
@@ -60,10 +63,12 @@ import org.apache.cloudstack.api.response.ProjectAccountResponse;
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.ProviderResponse;
+import org.apache.cloudstack.api.response.RegionResponse;
import org.apache.cloudstack.api.response.RemoteAccessVpnResponse;
import org.apache.cloudstack.api.response.ResourceCountResponse;
import org.apache.cloudstack.api.response.ResourceLimitResponse;
import org.apache.cloudstack.api.response.ResourceTagResponse;
+import org.apache.cloudstack.api.response.S3Response;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.ServiceResponse;
@@ -92,12 +97,6 @@ import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.VpnUsersResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
-import org.apache.cloudstack.api.response.S3Response;
-
-import com.cloud.api.response.FindAccountResponse;
-import com.cloud.api.response.FindDomainResponse;
-import com.cloud.api.response.FindUserResponse;
-import com.cloud.api.response.RegionResponse;
import com.cloud.async.AsyncJob;
import com.cloud.capacity.Capacity;
import com.cloud.configuration.Configuration;
@@ -105,7 +104,6 @@ import com.cloud.configuration.ResourceCount;
import com.cloud.configuration.ResourceLimit;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
-import com.cloud.region.Region;
import com.cloud.dc.StorageNetworkIpRange;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
@@ -148,6 +146,7 @@ import com.cloud.org.Cluster;
import com.cloud.projects.Project;
import com.cloud.projects.ProjectAccount;
import com.cloud.projects.ProjectInvitation;
+import com.cloud.region.Region;
import com.cloud.server.ResourceTag;
import com.cloud.storage.GuestOS;
import com.cloud.storage.S3;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/org/apache/cloudstack/api/command/admin/account/FindAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/FindAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/FindAccountCmd.java
new file mode 100644
index 0000000..9cfe548
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/FindAccountCmd.java
@@ -0,0 +1,76 @@
+// 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.command.admin.account;
+
+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.AccountResponse;
+import org.apache.cloudstack.api.response.FindAccountResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.Account;
+
+@APICommand(name = "findAccount", description="Find account by ID", responseObject=FindAccountResponse.class)
+public class FindAccountCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(FindAccountCmd.class.getName());
+
+ private static final String s_name = "findaccountresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type=CommandType.UUID, entityType=AccountResponse.class, required=true, description = "Id of the account")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return 0;
+ }
+
+ @Override
+ public void execute(){
+ Account result = _accountService.findAccount(getId());
+ if(result != null){
+ FindAccountResponse response = _responseGenerator.createFindAccountResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new InvalidParameterValueException("Account with specified Id does not exist");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/org/apache/cloudstack/api/command/admin/domain/FindDomainCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/FindDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/FindDomainCmd.java
new file mode 100644
index 0000000..ff9bdc1
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/FindDomainCmd.java
@@ -0,0 +1,89 @@
+// 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.command.admin.domain;
+
+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.DomainResponse;
+import org.apache.cloudstack.api.response.FindDomainResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.domain.Domain;
+import com.cloud.exception.InvalidParameterValueException;
+
+@APICommand(name = "findDomain", description="Find account by ID", responseObject=FindDomainResponse.class)
+public class FindDomainCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(FindDomainCmd.class.getName());
+
+ private static final String s_name = "finddomainresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type=CommandType.UUID, entityType=DomainResponse.class, description = "Id of the domain")
+ private Long id;
+
+ @Parameter(name = ApiConstants.DOMAIN, type = CommandType.STRING, description = "Path of the domain")
+ private String domain;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return 0;
+ }
+
+ @Override
+ public void execute(){
+ Domain result = null;
+ if(getId() != null){
+ result = _domainService.getDomain(getId());
+ } else if (getDomain() != null){
+ result = _domainService.findDomainByPath(getDomain());
+ }
+
+ if(result != null){
+ FindDomainResponse response = _responseGenerator.createFindDomainResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new InvalidParameterValueException("Domain with specified Id does not exist");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
new file mode 100644
index 0000000..73453a6
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
@@ -0,0 +1,104 @@
+// 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.command.admin.region;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.RegionResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.region.Region;
+import com.cloud.user.Account;
+
+@APICommand(name = "addRegion", description="Adds a Region", responseObject=RegionResponse.class)
+public class AddRegionCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(AddRegionCmd.class.getName());
+
+ private static final String s_name = "addregionresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="Id of the Region")
+ private Integer id;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="adds Region with this name")
+ private String regionName;
+
+ @Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, required=true, description="end_point of the Region")
+ private String endPoint;
+
+ @Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="API key")
+ private String apiKey;
+
+ @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="Secret Key")
+ private String secretKey;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getRegionName() {
+ return regionName;
+ }
+
+ public String getEndPoint() {
+ return endPoint;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public String getSecretKey() {
+ return secretKey;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ Region region = _regionService.addRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey());
+ if (region != null) {
+ RegionResponse response = _responseGenerator.createRegionResponse(region);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Region");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
new file mode 100644
index 0000000..bb74c17
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
@@ -0,0 +1,74 @@
+// 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.command.admin.region;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "removeRegion", description="Removes specified region", responseObject=SuccessResponse.class)
+public class RemoveRegionCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(RemoveRegionCmd.class.getName());
+ private static final String s_name = "updateregionresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="ID of the region to delete")
+ private Integer id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer 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 = _regionService.removeRegion(id);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove region");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
new file mode 100644
index 0000000..626fb33
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
@@ -0,0 +1,103 @@
+// 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.command.admin.region;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.RegionResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.region.Region;
+import com.cloud.user.Account;
+
+@APICommand(name = "updateRegion", description="Updates a region", responseObject=RegionResponse.class)
+public class UpdateRegionCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateRegionCmd.class.getName());
+ private static final String s_name = "updateregionresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="ID of region to update")
+ private Integer id;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="updates region with this name")
+ private String regionName;
+
+ @Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, description="updates region with this end point")
+ private String endPoint;
+
+ @Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="API key")
+ private String apiKey;
+
+ @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="Secret Key")
+ private String secretKey;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getRegionName() {
+ return regionName;
+ }
+
+ public String getEndPoint() {
+ return endPoint;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public String getSecretKey() {
+ return secretKey;
+ }
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ Region region = _regionService.updateRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey());
+ if (region != null) {
+ RegionResponse response = _responseGenerator.createRegionResponse(region);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Region");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/org/apache/cloudstack/api/command/admin/user/FindUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/FindUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/FindUserCmd.java
new file mode 100644
index 0000000..ffd5487
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/FindUserCmd.java
@@ -0,0 +1,83 @@
+// 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.command.admin.user;
+
+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.DomainResponse;
+import org.apache.cloudstack.api.response.FindUserResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.User;
+
+@APICommand(name = "findUser", description="Find user by name and domain", responseObject=FindUserResponse.class)
+public class FindUserCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(FindUserCmd.class.getName());
+
+ private static final String s_name = "finduserresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="find user with specified username")
+ private String username;
+
+ @Parameter(name = ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class, required=true, description = "Domain the user belongs to")
+ private Long domainId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getUserName() {
+ return username;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return 0;
+ }
+
+ @Override
+ public void execute(){
+ User result = _accountService.findUser(getUserName(), getDomainId());
+ if(result != null){
+ FindUserResponse response = _responseGenerator.createFindUserResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new InvalidParameterValueException("User with specified name and domainId does not exist");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
new file mode 100644
index 0000000..beddc3f
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
@@ -0,0 +1,84 @@
+// 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.command.user.region;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.RegionResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.region.Region;
+
+@APICommand(name = "listRegions", description="Lists Regions", responseObject=RegionResponse.class)
+public class ListRegionsCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListRegionsCmd.class.getName());
+
+ private static final String s_name = "listregionsresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="List Region by region ID.")
+ private Integer id;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="List Region by region name.")
+ private String domainName;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getRegionName() {
+ return domainName;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ List<? extends Region> result = _regionService.listRegions(this);
+ ListResponse<RegionResponse> response = new ListResponse<RegionResponse>();
+ List<RegionResponse> regionResponses = new ArrayList<RegionResponse>();
+ for (Region region : result) {
+ RegionResponse regionResponse = _responseGenerator.createRegionResponse(region);
+ regionResponse.setObjectName("region");
+ regionResponses.add(regionResponse);
+ }
+
+ response.setResponses(regionResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/org/apache/cloudstack/api/response/FindAccountResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/FindAccountResponse.java b/api/src/org/apache/cloudstack/api/response/FindAccountResponse.java
new file mode 100755
index 0000000..6cff618
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/FindAccountResponse.java
@@ -0,0 +1,106 @@
+// 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 java.util.Map;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.serializer.Param;
+import com.cloud.user.Account;
+import com.google.gson.annotations.SerializedName;
+
+@SuppressWarnings("unused")
+@EntityReference(value = Account.class)
+public class FindAccountResponse extends BaseResponse {
+ @SerializedName(ApiConstants.ID) @Param(description="the id of the account")
+ private String id;
+
+ @SerializedName(ApiConstants.NAME) @Param(description="the name of the account")
+ private String name;
+
+ @SerializedName(ApiConstants.ACCOUNT_TYPE) @Param(description="account type (admin, domain-admin, user)")
+ private Short accountType;
+
+ @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="id of the Domain the account belongs too")
+ private String domainId;
+
+ @SerializedName(ApiConstants.DEFAULT_ZONE_ID) @Param(description="the default zone of the account")
+ private String defaultZoneId;
+
+ @SerializedName(ApiConstants.STATE) @Param(description="the state of the account")
+ private String state;
+
+ @SerializedName(ApiConstants.NETWORK_DOMAIN) @Param(description="the network domain")
+ private String networkDomain;
+
+ @SerializedName(ApiConstants.ACCOUNT_DETAILS) @Param(description="details for the account")
+ private Map<String, String> details;
+
+ @SerializedName("regionId") @Param(description="source region id of the user")
+ private int regionId;
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setAccountType(Short accountType) {
+ this.accountType = accountType;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public void setNetworkDomain(String networkDomain) {
+ this.networkDomain = networkDomain;
+ }
+
+ public void setDetails(Map<String, String> details) {
+ this.details = details;
+ }
+
+ public void setRegionId(int regionId) {
+ this.regionId = regionId;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getDomainId() {
+ return domainId;
+ }
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ public String getDefaultZoneId() {
+ return defaultZoneId;
+ }
+
+ public void setDefaultZoneId(String defaultZoneId) {
+ this.defaultZoneId = defaultZoneId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/de20cb6c/api/src/org/apache/cloudstack/api/response/FindDomainResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/FindDomainResponse.java b/api/src/org/apache/cloudstack/api/response/FindDomainResponse.java
new file mode 100644
index 0000000..055e4a2
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/FindDomainResponse.java
@@ -0,0 +1,103 @@
+// 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 org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.domain.Domain;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@EntityReference(value = Domain.class)
+public class FindDomainResponse extends BaseResponse {
+ @SerializedName(ApiConstants.ID) @Param(description="the ID of the domain")
+ private String id;
+
+ @SerializedName(ApiConstants.NAME) @Param(description="the name of the domain")
+ private String domainName;
+
+ @SerializedName(ApiConstants.LEVEL) @Param(description="the level of the domain")
+ private Integer level;
+
+ @SerializedName("parentdomainid") @Param(description="the domain ID of the parent domain")
+ private String parent;
+
+ @SerializedName("haschild") @Param(description="whether the domain has one or more sub-domains")
+ private boolean hasChild;
+
+ @SerializedName(ApiConstants.NETWORK_DOMAIN) @Param(description="the network domain")
+ private String networkDomain;
+
+ @SerializedName(ApiConstants.PATH) @Param(description="the path of the domain")
+ private String path;
+
+ @SerializedName(ApiConstants.STATE) @Param(description="the state of the domain")
+ private String state;
+
+ @SerializedName("regionId") @Param(description="source region id of the user")
+ private int regionId;
+
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+ public void setLevel(Integer level) {
+ this.level = level;
+ }
+
+ public void setHasChild(boolean hasChild) {
+ this.hasChild = hasChild;
+ }
+
+ public void setNetworkDomain(String networkDomain) {
+ this.networkDomain = networkDomain;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public void setRegionId(int regionId) {
+ this.regionId = regionId;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getParent() {
+ return parent;
+ }
+
+ public void setParent(String parent) {
+ this.parent = parent;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+}