You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ad...@apache.org on 2017/05/23 10:34:14 UTC

[16/49] ambari git commit: AMBARI-20436. Create a prototype of ambari-server swagger integration. (jaimin)

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupPrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupPrivilegeResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupPrivilegeResponse.java
new file mode 100644
index 0000000..a722ba5
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupPrivilegeResponse.java
@@ -0,0 +1,61 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ambari.server.controller;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.services.groups.GroupPrivilegeService;
+import org.apache.ambari.server.orm.entities.PrincipalTypeEntity;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Response schema for endpoint {@link GroupPrivilegeService#getPrivileges(HttpHeaders, UriInfo, String)}
+ */
+public class GroupPrivilegeResponse extends PrivilegeResponse implements ApiModel {
+
+  private String groupName;
+
+  /**
+   *
+   * @param groupName          group name
+   * @param permissionLabel    permission label
+   * @param permissionName     permission name
+   * @param privilegeId        privilege id
+   * @param principalType      principal type
+   */
+  public GroupPrivilegeResponse(String groupName, String permissionLabel, String permissionName, Integer privilegeId,
+                               PrincipalTypeEntity.PrincipalType principalType) {
+    this.groupName = groupName;
+    this.permissionLabel = permissionLabel;
+    this.privilegeId = privilegeId;
+    this.permissionName = permissionName;
+    this.principalType = principalType;
+  }
+
+  /**
+   *  Returns group name
+   * @return  group name
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/group_name", required = true)
+  public String getGroupName() {
+    return groupName;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupRequest.java
index 1bc18cc..e63a383 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupRequest.java
@@ -17,16 +17,19 @@
  */
 package org.apache.ambari.server.controller;
 
+import io.swagger.annotations.ApiModelProperty;
+
 /**
  * Represents a group maintenance request.
  */
-public class GroupRequest {
+public class GroupRequest implements ApiModel{
   private final String groupName;
 
   public GroupRequest(String groupName) {
     this.groupName = groupName;
   }
 
+  @ApiModelProperty(name = "Groups/group_name",required = true)
   public String getGroupName() {
     return groupName;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupResponse.java
index 0baccc7..a1cbe80 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/GroupResponse.java
@@ -19,10 +19,12 @@ package org.apache.ambari.server.controller;
 
 import org.apache.ambari.server.security.authorization.GroupType;
 
+import io.swagger.annotations.ApiModelProperty;
+
 /**
  * Represents a user group maintenance response.
  */
-public class GroupResponse {
+public class GroupResponse implements ApiModel{
   private final String groupName;
   private final boolean ldapGroup;
   private final GroupType groupType;
@@ -39,14 +41,17 @@ public class GroupResponse {
     this.groupType = GroupType.LOCAL;
   }
 
+  @ApiModelProperty(name = "Groups/group_name")
   public String getGroupName() {
     return groupName;
   }
 
+  @ApiModelProperty(name = "Groups/ldap_group")
   public boolean isLdapGroup() {
     return ldapGroup;
   }
 
+  @ApiModelProperty(name = "Groups/group_type")
   public GroupType getGroupType() {
     return groupType;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/MemberRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/MemberRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/MemberRequest.java
index 0245f36..dd0e999 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/MemberRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/MemberRequest.java
@@ -17,6 +17,8 @@
  */
 package org.apache.ambari.server.controller;
 
+import io.swagger.annotations.ApiModelProperty;
+
 /**
  * Represents a member maintenance request.
  */
@@ -29,10 +31,12 @@ public class MemberRequest {
     this.userName  = userName;
   }
 
+  @ApiModelProperty(name = "MemberInfo/group_name", required = true)
   public String getGroupName() {
     return groupName;
   }
 
+  @ApiModelProperty(name = "MemberInfo/user_name", required = true)
   public String getUserName() {
     return userName;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/MemberResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/MemberResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/MemberResponse.java
index 3dc6558..69a69a7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/MemberResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/MemberResponse.java
@@ -17,7 +17,9 @@
  */
 package org.apache.ambari.server.controller;
 
-public class MemberResponse {
+import io.swagger.annotations.ApiModelProperty;
+
+public class MemberResponse implements ApiModel{
   private final String groupName;
   private final String userName;
 
@@ -26,10 +28,12 @@ public class MemberResponse {
     this.userName = userName;
   }
 
+  @ApiModelProperty(name = "MemberInfo/group_name")
   public String getGroupName() {
     return groupName;
   }
 
+  @ApiModelProperty(name = "MemberInfo/user_name")
   public String getUserName() {
     return userName;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/PrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/PrivilegeResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/PrivilegeResponse.java
new file mode 100644
index 0000000..a067afb
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/PrivilegeResponse.java
@@ -0,0 +1,175 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ambari.server.controller;
+
+
+import org.apache.ambari.server.orm.entities.PrincipalTypeEntity.PrincipalType;
+import org.apache.ambari.server.security.authorization.ResourceType;
+
+import io.swagger.annotations.ApiModelProperty;
+
+
+public abstract class PrivilegeResponse implements ApiModel {
+  protected String permissionLabel;
+  protected Integer privilegeId;
+  protected String permissionName;
+  protected PrincipalType principalType;
+  protected String principalName;
+  protected ResourceType type;
+  protected String clusterName;
+  protected String viewName;
+  protected String version;
+  protected String instanceName;
+
+
+  /**
+   * Returns permission label
+   * @return permission label
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/permission_label")
+  public String getPermissionLabel() {
+    return permissionLabel;
+  }
+
+  /**
+   * Returns principal name
+   * @return principal name
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/principal_name")
+  public String getPrincipalName() {
+    return principalName;
+  }
+
+  /**
+   * Sets principal name
+   * @param principalName  principal name
+   */
+  public void setPrincipalName(String principalName) {
+    this.principalName = principalName;
+  }
+
+  /**
+   * Returns privilege id
+   * @return  privilege id
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/privilege_id")
+  public Integer getPrivilegeId() {
+    return privilegeId;
+  }
+
+  /**
+   * Returns permission name
+   * @return permission name
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/permission_name")
+  public String getPermissionName() {
+    return permissionName;
+  }
+
+  /**
+   * Returns principal type
+   * @return principal type
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/principal_type")
+  public PrincipalType getPrincipalType() {
+    return principalType;
+  }
+
+  /**
+   * Returns resource type
+   * @return resource type
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/type")
+  public ResourceType getType() {
+    return type;
+  }
+
+  /**
+   * Sets resource type
+   * @param type resource type
+   */
+  public void setType(ResourceType type) {
+    this.type = type;
+  }
+
+  /**
+   * Returns cluster name
+   * @return cluster name
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/cluster_name")
+  public String getClusterName() {
+    return clusterName;
+  }
+
+  /**
+   * Sets cluster name
+   * @param clusterName cluster name
+   */
+  public void setClusterName(String clusterName) {
+    this.clusterName = clusterName;
+  }
+
+  /**
+   * Returns view name
+   * @return view name
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/view_name")
+  public String getViewName() {
+    return viewName;
+  }
+
+  /**
+   * Sets view name
+   * @param viewName  view name
+   */
+  public void setViewName(String viewName) {
+    this.viewName = viewName;
+  }
+
+  /**
+   * Returns view version
+   * @return view version
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/version")
+  public String getVersion() {
+    return version;
+  }
+
+  /**
+   * Sets view version
+   * @param version view version
+   */
+  public void setVersion(String version) {
+    this.version = version;
+  }
+
+  /**
+   * Returns view instance name
+   * @return view instance name
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/instance_name")
+  public String getInstanceName() {
+    return instanceName;
+  }
+
+  public void setInstanceName(String instanceName) {
+    this.instanceName = instanceName;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserAuthorizationResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserAuthorizationResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserAuthorizationResponse.java
new file mode 100644
index 0000000..1965e6f
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserAuthorizationResponse.java
@@ -0,0 +1,153 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ambari.server.controller;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.services.users.UserAuthorizationService;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Response schema for endpoint {@link UserAuthorizationService#getAuthorizations(HttpHeaders, UriInfo, String)}
+ */
+public class UserAuthorizationResponse implements ApiModel {
+
+  private final String authorizationId;
+  private final String authorizationName;
+  private final String resourceType;
+  private final String userName;
+  private String clusterName;
+  private String viewName;
+  private String viewVersion;
+  private String viewInstanceName;
+
+
+  /**
+   *
+   * @param authorizationId      authorization id
+   * @param authorizationName    authorization name
+   * @param clusterName          cluster name
+   * @param resourceType         resource type
+   * @param userName             user name
+   */
+  public UserAuthorizationResponse(String authorizationId, String authorizationName,
+                               String clusterName, String resourceType, String userName) {
+    this.authorizationId = authorizationId;
+    this.authorizationName = authorizationName;
+    this.clusterName = clusterName;
+    this.resourceType = resourceType;
+    this.userName = userName;
+  }
+
+  /**
+   *
+   * @param authorizationId     authorization id
+   * @param authorizationName   authorization name
+   * @param resourceType        resource type
+   * @param userName            user name
+   * @param viewName            view name
+   * @param viewVersion         view version
+   * @param viewInstanceName    view instance name
+   */
+  public UserAuthorizationResponse(String authorizationId, String authorizationName,
+                               String resourceType, String userName, String viewName,
+                               String viewVersion, String viewInstanceName) {
+    this.authorizationId = authorizationId;
+    this.authorizationName = authorizationName;
+    this.resourceType = resourceType;
+    this.userName = userName;
+    this.viewName = viewName;
+    this.viewVersion = viewVersion;
+    this.viewInstanceName = viewInstanceName;
+  }
+
+  /**
+   * Returns authorization id
+   * @return authorization id
+   */
+  @ApiModelProperty(name = "AuthorizationInfo/authorization_id")
+  public String getAuthorizationId() {
+    return authorizationId;
+  }
+
+  /**
+   * Returns authorization name
+   * @return authorization name
+   */
+  @ApiModelProperty(name = "AuthorizationInfo/authorization_name")
+  public String getAuthorizationName() {
+    return authorizationName;
+  }
+
+  /**
+   * Returns resource type
+   * @return resource type
+   */
+  @ApiModelProperty(name = "AuthorizationInfo/resource_type")
+  public String getResourceType() {
+    return resourceType;
+  }
+
+  /**
+   * Returns view version
+   * @return view version
+   */
+  @ApiModelProperty(name = "AuthorizationInfo/view_version")
+  public String getViewVersion() {
+    return viewVersion;
+  }
+
+  /**
+   * Returns view instance name
+   * @return view instance name
+   */
+  @ApiModelProperty(name = "AuthorizationInfo/view_instance_name")
+  public String getViewInstanceName() {
+    return viewInstanceName;
+  }
+
+  /**
+   * Returns user name
+   * @return user name
+   */
+  @ApiModelProperty(name = "AuthorizationInfo/user_name",required = true)
+  public String getUserName() {
+    return userName;
+  }
+
+  /**
+   * Returns cluster name
+   * @return cluster name
+   */
+  @ApiModelProperty(name = "AuthorizationInfo/cluster_name")
+  public String getClusterName() {
+    return clusterName;
+  }
+
+  /**
+   * Returns view name
+   * @return view name
+   */
+  @ApiModelProperty(name = "AuthorizationInfo/view_name")
+  public String getViewName() {
+    return viewName;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserPrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserPrivilegeResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserPrivilegeResponse.java
new file mode 100644
index 0000000..6502581
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserPrivilegeResponse.java
@@ -0,0 +1,61 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ambari.server.controller;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.services.users.UserPrivilegeService;
+import org.apache.ambari.server.orm.entities.PrincipalTypeEntity;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Response schema for endpoint {@link UserPrivilegeService#getPrivileges(HttpHeaders, UriInfo, String)}
+ */
+public class UserPrivilegeResponse extends PrivilegeResponse implements ApiModel {
+
+  private final String userName;
+
+  /**
+   *
+   * @param userName           user name
+   * @param permissionLabel    permission label
+   * @param permissionName     permission name
+   * @param privilegeId        privilege id
+   * @param principalType      principal type
+   */
+  public UserPrivilegeResponse(String userName, String permissionLabel, String permissionName, Integer privilegeId,
+                           PrincipalTypeEntity.PrincipalType principalType) {
+    this.userName = userName;
+    this.permissionLabel = permissionLabel;
+    this.privilegeId = privilegeId;
+    this.permissionName = permissionName;
+    this.principalType = principalType;
+  }
+
+  /**
+   * Returns user name
+   * @return  user name
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/user_name",required = true)
+  public String getUserName() {
+    return userName;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
index 282131a..95f3d0f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
@@ -17,9 +17,13 @@
  */
 package org.apache.ambari.server.controller;
 
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
 /**
  * Represents a user maintenance request.
  */
+@ApiModel
 public class UserRequest {
   private String userName;
   private String password;
@@ -27,14 +31,16 @@ public class UserRequest {
   private Boolean active;
   private Boolean admin;
 
-  public UserRequest(String name) {
-    this.userName = name;
-  }
-
+  @ApiModelProperty(name = "Users/user_name",hidden = true)
   public String getUsername() {
     return userName;
   }
 
+  public UserRequest(String name) {
+    this.userName = name;
+  }
+
+  @ApiModelProperty(name = "Users/password")
   public String getPassword() {
     return password;
   }
@@ -43,6 +49,7 @@ public class UserRequest {
     password = userPass;
   }
 
+  @ApiModelProperty(name = "Users/old_password")
   public String getOldPassword() {
     return oldPassword;
   }
@@ -51,6 +58,7 @@ public class UserRequest {
     oldPassword = oldUserPass;
   }
 
+  @ApiModelProperty(name = "Users/active")
   public Boolean isActive() {
     return active;
   }
@@ -59,6 +67,7 @@ public class UserRequest {
     this.active = active;
   }
 
+  @ApiModelProperty(name = "Users/admin")
   public Boolean isAdmin() {
     return admin;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
index b90f864..aa1c3fc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
@@ -22,10 +22,12 @@ import java.util.Set;
 
 import org.apache.ambari.server.security.authorization.UserType;
 
+import io.swagger.annotations.ApiModelProperty;
+
 /**
  * Represents a user maintenance request.
  */
-public class UserResponse {
+public class UserResponse implements ApiModel {
 
   private final String userName;
   private final UserType userType;
@@ -50,10 +52,12 @@ public class UserResponse {
     this.userType = UserType.LOCAL;
   }
 
+  @ApiModelProperty(name = "Users/user_name",required = true)
   public String getUsername() {
     return userName;
   }
 
+  @ApiModelProperty(name = "Users/groups")
   public Set<String> getGroups() {
     return groups;
   }
@@ -62,41 +66,45 @@ public class UserResponse {
     this.groups = groups;
   }
 
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
-
-    UserResponse that = (UserResponse) o;
-
-    if (userName != null ? !userName.equals(that.userName) : that.userName != null) return false;
-    return userType == that.userType;
-
-  }
-
-  @Override
-  public int hashCode() {
-    int result = userName != null ? userName.hashCode() : 0;
-    result = 31 * result + (userType != null ? userType.hashCode() : 0);
-    return result;
-  }
-
   /**
    * @return the isLdapUser
    */
+  @ApiModelProperty(name = "Users/ldap_user")
   public boolean isLdapUser() {
     return isLdapUser;
   }
 
+  @ApiModelProperty(name = "Users/active")
   public boolean isActive() {
     return isActive;
   }
 
+  @ApiModelProperty(name = "Users/admin")
   public boolean isAdmin() {
     return isAdmin;
   }
 
+  @ApiModelProperty(name = "Users/user_type")
   public UserType getUserType() {
     return userType;
   }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+
+    UserResponse that = (UserResponse) o;
+
+    if (userName != null ? !userName.equals(that.userName) : that.userName != null) return false;
+    return userType == that.userType;
+
+  }
+
+  @Override
+  public int hashCode() {
+    int result = userName != null ? userName.hashCode() : 0;
+    result = 31 * result + (userType != null ? userType.hashCode() : 0);
+    return result;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewInstanceRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewInstanceRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewInstanceRequest.java
new file mode 100644
index 0000000..1664c8a
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewInstanceRequest.java
@@ -0,0 +1,209 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ambari.server.controller;
+
+import java.util.Map;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.services.views.ViewInstanceService;
+import org.apache.ambari.view.ClusterType;
+
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Request body schema for endpoint {@link ViewInstanceService#createService(String, HttpHeaders, UriInfo, String, String, String)}
+ */
+public class ViewInstanceRequest implements ApiModel{
+  private final ViewInstanceRequestInfo viewInstanceRequestInfo;
+
+  /**
+   * @param viewInstanceRequestInfo  {@link ViewInstanceRequestInfo}
+   */
+  public ViewInstanceRequest(ViewInstanceRequestInfo viewInstanceRequestInfo) {
+    this.viewInstanceRequestInfo = viewInstanceRequestInfo;
+  }
+
+  /**
+   * Returns wrapper class for view instance information
+   * @return {@link #viewInstanceRequestInfo}
+   */
+  @ApiModelProperty(name = "ViewInstanceInfo")
+  public ViewInstanceRequestInfo getViewInstanceInfo() {
+    return viewInstanceRequestInfo;
+  }
+
+  /**
+   * static class that wraps all view instance information
+   */
+  public static class ViewInstanceRequestInfo {
+    protected final String viewName;
+    protected final String version;
+    protected final String instanceName;
+    private final String label;
+    private final String description;
+    private final boolean visible;
+    private final String iconPath;
+    private final String icon64Path;
+    private final Map<String, String> properties;
+    private final Map<String, String> instanceData;
+    private final Integer clusterHandle;
+    private final ClusterType clusterType;
+
+    /**
+     *
+     * @param viewName        view name
+     * @param version         view version
+     * @param instanceName    instance name
+     * @param label           view label
+     * @param description     view description
+     * @param visible         visibility for view
+     * @param iconPath        icon path
+     * @param icon64Path      icon64 path
+     * @param properties      properties
+     * @param instanceData    instance data
+     * @param clusterHandle   cluster handle
+     * @param clusterType     cluster type (local|remote|none)
+     */
+    public ViewInstanceRequestInfo(String viewName, String version, String instanceName, String label, String description,
+                                   boolean visible, String iconPath, String icon64Path, Map<String, String> properties,
+                                   Map<String, String> instanceData, Integer clusterHandle, ClusterType clusterType) {
+      this.viewName = viewName;
+      this.version = version;
+      this.instanceName = instanceName;
+      this.label = label;
+      this.description = description;
+      this.visible = visible;
+      this.iconPath = iconPath;
+      this.icon64Path = icon64Path;
+      this.properties = properties;
+      this.instanceData = instanceData;
+      this.clusterHandle = clusterHandle;
+      this.clusterType = clusterType;
+    }
+
+    /**
+     * Returns view name
+     * @return view name
+     */
+    @ApiModelProperty(name = "view_name", hidden = true)
+    public String getViewName() {
+      return viewName;
+    }
+
+    /**
+     * Returns view version
+     * @return view version
+     */
+    @ApiModelProperty(hidden = true)
+    public String getVersion() {
+      return version;
+    }
+
+    /**
+     * Returns instance name
+     * @return instance name
+     */
+    @ApiModelProperty(name = "instance_name", hidden = true)
+    public String getInstanceName() {
+      return instanceName;
+    }
+
+    /**
+     * Returns view label
+     * @return view label
+     */
+    public String getLabel() {
+      return label;
+    }
+
+    /**
+     * Returns view description
+     * @return view description
+     */
+    public String getDescription() {
+      return description;
+    }
+
+    /**
+     * Returns visibility for view
+     * @return visibility for view
+     */
+    public boolean isVisible() {
+      return visible;
+    }
+
+    /**
+     * Returns icon path
+     * @return icon path
+     */
+    @ApiModelProperty(name = "icon_path")
+    public String getIconPath() {
+      return iconPath;
+    }
+
+    /**
+     * Returns icon64 patch
+     * @return icon64 path
+     */
+    @ApiModelProperty(name = "icon64_path")
+    public String getIcon64Path() {
+      return icon64Path;
+    }
+
+    /**
+     * Returns all view properties
+     * @return view properties
+     */
+    public Map<String, String> getProperties() {
+      return properties;
+    }
+
+    /**
+     * Returns instance data
+     * @return instance data
+     */
+    @ApiModelProperty(name = "instance_data")
+    public Map<String, String> getInstanceData() {
+      return instanceData;
+    }
+
+    /**
+     * Returns cluster handle
+     * @return cluster handle
+     */
+    @ApiModelProperty(name = "cluster_handle")
+    public Integer getClusterHandle() {
+      return clusterHandle;
+    }
+
+    /**
+     * Returns cluster type {@link ClusterType}
+     * @return cluster type
+     */
+    @ApiModelProperty(name = "cluster_type")
+    public ClusterType getClusterType() {
+      return clusterType;
+    }
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewInstanceResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewInstanceResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewInstanceResponse.java
new file mode 100644
index 0000000..d0a5206
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewInstanceResponse.java
@@ -0,0 +1,198 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ambari.server.controller;
+
+import java.util.Map;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.services.views.ViewInstanceService;
+import org.apache.ambari.view.ClusterType;
+import org.apache.ambari.view.validation.ValidationResult;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Response schema for endpoint {@link ViewInstanceService#getServices(String, HttpHeaders, UriInfo, String, String)}
+ */
+public class ViewInstanceResponse implements ApiModel{
+  private final ViewInstanceResponseInfo viewInstanceResponseInfo;
+
+  public ViewInstanceResponse(ViewInstanceResponseInfo viewInstanceResponseInfo) {
+    this.viewInstanceResponseInfo = viewInstanceResponseInfo;
+  }
+
+  @ApiModelProperty(name = "ViewInstanceInfo")
+  public ViewInstanceResponseInfo getViewInstanceInfo() {
+    return viewInstanceResponseInfo;
+  }
+
+  public class ViewInstanceResponseInfo extends ViewInstanceRequest.ViewInstanceRequestInfo {
+    private final String contextPath;
+    private final boolean staticDriven;
+    private String shortUrl;
+    private String shortUrlName;
+    private ValidationResult validationResult;
+    private Map<String, ValidationResult> propertyValidationResults;
+
+    /**
+     *
+     * @param viewName        view name
+     * @param version         view version
+     * @param instanceName    view instance name
+     * @param label           view label
+     * @param description     view description
+     * @param visible         visible
+     * @param iconPath        icon path
+     * @param icon64Path      icon64 path
+     * @param properties      view properties
+     * @param instanceData    view instance data
+     * @param clusterHandle   cluster handle
+     * @param clusterType     cluster type (local|remote|none)
+     * @param contextPath     context path
+     * @param staticDriven    is static driven
+     */
+    public ViewInstanceResponseInfo(String viewName, String version, String instanceName, String label, String description,
+                                    boolean visible, String iconPath, String icon64Path, Map<String, String> properties,
+                                    Map<String, String> instanceData, Integer clusterHandle, ClusterType clusterType,
+                                    String contextPath, boolean staticDriven) {
+      super(viewName, version, instanceName, label, description, visible, iconPath, icon64Path, properties, instanceData, clusterHandle, clusterType);
+      this.contextPath = contextPath;
+      this.staticDriven = staticDriven;
+    }
+
+    /**
+     * Return view name.
+     * @return view name
+     */
+    @Override
+    @ApiModelProperty(name = "view_name", hidden = false)
+    public String getViewName() {
+      return viewName;
+    }
+
+    /**
+     * Return view version
+     * @return view version
+     */
+    @Override
+    @ApiModelProperty(hidden = false)
+    public String getVersion() {
+      return version;
+    }
+
+    /**
+     * Return view instance name
+     * @return view instance name
+     */
+    @Override
+    @ApiModelProperty(name = "instance_name", hidden = false)
+    public String getInstanceName() {
+      return instanceName;
+    }
+
+    /**
+     * Return view context path
+     * @return context path
+     */
+    @ApiModelProperty(name = "context_path")
+    public String getContextPath() {
+      return contextPath;
+    }
+
+    /**
+     * Return if the view is static driven
+     * @return  {{@link #staticDriven}
+     */
+    @ApiModelProperty(name = "static")
+    public boolean isStaticDriven() {
+      return staticDriven;
+    }
+
+    /**
+     * Return short url for the view
+     * @return short url for the view
+     */
+    @ApiModelProperty(name = "short_url")
+    public String getShortUrl() {
+      return shortUrl;
+    }
+
+    /**
+     * set short url for the view
+     * @param shortUrl  short url
+     */
+    public void setShortUrl(String shortUrl) {
+      this.shortUrl = shortUrl;
+    }
+
+    /**
+     * Returns short url name
+     * @return short url name
+     */
+    @ApiModelProperty(name = "short_url_name")
+    public String getShortUrlName() {
+      return shortUrlName;
+    }
+
+    /**
+     * Sets short url name
+     * @param shortUrlName short url name
+     */
+    public void setShortUrlName(String shortUrlName) {
+      this.shortUrlName = shortUrlName;
+    }
+
+    /**
+     * Returns validation result
+     * @return {@link ValidationResult}
+     */
+    @ApiModelProperty(name = "validation_result")
+    public ValidationResult getValidationResult() {
+      return validationResult;
+    }
+
+    /**
+     * sets validation result
+     * @param validationResult {@link ValidationResult}
+     */
+    public void setValidationResult(ValidationResult validationResult) {
+      this.validationResult = validationResult;
+    }
+
+    /**
+     * Returns map of property->ValidationResult
+     * @return Map
+     */
+    @ApiModelProperty(name = "property_validation_results")
+    public Map<String, ValidationResult> getPropertyValidationResults() {
+      return propertyValidationResults;
+    }
+
+    /**
+     * Sets map of property->ValidationResult
+     * @param propertyValidationResults  Map
+     */
+    public void setPropertyValidationResults(Map<String, ValidationResult> propertyValidationResults) {
+      this.propertyValidationResults = propertyValidationResults;
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewPermissionResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewPermissionResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewPermissionResponse.java
new file mode 100644
index 0000000..15f4e6e
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewPermissionResponse.java
@@ -0,0 +1,122 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ambari.server.controller;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.services.views.ViewPermissionService;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Response schema for endpoint {@link ViewPermissionService#getPermissions(HttpHeaders, UriInfo, String, String)}
+ */
+public class ViewPermissionResponse implements ApiModel {
+
+  private final ViewPermissionInfo viewPermissionInfo;
+
+  /**
+   *
+   * @param viewPermissionInfo view permission info
+   */
+  public ViewPermissionResponse(ViewPermissionInfo viewPermissionInfo) {
+    this.viewPermissionInfo = viewPermissionInfo;
+  }
+
+  /**
+   * Returns {@link ViewPermissionInfo} instance that hold all view permission information
+   * @return {@link ViewPermissionInfo}
+   */
+  @ApiModelProperty(name = "ViewPermissionInfo")
+  public ViewPermissionInfo getViewPermissionInfo() {
+    return viewPermissionInfo;
+  }
+
+  /**
+   * static wrapper class that holds all view permission information
+   */
+  public static class ViewPermissionInfo {
+    private final String viewName;
+    private final String version;
+    private final Integer permissionId;
+    private final String permissionName;
+    private final String resourceName;
+
+    /**
+     *
+     * @param viewName            view name
+     * @param version             view version
+     * @param permissionId        permission id
+     * @param permissionName      permission name
+     * @param resourceName        resource name
+     */
+    public ViewPermissionInfo(String viewName, String version, Integer permissionId, String permissionName, String resourceName) {
+      this.viewName = viewName;
+      this.version = version;
+      this.permissionId = permissionId;
+      this.permissionName = permissionName;
+      this.resourceName = resourceName;
+    }
+
+    /**
+     * Returns view name
+     * @return view name
+     */
+    @ApiModelProperty(name = "view_name")
+    public String getViewName() {
+      return viewName;
+    }
+
+    /**
+     * Returns view version
+     * @return view version
+     */
+    public String getVersion() {
+      return version;
+    }
+
+    /**
+     * Returns permission id
+     * @return permission id
+     */
+    @ApiModelProperty(name = "permission_id")
+    public Integer getPermissionId() {
+      return permissionId;
+    }
+
+    /**
+     * Returns permission name
+     * @return permission name
+     */
+    @ApiModelProperty(name = "permission_name")
+    public String getPermissionName() {
+      return permissionName;
+    }
+
+    /**
+     * Returns resource name
+     * @return resource names
+     */
+    @ApiModelProperty(name = "resource_name")
+    public String getResourceName() {
+      return resourceName;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewPrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewPrivilegeRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewPrivilegeRequest.java
new file mode 100644
index 0000000..cf09e0a
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewPrivilegeRequest.java
@@ -0,0 +1,79 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ambari.server.controller;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.services.views.ViewPrivilegeService;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Request body schema for endpoint {@link ViewPrivilegeService#createPrivilege(String, HttpHeaders, UriInfo, String, String, String)} )}
+ */
+public class ViewPrivilegeRequest extends ViewPrivilegeResponse implements ApiModel {
+
+  /**
+   * Hide privilege id in request body schema
+   * @return privilege id
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/privilege_id", hidden = true)
+  public Integer getPrivilegeId() {
+    return privilegeId;
+  }
+
+  /**
+   * Hide permission label in request body schema
+   * @return permission label
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/permission_label", hidden = true)
+  public String getPermissionLabel() {
+    return permissionLabel;
+  }
+
+  /**
+   * Hide view name in request body schema
+   * @return view name
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/view_name", hidden = true)
+  public String getViewName() {
+    return viewName;
+  }
+
+  /**
+   * Hide view version in request body schema
+   * @return view version
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/version", hidden = true)
+  public String getVersion() {
+    return version;
+  }
+
+  /**
+   * Hide view instance name in request body schema
+   * @return view instance name
+   */
+  @ApiModelProperty(name = "PrivilegeInfo/instance_name", hidden = true)
+  public String getInstanceName() {
+    return instanceName;
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewPrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewPrivilegeResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewPrivilegeResponse.java
new file mode 100644
index 0000000..8199948
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewPrivilegeResponse.java
@@ -0,0 +1,55 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ambari.server.controller;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.services.views.ViewPrivilegeService;
+import org.apache.ambari.server.security.authorization.ResourceType;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Response schema for endpoint {@link ViewPrivilegeService#getPrivileges(HttpHeaders, UriInfo, String, String, String)}
+ */
+public class ViewPrivilegeResponse extends PrivilegeResponse implements ApiModel {
+
+  /**
+   * Hide cluster name from the response schema
+   * @return cluster name
+   */
+  @Override
+  @ApiModelProperty(name = "PrivilegeInfo/cluster_name", hidden = true)
+  public String getClusterName() {
+    return clusterName;
+  }
+
+  /**
+   * Hide resource type from the response schema
+   * @return resource type
+   */
+  @Override
+  @ApiModelProperty(name = "PrivilegeInfo/type", hidden = true)
+  public ResourceType getType() {
+    return type;
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewResponse.java
new file mode 100644
index 0000000..2d5a8f0
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewResponse.java
@@ -0,0 +1,82 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ambari.server.controller;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.services.views.ViewService;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Response schema for endpoint {@link ViewService#getViews(String, HttpHeaders, UriInfo)}
+ */
+public class ViewResponse implements ApiModel {
+  private ViewInfo viewInfo;
+
+  /**
+   *
+   * @param viewInfo {@link ViewInfo}
+   */
+  public ViewResponse(ViewInfo viewInfo) {
+    this.viewInfo = viewInfo;
+  }
+
+  /**
+   * Returns view information wrapper class instance
+   * @return {@link #viewInfo}
+   */
+  @ApiModelProperty(name = "ViewInfo")
+  public ViewInfo getViewInfo() {
+    return viewInfo;
+  }
+
+  /**
+   * static wrapper class for view information
+   */
+  private class ViewInfo implements ApiModel{
+    private String viewName;
+
+    /**
+     *
+     * @param viewName view name
+     */
+    public ViewInfo(String viewName) {
+      this.viewName = viewName;
+    }
+
+    /**
+     * Returns view name
+     * @return view name
+     */
+    @ApiModelProperty(name = "view_name")
+    public String getViewName() {
+      return viewName;
+    }
+
+    /**
+     * Sets view name
+     * @param viewName view name
+     */
+    public void setViewName(String viewName) {
+      this.viewName = viewName;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewVersionResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewVersionResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewVersionResponse.java
new file mode 100644
index 0000000..0bc84c0
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ViewVersionResponse.java
@@ -0,0 +1,234 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ambari.server.controller;
+
+import java.util.List;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.services.views.ViewVersionService;
+import org.apache.ambari.server.view.configuration.ParameterConfig;
+import org.apache.ambari.view.ViewDefinition;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Response schema for endpoint {@link ViewVersionService#getVersions(String, HttpHeaders, UriInfo, String)}
+ */
+public class ViewVersionResponse implements ApiModel {
+
+  ViewVersionInfo viewVersionInfo;
+
+  /**
+   *
+   * @param viewVersionInfo  view version information {@link #viewVersionInfo}
+   */
+  public ViewVersionResponse(ViewVersionInfo viewVersionInfo) {
+    this.viewVersionInfo = viewVersionInfo;
+  }
+
+  /**
+   * Returns wrapper class instance for view version information
+   * @return {@link #viewVersionInfo}
+   */
+  @ApiModelProperty(name = "ViewVersionInfo")
+  public ViewVersionInfo getViewVersionInfo() {
+    return viewVersionInfo;
+  }
+
+  /**
+   * static wrapper class for view version information
+   */
+  public static class ViewVersionInfo implements ApiModel {
+    private final String archive;
+    private final String buildNumber;
+    private final boolean clusterConfigurable;
+    private final String description;
+    private final String label;
+    private final String maskerClass;
+    private final String maxAmbariVersion;
+    private final String minAmbariVersion;
+    private final List<ParameterConfig> parameters;
+    private final ViewDefinition.ViewStatus status;
+    private final String statusDetail;
+    private final boolean system;
+    private final String version;
+    private final String viewName;
+
+    /**
+     *
+     * @param archive               archive
+     * @param buildNumber           build number
+     * @param clusterConfigurable   cluster configurable
+     * @param description           version description
+     * @param label                 version label
+     * @param maskerClass           masker class
+     * @param maxAmbariVersion      maximum ambari version
+     * @param minAmbariVersion      minimum ambari version
+     * @param parameters            version parameters
+     * @param status                status
+     * @param statusDetail          status details
+     * @param system                system
+     * @param version               version number
+     * @param viewName              view name
+     */
+    public ViewVersionInfo(String archive, String buildNumber, boolean clusterConfigurable, String description,
+                           String label, String maskerClass, String maxAmbariVersion, String minAmbariVersion,
+                           List<ParameterConfig> parameters, ViewDefinition.ViewStatus status, String statusDetail,
+                           boolean system, String version, String viewName) {
+      this.archive = archive;
+      this.buildNumber = buildNumber;
+      this.clusterConfigurable = clusterConfigurable;
+      this.description = description;
+      this.label = label;
+      this.maskerClass = maskerClass;
+      this.maxAmbariVersion = maxAmbariVersion;
+      this.minAmbariVersion = minAmbariVersion;
+      this.parameters = parameters;
+      this.status = status;
+      this.statusDetail = statusDetail;
+      this.system = system;
+      this.version = version;
+      this.viewName = viewName;
+    }
+
+    /**
+     * Returns archive string
+     * @return  archive
+     */
+    public String getArchive() {
+      return archive;
+    }
+
+    /**
+     * Returns build number
+     * @return build number
+     */
+    @ApiModelProperty(name = "build_number")
+    public String getBuildNumber() {
+      return buildNumber;
+    }
+
+    /**
+     * Checks if cluster is configurable
+     * @return {@code true} if cluster is configurable
+     *         {@code false} otherwise.
+     */
+    @ApiModelProperty(name = "cluster_configurable")
+    public boolean isClusterConfigurable() {
+      return clusterConfigurable;
+    }
+
+    /**
+     * Returns view description
+     * @return view description
+     */
+    public String getDescription() {
+      return description;
+    }
+
+    /**
+     * Returns view label
+     * @return view label
+     */
+    public String getLabel() {
+      return label;
+    }
+
+    /**
+     * Returns masker class
+     * @return masker class
+     */
+    @ApiModelProperty(name = "masker_class")
+    public String getMaskerClass() {
+      return maskerClass;
+    }
+
+    /**
+     * Returns maximum ambari version
+     * @return maximum ambari version
+     */
+    @ApiModelProperty(name = "max_ambari_version")
+    public String getMaxAmbariVersion() {
+      return maxAmbariVersion;
+    }
+
+    /**
+     * Returns minimum ambari version
+     * @return minimum ambari version
+     */
+    @ApiModelProperty(name = "min_ambari_version")
+    public String getMinAmbariVersion() {
+      return minAmbariVersion;
+    }
+
+    /**
+     * Returns view parameters
+     * @return list of {@link ParameterConfig}
+     */
+    public List<ParameterConfig> getParameters() {
+      return parameters;
+    }
+
+    /**
+     * Returns view status
+     * @return {@link ViewDefinition.ViewStatus}
+     */
+    public ViewDefinition.ViewStatus getStatus() {
+      return status;
+    }
+
+    /**
+     * Returns views status details
+     * @return status details
+     */
+    @ApiModelProperty(name = "status_detail")
+    public String getStatusDetail() {
+      return statusDetail;
+    }
+
+    /**
+     * Checks if system
+     * @return {@code true} if system view
+     *         {@code false} otherwise.
+     */
+    public boolean isSystem() {
+      return system;
+    }
+
+    /**
+     * Returns view version
+     * @return view version
+     */
+    public String getVersion() {
+      return version;
+    }
+
+    /**
+     * Returns view name
+     * @return view name
+     */
+    @ApiModelProperty(name = "view_name")
+    public String getViewName() {
+      return viewName;
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java
index d9a7997..5d52af2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java
@@ -26,6 +26,7 @@ import java.util.Set;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.StaticallyInject;
+import org.apache.ambari.server.controller.ActiveWidgetLayoutResponse;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.WidgetResponse;
 import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
@@ -168,36 +169,46 @@ public class ActiveWidgetLayoutResourceProvider extends AbstractControllerResour
     }
 
     for (WidgetLayoutEntity layoutEntity : layoutEntities) {
+      ActiveWidgetLayoutResponse activeWidgetLayoutResponse  = getResponse(layoutEntity);
       Resource resource = new ResourceImpl(Type.ActiveWidgetLayout);
-      resource.setProperty(WIDGETLAYOUT_ID_PROPERTY_ID, layoutEntity.getId());
-      String clusterName = null;
-      try {
-        clusterName = getManagementController().getClusters().getClusterById(layoutEntity.getClusterId()).getClusterName();
-      } catch (AmbariException e) {
-        throw new SystemException(e.getMessage());
-      }
-      resource.setProperty(WIDGETLAYOUT_CLUSTER_NAME_PROPERTY_ID, clusterName);
-      resource.setProperty(WIDGETLAYOUT_LAYOUT_NAME_PROPERTY_ID, layoutEntity.getLayoutName());
-      resource.setProperty(WIDGETLAYOUT_SECTION_NAME_PROPERTY_ID, layoutEntity.getSectionName());
-      resource.setProperty(WIDGETLAYOUT_SCOPE_PROPERTY_ID, layoutEntity.getScope());
-      resource.setProperty(WIDGETLAYOUT_USERNAME_PROPERTY_ID, layoutEntity.getUserName());
-      resource.setProperty(WIDGETLAYOUT_DISPLAY_NAME_PROPERTY_ID, layoutEntity.getDisplayName());
-
-      List<HashMap> widgets = new ArrayList<HashMap>();
-      List<WidgetLayoutUserWidgetEntity> widgetLayoutUserWidgetEntityList = layoutEntity.getListWidgetLayoutUserWidgetEntity();
-      for (WidgetLayoutUserWidgetEntity widgetLayoutUserWidgetEntity : widgetLayoutUserWidgetEntityList) {
-        WidgetEntity widgetEntity = widgetLayoutUserWidgetEntity.getWidget();
-        HashMap<String, Object> widgetInfoMap = new HashMap<String, Object>();
-        widgetInfoMap.put("WidgetInfo",WidgetResponse.coerce(widgetEntity));
-        widgets.add(widgetInfoMap);
-      }
-      resource.setProperty(WIDGETLAYOUT_WIDGETS_PROPERTY_ID, widgets);
-
+      resource.setProperty(WIDGETLAYOUT_ID_PROPERTY_ID, activeWidgetLayoutResponse.getId());
+      resource.setProperty(WIDGETLAYOUT_CLUSTER_NAME_PROPERTY_ID, activeWidgetLayoutResponse.getClusterName());
+      resource.setProperty(WIDGETLAYOUT_LAYOUT_NAME_PROPERTY_ID, activeWidgetLayoutResponse.getLayoutName());
+      resource.setProperty(WIDGETLAYOUT_SECTION_NAME_PROPERTY_ID, activeWidgetLayoutResponse.getSectionName());
+      resource.setProperty(WIDGETLAYOUT_SCOPE_PROPERTY_ID, activeWidgetLayoutResponse.getScope());
+      resource.setProperty(WIDGETLAYOUT_USERNAME_PROPERTY_ID, activeWidgetLayoutResponse.getUserName());
+      resource.setProperty(WIDGETLAYOUT_DISPLAY_NAME_PROPERTY_ID, activeWidgetLayoutResponse.getDisplayName());
+      resource.setProperty(WIDGETLAYOUT_WIDGETS_PROPERTY_ID, activeWidgetLayoutResponse.getWidgets());
       resources.add(resource);
     }
     return resources;
   }
 
+  /**
+   * Returns the response for the active widget layout that should be returned for the active widget layout REST endpoint
+   * @param layoutEntity {@link WidgetLayoutEntity}
+   * @return  {@link ActiveWidgetLayoutResponse}
+   * @throws SystemException
+   */
+  private ActiveWidgetLayoutResponse getResponse(WidgetLayoutEntity layoutEntity) throws SystemException {
+    String clusterName = null;
+    try {
+      clusterName = getManagementController().getClusters().getClusterById(layoutEntity.getClusterId()).getClusterName();
+    } catch (AmbariException e) {
+      throw new SystemException(e.getMessage());
+    }
+    List<HashMap<String,WidgetResponse>> widgets = new ArrayList<HashMap<String,WidgetResponse>>();
+    List<WidgetLayoutUserWidgetEntity> widgetLayoutUserWidgetEntityList = layoutEntity.getListWidgetLayoutUserWidgetEntity();
+    for (WidgetLayoutUserWidgetEntity widgetLayoutUserWidgetEntity : widgetLayoutUserWidgetEntityList) {
+      WidgetEntity widgetEntity = widgetLayoutUserWidgetEntity.getWidget();
+      HashMap<String, WidgetResponse> widgetInfoMap = new HashMap<String, WidgetResponse>();
+      widgetInfoMap.put("WidgetInfo",WidgetResponse.coerce(widgetEntity));
+      widgets.add(widgetInfoMap);
+    }
+   return  new ActiveWidgetLayoutResponse(layoutEntity.getId(), clusterName, layoutEntity.getDisplayName(), layoutEntity.getLayoutName(),
+      layoutEntity.getSectionName(), layoutEntity.getScope(), layoutEntity.getUserName(),  widgets);
+  }
+
   @Override
   public RequestStatus updateResources(Request request, Predicate predicate)
     throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/GroupPrivilegeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/GroupPrivilegeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/GroupPrivilegeResourceProvider.java
index bf63794..38c39f3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/GroupPrivilegeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/GroupPrivilegeResourceProvider.java
@@ -25,6 +25,8 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.ambari.server.StaticallyInject;
+import org.apache.ambari.server.controller.GroupPrivilegeResponse;
+import org.apache.ambari.server.controller.PrivilegeResponse;
 import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
 import org.apache.ambari.server.controller.spi.NoSuchResourceException;
 import org.apache.ambari.server.controller.spi.Predicate;
@@ -188,7 +190,8 @@ public class GroupPrivilegeResourceProvider extends ReadOnlyResourceProvider {
         final Collection<PrivilegeEntity> privileges = users.getGroupPrivileges(groupEntity);
 
         for (PrivilegeEntity privilegeEntity : privileges) {
-          resources.add(toResource(privilegeEntity, groupName, requestedIds));
+          GroupPrivilegeResponse response = getResponse(privilegeEntity, groupName);
+          resources.add(toResource(response, requestedIds));
         }
       }
     }
@@ -197,50 +200,83 @@ public class GroupPrivilegeResourceProvider extends ReadOnlyResourceProvider {
   }
 
   /**
-   * Translate the found data into a Resource
-   *
+   * Returns the response for the group privilege that should be returned for the group privilege REST endpoint
    * @param privilegeEntity the privilege data
-   * @param groupName        the group name
-   * @param requestedIds    the relevant request ids
-   * @return a resource
+   * @param groupName    the group name
+   * @return group privilege response
    */
-  protected Resource toResource(PrivilegeEntity privilegeEntity, Object groupName, Set<String> requestedIds) {
-    final ResourceImpl resource = new ResourceImpl(Resource.Type.GroupPrivilege);
+  protected GroupPrivilegeResponse getResponse(PrivilegeEntity privilegeEntity, String groupName) {
+    String permissionLabel = privilegeEntity.getPermission().getPermissionLabel();
+    String permissionName =  privilegeEntity.getPermission().getPermissionName();
+    String principalTypeName = privilegeEntity.getPrincipal().getPrincipalType().getName();
+    GroupPrivilegeResponse groupPrivilegeResponse = new GroupPrivilegeResponse(groupName, permissionLabel , permissionName,
+      privilegeEntity.getId(), PrincipalTypeEntity.PrincipalType.valueOf(principalTypeName));
 
-    setResourceProperty(resource, PRIVILEGE_GROUP_NAME_PROPERTY_ID, groupName, requestedIds);
-    setResourceProperty(resource, PRIVILEGE_PRIVILEGE_ID_PROPERTY_ID, privilegeEntity.getId(), requestedIds);
-    setResourceProperty(resource, PRIVILEGE_PERMISSION_NAME_PROPERTY_ID, privilegeEntity.getPermission().getPermissionName(), requestedIds);
-    setResourceProperty(resource, PRIVILEGE_PERMISSION_LABEL_PROPERTY_ID, privilegeEntity.getPermission().getPermissionLabel(), requestedIds);
-    setResourceProperty(resource, PRIVILEGE_PRINCIPAL_TYPE_PROPERTY_ID, privilegeEntity.getPrincipal().getPrincipalType().getName(), requestedIds);
-
-    final String principalTypeName = privilegeEntity.getPrincipal().getPrincipalType().getName();
     if (principalTypeName.equals(PrincipalTypeEntity.GROUP_PRINCIPAL_TYPE_NAME)) {
       final GroupEntity groupEntity = groupDAO.findGroupByPrincipal(privilegeEntity.getPrincipal());
-      setResourceProperty(resource, PRIVILEGE_PRINCIPAL_NAME_PROPERTY_ID, groupEntity.getGroupName(), requestedIds);
+      groupPrivilegeResponse.setPrincipalName(groupEntity.getGroupName());
     }
 
+
     String typeName = privilegeEntity.getResource().getResourceType().getName();
     ResourceType resourceType = ResourceType.translate(typeName);
-    if (resourceType != null) {
+
+    if(resourceType != null) {
       switch (resourceType) {
         case AMBARI:
           // there is nothing special to add for this case
           break;
         case CLUSTER:
           final ClusterEntity clusterEntity = clusterDAO.findByResourceId(privilegeEntity.getResource().getId());
-          setResourceProperty(resource, PRIVILEGE_CLUSTER_NAME_PROPERTY_ID, clusterEntity.getClusterName(), requestedIds);
+          groupPrivilegeResponse.setClusterName(clusterEntity.getClusterName());
           break;
         case VIEW:
           final ViewInstanceEntity viewInstanceEntity = viewInstanceDAO.findByResourceId(privilegeEntity.getResource().getId());
           final ViewEntity viewEntity = viewInstanceEntity.getViewEntity();
 
-          setResourceProperty(resource, PRIVILEGE_VIEW_NAME_PROPERTY_ID, viewEntity.getCommonName(), requestedIds);
-          setResourceProperty(resource, PRIVILEGE_VIEW_VERSION_PROPERTY_ID, viewEntity.getVersion(), requestedIds);
-          setResourceProperty(resource, PRIVILEGE_INSTANCE_NAME_PROPERTY_ID, viewInstanceEntity.getName(), requestedIds);
+          groupPrivilegeResponse.setViewName(viewEntity.getCommonName());
+          groupPrivilegeResponse.setVersion(viewEntity.getVersion());
+          groupPrivilegeResponse.setInstanceName(viewInstanceEntity.getName());
+          break;
+      }
+
+      groupPrivilegeResponse.setType(resourceType);
+    }
+
+    return groupPrivilegeResponse;
+  }
+
+  /**
+   * Translate the Response into a Resource
+   * @param response        {@link PrivilegeResponse}
+   * @param requestedIds    the relevant request ids
+   * @return a resource
+   */
+  protected Resource toResource(GroupPrivilegeResponse response, Set<String> requestedIds) {
+    final ResourceImpl resource = new ResourceImpl(Resource.Type.GroupPrivilege);
+
+    setResourceProperty(resource, PRIVILEGE_GROUP_NAME_PROPERTY_ID, response.getGroupName(), requestedIds);
+    setResourceProperty(resource, PRIVILEGE_PRIVILEGE_ID_PROPERTY_ID, response.getPrivilegeId(), requestedIds);
+    setResourceProperty(resource, PRIVILEGE_PERMISSION_NAME_PROPERTY_ID, response.getPermissionName(), requestedIds);
+    setResourceProperty(resource, PRIVILEGE_PERMISSION_LABEL_PROPERTY_ID, response.getPermissionLabel(), requestedIds);
+    setResourceProperty(resource, PRIVILEGE_PRINCIPAL_TYPE_PROPERTY_ID, response.getPrincipalType().name(), requestedIds);
+    if (response.getPrincipalName() != null) {
+      setResourceProperty(resource, PRIVILEGE_PRINCIPAL_NAME_PROPERTY_ID, response.getPrincipalName(), requestedIds);
+    }
+
+    if (response.getType() != null) {
+      setResourceProperty(resource, PRIVILEGE_TYPE_PROPERTY_ID, response.getType().name(), requestedIds);
+      switch (response.getType()) {
+        case CLUSTER:
+          setResourceProperty(resource, PRIVILEGE_CLUSTER_NAME_PROPERTY_ID, response.getClusterName(), requestedIds);
+          break;
+        case VIEW:
+          setResourceProperty(resource, PRIVILEGE_VIEW_NAME_PROPERTY_ID, response.getViewName(), requestedIds);
+          setResourceProperty(resource, PRIVILEGE_VIEW_VERSION_PROPERTY_ID, response.getVersion(), requestedIds);
+          setResourceProperty(resource, PRIVILEGE_INSTANCE_NAME_PROPERTY_ID, response.getInstanceName(), requestedIds);
           break;
       }
 
-      setResourceProperty(resource, PRIVILEGE_TYPE_PROPERTY_ID, resourceType.name(), requestedIds);
     }
 
     return resource;

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserAuthorizationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserAuthorizationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserAuthorizationResourceProvider.java
index 8193a49..6cb36db 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserAuthorizationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserAuthorizationResourceProvider.java
@@ -27,6 +27,7 @@ import java.util.Set;
 
 import org.apache.ambari.server.StaticallyInject;
 import org.apache.ambari.server.controller.AmbariManagementController;
+import org.apache.ambari.server.controller.UserAuthorizationResponse;
 import org.apache.ambari.server.controller.predicate.EqualsPredicate;
 import org.apache.ambari.server.controller.spi.ClusterController;
 import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
@@ -251,7 +252,10 @@ public class UserAuthorizationResourceProvider extends ReadOnlyResourceProvider
 
     for (RoleAuthorizationEntity entity : authorizationEntities) {
       Resource resource = new ResourceImpl(Type.UserAuthorization);
-      setResourceProperty(resource, AUTHORIZATION_ID_PROPERTY_ID, entity.getAuthorizationId(), requestedIds);
+      String clusterName = (String)privilegeResource.getPropertyValue(UserPrivilegeResourceProvider.PRIVILEGE_CLUSTER_NAME_PROPERTY_ID);
+      UserAuthorizationResponse userAuthorizationResponse = getResponse(entity.getAuthorizationId(),
+        entity.getAuthorizationName(), clusterName, resourceType, username);
+      setResourceProperty(resource, AUTHORIZATION_ID_PROPERTY_ID, userAuthorizationResponse.getAuthorizationId(), requestedIds);
       setResourceProperty(resource, USERNAME_PROPERTY_ID, username, requestedIds);
       setResourceProperty(resource, AUTHORIZATION_NAME_PROPERTY_ID, entity.getAuthorizationName(), requestedIds);
       setResourceProperty(resource, AUTHORIZATION_RESOURCE_TYPE_PROPERTY_ID, resourceType, requestedIds);
@@ -263,6 +267,7 @@ public class UserAuthorizationResourceProvider extends ReadOnlyResourceProvider
     }
   }
 
+
   /**
    * Creates and adds resources to the results where each resource properly identities the view
    * to which the authorization data applies.
@@ -291,21 +296,58 @@ public class UserAuthorizationResourceProvider extends ReadOnlyResourceProvider
                                 Set<String> requestedIds) {
     for (RoleAuthorizationEntity entity : authorizationEntities) {
       Resource resource = new ResourceImpl(Type.UserAuthorization);
-      setResourceProperty(resource, AUTHORIZATION_ID_PROPERTY_ID, entity.getAuthorizationId(), requestedIds);
-      setResourceProperty(resource, USERNAME_PROPERTY_ID, username, requestedIds);
-      setResourceProperty(resource, AUTHORIZATION_NAME_PROPERTY_ID, entity.getAuthorizationName(), requestedIds);
-      setResourceProperty(resource, AUTHORIZATION_RESOURCE_TYPE_PROPERTY_ID, resourceType, requestedIds);
-      setResourceProperty(resource, AUTHORIZATION_VIEW_NAME_PROPERTY_ID,
-          privilegeResource.getPropertyValue(UserPrivilegeResourceProvider.PRIVILEGE_VIEW_NAME_PROPERTY_ID),
+      String viewName = (String)privilegeResource.getPropertyValue(UserPrivilegeResourceProvider.PRIVILEGE_VIEW_NAME_PROPERTY_ID);
+      String viewVersion = (String)privilegeResource.getPropertyValue(UserPrivilegeResourceProvider.PRIVILEGE_VIEW_VERSION_PROPERTY_ID);
+      String viewInstanceName = (String)privilegeResource.getPropertyValue(UserPrivilegeResourceProvider.PRIVILEGE_INSTANCE_NAME_PROPERTY_ID);
+      UserAuthorizationResponse userAuthorizationResponse = getResponse(entity.getAuthorizationId(),
+        entity.getAuthorizationName(), resourceType, username, viewName, viewVersion, viewInstanceName);
+      setResourceProperty(resource, AUTHORIZATION_ID_PROPERTY_ID, userAuthorizationResponse.getAuthorizationId(), requestedIds);
+      setResourceProperty(resource, USERNAME_PROPERTY_ID, userAuthorizationResponse.getUserName(), requestedIds);
+      setResourceProperty(resource, AUTHORIZATION_NAME_PROPERTY_ID, userAuthorizationResponse.getAuthorizationName(), requestedIds);
+      setResourceProperty(resource, AUTHORIZATION_RESOURCE_TYPE_PROPERTY_ID, userAuthorizationResponse.getResourceType(), requestedIds);
+      setResourceProperty(resource, AUTHORIZATION_VIEW_NAME_PROPERTY_ID, userAuthorizationResponse.getViewName(),
           requestedIds);
-      setResourceProperty(resource, AUTHORIZATION_VIEW_VERSION_PROPERTY_ID,
-          privilegeResource.getPropertyValue(UserPrivilegeResourceProvider.PRIVILEGE_VIEW_VERSION_PROPERTY_ID),
+      setResourceProperty(resource, AUTHORIZATION_VIEW_VERSION_PROPERTY_ID, userAuthorizationResponse.getViewVersion(),
           requestedIds);
-      setResourceProperty(resource, AUTHORIZATION_VIEW_INSTANCE_NAME_PROPERTY_ID,
-          privilegeResource.getPropertyValue(UserPrivilegeResourceProvider.PRIVILEGE_INSTANCE_NAME_PROPERTY_ID),
+      setResourceProperty(resource, AUTHORIZATION_VIEW_INSTANCE_NAME_PROPERTY_ID, userAuthorizationResponse.getViewInstanceName(),
           requestedIds);
 
       resources.add(resource);
     }
   }
+
+  /**
+   *  Returns user authorization response instance that represents the response schema
+   *  for /users/{userName}/authorizations REST endpoint
+   * @param authorizationId     authorization id
+   * @param authorizationName   authorization name
+   * @param clusterName         cluster name
+   * @param resourceType        resource type
+   * @param userName            user name
+   * @return {@link UserAuthorizationResponse}
+   */
+  private UserAuthorizationResponse getResponse(String authorizationId, String authorizationName,
+                                                                     String clusterName, String resourceType, String userName) {
+    return new UserAuthorizationResponse(authorizationId, authorizationName, clusterName, resourceType, userName);
+
+  }
+
+  /**
+   * Returns user authorization response instance that represents the response schema
+   * for /users/{userName}/authorizations REST endpoint
+   * @param authorizationId      authorization id
+   * @param authorizationName    authorization name
+   * @param resourceType         resource type
+   * @param userName             user name
+   * @param viewName             view name
+   * @param viewVersion          view version
+   * @param viewInstanceName     view instance name
+   * @return  {@link UserAuthorizationResponse}
+   */
+  private UserAuthorizationResponse getResponse(String authorizationId, String authorizationName,
+                                                                     String resourceType, String userName, String viewName,
+                                                                     String viewVersion, String viewInstanceName) {
+    return new UserAuthorizationResponse(authorizationId, authorizationName, resourceType, userName, viewName, viewVersion, viewInstanceName);
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb86fb3b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProvider.java
index b9b756b..bb689ec 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProvider.java
@@ -26,6 +26,8 @@ import java.util.Set;
 import java.util.TreeMap;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.ambari.server.controller.PrivilegeResponse;
+import org.apache.ambari.server.controller.UserPrivilegeResponse;
 import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
 import org.apache.ambari.server.controller.spi.NoSuchResourceException;
 import org.apache.ambari.server.controller.spi.Predicate;
@@ -299,42 +301,38 @@ public class UserPrivilegeResourceProvider extends ReadOnlyResourceProvider {
         final Collection<PrivilegeEntity> privileges = users.getUserPrivileges(userEntity);
 
         for (PrivilegeEntity privilegeEntity : privileges) {
-          resources.add(toResource(privilegeEntity, userName, requestedIds));
+          UserPrivilegeResponse response = getResponse(privilegeEntity, userName);
+          resources.add(toResource(response, requestedIds));
         }
       }
     }
     return resources;
   }
 
-
   /**
-   * Translate the found data into a Resource
-   *
-   * @param privilegeEntity the privilege data
-   * @param userName        the username
-   * @param requestedIds    the relevant request ids
-   * @return a resource
+   * Returns response schema instance for /users/{userName}/privileges REST endpoint
+   * @param privilegeEntity {@link PrivilegeEntity}
+   * @param userName   user name
+   * @return {@link UserPrivilegeResponse}
    */
-  protected Resource toResource(PrivilegeEntity privilegeEntity, Object userName, Set<String> requestedIds){
-    final ResourceImpl resource = new ResourceImpl(Resource.Type.UserPrivilege);
-
-    setResourceProperty(resource, PRIVILEGE_USER_NAME_PROPERTY_ID, userName, requestedIds);
-    setResourceProperty(resource, PRIVILEGE_PRIVILEGE_ID_PROPERTY_ID, privilegeEntity.getId(), requestedIds);
-    setResourceProperty(resource, PRIVILEGE_PERMISSION_NAME_PROPERTY_ID, privilegeEntity.getPermission().getPermissionName(), requestedIds);
-    setResourceProperty(resource, PRIVILEGE_PERMISSION_LABEL_PROPERTY_ID, privilegeEntity.getPermission().getPermissionLabel(), requestedIds);
-    setResourceProperty(resource, PRIVILEGE_PRINCIPAL_TYPE_PROPERTY_ID, privilegeEntity.getPrincipal().getPrincipalType().getName(), requestedIds);
+  protected UserPrivilegeResponse getResponse(PrivilegeEntity privilegeEntity, String userName) {
+    String permissionLabel = privilegeEntity.getPermission().getPermissionLabel();
+    String permissionName =  privilegeEntity.getPermission().getPermissionName();
+    String principalTypeName = privilegeEntity.getPrincipal().getPrincipalType().getName();
+    UserPrivilegeResponse userPrivilegeResponse = new UserPrivilegeResponse(userName, permissionLabel , permissionName,
+      privilegeEntity.getId(), PrincipalTypeEntity.PrincipalType.valueOf(principalTypeName));
 
-    final String principalTypeName = privilegeEntity.getPrincipal().getPrincipalType().getName();
     if (principalTypeName.equals(PrincipalTypeEntity.USER_PRINCIPAL_TYPE_NAME)) {
       final UserEntity user = userDAO.findUserByPrincipal(privilegeEntity.getPrincipal());
-      setResourceProperty(resource, PRIVILEGE_PRINCIPAL_NAME_PROPERTY_ID, user.getUserName(), requestedIds);
+      userPrivilegeResponse.setPrincipalName(user.getUserName());
     } else if (principalTypeName.equals(PrincipalTypeEntity.GROUP_PRINCIPAL_TYPE_NAME)) {
       final GroupEntity groupEntity = getCachedGroupByPrincipal(privilegeEntity.getPrincipal());
-      setResourceProperty(resource, PRIVILEGE_PRINCIPAL_NAME_PROPERTY_ID, groupEntity.getGroupName(), requestedIds);
+      userPrivilegeResponse.setPrincipalName(groupEntity.getGroupName());
     }
 
     String typeName = privilegeEntity.getResource().getResourceType().getName();
     ResourceType resourceType = ResourceType.translate(typeName);
+
     if(resourceType != null) {
       switch (resourceType) {
         case AMBARI:
@@ -342,21 +340,57 @@ public class UserPrivilegeResourceProvider extends ReadOnlyResourceProvider {
           break;
         case CLUSTER:
           final ClusterEntity clusterEntity = clusterCache.get().getUnchecked(privilegeEntity.getResource().getId());
-          setResourceProperty(resource, PRIVILEGE_CLUSTER_NAME_PROPERTY_ID, clusterEntity.getClusterName(), requestedIds);
+          userPrivilegeResponse.setClusterName(clusterEntity.getClusterName());
           break;
         case VIEW:
           final ViewInstanceEntity viewInstanceEntity = viewInstanceCache.get().getUnchecked(privilegeEntity.getResource().getId());
           final ViewEntity viewEntity = viewInstanceEntity.getViewEntity();
 
-          setResourceProperty(resource, PRIVILEGE_VIEW_NAME_PROPERTY_ID, viewEntity.getCommonName(), requestedIds);
-          setResourceProperty(resource, PRIVILEGE_VIEW_VERSION_PROPERTY_ID, viewEntity.getVersion(), requestedIds);
-          setResourceProperty(resource, PRIVILEGE_INSTANCE_NAME_PROPERTY_ID, viewInstanceEntity.getName(), requestedIds);
+          userPrivilegeResponse.setViewName(viewEntity.getCommonName());
+          userPrivilegeResponse.setVersion(viewEntity.getVersion());
+          userPrivilegeResponse.setInstanceName(viewInstanceEntity.getName());
           break;
       }
 
-      setResourceProperty(resource, PRIVILEGE_TYPE_PROPERTY_ID, resourceType.name(), requestedIds);
+      userPrivilegeResponse.setType(resourceType);
+    }
+
+    return userPrivilegeResponse;
+  }
+
+  /**
+   * Translate the Response into a Resource
+   * @param response        {@link PrivilegeResponse}
+   * @param requestedIds    the relevant request ids
+   * @return a resource
+   */
+  protected Resource toResource(UserPrivilegeResponse response, Set<String> requestedIds){
+    final ResourceImpl resource = new ResourceImpl(Resource.Type.UserPrivilege);
+
+
+
+    setResourceProperty(resource, PRIVILEGE_USER_NAME_PROPERTY_ID, response.getUserName(), requestedIds);
+    setResourceProperty(resource, PRIVILEGE_PRIVILEGE_ID_PROPERTY_ID, response.getPrivilegeId(), requestedIds);
+    setResourceProperty(resource, PRIVILEGE_PERMISSION_NAME_PROPERTY_ID, response.getPermissionName(), requestedIds);
+    setResourceProperty(resource, PRIVILEGE_PERMISSION_LABEL_PROPERTY_ID, response.getPermissionLabel(), requestedIds);
+    setResourceProperty(resource, PRIVILEGE_PRINCIPAL_TYPE_PROPERTY_ID, response.getPrincipalType().name(), requestedIds);
+    if (response.getPrincipalName() != null) {
+      setResourceProperty(resource, PRIVILEGE_PRINCIPAL_NAME_PROPERTY_ID, response.getPrincipalName(), requestedIds);
     }
+    if (response.getType() != null) {
+      setResourceProperty(resource, PRIVILEGE_TYPE_PROPERTY_ID, response.getType().name(), requestedIds);
+      switch (response.getType()) {
+        case CLUSTER:
+          setResourceProperty(resource, PRIVILEGE_CLUSTER_NAME_PROPERTY_ID, response.getClusterName(), requestedIds);
+          break;
+        case VIEW:
+          setResourceProperty(resource, PRIVILEGE_VIEW_NAME_PROPERTY_ID, response.getViewName(), requestedIds);
+          setResourceProperty(resource, PRIVILEGE_VIEW_VERSION_PROPERTY_ID, response.getVersion(), requestedIds);
+          setResourceProperty(resource, PRIVILEGE_INSTANCE_NAME_PROPERTY_ID, response.getInstanceName(), requestedIds);
+          break;
+      }
 
+    }
     return resource;
   }
 }
\ No newline at end of file