From b0481385454f9aa7a0f7e05f40ad94ab43c32cf2 Mon Sep 17 00:00:00 2001 From: Jenkins Date: Mon, 28 Nov 2016 15:25:09 -0800 Subject: [PATCH 1/4] [CLOUDERA-BUILD] Bump up version number to 5.10.0 --- java/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/pom.xml b/java/pom.xml index ea7a3a16..f1d220f1 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -5,7 +5,7 @@ com.cloudera.api cloudera-manager-api Cloudera Manager API - 5.10.0-SNAPSHOT + 5.10.0 2.7.5 From b77114573138d2e64e6f90bd70d8f1f2ca9e503d Mon Sep 17 00:00:00 2001 From: mthakkar Date: Tue, 31 Jan 2017 10:51:32 -0800 Subject: [PATCH 2/4] [java] Updated with v5.10.0 java source --- java/api-docs.fmt | 207 ++++-- java/enunciate.xml | 6 +- java/pom.xml | 42 +- java/src/javadoc/javadoc.css | 607 ------------------ .../com/cloudera/api/ApiRootResource.java | 37 +- .../main/java/com/cloudera/api/ApiUtils.java | 11 + .../api/ClouderaManagerClientBuilder.java | 85 ++- .../main/java/com/cloudera/api/DataView.java | 6 + .../java/com/cloudera/api/Parameters.java | 8 + .../com/cloudera/api/model/ApiCluster.java | 50 +- .../api/model/ApiClusterTemplate.java | 137 ++++ .../api/model/ApiClusterTemplateConfig.java | 96 +++ .../api/model/ApiClusterTemplateHostInfo.java | 95 +++ .../model/ApiClusterTemplateHostTemplate.java | 70 ++ .../model/ApiClusterTemplateInstantiator.java | 86 +++ .../api/model/ApiClusterTemplateRole.java | 54 ++ .../ApiClusterTemplateRoleConfigGroup.java | 93 +++ ...ApiClusterTemplateRoleConfigGroupInfo.java | 51 ++ .../api/model/ApiClusterTemplateService.java | 104 +++ .../api/model/ApiClusterTemplateVariable.java | 52 ++ .../com/cloudera/api/model/ApiCmPeer.java | 107 ++- .../com/cloudera/api/model/ApiCmPeerType.java | 24 + .../ApiCollectDiagnosticDataArguments.java | 25 +- .../com/cloudera/api/model/ApiCommand.java | 40 +- .../com/cloudera/api/model/ApiConfig.java | 67 +- .../ApiConfigureForKerberosArguments.java | 78 +++ .../cloudera/api/model/ApiEntityStatus.java | 53 ++ .../api/model/ApiExternalAccount.java | 149 +++++ .../api/model/ApiExternalAccountCategory.java | 58 ++ .../model/ApiExternalAccountCategoryList.java | 46 ++ .../api/model/ApiExternalAccountList.java | 45 ++ .../api/model/ApiExternalAccountType.java | 109 ++++ .../api/model/ApiExternalAccountTypeList.java | 48 ++ .../ApiHdfsCloudReplicationArguments.java | 89 +++ .../model/ApiHdfsReplicationArguments.java | 74 ++- .../api/model/ApiHdfsReplicationResult.java | 36 +- .../cloudera/api/model/ApiHealthCheck.java | 42 ++ .../ApiHiveCloudReplicationArguments.java | 137 ++++ .../model/ApiHiveReplicationArguments.java | 11 +- .../api/model/ApiHiveReplicationError.java | 25 +- .../api/model/ApiHiveReplicationResult.java | 52 +- .../com/cloudera/api/model/ApiHiveUDF.java | 69 ++ .../java/com/cloudera/api/model/ApiHost.java | 32 + .../api/model/ApiHostInstallArguments.java | 8 +- .../api/model/ApiMrUsageReportRow.java | 210 +++++- .../cloudera/api/model/ApiProductVersion.java | 53 ++ ...iReplicationDiagnosticsCollectionArgs.java | 88 +++ .../api/model/ApiReplicationSchedule.java | 58 +- .../ApiReplicationScheduleDataLimits.java | 56 ++ .../api/model/ApiReplicationState.java | 55 ++ .../api/model/ApiRestartClusterArgs.java | 28 +- .../java/com/cloudera/api/model/ApiRole.java | 15 + .../model/ApiRollingRestartClusterArgs.java | 72 ++- .../com/cloudera/api/model/ApiScmDbInfo.java | 88 +++ .../com/cloudera/api/model/ApiService.java | 34 +- .../api/model/ApiShutdownReadiness.java | 60 ++ .../cloudera/api/model/ApiSnapshotPolicy.java | 18 +- .../ApiTimeSeriesCrossEntityMetadata.java | 32 + .../model/ApiTimeSeriesEntityAttribute.java | 97 +++ .../ApiTimeSeriesEntityAttributeList.java | 46 ++ .../api/model/ApiTimeSeriesEntityType.java | 184 ++++++ .../model/ApiTimeSeriesEntityTypeList.java | 44 ++ .../api/model/ApiTimeSeriesRequest.java | 188 ++++++ .../java/com/cloudera/api/model/ApiUser.java | 1 + .../cloudera/api/model/ApiUserSession.java | 112 ++++ .../api/model/ApiUserSessionList.java | 45 ++ .../com/cloudera/api/model/ApiWatchedDir.java | 37 ++ .../cloudera/api/model/ApiWatchedDirList.java | 48 ++ .../api/model/ApiYarnApplication.java | 205 +++++- .../cloudera/api/v1/MgmtServiceResource.java | 8 + .../cloudera/api/v10/AuditsResourceV10.java | 7 +- .../api/v10/RoleCommandsResourceV10.java | 3 +- .../api/v11/ClouderaManagerResourceV11.java | 35 + .../cloudera/api/v11/ClustersResourceV11.java | 60 ++ .../cloudera/api/v11/CmPeersResourceV11.java | 91 +++ .../cloudera/api/v11/CommandsResourceV11.java | 32 + .../cloudera/api/v11/HostsResourceV11.java | 52 ++ .../api/v11/NameservicesResourceV11.java | 51 ++ .../api/v11/ReplicationsResourceV11.java | 78 +++ .../cloudera/api/v11/RolesResourceV11.java | 63 ++ .../com/cloudera/api/v11/RootResourceV11.java | 46 ++ .../cloudera/api/v11/ServicesResourceV11.java | 66 ++ .../api/v11/TimeSeriesResourceV11.java | 67 ++ .../cloudera/api/v11/UsersResourceV11.java | 42 ++ .../com/cloudera/api/v11/package-info.java | 21 + .../api/v12/ClouderaManagerResourceV12.java | 34 + .../cloudera/api/v12/ClustersResourceV12.java | 69 ++ .../com/cloudera/api/v12/RootResourceV12.java | 33 + .../com/cloudera/api/v12/package-info.java | 21 + .../cloudera/api/v13/ClustersResourceV13.java | 39 ++ .../api/v13/ReplicationsResourceV13.java | 41 ++ .../com/cloudera/api/v13/RootResourceV13.java | 30 + .../cloudera/api/v13/ServicesResourceV13.java | 57 ++ .../com/cloudera/api/v13/package-info.java | 21 + .../api/v14/ClouderaManagerResourceV14.java | 41 ++ .../cloudera/api/v14/ClustersResourceV14.java | 39 ++ .../api/v14/ExternalAccountsResourceV14.java | 95 +++ .../api/v14/NameservicesResourceV14.java | 41 ++ .../com/cloudera/api/v14/RootResourceV14.java | 41 ++ .../cloudera/api/v14/ServicesResourceV14.java | 78 +++ .../cloudera/api/v14/WatchedDirResource.java | 76 +++ .../com/cloudera/api/v14/package-info.java | 21 + .../api/v15/ClouderaManagerResourceV15.java | 71 ++ .../com/cloudera/api/v15/RootResourceV15.java | 28 + .../com/cloudera/api/v15/package-info.java | 21 + .../api/v2/ClouderaManagerResourceV2.java | 2 +- .../com/cloudera/api/v3/CmPeersResource.java | 6 + .../com/cloudera/api/v4/AuditsResource.java | 10 +- .../api/v4/ImpalaQueriesResource.java | 9 +- .../cloudera/api/v4/ServicesResourceV4.java | 12 +- .../cloudera/api/v4/TimeSeriesResource.java | 7 +- .../cloudera/api/v6/DashboardsResource.java | 4 +- .../cloudera/api/v6/ServicesResourceV6.java | 24 +- .../cloudera/api/v6/TimeSeriesResourceV6.java | 14 +- .../api/v6/YarnApplicationsResource.java | 7 +- .../com/cloudera/api/v8/AuditsResourceV8.java | 11 +- .../api/ClouderaManagerClientBuilderTest.java | 67 ++ .../com/cloudera/api/model/ApiModelTest.java | 52 +- 118 files changed, 6183 insertions(+), 856 deletions(-) delete mode 100644 java/src/javadoc/javadoc.css create mode 100644 java/src/main/java/com/cloudera/api/model/ApiClusterTemplate.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiClusterTemplateConfig.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiClusterTemplateHostInfo.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiClusterTemplateHostTemplate.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiClusterTemplateInstantiator.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiClusterTemplateRole.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiClusterTemplateRoleConfigGroup.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiClusterTemplateRoleConfigGroupInfo.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiClusterTemplateService.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiClusterTemplateVariable.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiCmPeerType.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiConfigureForKerberosArguments.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiEntityStatus.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiExternalAccount.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiExternalAccountCategory.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiExternalAccountCategoryList.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiExternalAccountList.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiExternalAccountType.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiExternalAccountTypeList.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiHdfsCloudReplicationArguments.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiHiveCloudReplicationArguments.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiHiveUDF.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiProductVersion.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiReplicationDiagnosticsCollectionArgs.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiReplicationScheduleDataLimits.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiReplicationState.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiScmDbInfo.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiShutdownReadiness.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityAttribute.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityAttributeList.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityType.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityTypeList.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiTimeSeriesRequest.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiUserSession.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiUserSessionList.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiWatchedDir.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiWatchedDirList.java create mode 100644 java/src/main/java/com/cloudera/api/v11/ClouderaManagerResourceV11.java create mode 100644 java/src/main/java/com/cloudera/api/v11/ClustersResourceV11.java create mode 100644 java/src/main/java/com/cloudera/api/v11/CmPeersResourceV11.java create mode 100644 java/src/main/java/com/cloudera/api/v11/CommandsResourceV11.java create mode 100644 java/src/main/java/com/cloudera/api/v11/HostsResourceV11.java create mode 100644 java/src/main/java/com/cloudera/api/v11/NameservicesResourceV11.java create mode 100644 java/src/main/java/com/cloudera/api/v11/ReplicationsResourceV11.java create mode 100644 java/src/main/java/com/cloudera/api/v11/RolesResourceV11.java create mode 100644 java/src/main/java/com/cloudera/api/v11/RootResourceV11.java create mode 100644 java/src/main/java/com/cloudera/api/v11/ServicesResourceV11.java create mode 100644 java/src/main/java/com/cloudera/api/v11/TimeSeriesResourceV11.java create mode 100644 java/src/main/java/com/cloudera/api/v11/UsersResourceV11.java create mode 100644 java/src/main/java/com/cloudera/api/v11/package-info.java create mode 100644 java/src/main/java/com/cloudera/api/v12/ClouderaManagerResourceV12.java create mode 100644 java/src/main/java/com/cloudera/api/v12/ClustersResourceV12.java create mode 100644 java/src/main/java/com/cloudera/api/v12/RootResourceV12.java create mode 100644 java/src/main/java/com/cloudera/api/v12/package-info.java create mode 100644 java/src/main/java/com/cloudera/api/v13/ClustersResourceV13.java create mode 100644 java/src/main/java/com/cloudera/api/v13/ReplicationsResourceV13.java create mode 100644 java/src/main/java/com/cloudera/api/v13/RootResourceV13.java create mode 100644 java/src/main/java/com/cloudera/api/v13/ServicesResourceV13.java create mode 100644 java/src/main/java/com/cloudera/api/v13/package-info.java create mode 100644 java/src/main/java/com/cloudera/api/v14/ClouderaManagerResourceV14.java create mode 100644 java/src/main/java/com/cloudera/api/v14/ClustersResourceV14.java create mode 100644 java/src/main/java/com/cloudera/api/v14/ExternalAccountsResourceV14.java create mode 100644 java/src/main/java/com/cloudera/api/v14/NameservicesResourceV14.java create mode 100644 java/src/main/java/com/cloudera/api/v14/RootResourceV14.java create mode 100644 java/src/main/java/com/cloudera/api/v14/ServicesResourceV14.java create mode 100644 java/src/main/java/com/cloudera/api/v14/WatchedDirResource.java create mode 100644 java/src/main/java/com/cloudera/api/v14/package-info.java create mode 100644 java/src/main/java/com/cloudera/api/v15/ClouderaManagerResourceV15.java create mode 100644 java/src/main/java/com/cloudera/api/v15/RootResourceV15.java create mode 100644 java/src/main/java/com/cloudera/api/v15/package-info.java diff --git a/java/api-docs.fmt b/java/api-docs.fmt index 6c49f15a..188eb6e9 100644 --- a/java/api-docs.fmt +++ b/java/api-docs.fmt @@ -1064,10 +1064,10 @@ A service is an abstract entity providing a capability in a cluster. Examples of services are HDFS, MapReduce, YARN, and HBase. A service is usually distributed, and contains a set of roles that physically - run on the cluster. A service has its own configuration, status, - metrics, and roles. You may issue commands against a service, or - against a set of roles in bulk. Additionally, an HDFS service has - nameservices, and a MapReduce service has activities. + run on the cluster. A service has its own configuration, status and + roles. You may issue commands against a service, or against a set + of roles in bulk. Additionally, an HDFS service has nameservices, + and a MapReduce service has activities.

All services belong to a cluster (except for the Cloudera Management Service), and is uniquely identified by its name within a Cloudera @@ -1083,8 +1083,8 @@ processes.) Once created, a role cannot be reassigned to a different host. You need to delete and re-create it.

- A role has its own configuration, status and metrics. API commands on - roles are always issued in bulk at the service level. + A role has its own configuration and status. API commands on roles + are always issued in bulk at the service level.

Role Type
@@ -1119,6 +1119,18 @@ The operation of this service is similar to other Hadoop services, except that the Management Service does not belong to a cluster.
+
Metrics
+
+

+ A metric is a property that can be measured to quantify the state of an + entity or activity, such as the number of open file descriptors or CPU + utilization percentage. Full list of metric schema is available through + Cloudera Manager API /timeseries/schema endpoint. +

+ Cloudera Manager enables retrieving of metric data using a launguage + called tsquery. Please see tsquery documentation for more details on + how to write a tsquery. +

Debugging the API

@@ -1504,56 +1516,157 @@ } } -

Metrics

+

Querying metric data

-

In the Enterprise Edition, you can get metrics related to hosts, - services, roles and activities. The call by default fetches data points from - the last 5 minutes. +

+ Getting dfs capacity metric data for service HDFS-1. $ curl -u admin:admin \ - 'http://localhost:7180/api/v1/clusters/Cluster%201%20-%20CDH4/services/hdfs1/metrics?metrics=dfs_capacity_used_non_hdfs&metrics=dfs_capacity' + 'http://localhost:7180/api/v11/timeseries?query=select%20dfs_capacity,%20dfs_capacity_used,%20dfs_capacity_used_non_hdfs%20where%20entityName=HDFS-1' { "items" : [ { - "name" : "dfs_capacity_used_non_hdfs", - "context" : "hdfs1:nameservice1", - "data" : [ { - "value" : 0.0, - "timestamp" : "2012-05-06T10:25:46.000Z" - }, { - "value" : 0.0, - "timestamp" : "2012-05-06T10:26:46.000Z" - }, { - "value" : 0.0, - "timestamp" : "2012-05-06T10:27:46.000Z" - }, { - "value" : 0.0, - "timestamp" : "2012-05-06T10:28:46.000Z" - }, { - "value" : 0.0, - "timestamp" : "2012-05-06T10:29:46.000Z" - } ], - "unit" : "bytes" - }, { - "name" : "dfs_capacity", - "context" : "hdfs1:nameservice1", - "data" : [ { - "value" : 3.2103841792E10, - "timestamp" : "2012-05-06T10:25:46.000Z" - }, { - "value" : 3.2103841792E10, - "timestamp" : "2012-05-06T10:26:46.000Z" - }, { - "value" : 3.2103841792E10, - "timestamp" : "2012-05-06T10:27:46.000Z" + "timeSeries": [ { + "metadata": { + "metricName": "dfs_capacity", + "entityName": "HDFS-1", + "startTime": "2015-09-17T23:42:22.533Z", + "endTime": "2015-09-17T23:47:22.533Z", + "attributes": { + "clusterName": "Cluster 1", + "category": "SERVICE", + "clusterDisplayName": "Cluster 1", + "active": "true", + "serviceType": "HDFS", + "serviceDisplayName": "HDFS-1", + "version": "CDH 5.7.0", + "serviceName": "HDFS-1", + "entityName": "HDFS-1" + }, + "unitNumerators": [ + "bytes" + ], + "unitDenominators": [], + "expression": "SELECT dfs_capacity WHERE entityName = \"HDFS-1\" AND category = SERVICE", + "metricCollectionFrequencyMs": 60000, + "rollupUsed": "RAW" + }, + "data": [ { + "timestamp": "2015-09-17T23:43:10.599Z", + "value": 86909397813, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:44:10.605Z", + "value": 86909397813, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:45:10.608Z", + "value": 86909397813, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:46:10.615Z", + "value": 86909397813, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:47:15.613Z", + "value": 86909397813, + "type": "SAMPLE" + } ] }, { - "value" : 3.2103841792E10, - "timestamp" : "2012-05-06T10:28:46.000Z" + "metadata": { + "metricName": "dfs_capacity_used", + "entityName": "HDFS-1", + "startTime": "2015-09-17T23:42:22.533Z", + "endTime": "2015-09-17T23:47:22.533Z", + "attributes": { + "clusterName": "Cluster 1", + "category": "SERVICE", + "clusterDisplayName": "Cluster 1", + "active": "true", + "serviceType": "HDFS", + "serviceDisplayName": "HDFS-1", + "version": "CDH 5.7.0", + "serviceName": "HDFS-1", + "entityName": "HDFS-1" + }, + "unitNumerators": [ + "bytes" + ], + "unitDenominators": [], + "expression": "SELECT dfs_capacity_used WHERE entityName = \"HDFS-1\" AND category = SERVICE", + "metricCollectionFrequencyMs": 60000, + "rollupUsed": "RAW" + }, + "data": [ { + "timestamp": "2015-09-17T23:43:10.599Z", + "value": 1728884736, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:44:10.605Z", + "value": 1728884736, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:45:10.608Z", + "value": 1728884736, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:46:10.615Z", + "value": 1728884736, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:47:15.613Z", + "value": 1728884736, + "type": "SAMPLE" + } ] }, { - "value" : 3.2103841792E10, - "timestamp" : "2012-05-06T10:29:46.000Z" + "metadata": { + "metricName": "dfs_capacity_used_non_hdfs", + "entityName": "HDFS-1", + "startTime": "2015-09-17T23:42:22.533Z", + "endTime": "2015-09-17T23:47:22.533Z", + "attributes": { + "clusterName": "Cluster 1", + "category": "SERVICE", + "clusterDisplayName": "Cluster 1", + "active": "true", + "serviceType": "HDFS", + "serviceDisplayName": "HDFS-1", + "version": "CDH 5.7.0", + "serviceName": "HDFS-1", + "entityName": "HDFS-1" + }, + "unitNumerators": [ + "bytes" + ], + "unitDenominators": [], + "expression": "SELECT dfs_capacity_used_non_hdfs WHERE entityName = \"HDFS-1\" AND category = SERVICE", + "metricCollectionFrequencyMs": 60000, + "rollupUsed": "RAW" + }, + "data": [ { + "timestamp": "2015-09-17T23:43:10.599Z", + "value": 1610609973, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:44:10.605Z", + "value": 1610609973, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:45:10.608Z", + "value": 1610609973, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:46:10.615Z", + "value": 1610609973, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:47:15.613Z", + "value": 1610609973, + "type": "SAMPLE" + } ] } ], - "unit" : "bytes" + "warnings": [], + "timeSeriesQuery": "select dfs_capacity, dfs_capacity_used, dfs_capacity_used_non_hdfs where entityName=HDFS-1" } ] [/@boilerplate] diff --git a/java/enunciate.xml b/java/enunciate.xml index b8f56f4e..f9d03a8a 100644 --- a/java/enunciate.xml +++ b/java/enunciate.xml @@ -2,18 +2,18 @@ xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.27.xsd"> - + - + 5.10.0 - 2.7.5 + 2.7.7 14.0 2.1.0 2.1 @@ -21,7 +21,7 @@ cdh.releases.repo - http://maven.jenkins.cloudera.com:8081/artifactory/libs-release-local + http://maven.jenkins.cloudera.com:8081/artifactory/cdh-staging-local CDH Releases Repository @@ -114,6 +114,36 @@ + + + clover + + 4.0.3 + true + true + + + + com.atlassian.clover + clover + ${clover.version} + + + + + + + com.atlassian.maven.plugins + maven-clover2-plugin + ${clover.version} + + ${clover.generateHtml} + ${clover.generateXml} + + + + + @@ -153,7 +183,7 @@ com. ${privateClassPath}.com. - com.google.guava.** + com.google.common.** com.fasterxml.jackson.** @@ -209,7 +239,6 @@ ${javadocOptions} true ${project.build.directory}/javadoc - ${basedir}/src/javadoc/javadoc.css ${basedir}/src/javadoc/overview.html Cloudera Manager API (${project.version}) Cloudera Manager API (${project.version}) @@ -237,6 +266,11 @@ findbugs-exclude.xml + + org.owasp + dependency-check-maven + 1.4.3 + diff --git a/java/src/javadoc/javadoc.css b/java/src/javadoc/javadoc.css deleted file mode 100644 index cdc991dd..00000000 --- a/java/src/javadoc/javadoc.css +++ /dev/null @@ -1,607 +0,0 @@ -/*********************************************************/ -/* Javadoc style sheet --- JDK8 standard */ -/* http://download.java.net/jdk8/docs/api/stylesheet.css */ -/*********************************************************/ - -/* -Overall document style -*/ -body { - background-color:#ffffff; - color:#353833; - font-family:Arial, Helvetica, sans-serif; - font-size:76%; - margin:0; -} -a:link, a:visited { - text-decoration:none; - color:#4c6b87; -} -a:hover, a:focus { - text-decoration:none; - color:#bb7a2a; -} -a:active { - text-decoration:none; - color:#4c6b87; -} -a[name] { - color:#353833; -} -a[name]:hover { - text-decoration:none; - color:#353833; -} -pre { - font-size:1.3em; -} -h1 { - font-size:1.8em; -} -h2 { - font-size:1.5em; -} -h3 { - font-size:1.4em; -} -h4 { - font-size:1.3em; -} -h5 { - font-size:1.2em; -} -h6 { - font-size:1.1em; -} -ul { - list-style-type:disc; -} -code, tt { - font-size:1.2em; -} -dt code { - font-size:1.2em; -} -table tr td dt code { - font-size:1.2em; - vertical-align:top; -} -sup { - font-size:.6em; -} -/* -Document title and Copyright styles -*/ -.clear { - clear:both; - height:0px; - overflow:hidden; -} -.aboutLanguage { - float:right; - padding:0px 21px; - font-size:.8em; - z-index:200; - margin-top:-7px; -} -.legalCopy { - margin-left:.5em; -} -.bar a, .bar a:link, .bar a:visited, .bar a:active { - color:#FFFFFF; - text-decoration:none; -} -.bar a:hover, .bar a:focus { - color:#bb7a2a; -} -.tab { - background-color:#0066FF; - background-image:url(resources/titlebar.gif); - background-position:left top; - background-repeat:no-repeat; - color:#ffffff; - padding:8px; - width:5em; - font-weight:bold; -} -/* -Navigation bar styles -*/ -.bar { - background-image:url(resources/background.gif); - background-repeat:repeat-x; - color:#FFFFFF; - padding:.8em .5em .4em .8em; - height:auto;/*height:1.8em;*/ - font-size:1em; - margin:0; -} -.topNav { - background-image:url(resources/background.gif); - background-repeat:repeat-x; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; -} -.bottomNav { - margin-top:10px; - background-image:url(resources/background.gif); - background-repeat:repeat-x; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; -} -.subNav { - background-color:#dee3e9; - border-bottom:1px solid #9eadc0; - float:left; - width:100%; - overflow:hidden; -} -.subNav div { - clear:left; - float:left; - padding:0 0 5px 6px; -} -ul.navList, ul.subNavList { - float:left; - margin:0 25px 0 0; - padding:0; -} -ul.navList li{ - list-style:none; - float:left; - padding:3px 6px; -} -ul.subNavList li{ - list-style:none; - float:left; - font-size:90%; -} -.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { - color:#FFFFFF; - text-decoration:none; -} -.topNav a:hover, .bottomNav a:hover { - text-decoration:none; - color:#bb7a2a; -} -.navBarCell1Rev { - background-image:url(resources/tab.gif); - background-color:#a88834; - color:#FFFFFF; - margin: auto 5px; - border:1px solid #c9aa44; -} -/* -Page header and footer styles -*/ -.header, .footer { - clear:both; - margin:0 20px; - padding:5px 0 0 0; -} -.indexHeader { - margin:10px; - position:relative; -} -.indexHeader span{ - margin-right:15px; -} -.indexHeader h1 { - font-size:1.3em; -} -.title { - color:#2c4557; - margin:10px 0; -} -.subTitle { - margin:5px 0 0 0; -} -.header ul { - margin:0 0 25px 0; - padding:0; -} -.footer ul { - margin:20px 0 5px 0; -} -.header ul li, .footer ul li { - list-style:none; - /*font-size:1.2em;*/ -} -/* -Heading styles -*/ -div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { - background-color:#dee3e9; - border-top:1px solid #9eadc0; - border-bottom:1px solid #9eadc0; - margin:0 0 6px -8px; - padding:2px 5px; -} -ul.blockList ul.blockList ul.blockList li.blockList h3 { - background-color:#dee3e9; - border-top:1px solid #9eadc0; - border-bottom:1px solid #9eadc0; - margin:0 0 6px -8px; - padding:2px 5px; -} -ul.blockList ul.blockList li.blockList h3 { - padding:0; - margin:15px 0; -} -ul.blockList li.blockList h2 { - padding:0px 0 20px 0; -} -/* -Page layout container styles -*/ -.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { - clear:both; - padding:10px 20px; - position:relative; -} -.indexContainer { - margin:10px; - position:relative; - font-size:1.0em; -} -.indexContainer h2 { - font-size:1.1em; - padding:0 0 3px 0; -} -.indexContainer ul { - margin:0; - padding:0; -} -.indexContainer ul li { - list-style:none; -} -.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { - font-size:1.1em; - font-weight:bold; - margin:10px 0 0 0; - color:#4E4E4E; -} -.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { - margin:10px 0 10px 20px; -} -.serializedFormContainer dl.nameValue dt { - margin-left:1px; - font-size:1.1em; - display:inline; - font-weight:bold; -} -.serializedFormContainer dl.nameValue dd { - margin:0 0 0 1px; - font-size:1.1em; - display:inline; -} -/* -List styles -*/ -ul.horizontal li { - display:inline; - font-size:0.9em; -} -ul.inheritance { - margin:0; - padding:0; -} -ul.inheritance li { - display:inline; - list-style:none; -} -ul.inheritance li ul.inheritance { - margin-left:15px; - padding-left:15px; - padding-top:1px; -} -ul.blockList, ul.blockListLast { - margin:10px 0 10px 0; - padding:0; -} -ul.blockList li.blockList, ul.blockListLast li.blockList { - list-style:none; - margin-bottom:25px; -} -ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { - padding:0px 20px 5px 10px; - border:1px solid #9eadc0; - background-color:#f9f9f9; -} -ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { - padding:0 0 5px 8px; - background-color:#ffffff; - border:1px solid #9eadc0; - border-top:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { - margin-left:0; - padding-left:0; - padding-bottom:15px; - border:none; - border-bottom:1px solid #9eadc0; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { - list-style:none; - border-bottom:none; - padding-bottom:0; -} -table tr td dl, table tr td dl dt, table tr td dl dd { - margin-top:0; - margin-bottom:1px; -} -/* -Table styles -*/ -.contentContainer table, .classUseContainer table, .constantValuesContainer table { - border-bottom:1px solid #9eadc0; - width:100%; -} -.contentContainer ul li table, .classUseContainer ul li table, .constantValuesContainer ul li table { - width:100%; -} -.contentContainer .description table, .contentContainer .details table { - border-bottom:none; -} -.contentContainer ul li table th.colOne, .contentContainer ul li table th.colFirst, .contentContainer ul li table th.colLast, .classUseContainer ul li table th, .constantValuesContainer ul li table th, .contentContainer ul li table td.colOne, .contentContainer ul li table td.colFirst, .contentContainer ul li table td.colLast, .classUseContainer ul li table td, .constantValuesContainer ul li table td{ - vertical-align:top; - padding-right:20px; -} -.contentContainer ul li table th.colLast, .classUseContainer ul li table th.colLast,.constantValuesContainer ul li table th.colLast, -.contentContainer ul li table td.colLast, .classUseContainer ul li table td.colLast,.constantValuesContainer ul li table td.colLast, -.contentContainer ul li table th.colOne, .classUseContainer ul li table th.colOne, -.contentContainer ul li table td.colOne, .classUseContainer ul li table td.colOne { - padding-right:3px; -} -.overviewSummary caption, .packageSummary caption, .contentContainer ul.blockList li.blockList caption, .summary caption, .classUseContainer caption, .constantValuesContainer caption { - position:relative; - text-align:left; - background-repeat:no-repeat; - color:#FFFFFF; - font-weight:bold; - clear:none; - overflow:hidden; - padding:0px; - margin:0px; -} -caption a:link, caption a:hover, caption a:active, caption a:visited { - color:#FFFFFF; -} -.overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span { - white-space:nowrap; - padding-top:8px; - padding-left:8px; - display:block; - float:left; - background-image:url(resources/titlebar.gif); - height:18px; -} -.contentContainer ul.blockList li.blockList caption span.activeTableTab span { - white-space:nowrap; - padding-top:8px; - padding-left:8px; - display:block; - float:left; - background-image:url(resources/activetitlebar.gif); - height:18px; -} -.contentContainer ul.blockList li.blockList caption span.tableTab span { - white-space:nowrap; - padding-top:8px; - padding-left:8px; - display:block; - float:left; - background-image:url(resources/titlebar.gif); - height:18px; -} -.contentContainer ul.blockList li.blockList caption span.tableTab, .contentContainer ul.blockList li.blockList caption span.activeTableTab { - padding-top:0px; - padding-left:0px; - background-image:none; - float:none; - display:inline; -} -.overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { - width:10px; - background-image:url(resources/titlebar_end.gif); - background-repeat:no-repeat; - background-position:top right; - position:relative; - float:left; -} -.contentContainer ul.blockList li.blockList .activeTableTab .tabEnd { - width:10px; - margin-right:5px; - background-image:url(resources/activetitlebar_end.gif); - background-repeat:no-repeat; - background-position:top right; - position:relative; - float:left; -} -.contentContainer ul.blockList li.blockList .tableTab .tabEnd { - width:10px; - margin-right:5px; - background-image:url(resources/titlebar_end.gif); - background-repeat:no-repeat; - background-position:top right; - position:relative; - float:left; -} -ul.blockList ul.blockList li.blockList table { - margin:0 0 12px 0px; - width:100%; -} -.tableSubHeadingColor { - background-color: #EEEEFF; -} -.altColor { - background-color:#eeeeef; -} -.rowColor { - background-color:#ffffff; -} -.overviewSummary td, .packageSummary td, .contentContainer ul.blockList li.blockList td, .summary td, .classUseContainer td, .constantValuesContainer td { - text-align:left; - padding:3px 3px 3px 7px; -} -th.colFirst, th.colLast, th.colOne, .constantValuesContainer th { - background:#dee3e9; - border-top:1px solid #9eadc0; - border-bottom:1px solid #9eadc0; - text-align:left; - padding:3px 3px 3px 7px; -} -td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { - font-weight:bold; -} -td.colFirst, th.colFirst { - border-left:1px solid #9eadc0; - white-space:nowrap; -} -td.colLast, th.colLast { - border-right:1px solid #9eadc0; -} -td.colOne, th.colOne { - border-right:1px solid #9eadc0; - border-left:1px solid #9eadc0; -} -table.overviewSummary { - padding:0px; - margin-left:0px; -} -table.overviewSummary td.colFirst, table.overviewSummary th.colFirst, -table.overviewSummary td.colOne, table.overviewSummary th.colOne { - width:25%; - vertical-align:middle; -} -table.packageSummary td.colFirst, table.overviewSummary th.colFirst { - width:25%; - vertical-align:middle; -} -/* -Content styles -*/ -.description pre { - margin-top:0; -} -.deprecatedContent { - margin:0; - padding:10px 0; -} -.docSummary { - padding:0; -} -/* -Formatting effect styles -*/ -.sourceLineNo { - color:green; - padding:0 30px 0 0; -} -h1.hidden { - visibility:hidden; - overflow:hidden; - font-size:.9em; -} -.block { - display:block; - margin:3px 0 0 0; -} -.strong { - font-weight:bold; -} - -/************************************************/ -/* Cloudera custom */ -/************************************************/ - -body, th, td { - font-family: 'helvetica', 'arial', 'sans-serif'; - font-size: 13px; -} - -table { - border-collapse: collapse; -} -th, td { - text-align: left; - border: 1px solid #ccd; - padding: 4px 6px; - vertical-align: top; -} -th, td[bgcolor="#eeeeff"] { - background-color: #dde4ee; - color: #236; -} -th font { - font-size: 16px; -} -td { - white-space: nowrap; - background-color: #f4f6fa; -} -td + td { - white-space: normal; -} - -a[name="method_summary"] + table, a[name="method_summary"] + table tbody, -a[name="method_summary"] + table tr, a[name="method_summary"] + table th { - display: block; - border: none; -} -a[name="method_summary"] + table { - border: 1px solid #ccd; -} -a[name="method_summary"] + table th { - border-bottom: 1px solid #ccd; -} -a[name="method_summary"] + table, a[name="method_summary"] + table tr { - background: #f4f6fa; -} -a[name="method_summary"] + table td { - display: block; - padding: 0px 12px; - text-align: left; - border: none; - border-bottom: 1px solid #dde; - background: none; - padding-bottom: 10px; -} -a[name="method_summary"] + table td[align="right"] { - font-size: 6px; - color: #457; - margin-top: 6px; - position: relative; - left: -8px; - border-bottom: none; - padding-bottom: 2px; -} -a[name="method_summary"] + table td code { - font-size: 110%; -} -a[name="method_summary"] + table td code b a { - font-size: 14px; - font-family: 'helvetica', 'arial', 'sans-serif'; -} - -a { - color: #15d; -} -a:hover { - color: #18f; -} -a:active { - text-decoration: none; -} diff --git a/java/src/main/java/com/cloudera/api/ApiRootResource.java b/java/src/main/java/com/cloudera/api/ApiRootResource.java index f3029e20..49201062 100644 --- a/java/src/main/java/com/cloudera/api/ApiRootResource.java +++ b/java/src/main/java/com/cloudera/api/ApiRootResource.java @@ -16,6 +16,12 @@ package com.cloudera.api; import com.cloudera.api.v1.RootResourceV1; +import com.cloudera.api.v10.RootResourceV10; +import com.cloudera.api.v11.RootResourceV11; +import com.cloudera.api.v12.RootResourceV12; +import com.cloudera.api.v13.RootResourceV13; +import com.cloudera.api.v14.RootResourceV14; +import com.cloudera.api.v15.RootResourceV15; import com.cloudera.api.v2.RootResourceV2; import com.cloudera.api.v3.RootResourceV3; import com.cloudera.api.v4.RootResourceV4; @@ -24,7 +30,6 @@ import com.cloudera.api.v7.RootResourceV7; import com.cloudera.api.v8.RootResourceV8; import com.cloudera.api.v9.RootResourceV9; -import com.cloudera.api.v10.RootResourceV10; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -101,6 +106,36 @@ public interface ApiRootResource { @Path("/v10") RootResourceV10 getRootV10(); + /** + * @return The v11 root resource. + */ + @Path("/v11") + RootResourceV11 getRootV11(); + + /** + * @return The v12 root resource. + */ + @Path("/v12") + RootResourceV12 getRootV12(); + + /** + * @return The v13 root resource. + */ + @Path("/v13") + RootResourceV13 getRootV13(); + + /** + * @return The v14 root resource. + */ + @Path("/v14") + RootResourceV14 getRootV14(); + + /** + * @return The v15 root resource. + */ + @Path("/v15") + RootResourceV15 getRootV15(); + /** * Fetch the current API version supported by the server. *

diff --git a/java/src/main/java/com/cloudera/api/ApiUtils.java b/java/src/main/java/com/cloudera/api/ApiUtils.java index 1a4909ca..1e59ab9a 100644 --- a/java/src/main/java/com/cloudera/api/ApiUtils.java +++ b/java/src/main/java/com/cloudera/api/ApiUtils.java @@ -135,6 +135,17 @@ public static void checkOffsetAndLimit(int offset, int limit) { "Limit should be greater than 0."); } + + /** + * Check that the given limit is positive. + * + * @param limit Value to use as limit of a list's size. + */ + public static void checkLimit(int limit) { + Preconditions.checkArgument(limit > 0, + "Limit should be greater than 0."); + } + private ApiUtils() { } } diff --git a/java/src/main/java/com/cloudera/api/ClouderaManagerClientBuilder.java b/java/src/main/java/com/cloudera/api/ClouderaManagerClientBuilder.java index 1b6721d8..f071bc4b 100644 --- a/java/src/main/java/com/cloudera/api/ClouderaManagerClientBuilder.java +++ b/java/src/main/java/com/cloudera/api/ClouderaManagerClientBuilder.java @@ -35,13 +35,16 @@ import org.apache.cxf.configuration.jsse.TLSClientParameters; import org.apache.cxf.feature.AbstractFeature; import org.apache.cxf.feature.LoggingFeature; +import org.apache.cxf.jaxrs.client.Client; import org.apache.cxf.jaxrs.client.ClientConfiguration; import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.cxf.message.Message; import org.apache.cxf.transport.http.HTTPConduit; import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; public class ClouderaManagerClientBuilder { + public static final int DEFAULT_TCP_PORT = 7180; public static final long DEFAULT_CONNECTION_TIMEOUT = 0; public static final TimeUnit DEFAULT_CONNECTION_TIMEOUT_UNITS = @@ -53,8 +56,8 @@ public class ClouderaManagerClientBuilder { private URL baseUrl; private String hostname; private int port = DEFAULT_TCP_PORT; - private boolean enableTLS = false; - private boolean enableLogging = false; + private boolean enableTLS; + private boolean enableLogging; private String username; private String password; private long connectionTimeout = DEFAULT_CONNECTION_TIMEOUT; @@ -63,7 +66,11 @@ public class ClouderaManagerClientBuilder { private TimeUnit receiveTimeoutUnits = DEFAULT_RECEIVE_TIMEOUT_UNITS; private boolean validateCerts = true; private boolean validateCn = true; - private TrustManager[] trustManagers = null; + private boolean threadSafe; + private boolean maintainSessionAcrossRequests; + private boolean streamAutoClosure; + private TrustManager[] trustManagers; + private String acceptLanguage; /** * Cache JAXRSClientFactoryBean per proxyType. @@ -97,6 +104,12 @@ public JAXRSClientFactoryBean load(Class proxyType) throws Exception { } }); + public ClouderaManagerClientBuilder withAcceptLanguage( + String acceptLaunguage) { + this.acceptLanguage = acceptLaunguage; + return this; + } + public ClouderaManagerClientBuilder withBaseURL(URL baseUrl) { this.baseUrl = baseUrl; return this; @@ -122,6 +135,28 @@ public ClouderaManagerClientBuilder enableLogging() { return this; } + /** + * @param threadSafe Set if to create a thread safe client. + * @return + */ + public ClouderaManagerClientBuilder setThreadSafe(boolean threadSafe) { + this.threadSafe = threadSafe; + return this; + } + + /** + * @param maintainSessionAcrossRequests If set to true, created client will + * maintain HTTP session across multiple requests. Setting this to true also + * means that login attempt will be made for the 1st request for a new client + * or when the previous session has time out. + * @return + */ + public ClouderaManagerClientBuilder setMaintainSessionAcrossRequests( + boolean maintainSessionAcrossRequests) { + this.maintainSessionAcrossRequests = maintainSessionAcrossRequests; + return this; + } + public ClouderaManagerClientBuilder withUsernamePassword(String username, String password) { this.username = username; @@ -155,6 +190,18 @@ public ClouderaManagerClientBuilder disableTlsCnValidation() { return this; } + /** + * By default, ClouderaManagerClientBuilder disables auto-closure of response + * streams when generated client are making requests. This method enables + * this. If this is not enabled, caller of the client is responsible for + * closing the response streams. + * @return ClouderaManagerClientBuilder + */ + public ClouderaManagerClientBuilder enableStreamAutoClosure() { + this.streamAutoClosure = true; + return this; + } + @VisibleForTesting String generateAddress() { final String apiRootPath = "api/"; @@ -220,11 +267,21 @@ protected T build(Class proxyType) { if (enableLogging) { bean.setFeatures(Arrays.asList(new LoggingFeature())); } + bean.setThreadSafe(threadSafe); rootResource = bean.create(proxyType); } boolean isTlsEnabled = address.startsWith("https://"); ClientConfiguration config = WebClient.getConfig(rootResource); + if (maintainSessionAcrossRequests) { + config.getRequestContext().put(Message.MAINTAIN_SESSION, + Boolean.TRUE); + } + if (streamAutoClosure) { + config.getRequestContext().put("response.stream.auto.close", + Boolean.TRUE); + } + HTTPConduit conduit = (HTTPConduit) config.getConduit(); if (isTlsEnabled) { TLSClientParameters tlsParams = new TLSClientParameters(); @@ -239,6 +296,9 @@ else if (trustManagers != null) { } HTTPClientPolicy policy = conduit.getClient(); + if (acceptLanguage != null) { + policy.setAcceptLanguage(acceptLanguage); + } policy.setConnectionTimeout( connectionTimeoutUnits.toMillis(connectionTimeout)); policy.setReceiveTimeout( @@ -249,26 +309,24 @@ else if (trustManagers != null) { private static JAXRSClientFactoryBean cleanFactory(JAXRSClientFactoryBean bean) { bean.setUsername(null); bean.setPassword(null); + bean.setInitialState(null); bean.setFeatures(Arrays.asList()); return bean; } /** - * Closes the transport level conduit in the client. Reopening a new - * connection, requires creating a new client object using the build() - * method in this builder. + * Releases the internal state and configuration associated with this client. + * Reopening a new connection requires creating a new client object using the + * build() method in this builder. * * @param root The resource returned by the build() method of this * builder class */ public static void closeClient(ApiRootResource root) { - ClientConfiguration config = WebClient.getConfig(root); - HTTPConduit conduit = config.getHttpConduit(); - if (conduit == null) { - throw new IllegalArgumentException( - "Client is not using the HTTP transport"); + Client client = WebClient.client(root); + if (client != null) { + client.close(); } - conduit.close(); } /** @@ -289,14 +347,17 @@ public static void clearCachedResources() { /** A trust manager that will accept all certificates. */ private static class AcceptAllTrustManager implements X509TrustManager { + @Override public void checkClientTrusted(X509Certificate[] chain, String authType) { // no op. } + @Override public void checkServerTrusted(X509Certificate[] chain, String authType) { // no op. } + @Override public X509Certificate[] getAcceptedIssuers() { return null; } diff --git a/java/src/main/java/com/cloudera/api/DataView.java b/java/src/main/java/com/cloudera/api/DataView.java index 25737c98..b41b6c01 100644 --- a/java/src/main/java/com/cloudera/api/DataView.java +++ b/java/src/main/java/com/cloudera/api/DataView.java @@ -21,6 +21,12 @@ public enum DataView { SUMMARY, FULL, + /** + * Entities with health test results and health test explanation. + * Generating and transferring health check explanation for entities can be + * very expensive. + **/ + FULL_WITH_HEALTH_CHECK_EXPLANATION, EXPORT, /** All passwords and other sensitive fields are marked as REDACTED. */ EXPORT_REDACTED; diff --git a/java/src/main/java/com/cloudera/api/Parameters.java b/java/src/main/java/com/cloudera/api/Parameters.java index 64893610..7bf5913d 100644 --- a/java/src/main/java/com/cloudera/api/Parameters.java +++ b/java/src/main/java/com/cloudera/api/Parameters.java @@ -31,6 +31,7 @@ public final class Parameters { static public final String USER_NAME = "userName"; static public final String ACTIVITY_ID = "activityId"; static public final String PEER_NAME = "peerName"; + static public final String PEER_TYPE = "type"; static public final String SCHEDULE_ID = "scheduleId"; static public final String PRODUCT = "product"; static public final String VERSION = "version"; @@ -45,6 +46,11 @@ public final class Parameters { static public final String MUST_USE_DESIRED_ROLLUP = "mustUseDesiredRollup"; static public final String FILTER = "filter"; static public final String COMMAND_NAME = "commandName"; + static public final String DIR_PATH = "directoryPath"; + static public final String EXTERNAL_ACCOUNT_NAME = "name"; + static public final String EXTERNAL_ACCOUNT_TYPE_NAME = "typeName"; + static public final String EXTERNAL_ACCOUNT_CATEGORY_NAME = "categoryName"; + static public final String DISPLAY_NAME = "displayName"; /* Common query params. */ static public final String FROM = "from"; @@ -57,9 +63,11 @@ public final class Parameters { /* Default values. */ static public final String DATA_VIEW_DEFAULT = "summary"; static public final String DATA_VIEW_EXPORT = "export"; + static public final String DATA_VIEW_FULL = "full"; static public final String DATE_TIME_NOW = "now"; static public final String DAILY_AGGREGATION = "daily"; static public final String FILTER_DEFAULT = ""; + static public final String ROLLUP_DEFAULT = "RAW"; /* Common filtering properties. */ static public final String HOSTNAME = "hostname"; diff --git a/java/src/main/java/com/cloudera/api/model/ApiCluster.java b/java/src/main/java/com/cloudera/api/model/ApiCluster.java index 1874ce08..01da3419 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiCluster.java +++ b/java/src/main/java/com/cloudera/api/model/ApiCluster.java @@ -33,18 +33,22 @@ */ @XmlRootElement(name = "cluster") @XmlType(propOrder = {"name", "displayName", "version", "fullVersion", - "maintenanceMode", "maintenanceOwners", "services", "parcels", "clusterUrl"}) + "maintenanceMode", "maintenanceOwners", "services", "parcels", "clusterUrl", + "hostsUrl", "entityStatus", "uuid"}) public class ApiCluster { private String name; private String displayName; + private String uuid; private String clusterUrl; + private String hostsUrl; private ApiClusterVersion version; private String fullVersion; private Boolean maintenanceMode; private List maintenanceOwners; private List services; private List parcels; + private ApiEntityStatus entityStatus; public ApiCluster() { // For JAX-B @@ -102,8 +106,21 @@ public void setDisplayName(String displayName) { } /** - * Read only. - * Link into the Cloudera Manager web UI for this specific cluster. + * Readonly. The UUID of the cluster. + *

+ * Available since API v15. + */ + @XmlElement + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + * Readonly. Link into the Cloudera Manager web UI for this specific cluster. *

* Available since API v10. */ @@ -116,6 +133,20 @@ public void setClusterUrl(String clusterUrl) { this.clusterUrl = clusterUrl; } + /** + * Readonly. Link into the Cloudera Manager web UI for host table for this cluster. + *

+ * Available since API v11. + */ + @XmlElement + public String getHostsUrl() { + return hostsUrl; + } + + public void setHostsUrl(String hostsUrl) { + this.hostsUrl = hostsUrl; + } + /** The CDH version of the cluster. */ @XmlElement public ApiClusterVersion getVersion() { @@ -193,4 +224,17 @@ public List getParcels() { public void setParcels(List parcels) { this.parcels = parcels; } + + /** + * Readonly. The entity status for this cluster. + * Available since API v11. + */ + @XmlElement + public ApiEntityStatus getEntityStatus() { + return entityStatus; + } + + public void setEntityStatus(ApiEntityStatus entityStatus) { + this.entityStatus = entityStatus; + } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiClusterTemplate.java b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplate.java new file mode 100644 index 00000000..0a978b1c --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplate.java @@ -0,0 +1,137 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.google.common.collect.Lists; + +import java.util.List; + +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Details of cluster template + */ + +@XmlRootElement(name = "clusterTemplate") +@JsonInclude(Include.NON_EMPTY) +public class ApiClusterTemplate { + + /** + * CDH version + */ + private String cdhVersion; + /** + * Cluster display name + */ + private String displayName; + /** + * CM version for which the template + */ + private String cmVersion; + /** + * List of all repositories registered with CM + */ + @JsonInclude(Include.NON_EMPTY) + private List repositories = Lists.newArrayList(); + /** + * All the parcels that needs to be deployed and activated + */ + private List products = Lists.newArrayList(); + /** + * All the services that needs to be deployed + */ + @JsonInclude(Include.NON_EMPTY) + private List services = Lists.newArrayList(); + /** + * All host templates + */ + @JsonInclude(Include.NON_EMPTY) + private List hostTemplates = Lists.newArrayList(); + + /** + * A constructor listing all the variables and references that needs to be + * resolved for this template + */ + private ApiClusterTemplateInstantiator instantiator; + + public String getCdhVersion() { + return this.cdhVersion; + } + + public void setCdhVersion(String cdhVersion) { + this.cdhVersion = cdhVersion; + } + + public List getProducts() { + return this.products; + } + + public void setProducts(List products) { + this.products = products; + } + + public List getServices() { + return this.services; + } + + public void setServices(List services) { + this.services = services; + } + + public List getHostTemplates() { + return this.hostTemplates; + } + + public void setHostTemplates(List hostTemplates) { + this.hostTemplates = hostTemplates; + } + + public String getDisplayName() { + return this.displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getCmVersion() { + return this.cmVersion; + } + + public void setCmVersion(String cmVersion) { + this.cmVersion = cmVersion; + } + + public ApiClusterTemplateInstantiator getInstantiator() { + return this.instantiator; + } + + public void setInstantiator(ApiClusterTemplateInstantiator instantiator) { + this.instantiator = instantiator; + } + + public List getRepositories() { + return this.repositories; + } + + public void setRepositories(List repositories) { + this.repositories = repositories; + } + +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateConfig.java b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateConfig.java new file mode 100644 index 00000000..4fa0637b --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateConfig.java @@ -0,0 +1,96 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +/** + * Config Details: The config can either have a value or ref or variable. + */ +public class ApiClusterTemplateConfig { + /** + * Config name + */ + private String name; + /** + * Config value + */ + @JsonInclude(Include.NON_NULL) + private String value; + /** + * Name of the reference. If referring to a service then it will be replaced + * with actual service name at import time. If referring to a role then it + * will be replaced with the host name containing that role at import time. + */ + @JsonInclude(Include.NON_EMPTY) + private String ref; + /** + * Referring a variable. The variable value will be provided by the user at + * import time. Variable name for this config. At import time the value of + * this variable will be provided by the + * {@link #ApiClusterTemplateInstantiator.Variable} + */ + @JsonInclude(Include.NON_EMPTY) + private String variable; + /** + * This indicates that the value was automatically configured. + */ + @JsonInclude(Include.NON_DEFAULT) + private boolean autoConfig; + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getRef() { + return this.ref; + } + + public void setRef(String ref) { + this.ref = ref; + } + + public String getVariable() { + return this.variable; + } + + public void setVariable(String variable) { + this.variable = variable; + } + + public boolean isAutoConfig() { + return this.autoConfig; + } + + public void setAutoConfig(boolean autoConfig) { + this.autoConfig = autoConfig; + } + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateHostInfo.java b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateHostInfo.java new file mode 100644 index 00000000..12cd2e6b --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateHostInfo.java @@ -0,0 +1,95 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.google.common.collect.Sets; + +import java.util.Set; + +/** + * This contains information about the host or host range on which provided + * host template will be applied. + */ +@JsonInclude(Include.NON_EMPTY) +public class ApiClusterTemplateHostInfo { + /** + * Host name + */ + private String hostName; + /** + * Host range. Either this this or host name must be provided. + */ + private String hostNameRange; + /** + * Rack Id + */ + private String rackId; + /** + * Pointing to the host template reference in the cluster template. + */ + private String hostTemplateRefName; + /** + * This will used to resolve the roles defined in the cluster template. This + * roleRefName will be used to connect this host with that a role referrence + * defined in cluster template. + */ + private Set roleRefNames = Sets.newHashSet(); + + public String getHostName() { + return this.hostName; + } + + public ApiClusterTemplateHostInfo setHostName(String hostName) { + this.hostName = hostName; + return this; + } + + public String getHostNameRange() { + return this.hostNameRange; + } + + public void setHostNameRange(String hostNameRange) { + this.hostNameRange = hostNameRange; + } + + public String getRackId() { + return this.rackId; + } + + public void setRackId(String rackId) { + this.rackId = rackId; + } + + public String getHostTemplateRefName() { + return this.hostTemplateRefName; + } + + public void setHostTemplateRefName(String hostTemplateRefName) { + this.hostTemplateRefName = hostTemplateRefName; + } + + public Set getRoleRefNames() { + return this.roleRefNames; + } + + public void setRoleRefNames(Set roleRefNames) { + this.roleRefNames = roleRefNames; + } + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateHostTemplate.java b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateHostTemplate.java new file mode 100644 index 00000000..98415e4f --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateHostTemplate.java @@ -0,0 +1,70 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.google.common.collect.Lists; + +import java.util.List; + +/** + * Host templates will contain information about the role config groups that + * should be applied to a host. This basically means a host will have a role + * corresponding to each config group. + */ +@JsonInclude(Include.NON_EMPTY) +public class ApiClusterTemplateHostTemplate { + /** + * Reference name + */ + private String refName; + /** + * Represent the cardinality of this host template on source + */ + private int cardinality; + /** + * List of role config groups + */ + private List roleConfigGroupsRefNames = Lists.newArrayList(); + + public String getRefName() { + return this.refName; + } + + public void setRefName(String refName) { + this.refName = refName; + } + + public List getRoleConfigGroupsRefNames() { + return this.roleConfigGroupsRefNames; + } + + public void setRoleConfigGroupsRefNames( + List roleConfigGroupsRefNames) { + this.roleConfigGroupsRefNames = roleConfigGroupsRefNames; + } + + public int getCardinality() { + return this.cardinality; + } + + public void setCardinality(int cardinality) { + this.cardinality = cardinality; + } + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateInstantiator.java b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateInstantiator.java new file mode 100644 index 00000000..2562859e --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateInstantiator.java @@ -0,0 +1,86 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.google.common.collect.Lists; + +import java.util.List; + +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Details of cluster template + */ + +@XmlRootElement(name = "clusterTemplateInstantiator") +@JsonInclude(Include.NON_EMPTY) +public class ApiClusterTemplateInstantiator { + + /** + * Cluster name + */ + private String clusterName; + /** + * All the hosts that are part of that cluster + */ + private List hosts = Lists.newArrayList(); + /** + * All the variables the are referred by the cluster template + */ + private List variables = Lists.newArrayList(); + /** + * All the role config group informations for non-base RCGs. + */ + private List roleConfigGroups = Lists.newArrayList(); + + public String getClusterName() { + return this.clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + + public List getHosts() { + return this.hosts; + } + + public void setHosts(List hosts) { + this.hosts = hosts; + } + + public List getVariables() { + return this.variables; + } + + public void setVariables( + List variables) { + this.variables = variables; + } + + public List getRoleConfigGroups() { + return roleConfigGroups; + } + + public void setRoleConfigGroups( + List roleConfigGroups) { + this.roleConfigGroups = roleConfigGroups; + } + +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateRole.java b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateRole.java new file mode 100644 index 00000000..cffaa6f9 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateRole.java @@ -0,0 +1,54 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +/** + * Role info: This will contain information related to a role referred by some + * configuration. During import type this role must be materizalized. + * + */ +@JsonInclude(Include.NON_EMPTY) +public class ApiClusterTemplateRole { + /** + * Role reference name + */ + private String refName; + /** + * Role type + */ + private String roleType; + + public String getRefName() { + return this.refName; + } + + public void setRefName(String refName) { + this.refName = refName; + } + + public String getRoleType() { + return this.roleType; + } + + public void setRoleType(String roleType) { + this.roleType = roleType; + } + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateRoleConfigGroup.java b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateRoleConfigGroup.java new file mode 100644 index 00000000..a8a4ec16 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateRoleConfigGroup.java @@ -0,0 +1,93 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.google.common.collect.Lists; + +import java.util.List; + +/** + * Role config group info. + */ +@JsonInclude(Include.NON_EMPTY) +public class ApiClusterTemplateRoleConfigGroup { + /** + * The reference name of the role config. + */ + private String refName; + /** + * Role type + */ + private String roleType; + /** + * If true then it is the base config group for that role. There can only be + * one base role config group for a given role type. + */ + @JsonInclude(Include.NON_DEFAULT) + private boolean isBase; + /** + * Role config group display name + */ + private String displayName; + /** + * List of configurations + */ + private List configs = Lists.newArrayList(); + + public String getRefName() { + return this.refName; + } + + public void setRefName(String refName) { + this.refName = refName; + } + + public String getRoleType() { + return this.roleType; + } + + public void setRoleType(String roleType) { + this.roleType = roleType; + } + + public boolean isBase() { + return this.isBase; + } + + public void setBase(boolean isBase) { + this.isBase = isBase; + } + + public String getDisplayName() { + return this.displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public List getConfigs() { + return this.configs; + } + + public void setConfigs(List configs) { + this.configs = configs; + } + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateRoleConfigGroupInfo.java b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateRoleConfigGroupInfo.java new file mode 100644 index 00000000..009bc61c --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateRoleConfigGroupInfo.java @@ -0,0 +1,51 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + + +/** + * During import time information related to all the non-base config groups + * must be provided. + */ +public class ApiClusterTemplateRoleConfigGroupInfo { + /** + * Role config group reference name. This much match the reference name from + * the template. + */ + private String rcgRefName; + /** + * Role config group name. + */ + private String name; + + public String getRcgRefName() { + return this.rcgRefName; + } + + public void setRcgRefName(String rcgRefName) { + this.rcgRefName = rcgRefName; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateService.java b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateService.java new file mode 100644 index 00000000..d646269a --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateService.java @@ -0,0 +1,104 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.google.common.collect.Lists; + +import java.util.List; + +/** + * Service information + */ +@JsonInclude(Include.NON_EMPTY) +public class ApiClusterTemplateService { + /** + * Reference name of the service. This could be referred by some + * configuration. + */ + private String refName; + /** + * Service type + */ + private String serviceType; + /** + * Service level configuration + */ + private List serviceConfigs = Lists.newArrayList(); + /** + * All role config groups for that service + */ + private List roleConfigGroups = Lists.newArrayList(); + /** + * Service display name. + */ + private String displayName; + /** + * List of roles for this service that are referred by some configuration. + */ + private List roles = Lists.newArrayList(); + + public String getRefName() { + return this.refName; + } + + public void setRefName(String refName) { + this.refName = refName; + } + + public String getServiceType() { + return this.serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public List getServiceConfigs() { + return this.serviceConfigs; + } + + public void setServiceConfigs(List serviceConfigs) { + this.serviceConfigs = serviceConfigs; + } + + public List getRoleConfigGroups() { + return this.roleConfigGroups; + } + + public void setRoleConfigGroups(List roleConfigGroups) { + this.roleConfigGroups = roleConfigGroups; + } + + public List getRoles() { + return this.roles; + } + + public void setRoles(List roles) { + this.roles = roles; + } + + public String getDisplayName() { + return this.displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateVariable.java b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateVariable.java new file mode 100644 index 00000000..bec72eaa --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiClusterTemplateVariable.java @@ -0,0 +1,52 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +/** + * Variable that is referred in cluster template. + */ +@JsonInclude(Include.NON_EMPTY) +public class ApiClusterTemplateVariable { + /** + * Variable name that are referred in cluster template + */ + private String name; + /** + * This value will be placed whereever the variable is referred in the + * cluster template + */ + private String value; + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiCmPeer.java b/java/src/main/java/com/cloudera/api/model/ApiCmPeer.java index 865bc69b..42a3102c 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiCmPeer.java +++ b/java/src/main/java/com/cloudera/api/model/ApiCmPeer.java @@ -24,22 +24,34 @@ /** * Information about a Cloudera Manager peer instance. *

- * The username and password properties are only used when - * creating peers. They should be the credentials of a user with administrator - * privileges on the remote Cloudera Manager being linked. These credentials are - * not stored; they're just used to create the peer. + * The requirement and usage of username and password properties + * are dependent on the clouderaManagerCreatedUser flag. *

- * When retrieving peer information, neither of the above fields are populated. + * When creating peers, if 'clouderaManagerCreatedUser' is true, the + * username/password should be the credentials of a user with administrator + * privileges on the remote Cloudera Manager. These credentials are not stored, + * they are used to connect to the peer and create a user in that peer. The + * newly created user is stored and used for communication with that peer. + * If 'clouderaManagerCreatedUser' is false, which is not applicable to + * REPLICATION peer type, the username/password to the remote Cloudera Manager + * are directly stored and used for all communications with that peer. + *

+ * When updating peers, if 'clouderaManagerCreatedUser' is true and + * username/password are set, a new remote user will be created. If + * 'clouderaManagerCreatedUser' is false and username/password are set, the + * stored username/password will be updated. */ @XmlRootElement(name = "cmPeer") public class ApiCmPeer { private String name; + private ApiCmPeerType type; private String url; private String username; private String password; + private Boolean clouderaManagerCreatedUser; - /** The name of the link. */ + /** The name of the remote CM instance. Immutable during update.*/ @XmlElement public String getName() { return name; @@ -49,7 +61,21 @@ public void setName(String name) { this.name = name; } - /** The URL of the remote CM instance. */ + /** + * The type of the remote CM instance. Immutable during update. + * + * Available since API v11. + **/ + @XmlElement + public ApiCmPeerType getType() { + return type; + } + + public void setType(ApiCmPeerType type) { + this.type = type; + } + + /** The URL of the remote CM instance. Mutable during update.*/ @XmlElement public String getUrl() { return url; @@ -59,7 +85,22 @@ public void setUrl(String url) { this.url = url; } - /** The remote admin username, for setting up the link. */ + /** + * When creating peers, if 'clouderaManagerCreatedUser' is true, this should be + * the remote admin username for creating a user in remote Cloudera Manager. The + * created remote user will then be stored in the local Cloudera Manager DB and + * used in later communication. If 'clouderaManagerCreatedUser' is false, which + * is not applicable to REPLICATION peer type, Cloudera Manager will store this + * username in the local DB directly and use it together with 'password' for + * communication. + * + * Mutable during update. + * When set during update, if 'clouderaManagerCreatedUser' is true, a new user + * in remote Cloudera Manager is created, the newly created remote user will be + * stored in the local DB. An attempt to delete the previously created remote + * user will be made; If 'clouderaManagerCreatedUser' is false, the + * username/password in the local DB will be updated. + **/ @XmlElement public String getUsername() { return username; @@ -69,7 +110,22 @@ public void setUsername(String username) { this.username = username; } - /** The remote admin password, for setting up the link. */ + /** + * When creating peers, if 'clouderaManagerCreatedUser' is true, this should be + * the remote admin password for creating a user in remote Cloudera Manager. The + * created remote user will then be stored in the local Cloudera Manager DB and + * used in later communication. If 'clouderaManagerCreatedUser' is false, which + * is not applicable to REPLICATION peer type, Cloudera Manager will store this + * password in the local DB directly and use it together with 'username' for + * communication. + * + * Mutable during update. + * When set during update, if 'clouderaManagerCreatedUser' is true, a new user + * in remote Cloudera Manager is created, the newly created remote user will be + * stored in the local DB. An attempt to delete the previously created remote + * user will be made; If 'clouderaManagerCreatedUser' is false, the + * username/password in the local DB will be updated. + **/ @XmlElement public String getPassword() { return password; @@ -79,11 +135,36 @@ public void setPassword(String password) { this.password = password; } + /** + * If true, Cloudera Manager creates a remote user using the given + * username/password and stores the created user in local DB for use in later + * communication. Cloudera Manager will also try to delete the created remote + * user when deleting such peers. + * + * If false, Cloudera Manager will store the provided username/password in + * the local DB and use them in later communication. 'false' value on this + * field is not applicable to REPLICATION peer type. + * + * Available since API v11. + * + * Immutable during update. Should not be set when updating peers. + **/ + @XmlElement + public Boolean getClouderaManagerCreatedUser() { + return clouderaManagerCreatedUser; + } + + public void setClouderaManagerCreatedUser(Boolean clouderaManagerCreatedUser) { + this.clouderaManagerCreatedUser = clouderaManagerCreatedUser; + } + @Override public String toString() { return Objects.toStringHelper(this) .add("name", name) .add("url", url) + .add("type", type) + .add("clouderaManagerCreatedUser", clouderaManagerCreatedUser) .toString(); } @@ -92,12 +173,14 @@ public boolean equals(Object o) { ApiCmPeer other = ApiUtils.baseEquals(this, o); return this == other || (other != null && Objects.equal(name, other.getName()) && - Objects.equal(url, other.getUrl())); + Objects.equal(url, other.getUrl()) && + Objects.equal(type, other.getType()) && + Objects.equal(clouderaManagerCreatedUser, + other.getClouderaManagerCreatedUser())); } @Override public int hashCode() { - return Objects.hashCode(name, url); + return Objects.hashCode(name, url, type, clouderaManagerCreatedUser); } - } diff --git a/java/src/main/java/com/cloudera/api/model/ApiCmPeerType.java b/java/src/main/java/com/cloudera/api/model/ApiCmPeerType.java new file mode 100644 index 00000000..f3232062 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiCmPeerType.java @@ -0,0 +1,24 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +/** + * Enum for CM peer types. + */ +public enum ApiCmPeerType { + REPLICATION, // Remote CM is used in replication. + STATUS_AGGREGATION // Remote CM is used in status aggregation. +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiCollectDiagnosticDataArguments.java b/java/src/main/java/com/cloudera/api/model/ApiCollectDiagnosticDataArguments.java index 4b5107cf..62dd262f 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiCollectDiagnosticDataArguments.java +++ b/java/src/main/java/com/cloudera/api/model/ApiCollectDiagnosticDataArguments.java @@ -34,6 +34,7 @@ public class ApiCollectDiagnosticDataArguments { private String ticketNumber; private String comments; private String clusterName; + private Boolean enableMonitorMetricsCollection; private List roles; /** @@ -48,17 +49,21 @@ public void setBundleSize(long bundleSizeByte) { } /** - * This parameter is ignored as of CM 4.5. - * Use endTime and bundleSize instead. + * This parameter is ignored between CM 4.5 and CM 5.7 versions. + * For versions from CM 4.5 to CM 5.7, use endTime and + * bundleSizeBytes instead. + * + * For CM 5.7+ versions, startTime is an optional parameter that + * is with endTime and bundleSizeBytes. This was introduced + * to perform diagnostic data estimation and collection of global + * diagnostics data for a certain time range. * The start time (in ISO 8601 format) * of the period to collection statistics for. */ - @Deprecated public String getStartTime() { return startTime; } - @Deprecated public void setStartTime(String startTime) { this.startTime = startTime; } @@ -120,6 +125,18 @@ public void setClusterName(String clusterName) { this.clusterName = clusterName; } + /** + * Flag to enable collection of metrics for chart display. + */ + @XmlElement + public Boolean getEnableMonitorMetricsCollection() { + return enableMonitorMetricsCollection; + } + + public void setEnableMonitorMetricsCollection(Boolean enable) { + this.enableMonitorMetricsCollection = enable; + } + /** * List of roles for which to get logs and metrics. * diff --git a/java/src/main/java/com/cloudera/api/model/ApiCommand.java b/java/src/main/java/com/cloudera/api/model/ApiCommand.java index f9dc78d0..38c86c0c 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiCommand.java +++ b/java/src/main/java/com/cloudera/api/model/ApiCommand.java @@ -16,8 +16,10 @@ package com.cloudera.api.model; import com.cloudera.api.ApiUtils; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.base.Objects; +import java.util.Arrays; import java.util.Date; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -40,7 +42,8 @@ @XmlType(propOrder = { "id", "name", "startTime", "endTime", "active", "success", "resultMessage", "resultDataUrl", - "clusterRef", "serviceRef", "roleRef", "hostRef", "parent", "children" + "clusterRef", "serviceRef", "roleRef", "hostRef", "parent", "children", + "canRetry" }) public class ApiCommand { @@ -59,11 +62,12 @@ public class ApiCommand { private ApiHostRef hostRef; private ApiCommandList children; private ApiCommand parent; + private Boolean canRetry; public ApiCommand() { // For JAX-B this(null, null, null, null, false, null, null, null, null, null, null, null, - null, null); + null, null, null); } public ApiCommand(Long id, String name, Date startTime, Date endTime, @@ -71,7 +75,8 @@ public ApiCommand(Long id, String name, Date startTime, Date endTime, String resultDataUrl, ApiClusterRef clusterRef, ApiServiceRef serviceRef, ApiRoleRef roleRef, ApiHostRef hostRef, - ApiCommandList children, ApiCommand parent) { + ApiCommandList children, ApiCommand parent, + Boolean canRetry) { this.id = id; this.name = name; this.startTime = startTime; @@ -86,6 +91,7 @@ public ApiCommand(Long id, String name, Date startTime, Date endTime, this.hostRef = hostRef; this.children = children; this.parent = parent; + this.canRetry = canRetry; } @Override @@ -254,6 +260,29 @@ public void setChildren(ApiCommandList children) { this.children = children; } + /** + * Available since V11 + * + * @deprecated Use {@link ApiCommand#getCanRetry()} instead + */ + @Deprecated + @JsonIgnore + public Boolean isCanRetry() { + return this.canRetry; + } + + /** + * If the command can be retried. Available since V11 + */ + @XmlElement + public Boolean getCanRetry() { + return this.canRetry; + } + + public void setCanRetry(Boolean canRetry) { + this.canRetry = canRetry; + } + @Override public boolean equals(Object o) { ApiCommand that = ApiUtils.baseEquals(this, o); @@ -270,14 +299,15 @@ public boolean equals(Object o) { Objects.equal(roleRef, that.getRoleRef()) && Objects.equal(hostRef, that.getHostRef()) && Objects.equal(clusterRef, that.getClusterRef()) && - Objects.equal(parent, that.getParent())); + Objects.equal(parent, that.getParent()) && + Objects.equal(canRetry, that.getCanRetry())); } @Override public int hashCode() { return Objects.hashCode(id, name, startTime, endTime, active, success, resultMessage, resultDataUrl, serviceRef, roleRef, hostRef, clusterRef, - parent); + parent, canRetry); } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiConfig.java b/java/src/main/java/com/cloudera/api/model/ApiConfig.java index 99dc6e6a..db2bc478 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiConfig.java +++ b/java/src/main/java/com/cloudera/api/model/ApiConfig.java @@ -33,9 +33,17 @@ * the default value (if any). */ @XmlRootElement(name = "config") -@XmlType(propOrder = { "name", "value", "required", "defaultValue", - "displayName", "description", "relatedName", "validationState", - "validationMessage" }) +@XmlType(propOrder = { "name", + "value", + "required", + "defaultValue", + "displayName", + "description", + "relatedName", + "sensitive", + "validationState", + "validationMessage", + "validationWarningsSuppressed" }) public class ApiConfig { private String name; @@ -47,6 +55,8 @@ public class ApiConfig { private Boolean required; private ValidationState validationState; private String validationMessage; + private Boolean validationWarningsSuppressed; + private Boolean sensitive; public static enum ValidationState { OK, @@ -65,9 +75,16 @@ public static enum ValidationState { * @param validationState State of the parameter's validation. * @param validationMessage Message describing any validation issues. */ - public ApiConfig(String name, String value, Boolean required, - String defaultValue, String displayName, String description, - String relatedName, ValidationState validationState, String validationMessage) { + public ApiConfig( + String name, + String value, + Boolean required, + String defaultValue, + String displayName, + String description, + String relatedName, + ValidationState validationState, + String validationMessage) { this.name = name; this.value = value; this.required = required; @@ -77,6 +94,7 @@ public ApiConfig(String name, String value, Boolean required, this.relatedName = relatedName; this.validationState = validationState; this.validationMessage = validationMessage; + this.sensitive = null; // unset prior to v14 } public ApiConfig(String name, String value) { @@ -93,6 +111,8 @@ public ApiConfig() { this.relatedName = null; this.validationState = null; this.validationMessage = null; + this.validationWarningsSuppressed = null; + this.sensitive = null; } public String toString() { @@ -187,7 +207,7 @@ public void setName(String name) { /** * The user-defined value. When absent, the default value (if any) - * will be used. + * will be used. Can also be absent, when enumerating allowed configs. */ @XmlElement public String getValue() { @@ -238,4 +258,37 @@ public String getValidationMessage() { public void setValidationMessage(String validationMessage) { this.validationMessage = validationMessage; } + + /** + * Readonly. Requires "full" view. + * Whether validation warnings associated with this parameter are suppressed. + * In general, suppressed validation warnings are hidden in the Cloudera + * Manager UI. Configurations that do not produce warnings will not contain + * this field. + **/ + @XmlElement + public Boolean getValidationWarningsSuppressed() { + return validationWarningsSuppressed; + } + + public void setValidationWarningsSuppressed( + Boolean validationWarningsSuppressed) { + this.validationWarningsSuppressed = validationWarningsSuppressed; + } + + /** + * Readonly. + * Whether this configuration is sensitive, i.e. contains information such as passwords, which + * might affect how the value of this configuration might be shared by the caller. + * + * Available since v14. + */ + @XmlElement + public Boolean getSensitive() { + return sensitive; + } + + public void setSensitive(Boolean sensitive) { + this.sensitive = sensitive; + } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiConfigureForKerberosArguments.java b/java/src/main/java/com/cloudera/api/model/ApiConfigureForKerberosArguments.java new file mode 100644 index 00000000..a837c55d --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiConfigureForKerberosArguments.java @@ -0,0 +1,78 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import com.cloudera.api.ApiUtils; +import com.google.common.base.Objects; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Arguments used to configure a cluster for Kerberos. + */ +@XmlRootElement(name="configureForKerberosArgs") +public class ApiConfigureForKerberosArguments { + private Long datanodeTransceiverPort; + private Long datanodeWebPort; + + /** + * The HDFS DataNode transceiver port to use. This will be applied to all DataNode + * role configuration groups. If not specified, this will default to 1004. + */ + @XmlElement + public Long getDatanodeTransceiverPort() { + return datanodeTransceiverPort; + } + + public void setDatanodeTransceiverPort(Long datanodeTransceiverPort) { + this.datanodeTransceiverPort = datanodeTransceiverPort; + } + + /** + * The HDFS DataNode web port to use. This will be applied to all DataNode + * role configuration groups. If not specified, this will default to 1006. + */ + @XmlElement + public Long getDatanodeWebPort() { + return datanodeWebPort; + } + + public void setDatanodeWebPort(Long datanodeWebPort) { + this.datanodeWebPort = datanodeWebPort; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("datanodeTransceiverPort", datanodeTransceiverPort) + .add("datanodeWebPort", datanodeWebPort) + .toString(); + } + + @Override + public boolean equals(Object o) { + ApiConfigureForKerberosArguments other = ApiUtils.baseEquals(this, o); + return this == other || (other != null && + Objects.equal(this.datanodeTransceiverPort, other.datanodeTransceiverPort) && + Objects.equal(this.datanodeWebPort, other.datanodeWebPort)); + } + + @Override + public int hashCode() { + return Objects.hashCode(datanodeTransceiverPort, datanodeWebPort); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiEntityStatus.java b/java/src/main/java/com/cloudera/api/model/ApiEntityStatus.java new file mode 100644 index 00000000..992077bb --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiEntityStatus.java @@ -0,0 +1,53 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +/** + * The single value used by the Cloudera Manager UI to represent the status of + * the entity. It is computed from a variety of other entity-specific states, + * not all values apply to all entities. For example, STARTING/STOPPING do not + * apply to a host. + */ +public enum ApiEntityStatus { + // There is not enough information to determine the entity status. + UNKNOWN, + // The entity in question does not have a entity status. For example, it is + // not something that can be running and it cannot have health. + NONE, + // The entity in question is not running, as expected. + STOPPED, + // The entity in question is not running, but it is expected to be running. + DOWN, + // The entity in question is running, but we do not have enough information + // to determine its health. + UNKNOWN_HEALTH, + // The entity in question is running, but all of its health checks are + // disabled. + DISABLED_HEALTH, + // The entity in question is running with concerning health. + CONCERNING_HEALTH, + // The entity in question is running with bad health. + BAD_HEALTH, + // The entity in question is running with good health. + GOOD_HEALTH, + // The entity in question is starting. + STARTING, + // The entity in question is stopping. + STOPPING, + // The application is in historical mode, and the entity in question does not + // have historical monitoring support. + HISTORY_NOT_AVAILABLE; +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiExternalAccount.java b/java/src/main/java/com/cloudera/api/model/ApiExternalAccount.java new file mode 100644 index 00000000..9f7e91ef --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiExternalAccount.java @@ -0,0 +1,149 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import com.google.common.base.Objects; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Represents an instantiation of an external account type, referencing a supported + * external account type, via the typeName field, along with suitable configuration to + * access an external resource of the provided type. + * + * The typeName field must match the name of an external account type. + */ +@XmlRootElement(name="externalAccount") +public class ApiExternalAccount { + private String name; + private String displayName; + private Date createdTime; + private Date lastModifiedTime; + private String typeName; + private ApiConfigList accountConfigs; + + public ApiExternalAccount() { + // For JAX-B + } + + /** + * Represents the intial name of the account; used to uniquely identify this account. + */ + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * Represents a modifiable label to identify this account for user-visible purposes. + */ + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + /** + * Represents the time of creation for this account. + */ + public Date getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(Date createTime) { + this.createdTime = createTime; + } + + /** + * Represents the last modification time for this account. + */ + public Date getLastModifiedTime() { + return lastModifiedTime; + } + + public void setLastModifiedTime(Date lastModifiedTime) { + this.lastModifiedTime = lastModifiedTime; + } + + /** + * Represents the Type ID of a supported external account type. + * The type represented by this field dictates which configuration options must be defined + * for this account. + */ + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + /** + * Represents the account configuration for this account. + * + * When an account is retrieved from the server, + * the configs returned must match allowed configuration for the type of this account. + * + * When specified for creation of a new account or for the update of an existing account, + * this field must include every required configuration parameter specified in the type's definition, + * with the account configuration's value field specified to represent the specific + * configuration desired for this account. + */ + public ApiConfigList getAccountConfigs() { + return accountConfigs; + } + + public void setAccountConfigs(ApiConfigList accountConfigs) { + this.accountConfigs = accountConfigs; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ApiExternalAccount that = (ApiExternalAccount) o; + return Objects.equal(name, that.name) && + Objects.equal(displayName, that.displayName) && + Objects.equal(createdTime, that.createdTime) && + Objects.equal(lastModifiedTime, that.lastModifiedTime) && + Objects.equal(typeName, that.typeName) && + Objects.equal(accountConfigs, that.accountConfigs); + } + + @Override + public int hashCode() { + return Objects.hashCode(name, displayName, createdTime, lastModifiedTime, typeName, accountConfigs); + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("name", name) + .add("typeName", typeName) + .add("createdTime", createdTime) + .add("lastModifiedTime", lastModifiedTime) + .add("displayName", displayName) + .add("accountConfigs", accountConfigs) + .toString(); + } +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiExternalAccountCategory.java b/java/src/main/java/com/cloudera/api/model/ApiExternalAccountCategory.java new file mode 100644 index 00000000..6cfbbc8c --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiExternalAccountCategory.java @@ -0,0 +1,58 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +/** + * Type representing an external account category. + */ +public class ApiExternalAccountCategory { + private String name; + private String displayName; + private String description; + + /** + * Represents an identifier for a category. + */ + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * Represents a localized display name for a category. + */ + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + /** + * Represents a localized description for a category. + */ + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiExternalAccountCategoryList.java b/java/src/main/java/com/cloudera/api/model/ApiExternalAccountCategoryList.java new file mode 100644 index 00000000..5e5a4df4 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiExternalAccountCategoryList.java @@ -0,0 +1,46 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Represents a list of external account categories. + */ +@XmlRootElement(name="externalAccountCategories") +public class ApiExternalAccountCategoryList extends ApiListBase { + + public ApiExternalAccountCategoryList() { + // For JAX-B + super(); + } + + public ApiExternalAccountCategoryList(List values) { + super(values); + } + + @XmlElementWrapper(name = ApiListBase.ITEMS_ATTR) + public List getExternalAccountCategories() { + return values; + } + + public void setExternalAccountCategories(List values) { + this.values = values; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiExternalAccountList.java b/java/src/main/java/com/cloudera/api/model/ApiExternalAccountList.java new file mode 100644 index 00000000..d1e6c85d --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiExternalAccountList.java @@ -0,0 +1,45 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Represents a list of external accounts. + */ +@XmlRootElement(name="externalAccounts") +public class ApiExternalAccountList extends ApiListBase { + + public ApiExternalAccountList() { + super(); + } + + public ApiExternalAccountList(List values) { + super(values); + } + + @XmlElementWrapper(name = ApiListBase.ITEMS_ATTR) + public List getExternalAccounts() { + return values; + } + + public void setExternalAccountList(List values) { + this.values = values; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiExternalAccountType.java b/java/src/main/java/com/cloudera/api/model/ApiExternalAccountType.java new file mode 100644 index 00000000..5dfe6d37 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiExternalAccountType.java @@ -0,0 +1,109 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import javax.xml.bind.annotation.XmlRootElement; + +/** + * A supported external account type. + * An external account type represents an external authentication source that is used by + * Cloudera Manager in its APIs to take suitable actions that require authentication to an + * external service. + * + * An external account type is uniquely identified by a server-generated ID and identifies with + * a category identifier: e.g. The "AWS" category has an account type "AWS_Access_Key_Authorization" + * + */ +@XmlRootElement(name = "externalAccountType") +public class ApiExternalAccountType { + + private String name; + private String categoryName; + private String type; + private String displayName; + private String description; + private ApiConfigList allowedAccountConfigs; + + public ApiExternalAccountType() { + // For JAX-B + } + + /** + * Represents the immutable name for this account. + */ + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * Represents the category of this account. + */ + public String getCategoryName() { + return categoryName; + } + + public void setCategoryName(String categoryName) { + this.categoryName = categoryName; + } + + /** + * Represents the type for this account. + */ + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * Represents the localized display name for this account. + */ + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + /** + * Represents the localized description for this account type. + */ + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * Represents the list of allowed account configs. + */ + public ApiConfigList getAllowedAccountConfigs() { + return allowedAccountConfigs; + } + + public void setAllowedAccountConfigs(ApiConfigList allowedAccountConfigs) { + this.allowedAccountConfigs = allowedAccountConfigs; + } +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiExternalAccountTypeList.java b/java/src/main/java/com/cloudera/api/model/ApiExternalAccountTypeList.java new file mode 100644 index 00000000..77cf69f2 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiExternalAccountTypeList.java @@ -0,0 +1,48 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +// Types of external accounts supported - the list is dynamic, and can change/extend with +// CM versions without breaking API (though not behavior) backwards compatibility. + +/** + * Represents a list of external account types. + */ +@XmlRootElement(name = "externalAccountTypes") +public class ApiExternalAccountTypeList extends ApiListBase { + + public ApiExternalAccountTypeList() { + super(); + } + + public ApiExternalAccountTypeList(List values) { + super(values); + } + + @XmlElementWrapper(name = ApiListBase.ITEMS_ATTR) + public List getExternalAccountTypes() { + return values; + } + + public void setExternalAccountTypes(List values) { + this.values = values; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiHdfsCloudReplicationArguments.java b/java/src/main/java/com/cloudera/api/model/ApiHdfsCloudReplicationArguments.java new file mode 100644 index 00000000..75169898 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiHdfsCloudReplicationArguments.java @@ -0,0 +1,89 @@ +// Copyright (c) 2016 Cloudera, Inc. All rights reserved. +package com.cloudera.api.model; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import com.cloudera.api.ApiUtils; +import com.google.common.base.Objects; +import com.google.common.base.Preconditions; +import org.apache.cxf.common.util.StringUtils; + +@XmlRootElement(name = "hdfsCloudReplicationArguments") +public class ApiHdfsCloudReplicationArguments extends ApiHdfsReplicationArguments { + + /** + * Source Account during replication. If this is non-null, + * destinationAccount should be null + */ + private String sourceAccount; + + /** + * destination Account during replication. If this is non-null, + * sourceAccount should be null + */ + private String destinationAccount; + + // For JAX-B + public ApiHdfsCloudReplicationArguments() { + } + + public ApiHdfsCloudReplicationArguments(ApiServiceRef sourceService, + String sourcePath, String destinationPath, + String mapreduceServiceName, Integer numMaps, String userName, + String sourceAccount, String destinationAccount) { + super(sourceService, sourcePath, destinationPath, mapreduceServiceName, + numMaps, userName); + this.sourceAccount = sourceAccount; + this.destinationAccount = destinationAccount; + } + + @XmlElement + public String getSourceAccount() { + return sourceAccount; + } + + public void setSourceAccount(String sourceAccount) { + this.sourceAccount = sourceAccount; + } + + @XmlElement + public String getDestinationAccount() { + return destinationAccount; + } + + public void setDestinationAccount(String destinationAccount) { + this.destinationAccount = destinationAccount; + } + + @Override + public String toString() { + if (!StringUtils.isEmpty(sourceAccount)) { + return super.toStringHelper() + .add("sourceAccount", sourceAccount) + .toString(); + } else if (!StringUtils.isEmpty(destinationAccount)) { + return super.toStringHelper() + .add("destinationAccount", destinationAccount) + .toString(); + } + + Preconditions.checkState(false, "Both sourceAccount and destinationAccount are null " + + "in ApiHdfsCloudReplicationArguments"); + return null; + } + + @Override + public boolean equals(Object o) { + ApiHdfsCloudReplicationArguments other = ApiUtils.baseEquals(this, o); + return this == other || (other != null && + super.equals(other) && + Objects.equal(sourceAccount, other.sourceAccount) && + Objects.equal(destinationAccount, other.destinationAccount)); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), sourceAccount, destinationAccount); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationArguments.java b/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationArguments.java index 29b4a61b..ef6ed100 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationArguments.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationArguments.java @@ -15,11 +15,14 @@ // limitations under the License. package com.cloudera.api.model; +import com.cloudera.api.ApiUtils; +import com.google.common.base.Objects; + +import java.util.List; + import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import com.cloudera.api.ApiUtils; -import com.google.common.base.Objects; /** * Replication arguments for HDFS. @@ -45,6 +48,7 @@ public class ApiHdfsReplicationArguments { private Boolean skipTrash; private ReplicationStrategy replicationStrategy; private Boolean preserveXAttrs; + private List exclusionFilters; /** * The strategy for distributing the file replication tasks among the mappers @@ -277,7 +281,7 @@ public void setSkipTrash(Boolean skipTrash) { /** * The strategy for distributing the file replication tasks among the mappers * of the MR job associated with a replication. Default is - * {@link ReplicationStrategy.STATIC}. + * {@link ReplicationStrategy#STATIC}. */ @XmlElement public ReplicationStrategy getReplicationStrategy() { @@ -303,28 +307,47 @@ public void setPreserveXAttrs(Boolean preserveXAttrs) { this.preserveXAttrs = preserveXAttrs; } + /** + * Specify regular expression strings to match full paths of files and directories + * matching source paths and exclude them from the replication. Optional. + * Available since V11. + * @return exclusion paths, if set; null if no exclusion paths are specified. + */ + @XmlElement + public List getExclusionFilters() { + return exclusionFilters; + } + + public void setExclusionFilters(List exclusionFilters) { + this.exclusionFilters = exclusionFilters; + } + + protected Objects.ToStringHelper toStringHelper() { + return Objects.toStringHelper(this) + .add("sourceService", sourceService) + .add("sourcePath", sourcePath) + .add("destinationPath", destinationPath) + .add("mapreduceServiceName", mapreduceServiceName) + .add("schedulerPoolName", schedulerPoolName) + .add("numMaps", numMaps) + .add("dryRun", dryRun) + .add("bandwidthPerMap", bandwidthPerMap) + .add("abortOnError", abortOnError) + .add ("removeMissingFiles", removeMissingFiles) + .add("preserveReplicationCount", preserveReplicationCount) + .add("preserveBlockSize", preserveBlockSize) + .add("preservePermissions", preservePermissions) + .add("logPath", logPath) + .add("skipChecksumChecks", skipChecksumChecks) + .add("skipTrash", skipTrash) + .add("replicationStrategy", replicationStrategy) + .add("preserveXAttrs", preserveXAttrs) + .add("exclusionFilters", exclusionFilters); + } + @Override public String toString() { - return Objects.toStringHelper(this) - .add("sourceService", sourceService) - .add("sourcePath", sourcePath) - .add("destinationPath", destinationPath) - .add("mapreduceServiceName", mapreduceServiceName) - .add("schedulerPoolName", schedulerPoolName) - .add("numMaps", numMaps) - .add("dryRun", dryRun) - .add("bandwidthPerMap", bandwidthPerMap) - .add("abortOnError", abortOnError) - .add ("removeMissingFiles", removeMissingFiles) - .add("preserveReplicationCount", preserveReplicationCount) - .add("preserveBlockSize", preserveBlockSize) - .add("preservePermissions", preservePermissions) - .add("logPath", logPath) - .add("skipChecksumChecks", skipChecksumChecks) - .add("skipTrash", skipTrash) - .add("replicationStrategy", replicationStrategy) - .add("preserveXAttrs", preserveXAttrs) - .toString(); + return toStringHelper().toString(); } @Override @@ -348,7 +371,8 @@ public boolean equals(Object o) { skipChecksumChecks == other.getSkipChecksumChecks() && Objects.equal(skipTrash, other.getSkipTrash()) && Objects.equal(replicationStrategy, other.getReplicationStrategy()) && - Objects.equal(preserveXAttrs, other.getPreserveXAttrs())); + Objects.equal(preserveXAttrs, other.getPreserveXAttrs())) && + Objects.equal(exclusionFilters, other.getExclusionFilters()); } @Override @@ -358,6 +382,6 @@ public int hashCode() { bandwidthPerMap, abortOnError, removeMissingFiles, preserveReplicationCount, preserveBlockSize, preservePermissions, logPath, skipChecksumChecks, skipTrash, replicationStrategy, - preserveXAttrs); + preserveXAttrs, exclusionFilters); } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationResult.java b/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationResult.java index 50fe8479..91ecaded 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationResult.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationResult.java @@ -48,6 +48,8 @@ public class ApiHdfsReplicationResult { private String jobDetailsUri; private boolean dryRun; private List snapshottedDirs; + private List failedFiles; + private String runAsUser; /** The file copy progress percentage. */ @XmlElement @@ -257,6 +259,32 @@ public void setSnapshottedDirs(List snapshottedDirs) { this.snapshottedDirs = snapshottedDirs; } + /** + * Returns run-as user name. + * Available since API v11. + */ + @XmlElement + public String getRunAsUser() { + return runAsUser; + } + + public void setRunAsUser(String runAsUser) { + this.runAsUser = runAsUser; + } + + /** + * The list of files that failed during replication. + * Available since API v11. + */ + @XmlElement + public List getFailedFiles() { + return failedFiles; + } + + public void setFailedFiles(List failedFiles) { + this.failedFiles = failedFiles; + } + @Override public boolean equals(Object o) { ApiHdfsReplicationResult that = ApiUtils.baseEquals(this, o); @@ -265,13 +293,15 @@ public boolean equals(Object o) { Objects.equal(counters, that.getCounters()) && Objects.equal(setupError, that.getSetupError()) && dryRun == that.isDryRun() && - Objects.equal(snapshottedDirs, that.getSnapshottedDirs())); + Objects.equal(snapshottedDirs, that.getSnapshottedDirs())) && + Objects.equal(failedFiles, that.getFailedFiles()) && + Objects.equal(runAsUser, that.getRunAsUser()); } @Override public int hashCode() { return Objects.hashCode(progress, counters, setupError, dryRun, - snapshottedDirs); + snapshottedDirs, failedFiles, runAsUser); } @Override @@ -282,6 +312,8 @@ public String toString() { .add("setupError", setupError) .add("dryRun", dryRun) .add("snapshottedDirs", snapshottedDirs) + .add("failedFiles", failedFiles) + .add("runAsUser", runAsUser) .toString(); } diff --git a/java/src/main/java/com/cloudera/api/model/ApiHealthCheck.java b/java/src/main/java/com/cloudera/api/model/ApiHealthCheck.java index 04772591..f78cdfcd 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHealthCheck.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHealthCheck.java @@ -19,10 +19,16 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +/** + * Represents a result from a health test performed by Cloudera Manager for an + * entity. + */ @XmlRootElement(name = "healthCheck") public class ApiHealthCheck { private String name; private ApiHealthSummary summary; + private String explanation; + private Boolean suppressed; public ApiHealthCheck() { // For JAX-B @@ -33,6 +39,15 @@ public ApiHealthCheck(String name, ApiHealthSummary summary) { this.summary = summary; } + public ApiHealthCheck(String name, + ApiHealthSummary summary, + String explanation, + boolean suppressed) { + this(name, summary); + this.explanation = explanation; + this.suppressed = suppressed; + } + /** Unique name of this health check. */ @XmlElement public String getName() { @@ -52,4 +67,31 @@ public ApiHealthSummary getSummary() { public void setSummary(ApiHealthSummary summary) { this.summary = summary; } + + /** + * The explanation of this health check. + * Available since v11. + **/ + @XmlElement + public String getExplanation() { + return explanation; + } + + public void setExplanation(String explanation) { + this.explanation = explanation; + } + + /** + * Whether this health test is suppressed. A suppressed health test is not + * considered when computing an entity's overall health. + * Available since v11. + **/ + @XmlElement + public Boolean getSuppressed() { + return suppressed; + } + + public void setSuppressed(Boolean suppressed) { + this.suppressed = suppressed; + } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiHiveCloudReplicationArguments.java b/java/src/main/java/com/cloudera/api/model/ApiHiveCloudReplicationArguments.java new file mode 100644 index 00000000..8e714fd6 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiHiveCloudReplicationArguments.java @@ -0,0 +1,137 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import com.cloudera.api.ApiUtils; +import com.google.common.base.Objects; +import com.google.common.base.Preconditions; +import org.apache.cxf.common.util.StringUtils; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "hiveCloudReplicationArguments") +public class ApiHiveCloudReplicationArguments extends ApiHiveReplicationArguments { + + /** + * Source Account during replication. If this is non-null, + * destinationAccount should be null + */ + private String sourceAccount; + + /** + * destination Account during replication. If this is non-null, + * sourceAccount should be null + */ + private String destinationAccount; + + /** + * path at which data will be restored or backed up. + */ + private String cloudRootPath; + + /** + * This will decide how cloud replication will take place + */ + public enum ReplicationOption { + // This is used for backup as well as restore operation, + // Use this, when you want to store/get only metadata to/from cloud + METADATA_ONLY, + + // This is used for backup as well as restore operation, + // Use this, when you want to store/get complete metadata/data to/from cloud + METADATA_AND_DATA, + + // This is used for restore operation only, + // Use this, when you want to get metadata and hive entities are pointing to + // data on cloud. + KEEP_DATA_IN_CLOUD + } + + /** + * Decides the type of hive cloud replication. + */ + private ReplicationOption replicationOption; + + public ApiHiveCloudReplicationArguments() { + // For JAX-B + } + + @XmlElement + public String getSourceAccount() { + return sourceAccount; + } + + public void setSourceAccount(String sourceAccount) { + this.sourceAccount = sourceAccount; + } + + @XmlElement + public String getDestinationAccount() { + return destinationAccount; + } + + public void setDestinationAccount(String destinationAccount) { + this.destinationAccount = destinationAccount; + } + + public String getCloudRootPath() { + return cloudRootPath; + } + + public void setCloudRootPath(String cloudRootPath) { + this.cloudRootPath = cloudRootPath; + } + + public ReplicationOption getReplicationOption() { + return replicationOption; + } + + public void setReplicationOption(ReplicationOption replicationOption) { + this.replicationOption = replicationOption; + } + + @Override + public String toString() { + Objects.ToStringHelper stringHelper = super.toStringHelper(); + if (!StringUtils.isEmpty(sourceAccount)) { + stringHelper.add("sourceAccount", sourceAccount); + } else if (!StringUtils.isEmpty(destinationAccount)) { + stringHelper.add("destinationAccount", destinationAccount); + } + + stringHelper.add("cloudRootPath", cloudRootPath); + stringHelper.add("replicationOption", replicationOption); + return stringHelper.toString(); + } + + @Override + public boolean equals(Object o) { + ApiHiveCloudReplicationArguments other = ApiUtils.baseEquals(this, o); + return this == other || (other != null && + super.equals(other) && + Objects.equal(sourceAccount, other.sourceAccount) && + Objects.equal(destinationAccount, other.destinationAccount) && + Objects.equal(cloudRootPath, other.cloudRootPath) && + Objects.equal(replicationOption, other.replicationOption)); + } + + @Override + public int hashCode() { + return Objects.hashCode(super.hashCode(), sourceAccount, destinationAccount, + cloudRootPath, replicationOption); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationArguments.java b/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationArguments.java index a0fe898b..8d52275d 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationArguments.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationArguments.java @@ -155,8 +155,7 @@ public void setDryRun(boolean dryRun) { this.dryRun = dryRun; } - @Override - public String toString() { + protected Objects.ToStringHelper toStringHelper() { return Objects.toStringHelper(this) .add("sourceService", sourceService) .add("tableFilters", tableFilters) @@ -165,8 +164,12 @@ public String toString() { .add("replicateHdfs", replicateData) .add("hdfsArguments", hdfsArguments) .add("replicateImpalaMetadata", replicateImpalaMetadata) - .add("dryRun", dryRun) - .toString(); + .add("dryRun", dryRun); + } + + @Override + public String toString() { + return toStringHelper().toString(); } @Override diff --git a/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationError.java b/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationError.java index 812534df..8b43025d 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationError.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationError.java @@ -30,6 +30,7 @@ public class ApiHiveReplicationError { private String database; private String tableName; private String impalaUDF; + private String hiveUDF; private String error; public ApiHiveReplicationError() { @@ -49,6 +50,16 @@ public ApiHiveReplicationError(String database, String tableName, this.error = error; } + public ApiHiveReplicationError(String database, String tableName, + String impalaUDF, String hiveUDF, + String error) { + this.database = database; + this.tableName = tableName; + this.impalaUDF = impalaUDF; + this.hiveUDF = hiveUDF; + this.error = error; + } + /** Name of the database. */ @XmlElement public String getDatabase() { @@ -79,6 +90,16 @@ public void setImpalaUDF(String impalaUDF) { this.impalaUDF = impalaUDF; } + /** Hive UDF signature, includes the UDF name and parameter types. */ + @XmlElement + public String getHiveUDF() { + return hiveUDF; + } + + public void setHiveUDF(String hiveUDF) { + this.hiveUDF = hiveUDF; + } + /** Description of the error. */ @XmlElement public String getError() { @@ -95,6 +116,7 @@ public String toString() { .add("database", database) .add("tableName", tableName) .add("impalaUDF", impalaUDF) + .add("hiveUDF", hiveUDF) .add("error", error) .toString(); } @@ -106,12 +128,13 @@ public boolean equals(Object o) { Objects.equal(database, that.getDatabase()) && Objects.equal(tableName, that.getTableName()) && Objects.equal(impalaUDF, that.getImpalaUDF()) && + Objects.equal(hiveUDF, that.getHiveUDF()) && Objects.equal(error, that.getError())); } @Override public int hashCode() { - return Objects.hashCode(database, tableName, impalaUDF, error); + return Objects.hashCode(database, tableName, impalaUDF, hiveUDF, error); } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationResult.java b/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationResult.java index 72c12dd8..c8e338cf 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationResult.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationResult.java @@ -34,10 +34,13 @@ public class ApiHiveReplicationResult { private List tables; private Integer impalaUDFCount; private List impalaUDFs; + private Integer hiveUDFCount; + private List hiveUDFs; private Integer errorCount; private List errors; private ApiHdfsReplicationResult dataReplicationResult; private boolean dryRun; + private String runAsUser; public ApiHiveReplicationResult() { // For JAX-B @@ -104,6 +107,19 @@ public void setImpalaUDFCount(Integer impalaUDFCount) { this.impalaUDFCount = impalaUDFCount; } + /** + * Number of hive UDFs that were successfully replicated. Available since + * API v14. + */ + @XmlElement + public Integer getHiveUDFCount() { + return hiveUDFCount; + } + + public void setHiveUDFCount(Integer hiveUDFCount) { + this.hiveUDFCount = hiveUDFCount; + } + /** * The list of Impala UDFs successfully replicated. Available since API v6 * in the full view. @@ -117,6 +133,20 @@ public void setImpalaUDFs(List impalaUDFs) { this.impalaUDFs = impalaUDFs; } + + /** + * The list of Impala UDFs successfully replicated. Available since API v6 + * in the full view. + */ + @XmlElementWrapper + public List getHiveUDFs() { + return hiveUDFs; + } + + public void setHiveUDFs(List hiveUDFs) { + this.hiveUDFs = hiveUDFs; + } + /** * Number of errors detected during replication job. * Available since API v4. @@ -164,6 +194,19 @@ public void setDryRun(boolean dryRun) { this.dryRun = dryRun; } + /** + * Name of the of proxy user, if any. + * Available since API v11. + */ + @XmlElement + public String getRunAsUser() { + return runAsUser; + } + + public void setRunAsUser(String runAsUser) { + this.runAsUser = runAsUser; + } + @Override public boolean equals(Object o) { ApiHiveReplicationResult that = ApiUtils.baseEquals(this, o); @@ -171,13 +214,16 @@ public boolean equals(Object o) { Objects.equal(phase, that.getPhase()) && Objects.equal(tables, that.getTables()) && Objects.equal(impalaUDFs, that.getImpalaUDFs()) && + Objects.equal(hiveUDFs, that.getHiveUDFs()) && Objects.equal(errors, that.getErrors()) && - dryRun == that.isDryRun()); + dryRun == that.isDryRun() && + Objects.equal(runAsUser, that.getRunAsUser())); } @Override public int hashCode() { - return Objects.hashCode(phase, tables, impalaUDFs, errors, dryRun); + return Objects.hashCode(phase, tables, impalaUDFs, hiveUDFs, errors, dryRun, + runAsUser); } @Override @@ -186,8 +232,10 @@ public String toString() { .add("phase", phase) .add("tables", tables) .add("impalaUDFs", impalaUDFs) + .add("hiveUDFs", hiveUDFs) .add("errors", errors) .add("dryRun", dryRun) + .add("runAsUser", runAsUser) .toString(); } diff --git a/java/src/main/java/com/cloudera/api/model/ApiHiveUDF.java b/java/src/main/java/com/cloudera/api/model/ApiHiveUDF.java new file mode 100644 index 00000000..58c0991d --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiHiveUDF.java @@ -0,0 +1,69 @@ +// Copyright (c) 2016 Cloudera, Inc. All rights reserved. +package com.cloudera.api.model; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import com.cloudera.api.ApiUtils; +import com.google.common.base.Objects; + +/** + * An hive UDF identifier. + */ +@XmlRootElement(name = "hiveUDF") +public class ApiHiveUDF { + + private String database; + private String signature; + + public ApiHiveUDF() { + // For JAX-B + } + + public ApiHiveUDF(String database, String signature) { + this.database = database; + this.signature = signature; + } + + /** Name of the database to which this UDF belongs. */ + @XmlElement + public String getDatabase() { + return database; + } + + public void setDatabase(String database) { + this.database = database; + } + + /** UDF signature, includes the UDF name and parameter types. */ + @XmlElement + public String getSignature() { + return signature; + } + + public void setSignature(String signature) { + this.signature = signature; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("database", database) + .add("signature", signature) + .toString(); + } + + @Override + public boolean equals(Object o) { + ApiHiveUDF that = ApiUtils.baseEquals(this, o); + return (this == that) || (that != null && + Objects.equal(database, that.getDatabase()) && + Objects.equal(signature, that.getSignature())); + } + + @Override + public int hashCode() { + return Objects.hashCode(database, signature); + } + +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiHost.java b/java/src/main/java/com/cloudera/api/model/ApiHost.java index ed727278..7c145ba3 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHost.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHost.java @@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; + import java.util.Date; import java.util.List; @@ -49,6 +50,8 @@ public class ApiHost { private Long numCores; private Long numPhysicalCores; private Long totalPhysMemBytes; + private ApiEntityStatus entityStatus; + private ApiClusterRef clusterRef; public ApiHost() { // for JAX-B @@ -81,6 +84,7 @@ public ApiHost(ApiHost host) { this.numCores = host.getNumCores(); this.numPhysicalCores = host.getNumPhysicalCores(); this.totalPhysMemBytes = host.getTotalPhysMemBytes(); + this.clusterRef = host.clusterRef; } @Override @@ -94,6 +98,7 @@ public String toString() { .add("healthSummary", healthSummary) .add("healthChecks", healthChecks) .add("roleRefs", roleRefs) + .add("clusterRef", clusterRef) .toString(); } @@ -308,4 +313,31 @@ public Long getTotalPhysMemBytes() { public void setTotalPhysMemBytes(Long totalPhysMemBytes) { this.totalPhysMemBytes = totalPhysMemBytes; } + + /** + * Readonly. The entity status for this host. + * Available since API v11. + */ + @XmlElement + public ApiEntityStatus getEntityStatus() { + return entityStatus; + } + + public void setEntityStatus(ApiEntityStatus entityStatus) { + this.entityStatus = entityStatus; + } + + /** + * Readonly. A reference to the enclosing cluster. This might be null if the + * host is not yet assigned to a cluster. + * Available since API v11. + */ + @XmlElement + public ApiClusterRef getClusterRef() { + return clusterRef; + } + + public void setClusterRef(ApiClusterRef clusterRef) { + this.clusterRef = clusterRef; + } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiHostInstallArguments.java b/java/src/main/java/com/cloudera/api/model/ApiHostInstallArguments.java index d632f756..c7b22420 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHostInstallArguments.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHostInstallArguments.java @@ -192,9 +192,9 @@ public void setParallelInstallCount(Integer parallelInstallCount) { /** * The Cloudera Manager repository URL to use (optional). * Example for SLES, Redhat or other RPM based distributions: - * http://archive.cloudera.com/cm5/redhat/5/x86_64/cm/5/ + * https://archive.cloudera.com/cm5/redhat/5/x86_64/cm/5/ * Example for Ubuntu or other Debian based distributions: - * "deb http://archive.cloudera.com/cm5/ubuntu/lucid/amd64/cm lucid-cm5 contrib" + * "deb https://archive.cloudera.com/cm5/ubuntu/lucid/amd64/cm lucid-cm5 contrib" */ @XmlElement public String getCmRepoUrl() { @@ -208,9 +208,9 @@ public void setCmRepoUrl(String cmRepoUrl) { /** * The Cloudera Manager public GPG key (optional). * Example for SLES, Redhat or other RPM based distributions: - * http://archive.cloudera.com/cm5/redhat/5/x86_64/cm/RPM-GPG-KEY-cloudera + * https://archive.cloudera.com/cm5/redhat/5/x86_64/cm/RPM-GPG-KEY-cloudera * Example for Ubuntu or other Debian based distributions: - * http://archive.cloudera.com/cm5/ubuntu/lucid/amd64/cm/archive.key + * https://archive.cloudera.com/cm5/ubuntu/lucid/amd64/cm/archive.key */ @XmlElement public String getGpgKeyCustomUrl() { diff --git a/java/src/main/java/com/cloudera/api/model/ApiMrUsageReportRow.java b/java/src/main/java/com/cloudera/api/model/ApiMrUsageReportRow.java index 5dd0d578..35770ea0 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiMrUsageReportRow.java +++ b/java/src/main/java/com/cloudera/api/model/ApiMrUsageReportRow.java @@ -23,11 +23,23 @@ public class ApiMrUsageReportRow { private String timePeriod; private String user; private String group; - private long cpuSec; - private long memoryBytes; - private long jobCount; - private long taskCount; - private long durationSec; + private Long cpuSec; + private Long memoryBytes; + private Long jobCount; + private Long taskCount; + private Long durationSec; + private Long failedMaps; + private Long totalMaps; + private Long failedReduces; + private Long totalReduces; + private Long mapInputBytes; + private Long mapOutputBytes; + private Long hdfsBytesRead; + private Long hdfsBytesWritten; + private Long localBytesRead; + private Long localBytesWritten; + private Long dataLocalMaps; + private Long rackLocalMaps; public ApiMrUsageReportRow() { } @@ -45,6 +57,28 @@ public ApiMrUsageReportRow(String timePeriod, String user, String group, this.durationSec = durationSec; } + public ApiMrUsageReportRow(String timePeriod, String user, String group, + long cpuSec, long memoryBytes, long jobCount, long taskCount, + long durationSec, long failedMaps, long totalMaps, long failedReduces, + long totalReduces, long mapInputBytes, long mapOutputBytes, + long hdfsBytesRead, long hdfsBytesWritten, long localBytesRead, + long localBytesWritten, long dataLocalMaps, long rackLocalMaps) { + this(timePeriod, user, group, cpuSec, memoryBytes, jobCount, taskCount, + durationSec); + this.failedMaps = failedMaps; + this.totalMaps = totalMaps; + this.failedReduces = failedReduces; + this.totalReduces = totalReduces; + this.mapInputBytes = mapInputBytes; + this.mapOutputBytes = mapOutputBytes; + this.hdfsBytesRead = hdfsBytesRead; + this.hdfsBytesWritten = hdfsBytesWritten; + this.localBytesRead = localBytesRead; + this.localBytesWritten = localBytesWritten; + this.dataLocalMaps = dataLocalMaps; + this.rackLocalMaps = rackLocalMaps; + } + /** * The time period over which this report is generated. */ @@ -86,7 +120,7 @@ public void setGroup(String group) { * jobs. */ @XmlElement - public long getCpuSec() { + public Long getCpuSec() { return cpuSec; } @@ -99,7 +133,7 @@ public void setCpuSec(long cpuSec) { * MapReduce jobs. */ @XmlElement - public long getMemoryBytes() { + public Long getMemoryBytes() { return memoryBytes; } @@ -111,7 +145,7 @@ public void setMemoryBytes(long memoryBytes) { * Number of jobs. */ @XmlElement - public long getJobCount() { + public Long getJobCount() { return jobCount; } @@ -123,7 +157,7 @@ public void setJobCount(long jobCount) { * Number of tasks. */ @XmlElement - public long getTaskCount() { + public Long getTaskCount() { return taskCount; } @@ -135,11 +169,167 @@ public void setTaskCount(long taskCount) { * Total duration of this user's MapReduce jobs. */ @XmlElement - public long getDurationSec() { + public Long getDurationSec() { return durationSec; } public void setDurationSec(long durationSec) { this.durationSec = durationSec; } + + /** + * Failed maps of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getFailedMaps() { + return failedMaps; + } + + public void setFailedMaps(long failedMaps) { + this.failedMaps = failedMaps; + } + + /** + * Total maps of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getTotalMaps() { + return totalMaps; + } + + public void setTotalMaps(long totalMaps) { + this.totalMaps = totalMaps; + } + + /** + * Failed reduces of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getFailedReduces() { + return failedReduces; + } + + public void setFailedReduces(long failedReduces) { + this.failedReduces = failedReduces; + } + + /** + * Total reduces of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getTotalReduces() { + return totalReduces; + } + + public void setTotalReduces(long totalReduces) { + this.totalReduces = totalReduces; + } + + /** + * Map input bytes of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getMapInputBytes() { + return mapInputBytes; + } + + public void setMapInputBytes(long mapInputBytes) { + this.mapInputBytes = mapInputBytes; + } + + /** + * Map output bytes of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getMapOutputBytes() { + return mapOutputBytes; + } + + public void setMapOutputBytes(long mapOutputBytes) { + this.mapOutputBytes = mapOutputBytes; + } + + /** + * HDFS bytes read of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getHdfsBytesRead() { + return hdfsBytesRead; + } + + public void setHdfsBytesRead(long hdfsBytesRead) { + this.hdfsBytesRead = hdfsBytesRead; + } + + /** + * HDFS bytes written of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getHdfsBytesWritten() { + return hdfsBytesWritten; + } + + public void setHdfsBytesWritten(long hdfsBytesWritten) { + this.hdfsBytesWritten = hdfsBytesWritten; + } + + /** + * Local bytes read of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getLocalBytesRead() { + return localBytesRead; + } + + public void setLocalBytesRead(long localBytesRead) { + this.localBytesRead = localBytesRead; + } + + /** + * Local bytes written of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getLocalBytesWritten() { + return localBytesWritten; + } + + public void setLocalBytesWritten(long localBytesWritten) { + this.localBytesWritten = localBytesWritten; + } + + /** + * Data local maps of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getDataLocalMaps() { + return dataLocalMaps; + } + + public void setDataLocalMaps(long dataLocalMaps) { + this.dataLocalMaps = dataLocalMaps; + } + + /** + * Rack local maps of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getRackLocalMaps() { + return rackLocalMaps; + } + + public void setRackLocalMaps(long rackLocalMaps) { + this.rackLocalMaps = rackLocalMaps; + } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiProductVersion.java b/java/src/main/java/com/cloudera/api/model/ApiProductVersion.java new file mode 100644 index 00000000..0a537a85 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiProductVersion.java @@ -0,0 +1,53 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +import javax.xml.bind.annotation.XmlRootElement; + +@JsonInclude(Include.NON_EMPTY) +@XmlRootElement(name = "productVersion") +public class ApiProductVersion { + /** + * Product version + */ + private String version; + + /** + * Product name + */ + private String product; + + public String getVersion() { + return this.version; + } + + public String getProduct() { + return this.product; + } + + public void setVersion(String version) { + this.version = version; + } + + public void setProduct(String product) { + this.product = product; + } + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiReplicationDiagnosticsCollectionArgs.java b/java/src/main/java/com/cloudera/api/model/ApiReplicationDiagnosticsCollectionArgs.java new file mode 100644 index 00000000..3c31a366 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiReplicationDiagnosticsCollectionArgs.java @@ -0,0 +1,88 @@ +// Copyright (c) 2015 Cloudera, Inc. All rights reserved. +package com.cloudera.api.model; + +import com.google.common.base.Objects; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Optional arguments for diagnostics collection. + */ +@XmlRootElement(name = "replicationDiagnosticsCollectionArgs") +public class ApiReplicationDiagnosticsCollectionArgs { + private ApiCommandList commands; + private String ticketNumber; + private String comments; + private Boolean phoneHome; + + // For jackson/JAXB. + public ApiReplicationDiagnosticsCollectionArgs() { + } + + /** + * Commands to limit diagnostics to. + * By default, the most recent 10 commands on the schedule will be used. + */ + @XmlElement + public ApiCommandList getCommands() { + return commands; + } + + public void setCommands(ApiCommandList commands) { + this.commands = commands; + } + + /** + * Ticket number to which this bundle must be associated with. + */ + @XmlElement + public String getTicketNumber() { + return ticketNumber; + } + + public void setTicketNumber(String ticketNumber) { + this.ticketNumber = ticketNumber; + } + + /** + * Additional comments for the bundle. + */ + @XmlElement + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } + + /** + * Whether the diagnostics bundle must be uploaded to Cloudera. + */ + @XmlElement + public Boolean getPhoneHome() { + return phoneHome; + } + + public void setPhoneHome(Boolean phoneHome) { + this.phoneHome = phoneHome; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ApiReplicationDiagnosticsCollectionArgs that = (ApiReplicationDiagnosticsCollectionArgs) o; + return Objects.equal(this.commands, that.commands) && + Objects.equal(this.phoneHome, that.phoneHome) && + Objects.equal(this.comments, that.comments) && + Objects.equal(this.ticketNumber, that.ticketNumber); + } + + @Override + public int hashCode() { + return 31 * Objects.hashCode( + this.commands, this.phoneHome, this.comments, this.ticketNumber); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiReplicationSchedule.java b/java/src/main/java/com/cloudera/api/model/ApiReplicationSchedule.java index f8d925e9..fbefa05d 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiReplicationSchedule.java +++ b/java/src/main/java/com/cloudera/api/model/ApiReplicationSchedule.java @@ -17,6 +17,7 @@ import java.util.Date; import java.util.List; + import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; @@ -41,7 +42,10 @@ public class ApiReplicationSchedule extends ApiSchedule { private ApiHdfsReplicationArguments hdfsArguments; private ApiHiveReplicationArguments hiveArguments; + private ApiHdfsCloudReplicationArguments hdfsCloudArguments; + private ApiHiveCloudReplicationArguments hiveCloudArguments; private List history; + private Boolean active; public ApiReplicationSchedule() { // For JAX-B. @@ -72,6 +76,16 @@ public void setHiveArguments(ApiHiveReplicationArguments hiveArguments) { this.hiveArguments = hiveArguments; } + /** Arguments for HDFS cloud replication commands. */ + @XmlElement + public ApiHdfsCloudReplicationArguments getHdfsCloudArguments() { + return hdfsCloudArguments; + } + + public void setHdfsCloudArguments(ApiHdfsCloudReplicationArguments hdfsCloudArguments) { + this.hdfsCloudArguments = hdfsCloudArguments; + } + /** List of active and/or finished commands for this schedule. */ @XmlElementWrapper public List getHistory() { @@ -82,6 +96,29 @@ public void setHistory(List history) { this.history = history; } + /** + * Read-only field that is true if this schedule is currently active, false if not. + * Available since API v11. + */ + @XmlElement + public Boolean isActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + /** Arguments for Hive cloud replication commands. */ + @XmlElement + public ApiHiveCloudReplicationArguments getHiveCloudArguments() { + return hiveCloudArguments; + } + + public void setHiveCloudArguments(ApiHiveCloudReplicationArguments hiveCloudArguments) { + this.hiveCloudArguments = hiveCloudArguments; + } + @Override public boolean equals(Object o) { if (!super.equals(o)) { @@ -90,20 +127,27 @@ public boolean equals(Object o) { ApiReplicationSchedule that = (ApiReplicationSchedule) o; return Objects.equal(hdfsArguments, that.getHdfsArguments()) && - Objects.equal(hiveArguments, that.getHiveArguments()); + Objects.equal(hiveArguments, that.getHiveArguments()) && + Objects.equal(hdfsCloudArguments, that.getHdfsCloudArguments()) && + Objects.equal(hiveCloudArguments, that.getHiveCloudArguments()); } @Override public int hashCode() { - return 31 * super.hashCode() + Objects.hashCode(hdfsArguments, hiveArguments); + return 31 * super.hashCode() + Objects.hashCode(hdfsArguments, + hiveArguments, hdfsCloudArguments, hiveCloudArguments); } - @Override - public String toString() { + protected Objects.ToStringHelper toStringHelper() { return super.toStringHelper() - .add("hdfsArguments", hdfsArguments) - .add("hiveArguments", hiveArguments) - .toString(); + .add("hdfsArguments", hdfsArguments) + .add("hiveArguments", hiveArguments) + .add("hdfsCloudArguments", hdfsCloudArguments) + .add("hiveCloudArguments", hiveCloudArguments); } + @Override + public String toString() { + return toStringHelper().toString(); + } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiReplicationScheduleDataLimits.java b/java/src/main/java/com/cloudera/api/model/ApiReplicationScheduleDataLimits.java new file mode 100644 index 00000000..e7cb026b --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiReplicationScheduleDataLimits.java @@ -0,0 +1,56 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +/** + * This class encapsulates the data limits that we want to put on ApiReplicationSchedule to + * avoid potential OOME. It is currently used when archiving replication history. + * Available since v11. + */ +public class ApiReplicationScheduleDataLimits { + private final int maxCommandsPerSchedule; + private final int maxTablesPerResult; + private final int maxErrorsPerResult; + + public ApiReplicationScheduleDataLimits(int maxCommandsPerSchedule, int maxTablesPerResult, + int maxErrorsPerResult) { + this.maxCommandsPerSchedule = maxCommandsPerSchedule; + this.maxTablesPerResult = maxTablesPerResult; + this.maxErrorsPerResult = maxErrorsPerResult; + } + + /** + * @return Max number of ApiReplicationCommands per ApiReplicationSchedule. + */ + public int getMaxCommandsPerSchedule() { + return maxCommandsPerSchedule; + } + + /** + * @return Max number of ApiHiveTable per ApiHiveReplicationResult. + */ + public int getMaxTablesPerResult() { + return maxTablesPerResult; + } + + /** + * @return Max number of ApiHiveReplicationError per ApiHiveReplicationResult. + */ + public int getMaxErrorsPerResult() { + return maxErrorsPerResult; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiReplicationState.java b/java/src/main/java/com/cloudera/api/model/ApiReplicationState.java new file mode 100644 index 00000000..f93df2d3 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiReplicationState.java @@ -0,0 +1,55 @@ +// Copyright (c) 2016 Cloudera, Inc. All rights reserved. +package com.cloudera.api.model; + +import com.cloudera.api.ApiUtils; +import com.google.common.base.Objects; + +/** + * The state of Hive/HDFS Replication. + */ +public class ApiReplicationState { + private Boolean incrementalExportEnabled; + + public ApiReplicationState() { + this(false); + } + + public ApiReplicationState(Boolean incrementalExportEnabled) { + this.incrementalExportEnabled = incrementalExportEnabled; + } + + /** + * + * returns if incremental export is enabled for the given Hive service. + * Not applicable for HDFS service. + */ + public Boolean getIncrementalExportEnabled() { + return incrementalExportEnabled; + } + + public void setIncrementalExportEnabled(Boolean incrementalExportEnabled) { + this.incrementalExportEnabled = incrementalExportEnabled; + } + + @Override + public String toString() { + return toStringHelper().toString(); + } + + protected Objects.ToStringHelper toStringHelper() { + return Objects.toStringHelper(this) + .add("incrementalExportEnabled", incrementalExportEnabled); + } + + @Override + public boolean equals(Object o) { + ApiReplicationState that = ApiUtils.baseEquals(this, o); + return this == that || (that != null && + Objects.equal(incrementalExportEnabled, that.getIncrementalExportEnabled())); + } + + @Override + public int hashCode() { + return Objects.hashCode(incrementalExportEnabled); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiRestartClusterArgs.java b/java/src/main/java/com/cloudera/api/model/ApiRestartClusterArgs.java index 03dd7c99..cc5f8e36 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiRestartClusterArgs.java +++ b/java/src/main/java/com/cloudera/api/model/ApiRestartClusterArgs.java @@ -15,6 +15,8 @@ // limitations under the License. package com.cloudera.api.model; +import java.util.List; + import com.cloudera.api.ApiUtils; import com.google.common.base.Objects; @@ -23,12 +25,18 @@ /** * Arguments used for Cluster Restart command. + * + * Since V11: + * If both restartOnlyStaleServices and restartServiceNames are specified, + * a service must be specified in restartServiceNames and also be stale, + * in order to be restarted. */ @XmlRootElement(name="restartClusterArgs") public class ApiRestartClusterArgs { private Boolean restartOnlyStaleServices; private Boolean redeployClientConfiguration; + private List restartServiceNames; /** * Only restart services that have stale configuration and their dependent @@ -55,11 +63,25 @@ public void setRedeployClientConfiguration(Boolean redeployClientConfiguration) this.redeployClientConfiguration = redeployClientConfiguration; } + /** + * Only restart services that are specified and their dependent services. + * Available since V11. + */ + @XmlElement + public List getRestartServiceNames() { + return restartServiceNames; + } + + public void setRestartServiceNames(List restartServiceNames) { + this.restartServiceNames = restartServiceNames; + } + @Override public String toString() { return Objects.toStringHelper(this) .add("restartOnlyStaleServices", restartOnlyStaleServices) .add("redeployClientConfiguration", redeployClientConfiguration) + .add("restartServiceNames", restartServiceNames) .toString(); } @@ -68,11 +90,13 @@ public boolean equals(Object o) { ApiRestartClusterArgs other = ApiUtils.baseEquals(this, o); return this == other || (other != null && Objects.equal(restartOnlyStaleServices, other.restartOnlyStaleServices)) && - Objects.equal(redeployClientConfiguration, other.redeployClientConfiguration); + Objects.equal(redeployClientConfiguration, other.redeployClientConfiguration) && + Objects.equal(restartServiceNames, other.restartServiceNames); } @Override public int hashCode() { - return Objects.hashCode(restartOnlyStaleServices, redeployClientConfiguration); + return Objects.hashCode(restartOnlyStaleServices, redeployClientConfiguration, + restartServiceNames); } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiRole.java b/java/src/main/java/com/cloudera/api/model/ApiRole.java index baf33c23..0ef0f14c 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiRole.java +++ b/java/src/main/java/com/cloudera/api/model/ApiRole.java @@ -52,6 +52,7 @@ public class ApiRole { private ApiConfigList config; private ApiRoleConfigGroupRef roleConfigGroupRef; private ZooKeeperServerMode zooKeeperServerMode; + private ApiEntityStatus entityStatus; public enum HaStatus { ACTIVE, @@ -93,6 +94,7 @@ public ApiRole() { // For JAX-B } + @Override public String toString() { return Objects.toStringHelper(this) .add("name", name) @@ -340,4 +342,17 @@ public ZooKeeperServerMode getZooKeeperServerMode() { public void setZooKeeperServerMode(ZooKeeperServerMode zooKeeperServerMode) { this.zooKeeperServerMode = zooKeeperServerMode; } + + /** + * Readonly. The entity status for this role. + * Available since API v11. + */ + @XmlElement + public ApiEntityStatus getEntityStatus() { + return entityStatus; + } + + public void setEntityStatus(ApiEntityStatus entityStatus) { + this.entityStatus = entityStatus; + } } \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiRollingRestartClusterArgs.java b/java/src/main/java/com/cloudera/api/model/ApiRollingRestartClusterArgs.java index f11eb051..65becf19 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiRollingRestartClusterArgs.java +++ b/java/src/main/java/com/cloudera/api/model/ApiRollingRestartClusterArgs.java @@ -37,8 +37,8 @@ public class ApiRollingRestartClusterArgs { private Boolean redeployClientConfiguration; private ApiRolesToInclude rolesToInclude; private List restartServiceNames; - - /** + + /** * Number of hosts with slave roles to restart at a time. * Must be greater than zero. Default is 1. */ @@ -46,30 +46,30 @@ public class ApiRollingRestartClusterArgs { public Integer getSlaveBatchSize() { return slaveBatchSize; } - + public void setSlaveBatchSize(Integer slaveBatchSize) { this.slaveBatchSize = slaveBatchSize; } - - /** + + /** * Number of seconds to sleep between restarts of slave host batches. - * + *

* Must be greater than or equal to 0. Default is 0. */ @XmlElement public Integer getSleepSeconds() { return sleepSeconds; } - + public void setSleepSeconds(Integer sleepSeconds) { this.sleepSeconds = sleepSeconds; } - - /** - * The threshold for number of slave host batches that are allowed to fail + + /** + * The threshold for number of slave host batches that are allowed to fail * to restart before the entire command is considered failed. - * - * Must be greather than or equal to 0. Default is 0. + *

+ * Must be greater than or equal to 0. Default is 0. *

* This argument is for ADVANCED users only. *

@@ -78,32 +78,38 @@ public void setSleepSeconds(Integer sleepSeconds) { public Integer getSlaveFailCountThreshold() { return slaveFailCountThreshold; } - + public void setSlaveFailCountThreshold(Integer slaveFailCountThreshold) { this.slaveFailCountThreshold = slaveFailCountThreshold; } - - /** Restart roles with stale configs only. */ + + /** + * Restart roles with stale configs only. + */ @XmlElement public Boolean getStaleConfigsOnly() { return staleConfigsOnly; } - + public void setStaleConfigsOnly(Boolean staleConfigsOnly) { this.staleConfigsOnly = staleConfigsOnly; } - - /** Restart roles that haven't been upgraded yet. */ + + /** + * Restart roles that haven't been upgraded yet. + */ @XmlElement public Boolean getUnUpgradedOnly() { return unUpgradedOnly; } - + public void setUnUpgradedOnly(Boolean unUpgradedOnly) { this.unUpgradedOnly = unUpgradedOnly; } - /** Re-deploy client configuration. Available since API v6. */ + /** + * Re-deploy client configuration. Available since API v6. + */ @XmlElement public Boolean getRedeployClientConfiguration() { return redeployClientConfiguration; @@ -113,18 +119,18 @@ public void setRedeployClientConfiguration(Boolean redeployClientConfiguration) this.redeployClientConfiguration = redeployClientConfiguration; } - /** + /** * Role types to restart. Default is slave roles only. */ @XmlElement public ApiRolesToInclude getRolesToInclude() { return rolesToInclude; } - + public void setRolesToInclude(ApiRolesToInclude rolesToInclude) { this.rolesToInclude = rolesToInclude; } - + /** * List of services to restart. */ @@ -132,22 +138,22 @@ public void setRolesToInclude(ApiRolesToInclude rolesToInclude) { public List getRestartServiceNames() { return restartServiceNames; } - + public void setRestartServiceNames(List restartServiceNames) { this.restartServiceNames = restartServiceNames; } - + @Override public String toString() { return Objects.toStringHelper(this) - .add("slaveBatchSize", slaveBatchSize) - .add("slaveFailCountThreshold", slaveFailCountThreshold) - .add("sleepSeconds", sleepSeconds) - .add("staleConfigsOnly", staleConfigsOnly) - .add("unUpgradedOnly", unUpgradedOnly) - .add("rolesToInclude", rolesToInclude) - .add("restartServiceNames", restartServiceNames) - .toString(); + .add("slaveBatchSize", slaveBatchSize) + .add("slaveFailCountThreshold", slaveFailCountThreshold) + .add("sleepSeconds", sleepSeconds) + .add("staleConfigsOnly", staleConfigsOnly) + .add("unUpgradedOnly", unUpgradedOnly) + .add("rolesToInclude", rolesToInclude) + .add("restartServiceNames", restartServiceNames) + .toString(); } @Override diff --git a/java/src/main/java/com/cloudera/api/model/ApiScmDbInfo.java b/java/src/main/java/com/cloudera/api/model/ApiScmDbInfo.java new file mode 100644 index 00000000..da66f4b1 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiScmDbInfo.java @@ -0,0 +1,88 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Cloudera Manager server's database information + */ +@XmlRootElement(name = "scmDbInfo") +public class ApiScmDbInfo { + + /** + * Enum for Cloudera Manager DB type. + * Note that DERBY and SQLITE3 are not supported DBs + */ + public static enum ScmDbType { + /** mysql db */ + MYSQL("mysql"), + /** postgresql db */ + POSTGRESQL("postgresql"), + /** hsql db, in memory version */ + HSQL("mem"), + /** oracle db */ + ORACLE("oracle"), + /** derby db, not supported */ + DERBY("derby"), + /** sqlite3 db, not supported */ + SQLITE3("sqlite3"); + + private String name; + + ScmDbType(String name) { + this.name = name; + } + + public static ScmDbType convert(String str) { + for (ScmDbType scmDbType : ScmDbType.values()) { + if (scmDbType.name.equals(str)) { + return scmDbType; + } + } + return null; + } + } + + private boolean scmUsingEmbeddedDb; + private ScmDbType scmDbType; + + public ApiScmDbInfo() { + } + + /** Cloudera Manager server's db type */ + @XmlElement + public ScmDbType getScmDbType() { + return scmDbType; + } + + public void setScmDbType(ScmDbType scmDbType) { + this.scmDbType = scmDbType; + } + + /** Whether Cloudera Manager server is using embedded DB */ + @XmlElement + public boolean getEmbeddedDbUsed() { + return scmUsingEmbeddedDb; + } + + public void setEmbeddedDbUsed(boolean scmUsingEmbeddedDb) { + this.scmUsingEmbeddedDb = scmUsingEmbeddedDb; + } + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiService.java b/java/src/main/java/com/cloudera/api/model/ApiService.java index 3e617a74..1152942b 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiService.java +++ b/java/src/main/java/com/cloudera/api/model/ApiService.java @@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; + import java.util.List; /** @@ -46,6 +47,7 @@ public class ApiService { private String type; private ApiClusterRef clusterRef; private String serviceUrl; + private String roleInstancesUrl; private ApiServiceState serviceState; private ApiHealthSummary healthSummary; private List healthChecks; @@ -60,11 +62,13 @@ public class ApiService { private List roleConfigGroups; private List replicationSchedules; private List snapshotPolicies; + private ApiEntityStatus entityStatus; public ApiService() { // For JAX-B } + @Override public String toString() { return Objects.toStringHelper(this) .add("name", name) @@ -211,8 +215,7 @@ public void setHealthChecks(List healthChecks) { } /** - * Readonly. - * Link into the Cloudera Manager web UI for this specific service. + * Readonly. Link into the Cloudera Manager web UI for this specific service. */ @XmlElement public String getServiceUrl() { @@ -223,6 +226,20 @@ public void setServiceUrl(String serviceUrl) { this.serviceUrl = serviceUrl; } + /** + * Readonly. Link into the Cloudera Manager web UI for role instances table for + * this specific service. + * Available since API v11. + */ + @XmlElement + public String getRoleInstancesUrl() { + return roleInstancesUrl; + } + + public void setRoleInstancesUrl(String roleInstancesUrl) { + this.roleInstancesUrl = roleInstancesUrl; + } + /** * Readonly. Whether the service is in maintenance mode. * Available since API v2. @@ -321,4 +338,17 @@ public List getSnapshotPolicies() { public void setSnapshotPolicies(List snapshotPolicies) { this.snapshotPolicies = snapshotPolicies; } + + /** + * Readonly. The entity status for this service. + * Available since API v11. + */ + @XmlElement + public ApiEntityStatus getEntityStatus() { + return entityStatus; + } + + public void setEntityStatus(ApiEntityStatus entityStatus) { + this.entityStatus = entityStatus; + } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiShutdownReadiness.java b/java/src/main/java/com/cloudera/api/model/ApiShutdownReadiness.java new file mode 100644 index 00000000..15cee6b4 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiShutdownReadiness.java @@ -0,0 +1,60 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Cloudera Manager server's shutdown readiness + */ +@XmlRootElement(name = "shutdownReadiness") +public class ApiShutdownReadiness { + + /** + * Enum for Cloudera Manager shutdown readiness state. + */ + public static enum ShutdownReadinessState { + /** + * Ready for shutdown. This is a terminal state, meaning it will not change + * once reached, assuming same input. + */ + READY, + /** + * Critical activity still ongoing. + */ + NOT_READY; + + ShutdownReadinessState() { + } + } + + private ShutdownReadinessState state; + + public ApiShutdownReadiness() { + } + + /** Shutdown readiness state */ + @XmlElement + public ShutdownReadinessState getState() { + return state; + } + + public void setState(ShutdownReadinessState state) { + this.state = state; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiSnapshotPolicy.java b/java/src/main/java/com/cloudera/api/model/ApiSnapshotPolicy.java index 4108d073..6030912f 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiSnapshotPolicy.java +++ b/java/src/main/java/com/cloudera/api/model/ApiSnapshotPolicy.java @@ -58,6 +58,7 @@ public class ApiSnapshotPolicy { private boolean alertOnSuccess; private boolean alertOnFail; private boolean alertOnAbort; + private Boolean paused; private ApiHBaseSnapshotPolicyArguments hbaseArguments; private ApiHdfsSnapshotPolicyArguments hdfsArguments; @@ -340,6 +341,16 @@ public void setLastSuccessfulCommand(ApiSnapshotCommand lastSuccessfulCommand) { this.lastSuccessfulCommand = lastSuccessfulCommand; } + /** Whether to pause a snapshot policy, available since V11. */ + @XmlElement + public Boolean getPaused() { + return paused; + } + + public void setPaused(Boolean paused) { + this.paused = paused; + } + @Override public String toString() { return Objects.toStringHelper(this) @@ -364,6 +375,7 @@ public String toString() { .add("hdfsArguments", hdfsArguments) .add("lastCommand", lastCommand) .add("lastSuccessfulCommand", lastSuccessfulCommand) + .add("paused", paused) .toString(); } @@ -392,7 +404,8 @@ public boolean equals(Object o) { Objects.equal(hbaseArguments, other.getHBaseArguments()) && Objects.equal(hdfsArguments, other.getHdfsArguments()) && Objects.equal(lastCommand, other.lastCommand) && - Objects.equal(lastSuccessfulCommand, other.lastSuccessfulCommand); + Objects.equal(lastSuccessfulCommand, other.lastSuccessfulCommand) && + Objects.equal(paused, other.paused); } @Override @@ -401,6 +414,7 @@ public int hashCode() { weeklySnapshots, monthlySnapshots, yearlySnapshots, minuteOfHour, hourOfDay, dayOfWeek, dayOfMonth, monthOfYear, hoursForHourlySnapshots, alertOnStart, alertOnSuccess, alertOnFail, alertOnAbort, - hbaseArguments, hdfsArguments, lastCommand, lastSuccessfulCommand); + hbaseArguments, hdfsArguments, lastCommand, lastSuccessfulCommand, + paused); } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesCrossEntityMetadata.java b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesCrossEntityMetadata.java index ead1cc18..8d8b0dac 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesCrossEntityMetadata.java +++ b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesCrossEntityMetadata.java @@ -26,7 +26,9 @@ public class ApiTimeSeriesCrossEntityMetadata { private String maxEntityDisplayName; + private String maxEntityName; private String minEntityDisplayName; + private String minEntityName; private Double numEntities; /** @@ -42,6 +44,21 @@ public void setMaxEntityDisplayName(String maxEntityDisplayName) { this.maxEntityDisplayName = maxEntityDisplayName; } + /** + * The name of the entity that had the maximum value for the + * cross-entity aggregate metric. + *

+ * Available since API v11. + */ + @XmlElement + public String getMaxEntityName() { + return maxEntityName; + } + + public void setMaxEntityName(String maxEntityName) { + this.maxEntityName = maxEntityName; + } + /** * The display name of the entity that had the minimum value for the * cross-entity aggregate metric. @@ -55,6 +72,21 @@ public void setMinEntityDisplayName(String minEntityDisplayName) { this.minEntityDisplayName = minEntityDisplayName; } + /** + * The name of the entity that had the minimum value for the + * cross-entity aggregate metric. + *

+ * Available since API v11. + */ + @XmlElement + public String getMinEntityName() { + return minEntityName; + } + + public void setMinEntityName(String minEntityName) { + this.minEntityName = minEntityName; + } + /** * The number of entities covered by this point. For a raw cross-entity point * this number is exact. For a rollup point this number is an average, since diff --git a/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityAttribute.java b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityAttribute.java new file mode 100644 index 00000000..2f1e9afb --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityAttribute.java @@ -0,0 +1,97 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * A time series entity attribute represents a possible attribute of a time + * series entity type monitored by the Cloudera Management Services. + *

+ * Available since API v11. + */ +@XmlRootElement(name = "timeSeriesEntityAttribute") +public class ApiTimeSeriesEntityAttribute { + private String name; + private String displayName; + private String description; + private boolean isValueCaseSensitive; + + public ApiTimeSeriesEntityAttribute() { + // For JAX-B + } + + public ApiTimeSeriesEntityAttribute( + String name, + String displayName, + String description, + boolean isValueCaseSensitive) { + this.name = name; + this.displayName = displayName; + this.description = description; + this.isValueCaseSensitive = isValueCaseSensitive; + } + + /** + * Name of the of the attribute. + * This name uniquely identifies this attribute. + **/ + @XmlElement + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * Display name of the attribute. + **/ + @XmlElement + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + /** + * Description of the attribute. + **/ + @XmlElement + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * Returns whether to treat attribute values as case-sensitive. + **/ + @XmlElement + public boolean getIsValueCaseSensitive() { + return isValueCaseSensitive; + } + + public void setIsValueCaseSensitive(boolean isValueCaseSensitive) { + this.isValueCaseSensitive = isValueCaseSensitive; + } +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityAttributeList.java b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityAttributeList.java new file mode 100644 index 00000000..24973a77 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityAttributeList.java @@ -0,0 +1,46 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * A list of ApiTimeSeriesEntityAttribute objects + */ +@XmlRootElement(name = "timeSeriesEntityAttributeList") +public class ApiTimeSeriesEntityAttributeList extends + ApiListBase { + public ApiTimeSeriesEntityAttributeList() { + // For JAX-B + } + + public ApiTimeSeriesEntityAttributeList(List attrs) { + super(attrs); + } + + @XmlElementWrapper(name = ApiListBase.ITEMS_ATTR) + public List getMetricEntityTypeAttributes() { + return values; + } + + public void setMetricEntityTypeAttributes( + List values) { + this.values = values; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityType.java b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityType.java new file mode 100644 index 00000000..6ed2db92 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityType.java @@ -0,0 +1,184 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Describe a time series entity type and attributes associated with + * this entity type. + *

+ * Available since API v11. + */ +@XmlRootElement(name = "timeSeriesEntityType") +public class ApiTimeSeriesEntityType { + private String name; + private String category; + private String nameForCrossEntityAggregateMetrics; + private String displayName; + private String description; + private List immutableAttributeNames; + private List mutableAttributeNames; + private List entityNameFormat; + private String entityDisplayNameFormat; + private List parentMetricEntityTypeNames; + + public ApiTimeSeriesEntityType() { + // For JAX-B + } + + /** + * Returns the name of the entity type. This name uniquely identifies this + * entity type. + */ + @XmlElement + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * Returns the category of the entity type. + */ + @XmlElement + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + /** + * Returns the string to use to pluralize the name of the entity for cross + * entity aggregate metrics. + */ + @XmlElement + public String getNameForCrossEntityAggregateMetrics() { + return nameForCrossEntityAggregateMetrics; + } + + public void setNameForCrossEntityAggregateMetrics(String value) { + this.nameForCrossEntityAggregateMetrics = value; + } + + /** + * Returns the display name of the entity type. + */ + @XmlElement + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + /** + * Returns the description of the entity type. + */ + @XmlElement + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * Returns the list of immutable attributes for this entity type. Immutable + * attributes values for an entity may not change over its lifetime. + */ + @XmlElement + public List getImmutableAttributeNames() { + return immutableAttributeNames; + } + + public void setImmutableAttributeNames(List value) { + this.immutableAttributeNames = value; + } + + /** + * Returns the list of mutable attributes for this entity type. Mutable + * attributes for an entity may change over its lifetime. + */ + @XmlElement + public List getMutableAttributeNames() { + return mutableAttributeNames; + } + + public void setMutableAttributeNames(List value) { + this.mutableAttributeNames = value; + } + + /** + * Returns a list of attribute names that will be used to construct entity + * names for entities of this type. The attributes named here must be immutable + * attributes of this type or a parent type. + */ + @XmlElement + public List getEntityNameFormat() { + return entityNameFormat; + } + + public void setEntityNameFormat(List value) { + this.entityNameFormat = value; + } + + /** + * Returns a format string that will be used to construct the display name of + * entities of this type. If this returns null the entity name would be used + * as the display name. + * + * The entity attribute values are used to replace $attribute name portions of + * this format string. For example, an entity with roleType "DATANODE" and + * hostname "foo.com" will have a display name "DATANODE (foo.com)" if the + * format is "$roleType ($hostname)". + */ + @XmlElement + public String getEntityDisplayNameFormat() { + return entityDisplayNameFormat; + } + + public void setEntityDisplayNameFormat(String entityDisplayNameFormat) { + this.entityDisplayNameFormat = entityDisplayNameFormat; + } + + /** + * Returns a list of metric entity type names which are parents of this + * metric entity type. A metric entity type inherits the attributes of + * its ancestors. For example a role metric entity type has its service as a + * parent. A service metric entity type has a cluster as a parent. The role + * type inherits its cluster name attribute through its service parent. Only + * parent ancestors should be returned here. In the example given, only the + * service metric entity type should be specified in the parent list. + */ + @XmlElement + public List getParentMetricEntityTypeNames() { + return parentMetricEntityTypeNames; + } + + public void setParentMetricEntityTypeNames(List value) { + this.parentMetricEntityTypeNames = value; + } +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityTypeList.java b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityTypeList.java new file mode 100644 index 00000000..36dc3e01 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesEntityTypeList.java @@ -0,0 +1,44 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * A list of ApiTimeSeriesEntityType objects + */ +@XmlRootElement(name = "timeSeriesEntityTypeList") +public class ApiTimeSeriesEntityTypeList extends ApiListBase { + public ApiTimeSeriesEntityTypeList() { + // For JAX-B + } + + public ApiTimeSeriesEntityTypeList(List attrs) { + super(attrs); + } + + @XmlElementWrapper(name = ApiListBase.ITEMS_ATTR) + public List getMetricEntityTypes() { + return values; + } + + public void setMetricEntityTypes(List values) { + this.values = values; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesRequest.java b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesRequest.java new file mode 100644 index 00000000..ada9e9dc --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesRequest.java @@ -0,0 +1,188 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import static com.cloudera.api.Parameters.ROLLUP_DEFAULT; + +import com.cloudera.api.ApiUtils; +import com.google.common.base.Objects; + +import javax.ws.rs.core.MediaType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Request object containing information needed for querying timeseries data. + * + * Available since API v11. + */ +@XmlRootElement(name = "timeSeriesQuery") +public class ApiTimeSeriesRequest { + + String query; + String from; + String to; + String contentType; + String desiredRollup; + Boolean mustUseDesiredRollup; + + public ApiTimeSeriesRequest(String query, String from, String to) { + this(query, + from, + to, + MediaType.APPLICATION_JSON, + ROLLUP_DEFAULT, + false); + } + + public ApiTimeSeriesRequest( + String query, + String from, + String to, + String contentType, + String desiredRollup, + Boolean mustUseDesiredRollup) { + this.query = query; + this.from = from; + this.to = to; + this.contentType = contentType; + this.desiredRollup = desiredRollup; + this.mustUseDesiredRollup = mustUseDesiredRollup; + } + + public ApiTimeSeriesRequest() { + this.contentType = MediaType.APPLICATION_JSON; + this.desiredRollup = ROLLUP_DEFAULT; + this.mustUseDesiredRollup = false; + } + + /** + * tsquery to run against the CM time-series data store. + * Please see the + * tsquery language documentation.

+ */ + @XmlElement + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + /** + * Start of the period to query in ISO 8601 format (defaults to 5 minutes + * before the end of the period). + */ + @XmlElement + public String getFrom() { + return from; + } + + public void setFrom(String from) { + this.from = from; + } + + /** + * End of the period to query in ISO 8601 format (defaults to current time). + */ + @XmlElement + public String getTo() { + return to; + } + + public void setTo(String to) { + this.to = to; + } + + /** + * contentType to return the response in. The content types "application/json" + * and "text/csv" are supported. This defaults to "application/json". If + * "text/csv" is specified then we return one row per time series data point, + * and we don't return any of the metadata. + */ + @XmlElement + public String getContentType() { + return contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + /** + * Aggregate rollup level desired for the response data. + * Valid values are RAW, TEN_MINUTELY, HOURLY, SIX_HOURLY, DAILY, and WEEKLY. + * Note that if the mustUseDesiredRollup parameter is not set, then the + * monitoring server can decide to return a different rollup level. + */ + @XmlElement + public String getDesiredRollup() { + return desiredRollup; + } + + public void setDesiredRollup(String desiredRollup) { + this.desiredRollup = desiredRollup; + } + + /** + * If set to true, then the tsquery will return data with the desired + * aggregate rollup level. + */ + @XmlElement + public Boolean getMustUseDesiredRollup() { + return mustUseDesiredRollup; + } + + public void setMustUseDesiredRollup(Boolean mustUseDesiredRollup) { + this.mustUseDesiredRollup = mustUseDesiredRollup; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("query", query) + .add("from", from) + .add("to", to) + .add("contentType", contentType) + .add("desiredRollup", desiredRollup) + .add("mustUseDesiredRollup", mustUseDesiredRollup) + .toString(); + } + + @Override + public boolean equals(Object o) { + ApiTimeSeriesRequest other = ApiUtils.baseEquals(this, o); + return this == other || (other != null && + Objects.equal(query, other.getQuery()) && + Objects.equal(from, other.getFrom()) && + Objects.equal(to, other.getTo()) && + Objects.equal(contentType, other.getContentType()) && + Objects.equal(desiredRollup, other.getDesiredRollup()) && + Objects.equal(mustUseDesiredRollup, other.getMustUseDesiredRollup())); + } + + @Override + public int hashCode() { + return Objects.hashCode( + query, + from, + to, + contentType, + desiredRollup, + mustUseDesiredRollup); + } +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiUser.java b/java/src/main/java/com/cloudera/api/model/ApiUser.java index 6cc4874a..9cddad19 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiUser.java +++ b/java/src/main/java/com/cloudera/api/model/ApiUser.java @@ -121,6 +121,7 @@ public void setPassword(String password) { *

  • ROLE_BDR_ADMIN: Added in Cloudera Manager 5.2
  • *
  • ROLE_NAVIGATOR_ADMIN: Added in Cloudera Manager 5.2
  • *
  • ROLE_USER_ADMIN: Added in Cloudera Manager 5.2
  • + *
  • ROLE_KEY_ADMIN: Added in Cloudera Manager 5.5
  • * * An empty list implies ROLE_USER. *

    diff --git a/java/src/main/java/com/cloudera/api/model/ApiUserSession.java b/java/src/main/java/com/cloudera/api/model/ApiUserSession.java new file mode 100644 index 00000000..7b65755f --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiUserSession.java @@ -0,0 +1,112 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import com.cloudera.api.ApiUtils; +import com.google.common.base.Objects; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * This is the model for interactive user session information in the API. + *

    + * A user may have more than one active session. Each such session will have + * its own session object. + */ +@XmlRootElement(name = "userSession") +public class ApiUserSession { + + private String name; + private String remoteAddr; + private Date lastRequest; + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("name", name) + .add("remoteAddr", remoteAddr) + .add("expiration", lastRequest.toString()) + .toString(); + } + + public boolean equals(Object o) { + ApiUserSession other = ApiUtils.baseEquals(this, o); + return this == other || (other != null && + Objects.equal(name, other.getName()) && + Objects.equal(remoteAddr, other.getRemoteAddr()) && + Objects.equal(lastRequest, other.getLastRequest())); + } + + public int hashCode() { + return Objects.hashCode(name, remoteAddr, lastRequest); + } + + /** + * The username associated with the session. + *

    + * This will be the same value shown to the logged in user in the UI, which + * will normally be the same value they typed when logging in, but it is + * possible that in certain external authentication scenarios, it will differ + * from that value. + * + * @return the username + * */ + @XmlElement + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * The remote IP address for the session. + *

    + * This will be the remote IP address for the last request made as part of + * this session. It is not guaranteed to be the same IP address as was + * previously used, or the address used to initiate the session. + * + * @return The remote IP address. + */ + @XmlElement + public String getRemoteAddr() { + return remoteAddr; + } + + public void setRemoteAddr(String remoteAddr) { + this.remoteAddr = remoteAddr; + } + + /** + * The date and time of the last request received as part of this session. + *

    + * This will be returned in ISO 8601 format from the REST API. + * + * @return The date/time. + */ + @XmlElement + public Date getLastRequest() { + return lastRequest; + } + + public void setLastRequest(Date lastRequest) { + this.lastRequest = lastRequest; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiUserSessionList.java b/java/src/main/java/com/cloudera/api/model/ApiUserSessionList.java new file mode 100644 index 00000000..aeecbc46 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiUserSessionList.java @@ -0,0 +1,45 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +/** + * A list of user sessions. + */ +@XmlRootElement(name = "userSessionList") +public class ApiUserSessionList extends ApiListBase { + + public ApiUserSessionList() { + // For JAX-B + } + + public ApiUserSessionList(List users) { + super(users); + } + + @XmlElementWrapper(name = ApiListBase.ITEMS_ATTR) + public List getUserSessions() { + return values; + } + + public void setUserSessions(List values) { + this.values = values; + } + +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiWatchedDir.java b/java/src/main/java/com/cloudera/api/model/ApiWatchedDir.java new file mode 100644 index 00000000..39a1eb5f --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiWatchedDir.java @@ -0,0 +1,37 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "watchedDir") +public class ApiWatchedDir { + + private String path; + + public ApiWatchedDir() { + } + + public ApiWatchedDir(String path) { + this.path = path; + } + + @XmlElement + public String getPath() { + return path; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiWatchedDirList.java b/java/src/main/java/com/cloudera/api/model/ApiWatchedDirList.java new file mode 100644 index 00000000..8adb1474 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiWatchedDirList.java @@ -0,0 +1,48 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +import com.google.common.collect.Lists; + +/** + * A list of watched directories. + */ +@XmlRootElement(name = "watchedDirList") +public class ApiWatchedDirList extends ApiListBase { + private List watchedDirs = Lists.newArrayList(); + + public ApiWatchedDirList() { + // For JAX-B. + } + + public void addWatchedDir(String dir) { + watchedDirs.add(new ApiWatchedDir(dir)); + } + + @XmlElementWrapper(name = ApiListBase.ITEMS_ATTR) + public List getDirs() { + return watchedDirs; + } + + public void setDirs(List watchedDirs) { + this.watchedDirs = watchedDirs; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiYarnApplication.java b/java/src/main/java/com/cloudera/api/model/ApiYarnApplication.java index 885d31e6..81f29ac5 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiYarnApplication.java +++ b/java/src/main/java/com/cloudera/api/model/ApiYarnApplication.java @@ -15,15 +15,16 @@ // limitations under the License. package com.cloudera.api.model; +import com.google.common.base.Objects; +import com.google.common.base.Preconditions; + import java.util.Date; +import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import com.google.common.base.Objects; -import com.google.common.base.Preconditions; - /** * Represents a Yarn application */ @@ -31,6 +32,8 @@ public class ApiYarnApplication { private String applicationId; + + private String name; private Date startTime; private Date endTime; @@ -40,6 +43,18 @@ public class ApiYarnApplication { private Double progress; private ApiMr2AppInformation mr2AppInfo; private Map attributes; + private List applicationTags; + private Long allocatedMemorySeconds; + private Long allocatedVcoreSeconds; + private Integer allocatedMB; + private Integer allocatedVCores; + private Integer runningContainers; + + private Double containerUsedMemorySeconds; + private Double containerUsedCpuSeconds; + private Double containerUsedVcoreSeconds; + private Double containerAllocatedMemorySeconds; + private Double containerAllocatedVcoreSeconds; public ApiYarnApplication() { // For JAX-B @@ -55,7 +70,18 @@ public ApiYarnApplication( String state, Double progress, ApiMr2AppInformation mr2AppInfo, - Map attributes) { + Map attributes, + List applicationTags, + Long allocatedMemorySeconds, + Long allocatedVcoreSeconds, + Integer allocatedMB, + Integer allocatedVCores, + Integer runningContainers, + Double containerUsedMemorySeconds, + Double containerUsedCpuSeconds, + Double containerUsedVcoreSeconds, + Double containerAllocatedMemorySeconds, + Double containerAllocatedVcoreSeconds) { Preconditions.checkNotNull(applicationId); Preconditions.checkNotNull(name); Preconditions.checkNotNull(startTime); @@ -71,6 +97,89 @@ public ApiYarnApplication( this.progress = progress; this.attributes = attributes; this.mr2AppInfo = mr2AppInfo; + this.applicationTags = applicationTags; + this.allocatedMemorySeconds = allocatedMemorySeconds; + this.allocatedVcoreSeconds = allocatedVcoreSeconds; + this.allocatedMB = allocatedMB; + this.allocatedVCores = allocatedVCores; + this.runningContainers = runningContainers; + this.containerUsedMemorySeconds = containerUsedMemorySeconds; + this.containerUsedCpuSeconds = containerUsedCpuSeconds; + this.containerUsedVcoreSeconds = containerUsedVcoreSeconds; + this.containerAllocatedMemorySeconds = containerAllocatedMemorySeconds; + this.containerAllocatedVcoreSeconds = containerAllocatedVcoreSeconds; + } + + /** + The sum of memory in MB allocated to the application's running containers + Available since v12. + */ + @XmlElement + public Integer getAllocatedMB() { + return allocatedMB; + } + + public void setAllocatedMB(Integer allocatedMB) { + this.allocatedMB = allocatedMB; + } + + /** + The sum of virtual cores allocated to the application's running containers + Available since v12. + */ + @XmlElement + public Integer getAllocatedVCores() { + return allocatedVCores; + } + + public void setAllocatedVCores(Integer allocatedVCores) { + this.allocatedVCores = allocatedVCores; + } + + /** + The number of containers currently running for the application + Available since v12. + */ + @XmlElement + public Integer getRunningContainers() { + return runningContainers; + } + + public void setRunningContainers(Integer runningContainers) { + this.runningContainers = runningContainers; + } + + /** List of YARN application tags. Available since v12. */ + @XmlElement + public List getApplicationTags() { + return applicationTags; + } + + public void setApplicationTags(List applicationTags) { + this.applicationTags = applicationTags; + } + + /** + Allocated memory to the application in units of mb-secs. + Available since v12. + */ + @XmlElement + public Long getAllocatedMemorySeconds() { + return allocatedMemorySeconds; + } + + public void setAllocatedMemorySeconds(Long allocatedMemorySeconds) { + this.allocatedMemorySeconds = allocatedMemorySeconds; + } + + /** Allocated vcore-secs to the application. Available since v12. */ + @XmlElement + public Long getAllocatedVcoreSeconds() { + return allocatedVcoreSeconds; + } + + public void setAllocatedVcoreSeconds(Long allocatedVcoreSeconds) { + this.allocatedVcoreSeconds = allocatedVcoreSeconds; } /** The application id. */ @@ -179,6 +288,83 @@ public void setState(String state) { this.state = state; } + /** + * Actual memory (in MB-secs) used by containers launched by the YARN application. + * Computed by running a MapReduce job from Cloudera Service Monitor to + * aggregate YARN usage metrics. + * Available since v12. + */ + @XmlElement + public Double getContainerUsedMemorySeconds() { + return containerUsedMemorySeconds; + } + + public void setContainerUsedMemorySeconds(Double containerUsedMemorySeconds) { + this.containerUsedMemorySeconds = containerUsedMemorySeconds; + } + + /** + * Actual CPU (in percent-secs) used by containers launched by the YARN application. + * Computed by running a MapReduce job from Cloudera Service Monitor to + * aggregate YARN usage metrics. + * Available since v12. + */ + @XmlElement + public Double getContainerUsedCpuSeconds() { + return containerUsedCpuSeconds; + } + + public void setContainerUsedCpuSeconds(Double containerUsedCpuSeconds) { + this.containerUsedCpuSeconds = containerUsedCpuSeconds; + } + + /** + * Actual VCore-secs used by containers launched by the YARN application. + * Computed by running a MapReduce job from Cloudera Service Monitor to + * aggregate YARN usage metrics. + * Available since v12. + */ + @XmlElement + public Double getContainerUsedVcoreSeconds() { + return containerUsedVcoreSeconds; + } + + public void setContainerUsedVcoreSeconds(Double containerUsedVcoreSeconds) { + this.containerUsedVcoreSeconds = containerUsedVcoreSeconds; + } + + /** + * Total memory (in mb-secs) allocated to containers launched by the YARN application. + * Computed by running a MapReduce job from Cloudera Service Monitor to + * aggregate YARN usage metrics. + * Available since v12. + */ + @XmlElement + public Double getContainerAllocatedMemorySeconds() { + return containerAllocatedMemorySeconds; + } + + public void setContainerAllocatedMemorySeconds( + Double containerAllocatedMemorySeconds) { + this.containerAllocatedMemorySeconds = containerAllocatedMemorySeconds; + } + + /** + * Total vcore-secs allocated to containers launched by the YARN application. + * Computed by running a MapReduce job from Cloudera Service Monitor to + * aggregate YARN usage metrics. + * Available since v12. + */ + @XmlElement + public Double getContainerAllocatedVcoreSeconds() { + return containerAllocatedVcoreSeconds; + } + + public void setContainerAllocatedVcoreSeconds( + Double containerAllocatedVcoreSeconds) { + this.containerAllocatedVcoreSeconds = containerAllocatedVcoreSeconds; + } + @Override public String toString() { return Objects.toStringHelper(this) @@ -191,6 +377,17 @@ public String toString() { .add("progress", progress) .add("attributes", attributes) .add("mr2AppInfo", mr2AppInfo) + .add("applicationTags", applicationTags) + .add("allocatedMemorySeconds", allocatedMemorySeconds) + .add("allocatedVcoreSeconds", allocatedVcoreSeconds) + .add("allocatedMB", allocatedMB) + .add("allocatedVCores", allocatedVCores) + .add("runningContainers", runningContainers) + .add("containerUsedMemorySeconds", containerUsedMemorySeconds) + .add("containerUsedCpuSeconds", containerUsedCpuSeconds) + .add("containerUsedVcoreSeconds", containerUsedVcoreSeconds) + .add("containerAllocatedMemorySeconds", containerAllocatedMemorySeconds) + .add("containerAllocatedVcoreSeconds", containerAllocatedVcoreSeconds) .toString(); } } diff --git a/java/src/main/java/com/cloudera/api/v1/MgmtServiceResource.java b/java/src/main/java/com/cloudera/api/v1/MgmtServiceResource.java index 84f09e8d..2ed84cbe 100644 --- a/java/src/main/java/com/cloudera/api/v1/MgmtServiceResource.java +++ b/java/src/main/java/com/cloudera/api/v1/MgmtServiceResource.java @@ -42,6 +42,7 @@ public interface MgmtServiceResource { /** * Retrieve information about the Cloudera Management Services. * + * @throws javax.ws.rs.NotFoundException if no service exists. * @return Details about the management service. */ @GET @@ -51,6 +52,7 @@ public interface MgmtServiceResource { /** * Retrieve the configuration of the Cloudera Management Services. * + * @throws javax.ws.rs.NotFoundException if no service exists. * @param dataView The view of the data to materialize, * either "summary" or "full". * @return List with configured and available configuration options. @@ -72,6 +74,7 @@ public ApiServiceConfig readServiceConfig( * Attributes that are not listed in the input will maintain their * current values in the configuration. * + * @throws javax.ws.rs.ClientErrorException if no service exists. * @param message Optional message describing the changes. * @param config Configuration changes. * @return The new service configuration. @@ -85,6 +88,7 @@ public ApiServiceConfig updateServiceConfig( /** * List the supported role types for the Cloudera Management Services. * + * @throws javax.ws.rs.NotFoundException if no service exists. * @return List of role types the service supports. */ @GET @@ -94,6 +98,7 @@ public ApiServiceConfig updateServiceConfig( /** * List active Cloudera Management Services commands. * + * @throws javax.ws.rs.NotFoundException if no service exists. * @param dataView The view of the data to materialize, * either "summary" or "full". * @return A list of active role commands. @@ -107,6 +112,7 @@ public ApiCommandList listActiveCommands( /** * Start the Cloudera Management Services. * + * @throws javax.ws.rs.NotFoundException if no service exists. * @return A reference to the submitted command. */ @POST @@ -117,6 +123,7 @@ public ApiCommandList listActiveCommands( /** * Stop the Cloudera Management Services. * + * @throws javax.ws.rs.NotFoundException if no service exists. * @return A reference to the submitted command. */ @POST @@ -127,6 +134,7 @@ public ApiCommandList listActiveCommands( /** * Restart the Cloudera Management Services. * + * @throws javax.ws.rs.NotFoundException if no service exists. * @return A reference to the submitted command. */ @POST diff --git a/java/src/main/java/com/cloudera/api/v10/AuditsResourceV10.java b/java/src/main/java/com/cloudera/api/v10/AuditsResourceV10.java index 4b30c50b..02b6a140 100644 --- a/java/src/main/java/com/cloudera/api/v10/AuditsResourceV10.java +++ b/java/src/main/java/com/cloudera/api/v10/AuditsResourceV10.java @@ -31,9 +31,10 @@ * * @param maxResults Maximum number of audits to return * @param resultOffset Offset of audits to return - * @param startTime Start of the period to query (defaults to 1 day ago - * relative to endTime) - * @param endTime End of the period to query (defaults to current time) + * @param startTime Start of the period to query in ISO 8601 format (defaults + * to 1 day ago relative to endTime). + * @param endTime End of the period to query in ISO 8601 format. (defaults to + * current time). * @param query * The query to filter out audits in the system. It accepts * querying the intersection of a list of constraints, diff --git a/java/src/main/java/com/cloudera/api/v10/RoleCommandsResourceV10.java b/java/src/main/java/com/cloudera/api/v10/RoleCommandsResourceV10.java index 6bdd83a4..97df5a20 100644 --- a/java/src/main/java/com/cloudera/api/v10/RoleCommandsResourceV10.java +++ b/java/src/main/java/com/cloudera/api/v10/RoleCommandsResourceV10.java @@ -37,7 +37,8 @@ public interface RoleCommandsResourceV10 extends RoleCommandsResourceV8 { *

    * For HDFS services, this command should be executed on NameNode or * DataNode roles. For NameNodes, it refreshes the role's node list. - * For DataNodes, it refreshes the role's data directory list. + * For DataNodes, it refreshes the role's data directory list and other + * configuration. *

    * For YARN services, this command should be executed on ResourceManager * roles. It refreshes the role's queue and node information. diff --git a/java/src/main/java/com/cloudera/api/v11/ClouderaManagerResourceV11.java b/java/src/main/java/com/cloudera/api/v11/ClouderaManagerResourceV11.java new file mode 100644 index 00000000..25a5426f --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/ClouderaManagerResourceV11.java @@ -0,0 +1,35 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v11; + +import com.cloudera.api.v8.ClouderaManagerResourceV8; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Consumes({MediaType.APPLICATION_JSON}) +@Produces({MediaType.APPLICATION_JSON}) +public interface ClouderaManagerResourceV11 extends ClouderaManagerResourceV8 { + + /** + * Only available with Cloudera Manager Enterprise Edition. + */ + @Override + @Path("/peers") + public CmPeersResourceV11 getCmPeersResource(); +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v11/ClustersResourceV11.java b/java/src/main/java/com/cloudera/api/v11/ClustersResourceV11.java new file mode 100644 index 00000000..a213fd29 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/ClustersResourceV11.java @@ -0,0 +1,60 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v11; + +import static com.cloudera.api.Parameters.CLUSTER_NAME; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.model.ApiConfigureForKerberosArguments; +import com.cloudera.api.v10.ClustersResourceV10; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ClustersResourceV11 extends ClustersResourceV10 { + + /** + * Command to configure the cluster to use Kerberos for authentication. + * + * This command will configure all relevant services on a cluster for + * Kerberos usage. This command will trigger a GenerateCredentials command + * to create Kerberos keytabs for all roles in the cluster. + * + * @param clusterName The name of the cluster. + * @param args Arguments for the configure for kerberos command. + * @return Information about the submitted command. + */ + @POST + @Consumes + @Path("/{clusterName}/commands/configureForKerberos") + public ApiCommand configureForKerberos( + @PathParam(CLUSTER_NAME) String clusterName, + ApiConfigureForKerberosArguments args); + + /** + * @return The services resource handler. + */ + @Override + @Path("/{clusterName}/services") + public ServicesResourceV11 getServicesResource( + @PathParam(CLUSTER_NAME) String clusterName); +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v11/CmPeersResourceV11.java b/java/src/main/java/com/cloudera/api/v11/CmPeersResourceV11.java new file mode 100644 index 00000000..24137b6b --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/CmPeersResourceV11.java @@ -0,0 +1,91 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v11; + +import static com.cloudera.api.Parameters.PEER_NAME; +import static com.cloudera.api.Parameters.PEER_TYPE; + +import com.cloudera.api.model.ApiCmPeer; +import com.cloudera.api.model.ApiCmPeerType; +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.v3.CmPeersResource; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface CmPeersResourceV11 extends CmPeersResource { + /** + * Fetch information about an existing Cloudera Manager peer. + *

    + * Available since API v11. Only available with Cloudera Manager Enterprise + * Edition. + * + * @param peerName Name of peer to retrieve. + * @param peerType Type of peer to retrieve. If null, REPLICATION peer type + * will be returned. + * @return Peer information. + */ + @GET + @Path("/{peerName}") + public ApiCmPeer readPeer(@PathParam(PEER_NAME) String peerName, + @QueryParam(PEER_TYPE) ApiCmPeerType peerType); + + /** + * Delete Cloudera Manager peer. + *

    + * An attempt will be made to contact the peer server, so that the configured + * user can be deleted.. Errors while contacting the remote server are + * non-fatal. + *

    + * Available since API v11. Only available with Cloudera Manager Enterprise + * Edition. + * + * @param peerName Name of peer to delete. + * @param peerType Type of peer to delete. If null, REPLICATION peer type will + * be deleted. + * @return Information about the deleted peer. + */ + @DELETE + @Path("/{peerName}") + public ApiCmPeer deletePeer(@PathParam(PEER_NAME) String peerName, + @QueryParam(PEER_TYPE) ApiCmPeerType peerType); + + /** + * Test the connectivity of a peer. + *

    + * Available since API v11. Only available with Cloudera Manager Enterprise + * Edition. + * + * @param peerName Name of peer to test. + * @param peerType Type of peer to test. If null, REPLICATION peer type will + * be tested. + * @return Information about the submitted command. + */ + @POST + @Consumes + @Path("/{peerName}/commands/test") + public ApiCommand testPeer(@PathParam(PEER_NAME) String peerName, + @QueryParam(PEER_TYPE) ApiCmPeerType peerType); +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v11/CommandsResourceV11.java b/java/src/main/java/com/cloudera/api/v11/CommandsResourceV11.java new file mode 100644 index 00000000..d5026e5e --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/CommandsResourceV11.java @@ -0,0 +1,32 @@ +// Copyright (c) 2015 Cloudera, Inc. All rights reserved. +package com.cloudera.api.v11; + +import static com.cloudera.api.Parameters.COMMAND_ID; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.v1.CommandsResource; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + + +@Produces({ MediaType.APPLICATION_JSON }) +@Consumes({ MediaType.APPLICATION_JSON }) +public interface CommandsResourceV11 extends CommandsResource { + + /** + * Try to rerun a command. + * + * @param commandId ID of the command that needs to be run. + * @return Command that represents the retry attempt. + */ + @Consumes() + @POST + @Path("/{commandId}/retry") + public ApiCommand retry(@PathParam(COMMAND_ID) long commandId); + +} diff --git a/java/src/main/java/com/cloudera/api/v11/HostsResourceV11.java b/java/src/main/java/com/cloudera/api/v11/HostsResourceV11.java new file mode 100644 index 00000000..62b28124 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/HostsResourceV11.java @@ -0,0 +1,52 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.v11; + +import static com.cloudera.api.Parameters.DATA_VIEW; +import static com.cloudera.api.Parameters.DATA_VIEW_FULL; +import static com.cloudera.api.Parameters.HOST_ID; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import com.cloudera.api.DataView; +import com.cloudera.api.model.ApiHost; +import com.cloudera.api.v10.HostsResourceV10; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface HostsResourceV11 extends HostsResourceV10 { + + /** + * Returns a specific Host in the system. + * + * @param hostId The ID of the host to read. + * @param dataView The view to materialize. Defaults to 'full'. + * @return The Host object with the specified hostId. + */ + @GET + @Path("/{hostId}") + public ApiHost readHost( + @PathParam(HOST_ID) String hostId, + @DefaultValue(DATA_VIEW_FULL) @QueryParam(DATA_VIEW) DataView dataView); +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v11/NameservicesResourceV11.java b/java/src/main/java/com/cloudera/api/v11/NameservicesResourceV11.java new file mode 100644 index 00000000..21172c2d --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/NameservicesResourceV11.java @@ -0,0 +1,51 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v11; + +import static com.cloudera.api.Parameters.DATA_VIEW; +import static com.cloudera.api.Parameters.DATA_VIEW_DEFAULT; +import static com.cloudera.api.Parameters.NAMESERVICE_NAME; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import com.cloudera.api.DataView; +import com.cloudera.api.model.ApiNameservice; +import com.cloudera.api.v1.NameservicesResource; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface NameservicesResourceV11 extends NameservicesResource { + + /** + * Retrieve information about a nameservice. + * + * @param nameservice The nameservice to retrieve. + * @param dataView The view to materialize. Defaults to 'full'. + * @return Details of the nameservice. + */ + @GET + @Path("/{nameservice}") + public ApiNameservice readNameservice( + @PathParam(NAMESERVICE_NAME) String nameservice, + @QueryParam(DATA_VIEW) @DefaultValue(DATA_VIEW_DEFAULT) DataView dataView); +} diff --git a/java/src/main/java/com/cloudera/api/v11/ReplicationsResourceV11.java b/java/src/main/java/com/cloudera/api/v11/ReplicationsResourceV11.java new file mode 100644 index 00000000..0760a750 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/ReplicationsResourceV11.java @@ -0,0 +1,78 @@ +package com.cloudera.api.v11; +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import static com.cloudera.api.Parameters.DATA_VIEW; +import static com.cloudera.api.Parameters.DATA_VIEW_DEFAULT; +import static com.cloudera.api.Parameters.SCHEDULE_ID; + +import java.util.List; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import com.cloudera.api.DataView; +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.model.ApiReplicationDiagnosticsCollectionArgs; +import com.cloudera.api.model.ApiReplicationScheduleDataLimits; +import com.cloudera.api.model.ApiReplicationScheduleList; +import com.cloudera.api.v4.ReplicationsResourceV4; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ReplicationsResourceV11 extends ReplicationsResourceV4 { + + /** + * Returns information for all replication schedules. + *

    + * Available since API v11. + * + * @param limits Various limits on contents of returned schedules. + * @return List of replication schedules. + */ + @GET + @Path("/") + public ApiReplicationScheduleList readSchedules( + @QueryParam("limits") ApiReplicationScheduleDataLimits limits); + + + /** + * Collect diagnostic data for a schedule, optionally for a subset of commands + * on that schedule, matched by schedule ID. + * + * The returned command's resultDataUrl property, upon the commands completion, + * will refer to the generated diagnostic data. + * Available since API v11. + * + * @param scheduleId Schedule ID + * @param replicationCollectionArgs Replication collection arguments + * @param view view to materialize + * @return Command generated to collect the diagnostics data. + */ + @POST + @Path("/{scheduleId}/collectDiagnosticData") + public ApiCommand collectDiagnosticData( + @PathParam(SCHEDULE_ID) long scheduleId, + ApiReplicationDiagnosticsCollectionArgs replicationCollectionArgs, + @QueryParam(DATA_VIEW) @DefaultValue(DATA_VIEW_DEFAULT) DataView view); +} diff --git a/java/src/main/java/com/cloudera/api/v11/RolesResourceV11.java b/java/src/main/java/com/cloudera/api/v11/RolesResourceV11.java new file mode 100644 index 00000000..7b490dd9 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/RolesResourceV11.java @@ -0,0 +1,63 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v11; + +import static com.cloudera.api.Parameters.DATA_VIEW; +import static com.cloudera.api.Parameters.DATA_VIEW_DEFAULT; +import static com.cloudera.api.Parameters.DATA_VIEW_FULL; +import static com.cloudera.api.Parameters.ROLE_NAME; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import com.cloudera.api.DataView; +import com.cloudera.api.model.ApiRole; +import com.cloudera.api.model.ApiRoleList; +import com.cloudera.api.v8.RolesResourceV8; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface RolesResourceV11 extends RolesResourceV8 { + + /** + * Lists all roles of a given service. + * @param dataView DataView for getting roles. Defaults to 'summary'. + * @return List of roles. + */ + @GET + @Path("/") + public ApiRoleList readRoles( + @DefaultValue(DATA_VIEW_DEFAULT) @QueryParam(DATA_VIEW) DataView dataView); + + /** + * Retrieves detailed information about a role. + * + * @param roleName The role name. + * @param dataView The view to materialize. Defaults to 'full'. + * @return The details of the role. + */ + @GET + @Path("/{roleName}") + public ApiRole readRole( + @PathParam(ROLE_NAME) String roleName, + @DefaultValue(DATA_VIEW_FULL) @QueryParam(DATA_VIEW) DataView dataView); +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v11/RootResourceV11.java b/java/src/main/java/com/cloudera/api/v11/RootResourceV11.java new file mode 100644 index 00000000..c352b53a --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/RootResourceV11.java @@ -0,0 +1,46 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v11; + +import com.cloudera.api.v10.RootResourceV10; + +import javax.ws.rs.Path; + +@Path("") +public interface RootResourceV11 extends RootResourceV10 { + /** + * @return The Cloudera Manager resource handler. + */ + @Override + @Path("/cm") + public ClouderaManagerResourceV11 getClouderaManagerResource(); + + @Override + @Path("/clusters") + public ClustersResourceV11 getClustersResource(); + + @Override + @Path("/timeseries") + public TimeSeriesResourceV11 getTimeSeriesResource(); + + @Override + @Path("/users") + public UsersResourceV11 getUsersResource(); + + @Override + @Path("/commands") + public CommandsResourceV11 getCommandsResource(); +} diff --git a/java/src/main/java/com/cloudera/api/v11/ServicesResourceV11.java b/java/src/main/java/com/cloudera/api/v11/ServicesResourceV11.java new file mode 100644 index 00000000..cb92d17e --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/ServicesResourceV11.java @@ -0,0 +1,66 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v11; + +import static com.cloudera.api.Parameters.DATA_VIEW; +import static com.cloudera.api.Parameters.DATA_VIEW_FULL; +import static com.cloudera.api.Parameters.SERVICE_NAME; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import com.cloudera.api.DataView; +import com.cloudera.api.model.ApiService; +import com.cloudera.api.v10.ServicesResourceV10; +import com.cloudera.api.v4.ReplicationsResourceV4; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ServicesResourceV11 extends ServicesResourceV10 { + + @Override + public RolesResourceV11 getRolesResource(String serviceName); + + /** + * Retrieves the replication resource. + * Only available with Cloudera Manager Enterprise Edition. + * @param serviceName The service name. + * @return The replications resource handler. + */ + @Path("/{serviceName}/replications") + @Override + public ReplicationsResourceV11 getReplicationsResource( + @PathParam(SERVICE_NAME) String serviceName); + + /** + * Retrieves details information about a service. + * + * @param serviceName The service name. + * @param dataView DataView to materialize. Defaults to 'full'. + * @return The details of the service. + */ + @GET + @Path("/{serviceName}") + public ApiService readService( + @PathParam(SERVICE_NAME) String serviceName, + @DefaultValue(DATA_VIEW_FULL) @QueryParam(DATA_VIEW) DataView dataView); +} diff --git a/java/src/main/java/com/cloudera/api/v11/TimeSeriesResourceV11.java b/java/src/main/java/com/cloudera/api/v11/TimeSeriesResourceV11.java new file mode 100644 index 00000000..fd2e68ad --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/TimeSeriesResourceV11.java @@ -0,0 +1,67 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v11; + +import com.cloudera.api.model.ApiTimeSeriesEntityAttributeList; +import com.cloudera.api.model.ApiTimeSeriesEntityTypeList; +import com.cloudera.api.model.ApiTimeSeriesRequest; +import com.cloudera.api.v6.TimeSeriesResourceV6; + +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.Response; + +public interface TimeSeriesResourceV11 extends TimeSeriesResourceV6 { + /** + * Retrieve all metric entity types monitored by Cloudera Manager. + * It is guaranteed that parent types appear before their children. + *

    + * Available since API v11. + * + * @return List of time series entity type. + */ + @GET + @Path("/entityTypes") + public ApiTimeSeriesEntityTypeList getEntityTypes(); + + /** + * Retrieve all metric entity type attributes monitored by Cloudera Manager. + *

    + * Available since API v11. + * + * @return List of time series entity attributes. + */ + @GET + @Path("/entityTypeAttributes") + public ApiTimeSeriesEntityAttributeList getEntityTypeAttributes(); + + /** + * Retrieve time-series data from the Cloudera Manager (CM) time-series + * data store accepting HTTP POST request. This method differs + * from queryTimeSeries() in v6 that this could accept query strings that are + * longer than HTTP GET request limit. + * + * Available since API v11. + * + * @param timeSeriesRequest Request object containing information used when + * retrieving timeseries data. + * @return List of time series that match the tsquery. + */ + @POST + @Path("/") + public Response queryTimeSeries(ApiTimeSeriesRequest timeSeriesRequest); +} diff --git a/java/src/main/java/com/cloudera/api/v11/UsersResourceV11.java b/java/src/main/java/com/cloudera/api/v11/UsersResourceV11.java new file mode 100644 index 00000000..2c9da392 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/UsersResourceV11.java @@ -0,0 +1,42 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v11; + +import com.cloudera.api.model.ApiUserSessionList; +import com.cloudera.api.v1.UsersResource; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Consumes({MediaType.APPLICATION_JSON}) +@Produces({MediaType.APPLICATION_JSON}) +public interface UsersResourceV11 extends UsersResource { + /** + * Return a list of the sessions associated with interactive authenticated + * users in Cloudera Manager. + *

    + * Note that these sessions are only associated with users who log into the + * web interface. API users will not appear. + * + * @return A list of user sessions + */ + @GET + @Path("/sessions") + public ApiUserSessionList getSessions(); +} diff --git a/java/src/main/java/com/cloudera/api/v11/package-info.java b/java/src/main/java/com/cloudera/api/v11/package-info.java new file mode 100644 index 00000000..70c3d726 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/package-info.java @@ -0,0 +1,21 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * API version 11, introduced in Cloudera Manager 5.5.0. + */ + +package com.cloudera.api.v11; diff --git a/java/src/main/java/com/cloudera/api/v12/ClouderaManagerResourceV12.java b/java/src/main/java/com/cloudera/api/v12/ClouderaManagerResourceV12.java new file mode 100644 index 00000000..dc6a92ef --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v12/ClouderaManagerResourceV12.java @@ -0,0 +1,34 @@ +// Copyright (c) 2015 Cloudera, Inc. All rights reserved. +package com.cloudera.api.v12; + +import com.cloudera.api.model.ApiClusterTemplate; +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.v11.ClouderaManagerResourceV11; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ClouderaManagerResourceV12 extends ClouderaManagerResourceV11 { + + /** + * Create cluster as per the given cluster template + * + * @param apiClusterTemplate cluster template + * @param addRepositories if true the parcels repositories in the cluster + * template will be added. + * @return The command performing import task + */ + @POST + @Path("importClusterTemplate") + public ApiCommand importClusterTemplate( + ApiClusterTemplate apiClusterTemplate, + @QueryParam("addRepositories") @DefaultValue("false") boolean addRepositories); + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v12/ClustersResourceV12.java b/java/src/main/java/com/cloudera/api/v12/ClustersResourceV12.java new file mode 100644 index 00000000..7b2d3141 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v12/ClustersResourceV12.java @@ -0,0 +1,69 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v12; + +import static com.cloudera.api.Parameters.CLUSTER_NAME; +import static com.cloudera.api.Parameters.DATA_VIEW; +import static com.cloudera.api.Parameters.DATA_VIEW_DEFAULT; + +import com.cloudera.api.DataView; +import com.cloudera.api.model.ApiClusterTemplate; +import com.cloudera.api.model.ApiServiceList; +import com.cloudera.api.v11.ClustersResourceV11; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ClustersResourceV12 extends ClustersResourceV11 { + + /** + * Export the cluster template for the given cluster. If cluster does not have + * host templates defined it will export host templates based on roles + * assignment. + * + * @param clusterName cluster name + * @param exportAutoConfig export configs set by the auto configuration + * @return Cluster template + */ + @GET + @Consumes + @Path("/{clusterName}/export") + public ApiClusterTemplate export( + @PathParam(CLUSTER_NAME) String clusterName, + @QueryParam("exportAutoConfig") @DefaultValue("false") boolean exportAutoConfig); + + + /** + * List the services that can provide distributed file system (DFS) capabilities in this cluster. + * + * @param clusterName cluster name + * @param view data view required for matching services + * @return Services that provide DFS capabilities in this cluster + */ + @GET + @Path("/{clusterName}/dfsServices") + public ApiServiceList listDfsServices( + @PathParam(CLUSTER_NAME) String clusterName, + @QueryParam(DATA_VIEW) @DefaultValue(DATA_VIEW_DEFAULT) DataView view); +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v12/RootResourceV12.java b/java/src/main/java/com/cloudera/api/v12/RootResourceV12.java new file mode 100644 index 00000000..f2ed1cc0 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v12/RootResourceV12.java @@ -0,0 +1,33 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v12; + +import com.cloudera.api.v11.RootResourceV11; + +import javax.ws.rs.Path; + +@Path("") +public interface RootResourceV12 extends RootResourceV11 { + + @Override + @Path("/cm") + public ClouderaManagerResourceV12 getClouderaManagerResource(); + + @Override + @Path("/clusters") + public ClustersResourceV12 getClustersResource(); + +} diff --git a/java/src/main/java/com/cloudera/api/v12/package-info.java b/java/src/main/java/com/cloudera/api/v12/package-info.java new file mode 100644 index 00000000..78dcdcd0 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v12/package-info.java @@ -0,0 +1,21 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * API version 12, introduced in Cloudera Manager 5.7.0. + */ + +package com.cloudera.api.v12; diff --git a/java/src/main/java/com/cloudera/api/v13/ClustersResourceV13.java b/java/src/main/java/com/cloudera/api/v13/ClustersResourceV13.java new file mode 100644 index 00000000..d598cadd --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v13/ClustersResourceV13.java @@ -0,0 +1,39 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v13; + +import com.cloudera.api.v12.ClustersResourceV12; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import static com.cloudera.api.Parameters.CLUSTER_NAME; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ClustersResourceV13 extends ClustersResourceV12 { + + /** + * @return The services resource handler. + */ + @Override + @Path("/{clusterName}/services") + public ServicesResourceV13 getServicesResource( + @PathParam(CLUSTER_NAME) String clusterName); +} diff --git a/java/src/main/java/com/cloudera/api/v13/ReplicationsResourceV13.java b/java/src/main/java/com/cloudera/api/v13/ReplicationsResourceV13.java new file mode 100644 index 00000000..05417c9a --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v13/ReplicationsResourceV13.java @@ -0,0 +1,41 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v13; + +import com.cloudera.api.DataView; +import com.cloudera.api.model.ApiReplicationState; +import com.cloudera.api.v11.ReplicationsResourceV11; + +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; + +import static com.cloudera.api.Parameters.DATA_VIEW; +import static com.cloudera.api.Parameters.DATA_VIEW_DEFAULT; + +public interface ReplicationsResourceV13 extends ReplicationsResourceV11 { + /** + * returns the replication state. for example if incremental export + * is enabled, etc + * @param view view to materialize + * @return replicate state object. + */ + @GET + @Path("/replicationState") + public ApiReplicationState getReplicationState( + @QueryParam(DATA_VIEW) @DefaultValue(DATA_VIEW_DEFAULT) DataView view); +} diff --git a/java/src/main/java/com/cloudera/api/v13/RootResourceV13.java b/java/src/main/java/com/cloudera/api/v13/RootResourceV13.java new file mode 100644 index 00000000..3138a1f0 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v13/RootResourceV13.java @@ -0,0 +1,30 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v13; + +import com.cloudera.api.v12.RootResourceV12; + +import javax.ws.rs.Path; + +@Path("") +public interface RootResourceV13 extends RootResourceV12 { + /** + * @return The clusters resource handler. + */ + @Override + @Path("/clusters") + public ClustersResourceV13 getClustersResource(); +} diff --git a/java/src/main/java/com/cloudera/api/v13/ServicesResourceV13.java b/java/src/main/java/com/cloudera/api/v13/ServicesResourceV13.java new file mode 100644 index 00000000..a6a89399 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v13/ServicesResourceV13.java @@ -0,0 +1,57 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v13; + +import static com.cloudera.api.Parameters.SERVICE_NAME; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.v11.ServicesResourceV11; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ServicesResourceV13 extends ServicesResourceV11 { + /** + * Retrieves the replication resource. + * Only available with Cloudera Manager Enterprise Edition. + * @param serviceName The service name. + * @return The replications resource handler. + */ + @Path("/{serviceName}/replications") + @Override + public ReplicationsResourceV13 getReplicationsResource( + @PathParam(SERVICE_NAME) String serviceName); + + /** + * Creates the HDFS directory where YARN container usage metrics are + * stored by NodeManagers for CM to read and aggregate into app usage metrics. + *

    + * Available since API v13. + *

    + * @param serviceName The YARN service name. + * @return Information about the submitted command. + */ + @POST + @Path("/{serviceName}/commands/yarnCreateCmContainerUsageInputDirCommand") + public ApiCommand createYarnCmContainerUsageInputDirCommand( + @PathParam(SERVICE_NAME) String serviceName); +} diff --git a/java/src/main/java/com/cloudera/api/v13/package-info.java b/java/src/main/java/com/cloudera/api/v13/package-info.java new file mode 100644 index 00000000..aabbdb18 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v13/package-info.java @@ -0,0 +1,21 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * API version 13, introduced in Cloudera Manager 5.8.0. + */ + +package com.cloudera.api.v13; diff --git a/java/src/main/java/com/cloudera/api/v14/ClouderaManagerResourceV14.java b/java/src/main/java/com/cloudera/api/v14/ClouderaManagerResourceV14.java new file mode 100644 index 00000000..02b92c0d --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v14/ClouderaManagerResourceV14.java @@ -0,0 +1,41 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.v14; + +import com.cloudera.api.model.ApiScmDbInfo; +import com.cloudera.api.v12.ClouderaManagerResourceV12; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Consumes({MediaType.APPLICATION_JSON}) +@Produces({MediaType.APPLICATION_JSON}) +public interface ClouderaManagerResourceV14 extends ClouderaManagerResourceV12 { + + /** + * Provides Cloudera Manager server's database information + * + * @return Cloudera Manager server's database information + */ + @GET + @Path("scmDbInfo") + public ApiScmDbInfo getScmDbInfo(); + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v14/ClustersResourceV14.java b/java/src/main/java/com/cloudera/api/v14/ClustersResourceV14.java new file mode 100644 index 00000000..019ff349 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v14/ClustersResourceV14.java @@ -0,0 +1,39 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v14; + +import static com.cloudera.api.Parameters.CLUSTER_NAME; + +import com.cloudera.api.v13.ClustersResourceV13; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ClustersResourceV14 extends ClustersResourceV13 { + + /** + * @return The services resource handler. + */ + @Override + @Path("/{clusterName}/services") + public ServicesResourceV14 getServicesResource( + @PathParam(CLUSTER_NAME) String clusterName); +} diff --git a/java/src/main/java/com/cloudera/api/v14/ExternalAccountsResourceV14.java b/java/src/main/java/com/cloudera/api/v14/ExternalAccountsResourceV14.java new file mode 100644 index 00000000..4a7319d7 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v14/ExternalAccountsResourceV14.java @@ -0,0 +1,95 @@ +// Copyright (c) 2016 Cloudera, Inc. All rights reserved. +package com.cloudera.api.v14; + +import com.cloudera.api.DataView; +import com.cloudera.api.Parameters; +import com.cloudera.api.model.ApiExternalAccount; +import com.cloudera.api.model.ApiExternalAccountCategoryList; +import com.cloudera.api.model.ApiExternalAccountList; +import com.cloudera.api.model.ApiExternalAccountTypeList; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +/** + * Manage external accounts used by various Cloudera Manager features, for performing external + * tasks. + */ +@Consumes({MediaType.APPLICATION_JSON}) +@Produces({MediaType.APPLICATION_JSON}) +public interface ExternalAccountsResourceV14 { + + /** + * List of external account categories supported by this Cloudera Manager. + * @return external account categories + */ + @GET + @Path("/supportedCategories") + ApiExternalAccountCategoryList getSupportedCategories(); + + /** + * List of external account types supported by this Cloudera Manager by category. + */ + @GET + @Path("/supportedTypes/{" + Parameters.EXTERNAL_ACCOUNT_CATEGORY_NAME + "}") + ApiExternalAccountTypeList getSupportedTypes( + @PathParam(Parameters.EXTERNAL_ACCOUNT_CATEGORY_NAME) String categoryName); + + /** + * Get a list of external accounts for a specific account type. + */ + @GET + @Path("/type/{" + Parameters.EXTERNAL_ACCOUNT_TYPE_NAME + "}") + ApiExternalAccountList readAccounts( + @PathParam(Parameters.EXTERNAL_ACCOUNT_TYPE_NAME) String typeName, + @QueryParam(Parameters.DATA_VIEW) DataView view); + + /** + * Get a single external account by account name. + */ + @GET + @Path("/account/{" + Parameters.EXTERNAL_ACCOUNT_NAME + "}") + ApiExternalAccount readAccount(@PathParam(Parameters.EXTERNAL_ACCOUNT_NAME) String name, + @QueryParam(Parameters.DATA_VIEW) DataView view); + + /** + * Get a single external account by display name. + */ + @GET + @Path("/accountByDisplayName/{" + Parameters.DISPLAY_NAME + "}") + ApiExternalAccount readAccountByDisplayName( + @PathParam(Parameters.DISPLAY_NAME) String displayName, + @QueryParam(Parameters.DATA_VIEW) DataView view); + + /** + * Create a new external account. + * Account names and display names must be unique, i.e. they must not share names or display + * names with an existing account. + * Server generates an account ID for the requested account. + */ + @POST + @Path("/create") + ApiExternalAccount createAccount(ApiExternalAccount account); + + /** + * Update an external account. + */ + @PUT + @Path("/update") + ApiExternalAccount updateAccount(ApiExternalAccount account); + + /** + * Delete an external account, specifying its name. + */ + @DELETE + @Path("/delete/{" + Parameters.EXTERNAL_ACCOUNT_NAME + "}") + ApiExternalAccount deleteAccount(@PathParam(Parameters.EXTERNAL_ACCOUNT_NAME) String name); +} diff --git a/java/src/main/java/com/cloudera/api/v14/NameservicesResourceV14.java b/java/src/main/java/com/cloudera/api/v14/NameservicesResourceV14.java new file mode 100644 index 00000000..538dea29 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v14/NameservicesResourceV14.java @@ -0,0 +1,41 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v14; + +import static com.cloudera.api.Parameters.NAMESERVICE_NAME; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import com.cloudera.api.v11.NameservicesResourceV11; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface NameservicesResourceV14 extends NameservicesResourceV11 { + + /** + * Returns the watched directory resource handler. + * + * @param nameservice The nameservice to retrieve. + * @return the watched directory resource handler + */ + @Path("/{nameservice}/watcheddir") + public WatchedDirResource getWatchedDirResource( + @PathParam(NAMESERVICE_NAME) String nameservice); +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v14/RootResourceV14.java b/java/src/main/java/com/cloudera/api/v14/RootResourceV14.java new file mode 100644 index 00000000..f8305fcd --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v14/RootResourceV14.java @@ -0,0 +1,41 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v14; + +import com.cloudera.api.v13.RootResourceV13; + +import javax.ws.rs.Path; + +@Path("") +public interface RootResourceV14 extends RootResourceV13 { + + @Override + @Path("/cm") + public ClouderaManagerResourceV14 getClouderaManagerResource(); + + /** + * @return The external accounts resource handler. + */ + @Path("/externalAccounts") + ExternalAccountsResourceV14 getExternalAccountsResource(); + + /** + * @return The clusters resource handler. + */ + @Override + @Path("/clusters") + public ClustersResourceV14 getClustersResource(); +} diff --git a/java/src/main/java/com/cloudera/api/v14/ServicesResourceV14.java b/java/src/main/java/com/cloudera/api/v14/ServicesResourceV14.java new file mode 100644 index 00000000..426f2edd --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v14/ServicesResourceV14.java @@ -0,0 +1,78 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v14; + +import static com.cloudera.api.Parameters.SERVICE_NAME; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.v13.ServicesResourceV13; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ServicesResourceV14 extends ServicesResourceV13 { + + /** + * Returns the watched directory resource handler. + * + * @param serviceName The service name. + * @return the watched directory resource handler + */ + @Path("/{serviceName}/watcheddir") + public WatchedDirResource getWatchedDirResource( + @PathParam(SERVICE_NAME) String serviceName); + + /** + * Returns the nameservices resource handler. + * + * @param serviceName The service name. + * @return The nameservices resource handler. + */ + @Path("/{serviceName}/nameservices") + @Override + public NameservicesResourceV14 getNameservicesResource( + @PathParam(SERVICE_NAME) String serviceName); + + /** + * Dump the Oozie Server Database. + * + * @param serviceName The name of the service + * @return Information about the submitted command. + */ + @POST + @Consumes() + @Path("/{serviceName}/commands/oozieDumpDatabase") + public ApiCommand oozieDumpDatabaseCommand( + @PathParam(SERVICE_NAME) String serviceName); + + /** + * Load the Oozie Server Database from dump. + * + * @param serviceName The name of the service + * @return Information about the submitted command. + */ + @POST + @Consumes() + @Path("/{serviceName}/commands/oozieLoadDatabase") + public ApiCommand oozieLoadDatabaseCommand( + @PathParam(SERVICE_NAME) String serviceName); +} diff --git a/java/src/main/java/com/cloudera/api/v14/WatchedDirResource.java b/java/src/main/java/com/cloudera/api/v14/WatchedDirResource.java new file mode 100644 index 00000000..0a67910c --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v14/WatchedDirResource.java @@ -0,0 +1,76 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v14; + +import static com.cloudera.api.Parameters.DIR_PATH; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import com.cloudera.api.model.ApiWatchedDir; +import com.cloudera.api.model.ApiWatchedDirList; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface WatchedDirResource { + + /** + * Lists all the watched directories. + *

    + * Available since API v14. Only available with Cloudera Manager Enterprise + * Edition. + *

    + * + * @return List of currently watched directories. + */ + @GET + @Path("/") + public ApiWatchedDirList listWatchedDirectories(); + + /** + * Adds a directory to the watching list. + *

    + * Available since API v14. Only available with Cloudera Manager Enterprise + * Edition. + *

    + * + * @param dir The directory to be added. + * @return Added directory. + */ + @POST + @Path("/") + public ApiWatchedDir addWatchedDirectory(ApiWatchedDir dir); + + /** + * Removes a directory from the watching list. + *

    + * Available since API v14. Only available with Cloudera Manager Enterprise + * Edition. + *

    + * + * @param directoryPath The directory path to be removed. + * @return Removed directory. + */ + @DELETE + @Path("/{directoryPath}") + public ApiWatchedDir removeWatchedDirectory(@PathParam(DIR_PATH) String directoryPath); +} diff --git a/java/src/main/java/com/cloudera/api/v14/package-info.java b/java/src/main/java/com/cloudera/api/v14/package-info.java new file mode 100644 index 00000000..a5626a12 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v14/package-info.java @@ -0,0 +1,21 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * API version 14, introduced in Cloudera Manager 5.9.0. + */ + +package com.cloudera.api.v14; diff --git a/java/src/main/java/com/cloudera/api/v15/ClouderaManagerResourceV15.java b/java/src/main/java/com/cloudera/api/v15/ClouderaManagerResourceV15.java new file mode 100644 index 00000000..9d45444a --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v15/ClouderaManagerResourceV15.java @@ -0,0 +1,71 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.v15; + +import com.cloudera.api.Parameters; +import com.cloudera.api.model.ApiConfigList; +import com.cloudera.api.model.ApiShutdownReadiness; +import com.cloudera.api.v14.ClouderaManagerResourceV14; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Consumes({MediaType.APPLICATION_JSON}) +@Produces({MediaType.APPLICATION_JSON}) +public interface ClouderaManagerResourceV15 extends ClouderaManagerResourceV14 { + + /** + * Update the Cloudera Manager settings. + *

    + * If a value is set in the given configuration, it will be added to the + * manager's settings, replacing any existing entry. If a value is unset (its + * value is null), the existing the setting will be erased. + *

    + * Settings that are not listed in the input will maintain their current + * values. + * + * @param config Settings to update. + * @param message Optional message describing the changes. + * @return The updated configuration. + */ + @PUT + @Path("/config") + public ApiConfigList updateConfig( + ApiConfigList config, + @QueryParam(Parameters.MESSAGE) String message); + + /** + * Retrieve Cloudera Manager's readiness for shutdown and destroy. + * Applications that wish to destroy Cloudera Manager and its managed cluster + * should poll this API, repeatedly if necessary, to respect its readiness. + * + * @param lastActivityTime End time of the last known activity/workload + * against the managed clusters, in ISO 8601 format. + * @return Cloudera Manager readiness for shutdown + */ + @GET + @Path("/shutdownReadiness") + public ApiShutdownReadiness getShutdownReadiness( + @QueryParam("lastActivityTime") + String lastActivityTime); + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v15/RootResourceV15.java b/java/src/main/java/com/cloudera/api/v15/RootResourceV15.java new file mode 100644 index 00000000..633e62b7 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v15/RootResourceV15.java @@ -0,0 +1,28 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v15; + +import com.cloudera.api.v14.RootResourceV14; + +import javax.ws.rs.Path; + +@Path("") +public interface RootResourceV15 extends RootResourceV14 { + + @Override + @Path("/cm") + public ClouderaManagerResourceV15 getClouderaManagerResource(); +} diff --git a/java/src/main/java/com/cloudera/api/v15/package-info.java b/java/src/main/java/com/cloudera/api/v15/package-info.java new file mode 100644 index 00000000..bde151a4 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v15/package-info.java @@ -0,0 +1,21 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * API version 15, introduced in Cloudera Manager 5.10.0. + */ + +package com.cloudera.api.v15; diff --git a/java/src/main/java/com/cloudera/api/v2/ClouderaManagerResourceV2.java b/java/src/main/java/com/cloudera/api/v2/ClouderaManagerResourceV2.java index e95bfce9..5c1b01fc 100644 --- a/java/src/main/java/com/cloudera/api/v2/ClouderaManagerResourceV2.java +++ b/java/src/main/java/com/cloudera/api/v2/ClouderaManagerResourceV2.java @@ -48,7 +48,7 @@ public interface ClouderaManagerResourceV2 extends ClouderaManagerResource { *

  • Cluster Administrators (but Navigator config will be redacted)
  • * *

    - * Note: starting with v3, the deployment information contais data about + * Note: starting with v3, the deployment information contains data about * Cloudera Manager peers configured for the instance. This data contains * plain text authentication information used to connect to the remote peer. * diff --git a/java/src/main/java/com/cloudera/api/v3/CmPeersResource.java b/java/src/main/java/com/cloudera/api/v3/CmPeersResource.java index dbff46fa..4282f55a 100644 --- a/java/src/main/java/com/cloudera/api/v3/CmPeersResource.java +++ b/java/src/main/java/com/cloudera/api/v3/CmPeersResource.java @@ -40,6 +40,9 @@ public interface CmPeersResource { *

    * Available since API v3. Only available with Cloudera Manager Enterprise * Edition. + *

    + * When accessed via API version before v11, only REPLICATION type peers will + * be returned. * * @return List of Cloudera Manager peers. */ @@ -62,6 +65,9 @@ public interface CmPeersResource { *

    * Available since API v3. Only available with Cloudera Manager Enterprise * Edition. + *

    + * Type field in ApiCmPeer is available since API v11. if not specified + * when making createPeer() call, 'REPLICATION' type peer will be created. * * @param peer Peer to create (see above). * @return Information about the created peer. diff --git a/java/src/main/java/com/cloudera/api/v4/AuditsResource.java b/java/src/main/java/com/cloudera/api/v4/AuditsResource.java index 03a218c1..52c945ce 100644 --- a/java/src/main/java/com/cloudera/api/v4/AuditsResource.java +++ b/java/src/main/java/com/cloudera/api/v4/AuditsResource.java @@ -46,9 +46,10 @@ public interface AuditsResource { * * @param maxResults Maximum number of audits to return * @param resultOffset Offset of audits to return - * @param startTime Start of the period to query (defaults to 1 day ago - * relative to endTime) - * @param endTime End of the period to query (defaults to current time) + * @param startTime Start of the period to query in ISO 8601 format (defaults + * to 1 day ago relative to endTime). + * @param endTime End of the period to query in ISO 8601 format (defaults to + * current time). * @param query * The query to filter out audits in the system. It accepts * querying the intersection of a list of constraints, @@ -207,9 +208,6 @@ public interface AuditsResource { * queries are converted to standard SQL LIKE syntax, so any % (%25) * character in a value that also contains a wild card will be * interpreted as a wild card.) - *

    - * Values for time related query parameters (startTime and - * endTime) should be ISO8601 timestamps. *

    * Available since API v4. * diff --git a/java/src/main/java/com/cloudera/api/v4/ImpalaQueriesResource.java b/java/src/main/java/com/cloudera/api/v4/ImpalaQueriesResource.java index d4a56efd..4c0e13c5 100644 --- a/java/src/main/java/com/cloudera/api/v4/ImpalaQueriesResource.java +++ b/java/src/main/java/com/cloudera/api/v4/ImpalaQueriesResource.java @@ -51,9 +51,12 @@ public interface ImpalaQueriesResource { * 'user = root'. Multiple basic filters can be combined into a complex * expression using standard and / or boolean logic and parenthesis. * An example of a complex filter is: 'query_duration > 5s and (user = root or - * user = myUserName)'. - * @param from Returns queries that were active between the from and to times - * @param to Returns queries that were active between the from and to times + * user = myUserName)'. An example of expected full query string in requested + * URL is: '?filter=(query_duration > 5s and (user = root or user = myUserName))'. + * @param from Start of the period to query in ISO 8601 format (defaults to 5 + * minutes before the 'to' time). + * @param to End of the period to query in ISO 8601 format (defaults to + * current time). * @param limit The maximum number of queries to return. Queries will be * returned in the following order: *

      diff --git a/java/src/main/java/com/cloudera/api/v4/ServicesResourceV4.java b/java/src/main/java/com/cloudera/api/v4/ServicesResourceV4.java index 09f22a4d..5e503854 100644 --- a/java/src/main/java/com/cloudera/api/v4/ServicesResourceV4.java +++ b/java/src/main/java/com/cloudera/api/v4/ServicesResourceV4.java @@ -234,8 +234,10 @@ public RoleCommandsResourceV4 getRoleCommandsResource( * * @param hdfsServiceName The HDFS service name. * @param nameService The (optional) HDFS nameservice. Required for HA setup. - * @param from The (optional) start time of the report. Default to 24 hours before "to" time. - * @param to The (optional) end time of the report. Default to now. + * @param from The (optional) start time of the report in ISO 8601 format ( + * defaults to 24 hours before "to" time). + * @param to The (optional) end time of the report in ISO 8601 format ( + * defaults to now). * @param aggregation The (optional) aggregation period for the data. * Supports "hourly", "daily" (default) and "weekly". * @return Report data. @@ -263,8 +265,10 @@ public ApiHdfsUsageReport getHdfsUsageReport( * Edition. * * @param mrServiceName The MR service name. - * @param from The (optional) start time of the report. Default to 24 hours before "to" time. - * @param to The (optional) end time of the report. Default to now. + * @param from The (optional) start time of the report in ISO 8601 format + * (defaults to 24 hours before "to" time). + * @param to The (optional) end time of the report in ISO 8601 format (defaults + * to now). * @param aggregation The (optional) aggregation period for the data. * Supports "hourly", "daily" (default) and "weekly". * @return Report data. diff --git a/java/src/main/java/com/cloudera/api/v4/TimeSeriesResource.java b/java/src/main/java/com/cloudera/api/v4/TimeSeriesResource.java index 2b0a9a5f..e6124938 100644 --- a/java/src/main/java/com/cloudera/api/v4/TimeSeriesResource.java +++ b/java/src/main/java/com/cloudera/api/v4/TimeSeriesResource.java @@ -41,13 +41,14 @@ public interface TimeSeriesResource { *

      * Please see the * - * tsquery language documentation.

      + * tsquery language documentation. + *

      * Available since API v4. * * @param query Tsquery to run against the CM time-series data store. - * @param from Start of the period to query (defaults to 5 minutes before the + * @param from Start of the period to query in ISO 8601 format (defaults to 5 minutes before the * end of the period). - * @param to End of the period to query (defaults to current time). + * @param to End of the period to query in ISO 8601 format (defaults to current time). * * @return List of time series that match the tsquery. */ diff --git a/java/src/main/java/com/cloudera/api/v6/DashboardsResource.java b/java/src/main/java/com/cloudera/api/v6/DashboardsResource.java index f1f31644..e2ca3205 100644 --- a/java/src/main/java/com/cloudera/api/v6/DashboardsResource.java +++ b/java/src/main/java/com/cloudera/api/v6/DashboardsResource.java @@ -32,7 +32,9 @@ public interface DashboardsResource { /** - * Returns the list of all dashboards. + * Returns the list of all user-customized dashboards. This includes both the + * new dashboards created by users as well as any user customizations to + * built-in dashboards. *

      * Available since API v6. */ diff --git a/java/src/main/java/com/cloudera/api/v6/ServicesResourceV6.java b/java/src/main/java/com/cloudera/api/v6/ServicesResourceV6.java index 8fe9927d..8e737e38 100644 --- a/java/src/main/java/com/cloudera/api/v6/ServicesResourceV6.java +++ b/java/src/main/java/com/cloudera/api/v6/ServicesResourceV6.java @@ -52,7 +52,7 @@ public interface ServicesResourceV6 extends ServicesResourceV4 { @Path("/{serviceName}/snapshots") public SnapshotsResource getSnapshotsResource( @PathParam(SERVICE_NAME) String serviceName); - + /** * @return The YARN applications resource handler. */ @@ -72,7 +72,7 @@ public YarnApplicationsResource getYarnApplicationsResource( * with valid configuration. *

      * Available since API v6. - * + * * @param serviceName * Name of the Yarn service on which to run the command. * @return Information about the submitted command @@ -95,7 +95,7 @@ public ApiCommand importMrConfigsIntoYarn( *

    *

    * Available since API v6. - * + * * @param serviceName * Name of the Yarn service on which to run the command. * @return Information about the submitted command @@ -104,7 +104,7 @@ public ApiCommand importMrConfigsIntoYarn( @Path("/{serviceName}/commands/switchToMr2") public ApiCommand switchToMr2( @PathParam(SERVICE_NAME) String serviceName); - + /** * Enable high availability (HA) for a YARN ResourceManager. *

    @@ -127,7 +127,7 @@ public ApiCommand switchToMr2( public ApiCommand enableRmHaCommand( @PathParam(SERVICE_NAME) String serviceName, ApiEnableRmHaArguments args); - + /** * Disable high availability (HA) for ResourceManager. * @@ -185,7 +185,7 @@ public ApiCommand enableOozieHaCommand( public ApiCommand disableOozieHaCommand( @PathParam(SERVICE_NAME) String serviceName, ApiDisableOozieHaArguments args); - + /** * Enable High Availability (HA) with Automatic Failover for an HDFS NameNode. *

    @@ -225,7 +225,7 @@ public ApiCommand hdfsEnableNnHaCommand( * Then, HDFS service is restarted and all services that were stopped * are started again afterwards. * Finally, client configs for HDFS and its depedents will be re-deployed. - * + * * @param serviceName The HDFS service name. * @param args Arguments for the command. * @return Information about the submitted command. @@ -439,5 +439,13 @@ public ApiCommand serviceCommandByName( @GET @Path("/{serviceName}/commandsByName") public ApiCommandMetadataList listServiceCommands( - @PathParam(SERVICE_NAME) String serviceName); + @PathParam(SERVICE_NAME) String serviceName); + + /** + * @return The Impala queries resource handler + */ + @Override + @Path("/{serviceName}/impalaQueries") + public ImpalaQueriesResourceV6 getImpalaQueriesResource( + @PathParam(SERVICE_NAME) String serviceName); } diff --git a/java/src/main/java/com/cloudera/api/v6/TimeSeriesResourceV6.java b/java/src/main/java/com/cloudera/api/v6/TimeSeriesResourceV6.java index 314d54dc..332dff3d 100644 --- a/java/src/main/java/com/cloudera/api/v6/TimeSeriesResourceV6.java +++ b/java/src/main/java/com/cloudera/api/v6/TimeSeriesResourceV6.java @@ -21,6 +21,7 @@ import static com.cloudera.api.Parameters.CONTENT_TYPE; import static com.cloudera.api.Parameters.DESIRED_ROLLUP; import static com.cloudera.api.Parameters.MUST_USE_DESIRED_ROLLUP; +import static com.cloudera.api.Parameters.ROLLUP_DEFAULT; import static com.cloudera.api.Parameters.TO; import javax.ws.rs.DefaultValue; @@ -33,20 +34,21 @@ import com.cloudera.api.v4.TimeSeriesResource; public interface TimeSeriesResourceV6 extends TimeSeriesResource { - /** * Retrieve time-series data from the Cloudera Manager (CM) time-series * data store using a tsquery. * * Please see the * - * tsquery language documentation.

    + * tsquery language documentation. + *

    * Available since API v6. * * @param query Tsquery to run against the CM time-series data store. - * @param from Start of the period to query (defaults to 5 minutes before the - * end of the period). - * @param to End of the period to query (defaults to current time). + * @param from Start of the period to query in ISO 8601 format (defaults to 5 + * minutes before the end of the period). + * @param to End of the period to query in ISO 8601 format (defaults to + * current time). * @param contentType to return the response in. The content types * "application/json" and "text/csv" are supported. This defaults to * "application/json". If "text/csv" is specified then we return one row @@ -71,7 +73,7 @@ public Response queryTimeSeries( @DefaultValue(MediaType.APPLICATION_JSON) String contentType, @QueryParam(DESIRED_ROLLUP) - @DefaultValue("RAW") + @DefaultValue(ROLLUP_DEFAULT) String desiredRollup, @QueryParam(MUST_USE_DESIRED_ROLLUP) @DefaultValue("false") diff --git a/java/src/main/java/com/cloudera/api/v6/YarnApplicationsResource.java b/java/src/main/java/com/cloudera/api/v6/YarnApplicationsResource.java index 697875bb..290c5f6a 100644 --- a/java/src/main/java/com/cloudera/api/v6/YarnApplicationsResource.java +++ b/java/src/main/java/com/cloudera/api/v6/YarnApplicationsResource.java @@ -52,10 +52,9 @@ public interface YarnApplicationsResource { * expression using standard and / or boolean logic and parenthesis. * An example of a complex filter is: 'application_duration > 5s and (user = root or * user = myUserName'). - * @param from Returns applications that were active between the from and to times. - * Defaults to 5 minutes before the 'to' time. - * @param to Returns applications that were active between the from and to times. - * Defaults to now. + * @param from Start of the period to query in ISO 8601 format (defaults to 5 + * minutes before the 'to' time). + * @param to End of the period to query in ISO 8601 format (defaults to now). * @param limit The maximum number of applications to return. Applications will be * returned in the following order: *

      diff --git a/java/src/main/java/com/cloudera/api/v8/AuditsResourceV8.java b/java/src/main/java/com/cloudera/api/v8/AuditsResourceV8.java index 05c201cb..5721c72b 100644 --- a/java/src/main/java/com/cloudera/api/v8/AuditsResourceV8.java +++ b/java/src/main/java/com/cloudera/api/v8/AuditsResourceV8.java @@ -48,9 +48,10 @@ public interface AuditsResourceV8 extends AuditsResource { * * @param maxResults Maximum number of audits to return * @param resultOffset Offset of audits to return - * @param startTime Start of the period to query (defaults to 1 day ago - * relative to endTime) - * @param endTime End of the period to query (defaults to current time) + * @param startTime Start of the period to query in ISO 8601 format (defaults + * to 1 day ago relative to endTime). + * @param endTime End of the period to query in ISO 8601 format (defaults to + * current time). * @param query * The query to filter out audits in the system. It accepts * querying the intersection of a list of constraints, @@ -253,14 +254,12 @@ public interface AuditsResourceV8 extends AuditsResource { * queries are converted to standard SQL LIKE syntax, so any % (%25) * character in a value that also contains a wild card will be * interpreted as a wild card.) - *

      - * Values for time related query parameters (startTime and - * endTime) should be ISO8601 timestamps. *

      * Available since API v8. A subset of these features is available since v4. * * @return List of audits in descending order of timestamp */ + @Override @GET @Path("/") public ApiAuditList readAudits( diff --git a/java/src/test/java/com/cloudera/api/ClouderaManagerClientBuilderTest.java b/java/src/test/java/com/cloudera/api/ClouderaManagerClientBuilderTest.java index bbf020d7..5066a5ee 100644 --- a/java/src/test/java/com/cloudera/api/ClouderaManagerClientBuilderTest.java +++ b/java/src/test/java/com/cloudera/api/ClouderaManagerClientBuilderTest.java @@ -16,6 +16,11 @@ package com.cloudera.api; +import org.apache.cxf.jaxrs.client.ClientConfiguration; +import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.cxf.message.Message; +import org.apache.cxf.transport.http.HTTPConduit; +import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; import org.junit.Test; import java.net.MalformedURLException; @@ -23,6 +28,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; public class ClouderaManagerClientBuilderTest { @@ -96,4 +103,64 @@ public ApiRootResource newProxy(ClouderaManagerClientBuilder builder) { .enableLogging() .build(); } + + @Test + public void testMaintainSessionConfig() { + ClouderaManagerClientBuilder builder = new ClouderaManagerClientBuilder(); + ApiRootResource proxy = builder.withHost("localhost") + .withPort(1) + .enableLogging() + .build(); + ClientConfiguration cfg = WebClient.getConfig(proxy); + assertNotNull(cfg); + Boolean maintainSession = (Boolean)cfg.getRequestContext().get(Message.MAINTAIN_SESSION); + assertNull(maintainSession); + + proxy = builder.setMaintainSessionAcrossRequests(true).build(); + cfg = WebClient.getConfig(proxy); + assertNotNull(cfg); + maintainSession = (Boolean)cfg.getRequestContext().get(Message.MAINTAIN_SESSION); + assertTrue(maintainSession); + } + + @Test + public void testPassingLocale() { + ClouderaManagerClientBuilder builder = new ClouderaManagerClientBuilder(); + ApiRootResource proxy = builder.withHost("localhost") + .withPort(1) + .enableLogging() + .build(); + ClientConfiguration cfg = WebClient.getConfig(proxy); + HTTPConduit conduit = (HTTPConduit) cfg.getConduit(); + HTTPClientPolicy clientPolicy = conduit.getClient(); + + assertNotNull(clientPolicy); + String acceptLanguage = clientPolicy.getAcceptLanguage(); + assertNull(acceptLanguage); + + proxy = builder.withAcceptLanguage("some-string").build(); + cfg = WebClient.getConfig(proxy); + conduit = (HTTPConduit) cfg.getConduit(); + clientPolicy = conduit.getClient(); + assertEquals("some-string", clientPolicy.getAcceptLanguage()); + } + + @Test + public void testStreamAutoClosureConfig() { + ClouderaManagerClientBuilder builder = new ClouderaManagerClientBuilder(); + ApiRootResource proxy = builder.withHost("localhost") + .withPort(1) + .enableLogging() + .build(); + ClientConfiguration cfg = WebClient.getConfig(proxy); + assertNotNull(cfg); + Boolean autoClosure = (Boolean)cfg.getRequestContext().get("response.stream.auto.close"); + assertNull(autoClosure); + + proxy = builder.enableStreamAutoClosure().build(); + cfg = WebClient.getConfig(proxy); + assertNotNull(cfg); + autoClosure = (Boolean)cfg.getRequestContext().get("response.stream.auto.close"); + assertTrue(autoClosure); + } } diff --git a/java/src/test/java/com/cloudera/api/model/ApiModelTest.java b/java/src/test/java/com/cloudera/api/model/ApiModelTest.java index 1457c98c..2b0a74b7 100644 --- a/java/src/test/java/com/cloudera/api/model/ApiModelTest.java +++ b/java/src/test/java/com/cloudera/api/model/ApiModelTest.java @@ -16,6 +16,8 @@ package com.cloudera.api.model; +import static org.junit.Assert.*; + import com.cloudera.api.ApiErrorMessage; import com.cloudera.api.ApiObjectMapper; import com.cloudera.api.ApiUtils; @@ -42,6 +44,7 @@ import java.util.List; import java.util.Map; import java.util.UUID; + import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; @@ -54,7 +57,6 @@ import org.joda.time.Duration; import org.joda.time.Instant; import org.junit.Test; -import static org.junit.Assert.*; public class ApiModelTest { private final static String TEXT_ENCODING = "UTF-8"; @@ -223,6 +225,8 @@ public void testApiConfig() throws Exception { ApiConfig cfg = new ApiConfig("name", "value", true, "default", "display", "description", "relatedName", ApiConfig.ValidationState.OK, "validationMessage"); + cfg.setValidationWarningsSuppressed(true); + cfg.setSensitive(false); checkJsonXML(cfg); ApiServiceConfig svcCfg = new ApiServiceConfig(); @@ -243,7 +247,9 @@ public void testApiHost() @Test public void testApiHealthCheck() throws Exception { ApiHealthCheck healthCheck = new ApiHealthCheck("checkName", - ApiHealthSummary.GOOD); + ApiHealthSummary.GOOD, + "Dummy Health explanation.", + false); checkJsonXML(healthCheck); } @@ -258,6 +264,7 @@ public void testApiRole() role.setHaStatus(ApiRole.HaStatus.ACTIVE); role.setHealthChecks(createHealthChecks()); role.setHealthSummary(ApiHealthSummary.GOOD); + role.setEntityStatus(ApiEntityStatus.GOOD_HEALTH); role.setHostRef(new ApiHostRef("myhost")); role.setMaintenanceMode(true); role.setMaintenanceOwners(createMaintenanceOwners()); @@ -282,11 +289,13 @@ public void testApiService() service.setDisplayName("mydisplayname"); service.setHealthChecks(createHealthChecks()); service.setHealthSummary(ApiHealthSummary.GOOD); + service.setEntityStatus(ApiEntityStatus.GOOD_HEALTH); service.setMaintenanceMode(true); service.setMaintenanceOwners(createMaintenanceOwners()); service.setName("myname"); service.setServiceState(ApiServiceState.STARTED); service.setServiceUrl("http://foo:7180"); + service.setRoleInstancesUrl("http://foo:7180/instances"); service.setType("mytype"); ApiRoleConfigGroup rcg = new ApiRoleConfigGroup(); @@ -519,6 +528,8 @@ public void testConfig() throws Exception { "relatedName", ApiConfig.ValidationState.OK, "validationMessage"); + config.setValidationWarningsSuppressed(false); + config.setSensitive(true); checkJsonXML(config); } @@ -586,6 +597,8 @@ public void testCmPeer() throws Exception { peer.setUrl("url1"); peer.setUsername("user1"); peer.setPassword("password1"); + peer.setType(ApiCmPeerType.REPLICATION); + peer.setClouderaManagerCreatedUser(true); checkJsonXML(peer); } @@ -615,6 +628,7 @@ public void testHdfsReplication() throws Exception { ApiScheduleInterval.MONTH, true); hdfsInfo.setHdfsArguments(hdfsArgs); hdfsInfo.setNextRun(new Date(12345)); + hdfsInfo.setActive(true); ApiReplicationCommand cmd = new ApiReplicationCommand(); fillInCommand(cmd); @@ -664,6 +678,7 @@ public void testHiveReplication() throws Exception { ApiReplicationSchedule sch = new ApiReplicationSchedule(20L, new Date(1234), new Date(5678), 10, ApiScheduleInterval.MONTH, true); sch.setHiveArguments(args); + sch.setActive(true); checkJsonXML(sch); ApiHiveReplicationResult res = new ApiHiveReplicationResult(); @@ -671,11 +686,14 @@ public void testHiveReplication() throws Exception { res.setTableCount(1); res.setImpalaUDFs(Arrays.asList(new ApiImpalaUDF("db1", "func1"))); res.setImpalaUDFCount(1); + res.setHiveUDFs(Arrays.asList(new ApiHiveUDF("db2", "func2"))); + res.setHiveUDFCount(1); res.setErrors(Arrays.asList(new ApiHiveReplicationError("db1", "table1", - "func1(STRING)", "error1"))); + "func1(STRING)", "func2(STRING)", "error1"))); res.setErrorCount(1); res.setDryRun(true); res.setPhase("foo"); + res.setRunAsUser("foo"); ApiHdfsReplicationResult hdfsRes = newHdfsReplicationResult(); res.setDataReplicationResult(hdfsRes); @@ -833,6 +851,7 @@ private ApiSnapshotPolicy createPolicy() { policy.setDayOfMonth((byte) 31); policy.setMonthOfYear((byte) 6); policy.setHoursForHourlySnapshots(Arrays.asList((byte) 4, (byte) 8)); + policy.setPaused(false); return policy; } @@ -842,7 +861,9 @@ public void testYarnApplication() throws Exception { ApiMr2AppInformation mr2Information = new ApiMr2AppInformation("jobState"); ApiYarnApplication application = new ApiYarnApplication( "appId", "appName", new Date(), new Date(), "user", "pool", - "FINISHED", 80.0, mr2Information, Maps.newHashMap()); + "FINISHED", 80.0, mr2Information, Maps.newHashMap(), + ImmutableList.of("foo"), 1234L, 5678L, + 123, 1, 3, 1d, 2d, 3d, 4d, 5d); checkJsonXML(application); ApiYarnApplicationResponse response = new ApiYarnApplicationResponse( @@ -896,8 +917,10 @@ public void testApiTimeSeriesData() throws Exception { ApiTimeSeriesCrossEntityMetadata xEntityMetadata = new ApiTimeSeriesCrossEntityMetadata(); - xEntityMetadata.setMaxEntityDisplayName("maxDisplayName"); + xEntityMetadata.setMaxEntityDisplayName("maxEntityDisplayName"); xEntityMetadata.setMinEntityDisplayName("minEntityDisplayName"); + xEntityMetadata.setMaxEntityName("maxEntityName"); + xEntityMetadata.setMinEntityName("minEntityName"); xEntityMetadata.setNumEntities(3.14); aggStats.setCrossEntityMetadata(xEntityMetadata); checkJsonXML(data); @@ -905,8 +928,14 @@ public void testApiTimeSeriesData() throws Exception { private List createHealthChecks() { return ImmutableList.of( - new ApiHealthCheck("TEST1", ApiHealthSummary.GOOD), - new ApiHealthCheck("TEST2", ApiHealthSummary.CONCERNING)); + new ApiHealthCheck("TEST1", + ApiHealthSummary.GOOD, + "Dummy Health explanation.", + false), + new ApiHealthCheck("TEST2", + ApiHealthSummary.CONCERNING, + "Dummy Health explanation.", + false)); } private List createMaintenanceOwners() { @@ -928,6 +957,7 @@ private ApiHdfsReplicationArguments newHdfsReplicationArguments() { hdfsArgs.setSkipTrash(true); hdfsArgs.setPreserveXAttrs(true); hdfsArgs.setReplicationStrategy(ReplicationStrategy.DYNAMIC); + hdfsArgs.setExclusionFilters(Lists.newArrayList("/a/.*", "/b/.*")); return hdfsArgs; } @@ -946,6 +976,8 @@ private ApiHdfsReplicationResult newHdfsReplicationResult() { result.setNumBytesCopyFailed(400); result.setSetupError("error"); result.setSnapshottedDirs(Arrays.asList("/user/a")); + result.setFailedFiles(Arrays.asList("path1")); + result.setRunAsUser("systest"); return result; } @@ -958,6 +990,7 @@ private void fillInCommand(ApiCommand cmd) { cmd.setSuccess(false); cmd.setResultMessage("message"); cmd.setResultDataUrl("url"); + cmd.setCanRetry(false); } private ApiCluster newCluster() { @@ -966,9 +999,12 @@ private ApiCluster newCluster() { cluster.setMaintenanceMode(true); cluster.setName("mycluster"); cluster.setDisplayName("mycluster-displayName"); + cluster.setUuid("abcd-efg-hijk-lmnop"); cluster.setClusterUrl("http://some-url:7180/cmf/clusterRedirect/mycluster"); + cluster.setHostsUrl("http://some-url:7180/cmf/clusterRedirect/mycluster/hosts"); cluster.setVersion(ApiClusterVersion.CDH4); cluster.setFullVersion("4.1.2"); + cluster.setEntityStatus(ApiEntityStatus.GOOD_HEALTH); return cluster; } @@ -980,6 +1016,7 @@ private ApiHost newHost() { host.setCommissionState(ApiCommissionState.COMMISSIONED); host.setHealthChecks(createHealthChecks()); host.setHealthSummary(ApiHealthSummary.GOOD); + host.setEntityStatus(ApiEntityStatus.GOOD_HEALTH); host.setHostId("myHostId"); host.setHostUrl("http://foo:7180"); host.setHostname("myHostname"); @@ -992,6 +1029,7 @@ private ApiHost newHost() { host.setRackId("/default"); host.setRoleRefs(roleRefs); host.setTotalPhysMemBytes(1234L); + host.setClusterRef(new ApiClusterRef("clusterName")); return host; } From 9381dfc271128ee7c214da2053fa4eb3b72f8588 Mon Sep 17 00:00:00 2001 From: mthakkar Date: Tue, 31 Jan 2017 15:05:16 -0800 Subject: [PATCH 3/4] [java] Updated with v15 java source --- .../api/v15/ClouderaManagerResourceV15.java | 24 ++++++++ .../cloudera/api/v15/ClustersResourceV15.java | 39 ++++++++++++ .../com/cloudera/api/v15/RootResourceV15.java | 8 +++ .../cloudera/api/v15/ServicesResourceV15.java | 59 +++++++++++++++++++ 4 files changed, 130 insertions(+) create mode 100644 java/src/main/java/com/cloudera/api/v15/ClustersResourceV15.java create mode 100644 java/src/main/java/com/cloudera/api/v15/ServicesResourceV15.java diff --git a/java/src/main/java/com/cloudera/api/v15/ClouderaManagerResourceV15.java b/java/src/main/java/com/cloudera/api/v15/ClouderaManagerResourceV15.java index 9d45444a..2e33cbab 100644 --- a/java/src/main/java/com/cloudera/api/v15/ClouderaManagerResourceV15.java +++ b/java/src/main/java/com/cloudera/api/v15/ClouderaManagerResourceV15.java @@ -17,12 +17,15 @@ package com.cloudera.api.v15; import com.cloudera.api.Parameters; +import com.cloudera.api.model.ApiCommand; import com.cloudera.api.model.ApiConfigList; import com.cloudera.api.model.ApiShutdownReadiness; +import com.cloudera.api.model.ApiHostNameList; import com.cloudera.api.v14.ClouderaManagerResourceV14; import javax.ws.rs.Consumes; import javax.ws.rs.GET; +import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.Produces; @@ -68,4 +71,25 @@ public ApiShutdownReadiness getShutdownReadiness( @QueryParam("lastActivityTime") String lastActivityTime); + + /** + * Recommission the given hosts. If slave roles support start when decommissioned, + * start those roles before recommission. + * All slave roles on the hosts will be recommissioned. + * + * Warning: Evolving. This method may change in the future and does not offer standard compatibility guarantees. + * Recommission the given hosts. If possible, start those roles before recommission. All slave roles on the hosts + * will be recommissioned. + * Do not use without guidance from Cloudera. + * + * Currently, only HDFS DataNodes will be started by this command. + * + * + * @return Information about the submitted command. + */ + @POST + @Consumes + @Path("/commands/hostsRecommissionWithStart") + public ApiCommand hostsRecommissionWithStartCommand( + ApiHostNameList hostNameList); } \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v15/ClustersResourceV15.java b/java/src/main/java/com/cloudera/api/v15/ClustersResourceV15.java new file mode 100644 index 00000000..619bbbdc --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v15/ClustersResourceV15.java @@ -0,0 +1,39 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v15; + +import static com.cloudera.api.Parameters.*; + +import com.cloudera.api.v14.ClustersResourceV14; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ClustersResourceV15 extends ClustersResourceV14 { + /** + * @return The services resource handler. + */ + @Override + @Path("/{clusterName}/services") + public ServicesResourceV15 getServicesResource( + @PathParam(CLUSTER_NAME) String clusterName); + +} diff --git a/java/src/main/java/com/cloudera/api/v15/RootResourceV15.java b/java/src/main/java/com/cloudera/api/v15/RootResourceV15.java index 633e62b7..56177a57 100644 --- a/java/src/main/java/com/cloudera/api/v15/RootResourceV15.java +++ b/java/src/main/java/com/cloudera/api/v15/RootResourceV15.java @@ -25,4 +25,12 @@ public interface RootResourceV15 extends RootResourceV14 { @Override @Path("/cm") public ClouderaManagerResourceV15 getClouderaManagerResource(); + + /** + * @return The clusters resource handler. + */ + @Override + @Path("/clusters") + public ClustersResourceV15 getClustersResource(); + } diff --git a/java/src/main/java/com/cloudera/api/v15/ServicesResourceV15.java b/java/src/main/java/com/cloudera/api/v15/ServicesResourceV15.java new file mode 100644 index 00000000..25ef4dee --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v15/ServicesResourceV15.java @@ -0,0 +1,59 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v15; + +import static com.cloudera.api.Parameters.*; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.model.ApiRoleNameList; +import com.cloudera.api.v14.ServicesResourceV14; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ServicesResourceV15 extends ServicesResourceV14 { + /** + * Start and recommission roles of a service. + *

      + * The list should contain names of slave roles to start and recommission. + *

      + * + *

      + * Warning: Evolving. This method may change in the future and does not offer standard compatibility guarantees. + * Only support by HDFS. + * Do not use without guidance from Cloudera. + *

      + * + *

      + * Available since API v15. + *

      + * + * @param serviceName Name of the service on which to run the command. + * @param roleNames List of role names to recommision. + * @return Information about the submitted command. + */ + @POST + @Path("/{serviceName}/commands/recommissionWithStart") + public ApiCommand recommissionWithStartCommand( + @PathParam(SERVICE_NAME) String serviceName, + ApiRoleNameList roleNames); +} From a66c93d208ef7f39df3bc7b3a59b723634a3b2bb Mon Sep 17 00:00:00 2001 From: Herman Chen Date: Wed, 30 Nov 2016 12:35:52 -0800 Subject: [PATCH 4/4] [scm] OPSAPS-37770 Add cluster UUID The readonly attribute will only be present when using API>=15. (cherry picked from commit ff41c6c8cc259b85e9a034ae8226bd853bf664f6) --- python/src/cm_api/endpoints/clusters.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/src/cm_api/endpoints/clusters.py b/python/src/cm_api/endpoints/clusters.py index 9f0b578c..3f2d9385 100644 --- a/python/src/cm_api/endpoints/clusters.py +++ b/python/src/cm_api/endpoints/clusters.py @@ -85,6 +85,7 @@ class ApiCluster(BaseApiResource): 'maintenanceMode' : ROAttr(), 'maintenanceOwners' : ROAttr(), 'entityStatus' : ROAttr(), + 'uuid' : ROAttr(), } def __init__(self, resource_root, name=None, version=None, fullVersion=None):