You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Sid Wagle <sw...@hortonworks.com> on 2014/05/31 08:23:05 UTC

Review Request 22108: Hosts API should provide count of filtered hosts

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22108/
-----------------------------------------------------------

Review request for Ambari, Mahadev Konar and Tom Beerbower.


Bugs: AMBARI-5981
    https://issues.apache.org/jira/browse/AMBARI-5981


Repository: ambari


Description
-------

We need the number of filtered hosts in response of query to Hosts API.
The number should be affected by all filter properties, except "from" and "page_size".
For example,
following query:

/api/v1/clusters/c/hosts?from=0&page_size=25&Hosts/host_name.matches(host.*)

should return number of filtered hosts by host_name, but ignoring "from" and "page_size" parameters.

Basically, paging ability implies provide a total count of items.

Result:

{
  "href" : "http://c6401.ambari.apache.org:8080/api/v1/hosts?from=0&page_size=2",
  "itemCount" : "2",
  "items" : [
    {
      "href" : "http://c6401.ambari.apache.org:8080/api/v1/hosts/c6401.ambari.apache.org",
      "Hosts" : {
        "host_name" : "c6401.ambari.apache.org"
      }
    },
    {
      "href" : "http://c6401.ambari.apache.org:8080/api/v1/hosts/c6402.ambari.apache.org",
      "Hosts" : {
        "host_name" : "c6402.ambari.apache.org"
      }
    }
  ]
}


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java 73ad19a 
  ambari-server/src/main/java/org/apache/ambari/server/api/resources/BaseResourceDefinition.java 1db8518 
  ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/JsonSerializer.java 35a9856 
  ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterControllerImpl.java b057334 
  ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PageResponseImpl.java f115ee2 
  ambari-server/src/main/java/org/apache/ambari/server/controller/spi/PageResponse.java 1d67927 
  ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterControllerImplTest.java f2b1487 
  ambari-server/src/test/java/org/apache/ambari/server/controller/internal/PageResponseImplTest.java 3177e88 

Diff: https://reviews.apache.org/r/22108/diff/


Testing
-------


Thanks,

Sid Wagle


Re: Review Request 22108: Hosts API should provide count of filtered hosts

Posted by Tom Beerbower <tb...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22108/#review44461
-----------------------------------------------------------

Ship it!


Ship It!

- Tom Beerbower


On May 31, 2014, 6:23 a.m., Sid Wagle wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/22108/
> -----------------------------------------------------------
> 
> (Updated May 31, 2014, 6:23 a.m.)
> 
> 
> Review request for Ambari, Mahadev Konar and Tom Beerbower.
> 
> 
> Bugs: AMBARI-5981
>     https://issues.apache.org/jira/browse/AMBARI-5981
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> We need the number of filtered hosts in response of query to Hosts API.
> The number should be affected by all filter properties, except "from" and "page_size".
> For example,
> following query:
> 
> /api/v1/clusters/c/hosts?from=0&page_size=25&Hosts/host_name.matches(host.*)
> 
> should return number of filtered hosts by host_name, but ignoring "from" and "page_size" parameters.
> 
> Basically, paging ability implies provide a total count of items.
> 
> Result:
> 
> {
>   "href" : "http://c6401.ambari.apache.org:8080/api/v1/hosts?from=0&page_size=2",
>   "itemCount" : "2",
>   "items" : [
>     {
>       "href" : "http://c6401.ambari.apache.org:8080/api/v1/hosts/c6401.ambari.apache.org",
>       "Hosts" : {
>         "host_name" : "c6401.ambari.apache.org"
>       }
>     },
>     {
>       "href" : "http://c6401.ambari.apache.org:8080/api/v1/hosts/c6402.ambari.apache.org",
>       "Hosts" : {
>         "host_name" : "c6402.ambari.apache.org"
>       }
>     }
>   ]
> }
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java 73ad19a 
>   ambari-server/src/main/java/org/apache/ambari/server/api/resources/BaseResourceDefinition.java 1db8518 
>   ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/JsonSerializer.java 35a9856 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterControllerImpl.java b057334 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PageResponseImpl.java f115ee2 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/spi/PageResponse.java 1d67927 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterControllerImplTest.java f2b1487 
>   ambari-server/src/test/java/org/apache/ambari/server/controller/internal/PageResponseImplTest.java 3177e88 
> 
> Diff: https://reviews.apache.org/r/22108/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Sid Wagle
> 
>