Skip to content

Commit 53c911b

Browse files
Bryan GuoPhilip Langdale
Bryan Guo
authored and
Philip Langdale
committed
[cm_api] OPSAPS-22168 missing /cm/licensedFeatureUsage
1 parent 1648521 commit 53c911b

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

python/src/cm_api/endpoints/cms.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,24 @@ def import_admin_credentials(self, username, password):
146146
"""
147147
return self._cmd('importAdminCredentials', params=dict(username=username, password=password))
148148

149+
def get_licensed_feature_usage(self):
150+
"""
151+
Retrieve a summary of licensed feature usage.
152+
153+
This command will return information about what Cloudera Enterprise
154+
licensed features are in use in the clusters being managed by this Cloudera
155+
Manager, as well as totals for usage across all clusters.
156+
157+
The specific features described can vary between different versions of
158+
Cloudera Manager.
159+
160+
Available since API v6.
161+
"""
162+
return self._get('getLicensedFeatureUsage',
163+
ret_type=ApiLicensedFeatureUsage,
164+
ret_is_list=False,
165+
api_version=6)
166+
149167
def inspect_hosts(self):
150168
"""
151169
Runs the host inspector on the configured hosts.

python/src/cm_api/endpoints/types.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,12 @@ class ApiCmPeer(BaseApiObject):
664664
def __str__(self):
665665
return "<ApiPeer>: %s (%s)" % (self.name, self.url)
666666

667+
class ApiLicensedFeatureUsage(BaseApiObject):
668+
_ATTRIBUTES = {
669+
'totals' : ROAttr(),
670+
'clusters' : ROAttr(),
671+
}
672+
667673
class ApiHdfsReplicationArguments(BaseApiObject):
668674
_ATTRIBUTES = {
669675
'sourceService' : Attr(ApiServiceRef),

python/src/cm_api_tests/test_cms.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,40 @@ def test_host_commission(self):
9292
data=[ "host1", "host2" ],
9393
retdata={})
9494
cms.hosts_recommission([ "host1", "host2" ])
95+
96+
def test_get_licensed_feature_usage(self):
97+
resource = utils.MockResource(self)
98+
cms = ClouderaManager(resource)
99+
json_string = {
100+
"totals" : {
101+
"Core" : 8,
102+
"HBase" : 8,
103+
"Impala" : 8,
104+
"Search" : 2,
105+
"Spark" : 5,
106+
"Accumulo" : 0,
107+
"Navigator" : 8
108+
},
109+
"clusters" : {
110+
"Cluster 1" : {
111+
"Core" : 4,
112+
"HBase" : 4,
113+
"Impala" : 4,
114+
"Search" : 1,
115+
"Spark" : 1,
116+
"Accumulo" : 0,
117+
"Navigator" : 4
118+
},
119+
"Cluster 2" : {
120+
"Core" : 4,
121+
"HBase" : 4,
122+
"Impala" : 4,
123+
"Search" : 1,
124+
"Spark" : 4,
125+
"Accumulo" : 0,
126+
"Navigator" : 4
127+
}
128+
}
129+
}
130+
resource.expect("GET", "/cm/getLicensedFeatureUsage", retdata=json_string)
131+
cms.get_licensed_feature_usage()

0 commit comments

Comments
 (0)