From ebb22f63aa86998c6a4e045b9c2027686eba9125 Mon Sep 17 00:00:00 2001 From: Jenkins slave Date: Thu, 28 Jun 2018 02:03:47 -0700 Subject: [PATCH 1/2] [java] Updated with v20 java source --- java/api-docs.fmt | 211 ++++-- java/enunciate.xml | 6 +- java/pom.xml | 42 +- java/src/javadoc/javadoc.css | 607 ------------------ .../com/cloudera/api/ApiRootResource.java | 70 +- .../cloudera/api/ApiRootResourceExternal.java | 172 +++++ .../api/ApiRootResourceInvocationHandler.java | 47 ++ .../main/java/com/cloudera/api/ApiUtils.java | 11 + .../api/ClouderaManagerClientBuilder.java | 105 ++- .../main/java/com/cloudera/api/DataView.java | 6 + .../java/com/cloudera/api/Parameters.java | 17 + .../com/cloudera/api/model/ApiCluster.java | 58 +- .../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 ++ .../api/model/ApiClusterUtilization.java | 358 +++++++++++ .../cloudera/api/model/ApiClusterVersion.java | 3 + .../com/cloudera/api/model/ApiCmPeer.java | 107 ++- .../com/cloudera/api/model/ApiCmPeerType.java | 24 + .../ApiCollectDiagnosticDataArguments.java | 25 +- .../com/cloudera/api/model/ApiCommand.java | 40 +- .../api/model/ApiCommissionState.java | 4 +- .../com/cloudera/api/model/ApiConfig.java | 67 +- .../ApiConfigureForKerberosArguments.java | 78 +++ .../api/model/ApiDisableSentryHaArgs.java | 60 ++ .../api/model/ApiEnableOozieHaArguments.java | 64 +- .../api/model/ApiEnableSentryHaArgs.java | 107 +++ .../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 | 121 +++- .../api/model/ApiHdfsReplicationResult.java | 95 ++- .../cloudera/api/model/ApiHealthCheck.java | 42 ++ .../ApiHiveCloudReplicationArguments.java | 137 ++++ .../model/ApiHiveReplicationArguments.java | 59 +- .../api/model/ApiHiveReplicationError.java | 25 +- .../api/model/ApiHiveReplicationResult.java | 250 +++++++- .../com/cloudera/api/model/ApiHiveUDF.java | 69 ++ .../java/com/cloudera/api/model/ApiHost.java | 37 +- .../api/model/ApiHostInstallArguments.java | 8 +- .../api/model/ApiHostRecommissionType.java | 26 + .../api/model/ApiImpalaTenantUtilization.java | 357 ++++++++++ .../model/ApiImpalaTenantUtilizationList.java | 43 ++ .../api/model/ApiImpalaUtilization.java | 403 ++++++++++++ .../model/ApiImpalaUtilizationHistogram.java | 53 ++ .../ApiImpalaUtilizationHistogramBin.java | 100 +++ .../ApiImpalaUtilizationHistogramBinList.java | 42 ++ .../cloudera/api/model/ApiKerberosInfo.java | 133 ++++ .../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 | 20 +- .../model/ApiRollingRestartClusterArgs.java | 72 ++- .../com/cloudera/api/model/ApiSchedule.java | 32 +- .../com/cloudera/api/model/ApiScmDbInfo.java | 88 +++ .../com/cloudera/api/model/ApiService.java | 39 +- .../api/model/ApiShutdownReadiness.java | 60 ++ .../ApiSimpleRollingRestartClusterArgs.java | 102 +++ .../cloudera/api/model/ApiSnapshotPolicy.java | 18 +- .../api/model/ApiTenantUtilization.java | 85 +++ .../api/model/ApiTenantUtilizationList.java | 45 ++ .../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 | 224 ++++++- .../api/model/ApiYarnTenantUtilization.java | 286 +++++++++ .../model/ApiYarnTenantUtilizationList.java | 43 ++ .../api/model/ApiYarnUtilization.java | 280 ++++++++ .../com/cloudera/api/v1/HostsResource.java | 2 +- .../cloudera/api/v1/MgmtServiceResource.java | 8 + .../cloudera/api/v1/NameservicesResource.java | 2 +- .../com/cloudera/api/v1/RolesResource.java | 6 +- .../com/cloudera/api/v1/ServicesResource.java | 2 +- .../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 | 80 +++ .../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 | 95 +++ .../cloudera/api/v15/ClustersResourceV15.java | 39 ++ .../com/cloudera/api/v15/RootResourceV15.java | 36 ++ .../cloudera/api/v15/ServicesResourceV15.java | 59 ++ .../com/cloudera/api/v15/package-info.java | 21 + .../api/v16/ClouderaManagerResourceV16.java | 51 ++ .../cloudera/api/v16/ClustersResourceV16.java | 39 ++ .../api/v16/ExternalAccountsResourceV16.java | 109 ++++ .../com/cloudera/api/v16/RootResourceV16.java | 37 ++ .../cloudera/api/v16/ServicesResourceV16.java | 28 + .../com/cloudera/api/v16/package-info.java | 21 + .../api/v17/ClouderaManagerResourceV17.java | 84 +++ .../cloudera/api/v17/ClustersResourceV17.java | 51 ++ .../com/cloudera/api/v17/RootResourceV17.java | 39 ++ .../cloudera/api/v17/ServicesResourceV17.java | 78 +++ .../com/cloudera/api/v17/package-info.java | 21 + .../api/v18/ClouderaManagerResourceV18.java | 64 ++ .../cloudera/api/v18/ClustersResourceV18.java | 90 +++ .../api/v18/MgmtRolesResourceV18.java | 67 ++ .../api/v18/MgmtServiceResourceV18.java | 65 ++ .../api/v18/ReplicationsResourceV18.java | 41 ++ .../com/cloudera/api/v18/RootResourceV18.java | 39 ++ .../cloudera/api/v18/ServicesResourceV18.java | 156 +++++ .../com/cloudera/api/v18/package-info.java | 21 + .../api/v19/ClouderaManagerResourceV19.java | 48 ++ .../com/cloudera/api/v19/RootResourceV19.java | 31 + .../com/cloudera/api/v19/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 | 9 +- .../cloudera/api/v6/DashboardsResource.java | 4 +- .../cloudera/api/v6/ServicesResourceV6.java | 24 +- .../cloudera/api/v6/TimeSeriesResourceV6.java | 16 +- .../api/v6/YarnApplicationsResource.java | 7 +- .../com/cloudera/api/v8/AuditsResourceV8.java | 11 +- .../api/ClouderaManagerClientBuilderTest.java | 83 +++ .../com/cloudera/api/model/ApiModelTest.java | 235 ++++++- 169 files changed, 11015 insertions(+), 892 deletions(-) delete mode 100644 java/src/javadoc/javadoc.css create mode 100644 java/src/main/java/com/cloudera/api/ApiRootResourceExternal.java create mode 100644 java/src/main/java/com/cloudera/api/ApiRootResourceInvocationHandler.java 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/ApiClusterUtilization.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/ApiDisableSentryHaArgs.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiEnableSentryHaArgs.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/ApiHostRecommissionType.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiImpalaTenantUtilization.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiImpalaTenantUtilizationList.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiImpalaUtilization.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiImpalaUtilizationHistogram.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiImpalaUtilizationHistogramBin.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiImpalaUtilizationHistogramBinList.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiKerberosInfo.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/ApiSimpleRollingRestartClusterArgs.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiTenantUtilization.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiTenantUtilizationList.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/model/ApiYarnTenantUtilization.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiYarnTenantUtilizationList.java create mode 100644 java/src/main/java/com/cloudera/api/model/ApiYarnUtilization.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/ClustersResourceV15.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/ServicesResourceV15.java create mode 100644 java/src/main/java/com/cloudera/api/v15/package-info.java create mode 100644 java/src/main/java/com/cloudera/api/v16/ClouderaManagerResourceV16.java create mode 100644 java/src/main/java/com/cloudera/api/v16/ClustersResourceV16.java create mode 100644 java/src/main/java/com/cloudera/api/v16/ExternalAccountsResourceV16.java create mode 100644 java/src/main/java/com/cloudera/api/v16/RootResourceV16.java create mode 100644 java/src/main/java/com/cloudera/api/v16/ServicesResourceV16.java create mode 100644 java/src/main/java/com/cloudera/api/v16/package-info.java create mode 100644 java/src/main/java/com/cloudera/api/v17/ClouderaManagerResourceV17.java create mode 100644 java/src/main/java/com/cloudera/api/v17/ClustersResourceV17.java create mode 100644 java/src/main/java/com/cloudera/api/v17/RootResourceV17.java create mode 100644 java/src/main/java/com/cloudera/api/v17/ServicesResourceV17.java create mode 100644 java/src/main/java/com/cloudera/api/v17/package-info.java create mode 100644 java/src/main/java/com/cloudera/api/v18/ClouderaManagerResourceV18.java create mode 100644 java/src/main/java/com/cloudera/api/v18/ClustersResourceV18.java create mode 100644 java/src/main/java/com/cloudera/api/v18/MgmtRolesResourceV18.java create mode 100644 java/src/main/java/com/cloudera/api/v18/MgmtServiceResourceV18.java create mode 100644 java/src/main/java/com/cloudera/api/v18/ReplicationsResourceV18.java create mode 100644 java/src/main/java/com/cloudera/api/v18/RootResourceV18.java create mode 100644 java/src/main/java/com/cloudera/api/v18/ServicesResourceV18.java create mode 100644 java/src/main/java/com/cloudera/api/v18/package-info.java create mode 100644 java/src/main/java/com/cloudera/api/v19/ClouderaManagerResourceV19.java create mode 100644 java/src/main/java/com/cloudera/api/v19/RootResourceV19.java create mode 100644 java/src/main/java/com/cloudera/api/v19/package-info.java diff --git a/java/api-docs.fmt b/java/api-docs.fmt index 6c49f15a..9d83408a 100644 --- a/java/api-docs.fmt +++ b/java/api-docs.fmt @@ -165,8 +165,8 @@ - - + + @@ -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..9d2a932e 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.15.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..a4df0b47 100644 --- a/java/src/main/java/com/cloudera/api/ApiRootResource.java +++ b/java/src/main/java/com/cloudera/api/ApiRootResource.java @@ -16,6 +16,16 @@ 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.v16.RootResourceV16; +import com.cloudera.api.v17.RootResourceV17; +import com.cloudera.api.v18.RootResourceV18; +import com.cloudera.api.v19.RootResourceV19; import com.cloudera.api.v2.RootResourceV2; import com.cloudera.api.v3.RootResourceV3; import com.cloudera.api.v4.RootResourceV4; @@ -24,7 +34,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 +110,65 @@ 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(); + + /** + * @return The v16 root resource. + */ + @Path("/v16") + RootResourceV16 getRootV16(); + + /** + * @return The v17 root resource. + */ + @Path("/v17") + RootResourceV17 getRootV17(); + + /** + * @return The v18 root resource. + */ + @Path("/v18") + RootResourceV18 getRootV18(); + + /** + * @return The v19 root resource. + */ + @Path("/v19") + RootResourceV19 getRootV19(); + + /** + * Important: Update {@link ApiRootResourceExternal} interface as well + * on adding new CM API version. + */ + /** * Fetch the current API version supported by the server. *

diff --git a/java/src/main/java/com/cloudera/api/ApiRootResourceExternal.java b/java/src/main/java/com/cloudera/api/ApiRootResourceExternal.java new file mode 100644 index 00000000..59e7c934 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/ApiRootResourceExternal.java @@ -0,0 +1,172 @@ +// 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; + + +import com.cloudera.api.v19.RootResourceV19; + +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; + +/** + * ApiRootResourceExternal interface is used specifically to generate proxies by CXF for + * direct consumers of {@link ClouderaManagerClientBuilder}. + * + * It must be kept in-sync with {@link ApiRootResource}. + * + * In order to reduce memory usage while generating proxies, single RootResource version + * is returned. + * + * On adding a new API version: + * - add corresponding getRootV() method with newer version of RootResource as data type + * of return parameter + * - update return data type of all existing getRootV() methods as well + */ +@Path("/") +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +interface ApiRootResourceExternal { + + /** + * @return The v1 root resource. + */ + @Path("/v1") + RootResourceV19 getRootV1(); + + /** + * @return The v2 root resource. + */ + @Path("/v2") + RootResourceV19 getRootV2(); + + /** + * @return The v3 root resource. + */ + @Path("/v3") + RootResourceV19 getRootV3(); + + /** + * @return The v4 root resource. + */ + @Path("/v4") + RootResourceV19 getRootV4(); + + /** + * @return The v5 root resource. + */ + @Path("/v5") + RootResourceV19 getRootV5(); + + /** + * @return The v6 root resource. + */ + @Path("/v6") + RootResourceV19 getRootV6(); + + /** + * @return The v7 root resource. + */ + @Path("/v7") + RootResourceV19 getRootV7(); + + /** + * @return The v8 root resource. + */ + @Path("/v8") + RootResourceV19 getRootV8(); + + /** + * @return The v9 root resource. + */ + @Path("/v9") + RootResourceV19 getRootV9(); + + /** + * @return The v10 root resource. + */ + @Path("/v10") + RootResourceV19 getRootV10(); + + /** + * @return The v11 root resource. + */ + @Path("/v11") + RootResourceV19 getRootV11(); + + /** + * @return The v12 root resource. + */ + @Path("/v12") + RootResourceV19 getRootV12(); + + /** + * @return The v13 root resource. + */ + @Path("/v13") + RootResourceV19 getRootV13(); + + /** + * @return The v14 root resource. + */ + @Path("/v14") + RootResourceV19 getRootV14(); + + /** + * @return The v15 root resource. + */ + @Path("/v15") + RootResourceV19 getRootV15(); + + /** + * @return The v16 root resource. + */ + @Path("/v16") + RootResourceV19 getRootV16(); + + /** + * @return The v17 root resource. + */ + @Path("/v17") + RootResourceV19 getRootV17(); + + /** + * @return The v18 root resource. + */ + @Path("/v18") + RootResourceV19 getRootV18(); + + /** + * @return The v19 root resource. + */ + @Path("/v19") + RootResourceV19 getRootV19(); + + /** + * Fetch the current API version supported by the server. + *

+ * Available since API v2. + * + * @return The current API version (e.g., "v2"). + */ + @GET + @Path("/version") + @Consumes() + @Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) + String getCurrentVersion(); +} diff --git a/java/src/main/java/com/cloudera/api/ApiRootResourceInvocationHandler.java b/java/src/main/java/com/cloudera/api/ApiRootResourceInvocationHandler.java new file mode 100644 index 00000000..1eb7c62c --- /dev/null +++ b/java/src/main/java/com/cloudera/api/ApiRootResourceInvocationHandler.java @@ -0,0 +1,47 @@ +// 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; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; + +/** + * ApiRootResourceInvocationHandler allows delegation of + * call on API proxy from {@link ApiRootResource} interface to {@link ApiRootResourceExternal}. + * + * Generating stubs using {@link ApiRootResourceExternal} is more memory efficient and hence + * the need for delegation which allows us to redirect call without requiring + * changes for consumers of {@link ClouderaManagerClientBuilder}. + */ +class ApiRootResourceInvocationHandler implements InvocationHandler { + final private ApiRootResourceExternal delegateRootResource; + + ApiRootResourceInvocationHandler(ApiRootResourceExternal rootResource) { + delegateRootResource = rootResource; + } + + ApiRootResourceExternal getDelegateRootResource() { + return delegateRootResource; + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + Method delegateMethod = ApiRootResourceExternal.class.getMethod(method.getName(), + method.getParameterTypes()); + return delegateMethod.invoke(delegateRootResource, args); + } +} \ No newline at end of file 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..bbe49e12 100644 --- a/java/src/main/java/com/cloudera/api/ClouderaManagerClientBuilder.java +++ b/java/src/main/java/com/cloudera/api/ClouderaManagerClientBuilder.java @@ -16,12 +16,14 @@ package com.cloudera.api; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; import com.google.common.annotations.VisibleForTesting; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; +import java.lang.reflect.Proxy; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; @@ -35,13 +37,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 +58,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 +68,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. @@ -92,11 +101,21 @@ public class ClouderaManagerClientBuilder { public JAXRSClientFactoryBean load(Class proxyType) throws Exception { JAXRSClientFactoryBean clientFactoryBean = new JAXRSClientFactoryBean(); clientFactoryBean.setResourceClass(proxyType); - clientFactoryBean.setProvider(new JacksonJsonProvider(new ApiObjectMapper())); + // Configuring the deserialization to not fail on unknown properties. + // This ensures backward compatibility of APIs especially with BDR. OPSAPS-45062 + clientFactoryBean.setProvider(new JacksonJsonProvider(( + new ApiObjectMapper()).configure( + DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false))); return clientFactoryBean; } }); + public ClouderaManagerClientBuilder withAcceptLanguage( + String acceptLaunguage) { + this.acceptLanguage = acceptLaunguage; + return this; + } + public ClouderaManagerClientBuilder withBaseURL(URL baseUrl) { this.baseUrl = baseUrl; return this; @@ -122,6 +141,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 +196,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/"; @@ -195,7 +248,15 @@ public void setTrustManagers(TrustManager[] managers) { * @return an ApiRootResource proxy object */ public ApiRootResource build() { - return build(ApiRootResource.class); + // Generating stubs on ApiRootResource consumes more memory. + // Hence we generate stubs using ApiRootResourceExternal and then use dynamic proxy mechanism + // to delegate call on ApiRootResource to ApiRootResourceExternal generated stub. + ApiRootResourceExternal apiRootResourceExternal = build(ApiRootResourceExternal.class); + + return (ApiRootResource) Proxy.newProxyInstance( + ClouderaManagerClientBuilder.class.getClassLoader(), + new Class[]{ApiRootResource.class}, + new ApiRootResourceInvocationHandler(apiRootResourceExternal)); } /** @@ -220,11 +281,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 +310,9 @@ else if (trustManagers != null) { } HTTPClientPolicy policy = conduit.getClient(); + if (acceptLanguage != null) { + policy.setAcceptLanguage(acceptLanguage); + } policy.setConnectionTimeout( connectionTimeoutUnits.toMillis(connectionTimeout)); policy.setReceiveTimeout( @@ -249,26 +323,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"); + public static void closeClient(Object root) { + Client client = WebClient.client(root); + if (client != null) { + client.close(); } - conduit.close(); } /** @@ -289,14 +361,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..a7ec1423 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,13 @@ 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"; + static public final String TENANT_TYPE = "tenantType"; + static public final String DELETE_CREDENTIALS_MODE = "deleteCredentialsMode"; /* Common query params. */ static public final String FROM = "from"; @@ -53,13 +61,22 @@ public final class Parameters { static public final String LIMIT = "limit"; static public final String METRICS = "metrics"; static public final String QUERY = "query"; + static public final String DAYS_OF_WEEK = "daysOfWeek"; + static public final String IS_ALL_DAY = "isAllDay"; + static public final String START_HOUR_OF_DAY = "startHourOfDay"; + static public final String END_HOUR_OF_DAY = "endHourOfDay"; /* 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"; + static public final String POOL = "POOL"; + static public final String USER = "USER"; + static public final String DELETE_CREDENTIALS_MODE_DEFAULT = "all"; /* 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..b94672c6 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiCluster.java +++ b/java/src/main/java/com/cloudera/api/model/ApiCluster.java @@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; +import java.util.ArrayList; import java.util.List; /** @@ -33,18 +34,23 @@ */ @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; + @Deprecated 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 +108,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,12 +135,28 @@ 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 + @Deprecated public ApiClusterVersion getVersion() { return version; } + @Deprecated public void setVersion(ApiClusterVersion version) { this.version = version; } @@ -166,7 +201,9 @@ public List getMaintenanceOwners() { } public void setMaintenanceOwners(List maintenanceOwners) { - this.maintenanceOwners = Lists.newArrayList(maintenanceOwners); + this.maintenanceOwners = (null == maintenanceOwners) + ? new ArrayList() + : Lists.newArrayList(maintenanceOwners); } /** @@ -193,4 +230,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/ApiClusterUtilization.java b/java/src/main/java/com/cloudera/api/model/ApiClusterUtilization.java new file mode 100644 index 00000000..bb157a6a --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiClusterUtilization.java @@ -0,0 +1,358 @@ +// 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 javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Utilization report information of a Cluster. + */ +@XmlRootElement(name = "clusterUtilization") +public class ApiClusterUtilization { + + private Double totalCpuCores; + private Double avgCpuUtilization; + private Double maxCpuUtilization; + private Long maxCpuUtilizationTimestampMs; + private Double avgCpuDailyPeak; + private Double avgWorkloadCpu; + private Double maxWorkloadCpu; + private Long maxWorkloadCpuTimestampMs; + private Double avgWorkloadCpuDailyPeak; + + private Double totalMemory; + private Double avgMemoryUtilization; + private Double maxMemoryUtilization; + private Long maxMemoryUtilizationTimestampMs; + private Double avgMemoryDailyPeak; + private Double avgWorkloadMemory; + private Double maxWorkloadMemory; + private Long maxWorkloadMemoryTimestampMs; + private Double avgWorkloadMemoryDailyPeak; + private ApiTenantUtilizationList tenantUtilizations; + + private String errorMessage; + + public ApiClusterUtilization() { + // For JAX-B + } + + /** + * Average number of CPU cores available in the cluster during the report window. + */ + @XmlElement + public Double getTotalCpuCores() { + return totalCpuCores; + } + + public void setTotalCpuCores(Double totalCpuCores) { + this.totalCpuCores = totalCpuCores; + } + + /** + * Average CPU consumption for the entire cluster during the report window. + * This includes consumption by user workloads in YARN and Impala, as well as + * consumption by all services running in the cluster. + */ + @XmlElement + public Double getAvgCpuUtilization() { + return avgCpuUtilization; + } + + public void setAvgCpuUtilization(Double avgCpuUtilization) { + this.avgCpuUtilization = avgCpuUtilization; + } + + /** + * Maximum CPU consumption for the entire cluster during the report window. + * This includes consumption by user workloads in YARN and Impala, as well as + * consumption by all services running in the cluster. + */ + @XmlElement + public Double getMaxCpuUtilization() { + return maxCpuUtilization; + } + + public void setMaxCpuUtilization(Double maxCpuUtilization) { + this.maxCpuUtilization = maxCpuUtilization; + } + + /** + * Average daily peak CPU consumption for the entire cluster during the report + * window. This includes consumption by user workloads in YARN and Impala, as + * well as consumption by all services running in the cluster. + */ + @XmlElement + public Double getAvgCpuDailyPeak() { + return avgCpuDailyPeak; + } + + public void setAvgCpuDailyPeak(Double avgCpuDailyPeak) { + this.avgCpuDailyPeak = avgCpuDailyPeak; + } + + /** + * Average CPU consumption by workloads that ran on the cluster during the + * report window. This includes consumption by user workloads in YARN and + * Impala. + */ + @XmlElement + public Double getAvgWorkloadCpu() { + return avgWorkloadCpu; + } + + public void setAvgWorkloadCpu(Double avgWorkloadCpu) { + this.avgWorkloadCpu = avgWorkloadCpu; + } + + /** + * Maximum CPU consumption by workloads that ran on the cluster during the + * report window. This includes consumption by user workloads in YARN and + * Impala. + */ + @XmlElement + public Double getMaxWorkloadCpu() { + return maxWorkloadCpu; + } + + public void setMaxWorkloadCpu(Double maxWorkloadCpu) { + this.maxWorkloadCpu = maxWorkloadCpu; + } + + /** + * Average daily peak CPU consumption by workloads that ran on the cluster + * during the report window. This includes consumption by user workloads in + * YARN and Impala. + */ + @XmlElement + public Double getAvgWorkloadCpuDailyPeak() { + return avgWorkloadCpuDailyPeak; + } + + public void setAvgWorkloadCpuDailyPeak( + Double avgWorkloadCpuDailyPeak) { + this.avgWorkloadCpuDailyPeak = avgWorkloadCpuDailyPeak; + } + + /** + * Average physical memory (in bytes) available in the cluster during the + * report window. This includes consumption by user workloads in YARN and + * Impala, as well as consumption by all services running in the cluster. + */ + @XmlElement + public Double getTotalMemory() { + return totalMemory; + } + + public void setTotalMemory(Double totalMemory) { + this.totalMemory = totalMemory; + } + + /** + * Average memory consumption (as percentage of total memory) for the entire + * cluster during the report window. This includes consumption by user + * workloads in YARN and Impala, as well as consumption by all services + * running in the cluster. + */ + @XmlElement + public Double getAvgMemoryUtilization() { + return avgMemoryUtilization; + } + + public void setAvgMemoryUtilization(Double avgMemoryUtilization) { + this.avgMemoryUtilization = avgMemoryUtilization; + } + + /** + * Maximum memory consumption (as percentage of total memory) for the entire + * cluster during the report window. This includes consumption by user + * workloads in YARN and Impala, as well as consumption by all services + * running in the cluster. + */ + @XmlElement + public Double getMaxMemoryUtilization() { + return maxMemoryUtilization; + } + + public void setMaxMemoryUtilization(Double maxMemoryUtilization) { + this.maxMemoryUtilization = maxMemoryUtilization; + } + + /** + * Average daily peak memory consumption (as percentage of total memory) for + * the entire cluster during the report window. This includes consumption by + * user workloads in YARN and Impala, as well as consumption by all services + * running in the cluster. + */ + @XmlElement + public Double getAvgMemoryDailyPeak() { + return avgMemoryDailyPeak; + } + + public void setAvgMemoryDailyPeak(Double avgMemoryDailyPeak) { + this.avgMemoryDailyPeak = avgMemoryDailyPeak; + } + + /** + * Average memory consumption (as percentage of total memory) by workloads + * that ran on the cluster during the report window. This includes consumption + * by user workloads in YARN and Impala. + */ + @XmlElement + public Double getAvgWorkloadMemory() { + return avgWorkloadMemory; + } + + public void setAvgWorkloadMemory(Double avgWorkloadMemory) { + this.avgWorkloadMemory = avgWorkloadMemory; + } + + /** + * Maximum memory consumption (as percentage of total memory) by workloads + * that ran on the cluster. This includes consumption by user workloads in + * YARN and Impala + */ + @XmlElement + public Double getMaxWorkloadMemory() { + return maxWorkloadMemory; + } + + public void setMaxWorkloadMemory(Double maxWorkloadMemory) { + this.maxWorkloadMemory = maxWorkloadMemory; + } + + /** + * Average daily peak memory consumption (as percentage of total memory) by + * workloads that ran on the cluster during the report window. This includes + * consumption by user workloads in YARN and Impala. + */ + @XmlElement + public Double getAvgWorkloadMemoryDailyPeak() { + return avgWorkloadMemoryDailyPeak; + } + + public void setAvgWorkloadMemoryDailyPeak( + Double avgWorkloadMemoryDailyPeak) { + this.avgWorkloadMemoryDailyPeak = avgWorkloadMemoryDailyPeak; + } + + /** + * A list of tenant utilization reports. + */ + @XmlElement + public ApiTenantUtilizationList getTenantUtilizations() { + return tenantUtilizations; + } + + public void setTenantUtilizations( + ApiTenantUtilizationList tenantUtilizations) { + this.tenantUtilizations = tenantUtilizations; + } + + /** + * Timestamp corresponding to maximum CPU utilization for the entire cluster + * during the report window. + */ + @XmlElement + public Long getMaxCpuUtilizationTimestampMs() { + return maxCpuUtilizationTimestampMs; + } + + public void setMaxCpuUtilizationTimestampMs(Long maxCpuUtilizationTimestampMs) { + this.maxCpuUtilizationTimestampMs = maxCpuUtilizationTimestampMs; + } + + /** + * Timestamp corresponding to maximum memory utilization for the entire + * cluster during the report window. + */ + @XmlElement + public Long getMaxMemoryUtilizationTimestampMs() { + return maxMemoryUtilizationTimestampMs; + } + + public void setMaxMemoryUtilizationTimestampMs(Long maxMemoryUtilizationTimestampMs) { + this.maxMemoryUtilizationTimestampMs = maxMemoryUtilizationTimestampMs; + } + + /** + * Timestamp corresponds to maximum CPU consumption by workloads that + * ran on the cluster during the report window. + */ + @XmlElement + public Long getMaxWorkloadCpuTimestampMs() { + return maxWorkloadCpuTimestampMs; + } + + public void setMaxWorkloadCpuTimestampMs(Long maxWorkloadCpuTimestampMs) { + this.maxWorkloadCpuTimestampMs = maxWorkloadCpuTimestampMs; + } + + + /** + * Timestamp corresponds to maximum memory resource consumption by workloads that + * ran on the cluster during the report window. + */ + @XmlElement + public Long getMaxWorkloadMemoryTimestampMs() { + return maxWorkloadMemoryTimestampMs; + } + + public void setMaxWorkloadMemoryTimestampMs(Long maxWorkloadMemoryTimestampMs) { + this.maxWorkloadMemoryTimestampMs = maxWorkloadMemoryTimestampMs; + } + + /** + * Error message while generating utilization report. + */ + @XmlElement + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("totalCpuCores", totalCpuCores) + .add("avgCpuUtilization", avgCpuUtilization) + .add("maxCpuUtilization", maxCpuUtilization) + .add("avgCpuDailyPeak", avgCpuDailyPeak) + .add("avgWorkloadCpu", avgWorkloadCpu) + .add("maxWorkloadCpu", maxWorkloadCpu) + .add("avgWorkloadCpuDailyPeak", avgWorkloadCpuDailyPeak) + .add("totalMemory", totalMemory) + .add("avgMemoryUtilization", avgMemoryUtilization) + .add("maxMemoryUtilization", maxMemoryUtilization) + .add("avgMemoryDailyPeak", avgMemoryDailyPeak) + .add("avgWorkloadMemory", avgWorkloadMemory) + .add("maxWorkloadMemory", maxWorkloadMemory) + .add("avgWorkloadMemoryDailyPeak", avgWorkloadMemoryDailyPeak) + .add("maxWorkloadCpuTimestampMs", maxWorkloadCpuTimestampMs) + .add("maxWorkloadMemoryTimestampMs", maxWorkloadMemoryTimestampMs) + .add("maxCpuUtilizationTimestampMs", maxCpuUtilizationTimestampMs) + .add("maxMemoryUtilizationTimestampMs", maxMemoryUtilizationTimestampMs) + .add("tenantUtilizations", tenantUtilizations) + .add("errorMessage", errorMessage) + .toString(); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiClusterVersion.java b/java/src/main/java/com/cloudera/api/model/ApiClusterVersion.java index 2a2b99dd..d89d0762 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiClusterVersion.java +++ b/java/src/main/java/com/cloudera/api/model/ApiClusterVersion.java @@ -21,6 +21,7 @@ /** * The CDH version of the cluster. */ +@Deprecated public enum ApiClusterVersion { /** CDH3 version. CDH3 is not supported as of CM 5.0. */ @Deprecated @@ -32,6 +33,8 @@ public enum ApiClusterVersion { CDH4, /** CDH5 version */ CDH5, + /** CDH6 version */ + CDH6, /** Unknown version. */ UNKNOWN; 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/ApiCommissionState.java b/java/src/main/java/com/cloudera/api/model/ApiCommissionState.java index d4d42079..ad9e9b4d 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiCommissionState.java +++ b/java/src/main/java/com/cloudera/api/model/ApiCommissionState.java @@ -23,5 +23,7 @@ public enum ApiCommissionState { COMMISSIONED, DECOMMISSIONING, DECOMMISSIONED, - UNKNOWN; + UNKNOWN, + OFFLINING, + OFFLINED; } 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/ApiDisableSentryHaArgs.java b/java/src/main/java/com/cloudera/api/model/ApiDisableSentryHaArgs.java new file mode 100644 index 00000000..6e5699b2 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiDisableSentryHaArgs.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 com.cloudera.api.ApiUtils; +import com.google.common.base.Objects; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Arguments used for disable Sentry HA API call. + */ +@XmlRootElement(name = "disableSentryHaArgs") +public class ApiDisableSentryHaArgs { + private String activeName; + + /** Name of the single role that will remain active after HA is disabled. */ + @XmlElement + public String getActiveName() { + return activeName; + } + + public void setActiveName(String activeName) { + this.activeName = activeName; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("activeName", activeName) + .toString(); + } + + @Override + public boolean equals(Object o) { + ApiDisableSentryHaArgs that = ApiUtils.baseEquals(this, o); + return this == that || (that != null && + Objects.equal(activeName, that.getActiveName())); + } + + @Override + public int hashCode() { + return Objects.hashCode(activeName); + } + +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiEnableOozieHaArguments.java b/java/src/main/java/com/cloudera/api/model/ApiEnableOozieHaArguments.java index 61d09a9d..85fac343 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiEnableOozieHaArguments.java +++ b/java/src/main/java/com/cloudera/api/model/ApiEnableOozieHaArguments.java @@ -30,7 +30,10 @@ public class ApiEnableOozieHaArguments { private List newOozieServerHostIds; private List newOozieServerRoleNames; private String zkServiceName; - private String loadBalancerHostPort; + private String loadBalancerHostname; + private Long loadBalancerPort; + private Long loadBalancerSslPort; + @Deprecated private String loadBalancerHostPort; /** IDs of the hosts on which new Oozie Servers will be added. */ @XmlElement @@ -69,15 +72,63 @@ public void setZkServiceName(String zkServiceName) { this.zkServiceName = zkServiceName; } - /** + /** + * Hostname of the load balancer used for Oozie HA. + * Optional if load balancer host and ports are already set in CM. + * @since API v19 + */ + @XmlElement + public String getLoadBalancerHostname() { + return loadBalancerHostname; + } + + public void setLoadBalancerHostname(String loadBalancerHostname) { + this.loadBalancerHostname = loadBalancerHostname; + } + + /** + * HTTP port of the load balancer used for Oozie HA. + * Optional if load balancer host and ports are already set in CM. + * @since API v19 + */ + @XmlElement + public Long getLoadBalancerPort() { + return loadBalancerPort; + } + + public void setLoadBalancerPort(Long loadBalancerPort) { + this.loadBalancerPort = loadBalancerPort; + } + + /** + * HTTPS port of the load balancer used for Oozie HA when SSL is enabled. + * This port is only used for oozie.base.url -- the callback is always + * on HTTP. + * Optional if load balancer host and ports are already set in CM. + * @since API v19 + */ + @XmlElement + public Long getLoadBalancerSslPort() { + return loadBalancerSslPort; + } + + public void setLoadBalancerSslPort(Long loadBalancerSslPort) { + this.loadBalancerSslPort = loadBalancerSslPort; + } + + /** * Address of the load balancer used for Oozie HA. * This is an optional parameter if this config is already set in CM. + * @deprecated Since API v19. Instead use {@link #setLoadBalancerHostname}, {@link #setLoadBalancerPort} + * and {@link #setLoadBalancerSslPort}. Will be removed in API v30 */ @XmlElement + @Deprecated public String getLoadBalancerHostPort() { return loadBalancerHostPort; } + @Deprecated public void setLoadBalancerHostPort(String loadBalancerHostPort) { this.loadBalancerHostPort = loadBalancerHostPort; } @@ -88,6 +139,9 @@ public int hashCode() { newOozieServerHostIds, newOozieServerRoleNames, zkServiceName, + loadBalancerHostname, + loadBalancerPort, + loadBalancerSslPort, loadBalancerHostPort); } @@ -97,6 +151,9 @@ public String toString() { .add("newOozieServerHostIds", newOozieServerHostIds) .add("newOozieServerRoleNames", newOozieServerRoleNames) .add("zkServiceName", zkServiceName) + .add("loadBalancerHostname", loadBalancerHostname) + .add("loadBalancerPort", loadBalancerPort) + .add("loadBalancerSslPort", loadBalancerSslPort) .add("loadBalancerHostPort", loadBalancerHostPort) .toString(); } @@ -108,6 +165,9 @@ public boolean equals(Object o) { && Objects.equal(this.newOozieServerHostIds, that.getNewOozieServerHostIds()) && Objects.equal(this.newOozieServerRoleNames, that.getNewOozieServerRoleNames()) && Objects.equal(this.zkServiceName, that.getZkServiceName()) + && Objects.equal(this.loadBalancerHostname, that.getLoadBalancerHostname()) + && Objects.equal(this.loadBalancerPort, that.getLoadBalancerPort()) + && Objects.equal(this.loadBalancerSslPort, that.getLoadBalancerSslPort()) && Objects.equal(this.loadBalancerHostPort, that.getLoadBalancerHostPort())); } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiEnableSentryHaArgs.java b/java/src/main/java/com/cloudera/api/model/ApiEnableSentryHaArgs.java new file mode 100644 index 00000000..8c6ff3b7 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiEnableSentryHaArgs.java @@ -0,0 +1,107 @@ +// 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 for enable Sentry HA command. + */ +@XmlRootElement(name = "enableSentryHaArgs") +public class ApiEnableSentryHaArgs { + private String newSentryHostId; + private String newSentryRoleName; + private String zkServiceName; + private ApiSimpleRollingRestartClusterArgs rrcArgs; + + /** + * Id of host on which new Sentry Server role will be added. + */ + @XmlElement + public String getNewSentryHostId() { + return newSentryHostId; + } + + public void setNewSentryHostId(String newSentryHostId) { + this.newSentryHostId = newSentryHostId; + } + + /** + * Name of the new Sentry Server role to be created. This is an + * optional argument. + */ + @XmlElement + public String getNewSentryRoleName() { + return newSentryRoleName; + } + + public void setNewSentryRoleName(String newSentryRoleName) { + this.newSentryRoleName = newSentryRoleName; + } + + /** + * Name of the ZooKeeper service that will be used for Sentry HA. + * This is an optional parameter if the Sentry to ZooKeeper dependency is + * already set in CM. + */ + @XmlElement + public String getZkServiceName() { + return zkServiceName; + } + + public void setZkServiceName(String zkServiceName) { + this.zkServiceName = zkServiceName; + } + + public ApiSimpleRollingRestartClusterArgs getRrcArgs() { + return rrcArgs; + } + + public void setRrcArgs( + ApiSimpleRollingRestartClusterArgs rrcArgs) { + this.rrcArgs = rrcArgs; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("newSentryHostId", newSentryHostId) + .add("newSentryRoleName", newSentryRoleName) + .add("zkServiceName", zkServiceName) + .add("rrcArgs", rrcArgs) + .toString(); + } + + @Override + public boolean equals(Object o) { + ApiEnableSentryHaArgs that = ApiUtils.baseEquals(this, o); + return this == that || (that != null && + Objects.equal(newSentryHostId, that.getNewSentryHostId()) && + Objects.equal(newSentryRoleName, that.getNewSentryRoleName()) && + Objects.equal(zkServiceName, that.getZkServiceName()) && + Objects.equal(rrcArgs, that.getRrcArgs())); + } + + @Override + public int hashCode() { + return Objects.hashCode(newSentryHostId, newSentryRoleName, + zkServiceName, rrcArgs); + } +} 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..1503dead 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. @@ -32,6 +35,7 @@ public class ApiHdfsReplicationArguments { private String mapreduceServiceName; private String schedulerPoolName; private String userName; + private String sourceUser; private Integer numMaps; private boolean dryRun; private Integer bandwidthPerMap; @@ -42,9 +46,12 @@ public class ApiHdfsReplicationArguments { private boolean preservePermissions; private String logPath; private boolean skipChecksumChecks; + private Boolean skipListingChecksumChecks; private Boolean skipTrash; private ReplicationStrategy replicationStrategy; private Boolean preserveXAttrs; + private List exclusionFilters; + private Boolean raiseSnapshotDiffFailures; /** * The strategy for distributing the file replication tasks among the mappers @@ -146,6 +153,19 @@ public void setUserName(String userName) { this.userName = userName; } + /** + * The user which will perform operations on source cluster. Required if + * running with Kerberos enabled. + */ + @XmlElement + public String getSourceUser() { + return sourceUser; + } + + public void setSourceUser(String sourceUser) { + this.sourceUser = sourceUser; + } + /** The number of mappers to use for the mapreduce replication job. */ @XmlElement public Integer getNumMaps() { @@ -249,7 +269,7 @@ public void setLogPath(String logPath) { } /** - * Whether to skip checksum based file validation/comparison during + * Whether to skip checksum based file validation during * replication. Defaults to false. */ @XmlElement @@ -261,6 +281,19 @@ public void setSkipChecksumChecks(boolean skipChecksumChecks) { this.skipChecksumChecks = skipChecksumChecks; } + /** + * Whether to skip checksum based file comparison during + * replication. Defaults to false. + */ + @XmlElement + public Boolean getSkipListingChecksumChecks() { + return skipListingChecksumChecks; + } + + public void setSkipListingChecksumChecks(Boolean skipListingChecksumChecks) { + this.skipListingChecksumChecks = skipListingChecksumChecks; + } + /** * Whether to permanently delete destination files that are missing in source. * Defaults to null. @@ -277,7 +310,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 +336,59 @@ 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; + } + + @XmlElement + public Boolean getRaiseSnapshotDiffFailures() { + return raiseSnapshotDiffFailures; + } + + public void setRaiseSnapshotDiffFailures(Boolean raiseSnapshotDiffFailures) { + this.raiseSnapshotDiffFailures = raiseSnapshotDiffFailures; + } + + 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("skipListingChecksumChecks", skipListingChecksumChecks) + .add("skipTrash", skipTrash) + .add("replicationStrategy", replicationStrategy) + .add("preserveXAttrs", preserveXAttrs) + .add("exclusionFilters", exclusionFilters) + .add("sourceUser", sourceUser) + .add("raiseSnapshotDiffFailures", raiseSnapshotDiffFailures); + } + @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 @@ -346,9 +410,13 @@ public boolean equals(Object o) { preservePermissions == other.getPreservePermissions() && Objects.equal(logPath, other.getLogPath()) && skipChecksumChecks == other.getSkipChecksumChecks() && + Objects.equal(skipListingChecksumChecks, other.getSkipListingChecksumChecks()) && 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()) && + Objects.equal(sourceUser, other.getSourceUser()) && + Objects.equal(raiseSnapshotDiffFailures, other.getRaiseSnapshotDiffFailures()); } @Override @@ -358,6 +426,7 @@ public int hashCode() { bandwidthPerMap, abortOnError, removeMissingFiles, preserveReplicationCount, preserveBlockSize, preservePermissions, logPath, skipChecksumChecks, skipTrash, replicationStrategy, - preserveXAttrs); + preserveXAttrs, exclusionFilters, sourceUser, raiseSnapshotDiffFailures, + skipListingChecksumChecks); } } 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..89e10030 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationResult.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationResult.java @@ -18,6 +18,7 @@ import com.cloudera.api.ApiUtils; import com.google.common.base.Objects; +import java.util.Date; import java.util.List; import javax.xml.bind.annotation.XmlElement; @@ -31,6 +32,9 @@ public class ApiHdfsReplicationResult { private int progress; + private double throughput; + private int remainingTime; + private Date estimatedCompletionTime; private List counters; private long numBytesDryRun; private long numFilesDryRun; @@ -48,6 +52,9 @@ public class ApiHdfsReplicationResult { private String jobDetailsUri; private boolean dryRun; private List snapshottedDirs; + private List failedFiles; + private String runAsUser; + private String runOnSourceAsUser; /** The file copy progress percentage. */ @XmlElement @@ -59,6 +66,36 @@ public void setProgress(int progress) { this.progress = progress; } + /** The data throughput in KB/s. */ + @XmlElement + public double getThroughput() { + return throughput; + } + + public void setThroughput(double througput) { + this.throughput = througput; + } + + /** The time remaining for mapper phase (seconds). */ + @XmlElement + public int getRemainingTime() { + return remainingTime; + } + + public void setRemainingTime(int remainingTime) { + this.remainingTime = remainingTime; + } + + /** The estimated completion time for the mapper phase. */ + @XmlElement + public Date getEstimatedCompletionTime() { + return estimatedCompletionTime; + } + + public void setEstimatedCompletionTime(Date estimatedCompletionTime) { + this.estimatedCompletionTime = estimatedCompletionTime; + } + /** * The counters collected from the replication job. *

@@ -257,31 +294,83 @@ 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; + } + + /** + * Returns run-as user name for source cluster. + * Available since API v18. + */ + @XmlElement + public String getRunOnSourceAsUser() { + return runOnSourceAsUser; + } + + public void setRunOnSourceAsUser(String runOnSourceAsUser) { + this.runOnSourceAsUser = runOnSourceAsUser; + } + + /** + * 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); return this == that || (that != null && Objects.equal(progress, that.getProgress()) && + Objects.equal(throughput, that.getThroughput()) && + Objects.equal(remainingTime, that.getRemainingTime()) && + Objects.equal(estimatedCompletionTime, that.getEstimatedCompletionTime()) && 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()) && + Objects.equal(runOnSourceAsUser, that.getRunOnSourceAsUser()); } @Override public int hashCode() { - return Objects.hashCode(progress, counters, setupError, dryRun, - snapshottedDirs); + return Objects.hashCode(progress, throughput, remainingTime, + estimatedCompletionTime, counters, setupError, dryRun, snapshottedDirs, + failedFiles, runAsUser, runOnSourceAsUser); } @Override public String toString() { return Objects.toStringHelper(this) .add("progress", progress) + .add("throughput", throughput) + .add("remainingTime", remainingTime) + .add("estimatedCompletionTime", estimatedCompletionTime) .add("counters", counters) .add("setupError", setupError) .add("dryRun", dryRun) .add("snapshottedDirs", snapshottedDirs) + .add("failedFiles", failedFiles) + .add("runAsUser", runAsUser) + .add("runOnSourceAsUser", runOnSourceAsUser) .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..3aa0ef41 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationArguments.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationArguments.java @@ -41,6 +41,10 @@ public class ApiHiveReplicationArguments { private boolean dryRun; + private Boolean runInvalidateMetadata; + + private Integer numThreads; + public ApiHiveReplicationArguments() { // For JAX-B } @@ -145,6 +149,18 @@ public void setReplicateImpalaMetadata(Boolean replicateImpalaMetadata) { this.replicateImpalaMetadata = replicateImpalaMetadata; } + /** + * Whether to run invalidate metadata query or not + */ + @XmlElement + public Boolean getRunInvalidateMetadata() { + return runInvalidateMetadata; + } + + public void setRunInvalidateMetadata(Boolean runInvalidateMetadata) { + this.runInvalidateMetadata = runInvalidateMetadata; + } + /** Whether to perform a dry run. Defaults to false. */ @XmlElement public boolean isDryRun() { @@ -155,8 +171,17 @@ public void setDryRun(boolean dryRun) { this.dryRun = dryRun; } - @Override - public String toString() { + /** Number of threads to use in multi-threaded export/import phase */ + @XmlElement + public Integer getNumThreads() { + return numThreads; + } + + public void setNumThreads(Integer numThreads) { + this.numThreads = numThreads; + } + + protected Objects.ToStringHelper toStringHelper() { return Objects.toStringHelper(this) .add("sourceService", sourceService) .add("tableFilters", tableFilters) @@ -166,28 +191,36 @@ public String toString() { .add("hdfsArguments", hdfsArguments) .add("replicateImpalaMetadata", replicateImpalaMetadata) .add("dryRun", dryRun) - .toString(); + .add("numThreads", numThreads) + .add("runInvalidateMetadata", runInvalidateMetadata); + } + + @Override + public String toString() { + return toStringHelper().toString(); } @Override public boolean equals(Object o) { ApiHiveReplicationArguments that = ApiUtils.baseEquals(this, o); return this == that || (that != null && - Objects.equal(sourceService, that.getSourceService()) && - Objects.equal(tableFilters, that.getTableFilters()) && - Objects.equal(exportDir, that.getExportDir()) && - force == that.getForce() && - replicateData == that.getReplicateData() && - Objects.equal(hdfsArguments, that.getHdfsArguments()) && - Objects.equal(replicateImpalaMetadata, - that.getReplicateImpalaMetadata()) && - dryRun == that.isDryRun()); + Objects.equal(sourceService, that.getSourceService()) + && Objects.equal(tableFilters, that.getTableFilters()) + && Objects.equal(exportDir, that.getExportDir()) + && force == that.getForce() && replicateData == that.getReplicateData() + && Objects.equal(hdfsArguments, that.getHdfsArguments()) + && Objects.equal(replicateImpalaMetadata, + that.getReplicateImpalaMetadata()) + && dryRun == that.isDryRun() + && Objects.equal(numThreads, that.numThreads) + && Objects.equal(runInvalidateMetadata, that.runInvalidateMetadata)); } @Override public int hashCode() { return Objects.hashCode(sourceService, tableFilters, exportDir, force, - replicateData, hdfsArguments, replicateImpalaMetadata, dryRun); + replicateData, hdfsArguments, replicateImpalaMetadata, dryRun, + numThreads, runInvalidateMetadata); } } 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..e6c3eb48 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,27 @@ 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; + private String runOnSourceAsUser; + private boolean statsAvailable; + private long dbProcessed; + private long tableProcessed; + private long partitionProcessed; + private long functionProcessed; + private long indexProcessed; + private long statsProcessed; + private long dbExpected; + private long tableExpected; + private long partitionExpected; + private long functionExpected; + private long indexExpected; + private long statsExpected; public ApiHiveReplicationResult() { // For JAX-B @@ -104,6 +121,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 +147,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 +208,201 @@ 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; + } + + /** + * Name of the source proxy user, if any. + * Available since API v18. + */ + @XmlElement + public String getRunOnSourceAsUser() { + return runOnSourceAsUser; + } + + public void setRunOnSourceAsUser(String runOnSourceAsUser) { + this.runOnSourceAsUser = runOnSourceAsUser; + } + + /** + * Whether stats are available to display or not. + * Available since API v19. + */ + @XmlElement + public boolean isStatsAvailable() { + return statsAvailable; + } + + public void setStatsAvailable(boolean statsAvailable) { + this.statsAvailable = statsAvailable; + } + + /** + * Number of Db's Imported/Exported. + * Available since API v19. + */ + @XmlElement + public long getDbProcessed() { + return dbProcessed; + } + + public void setDbProcessed(long dbProcessed) { + this.dbProcessed = dbProcessed; + } + + /** + * Number of Tables Imported/Exported. + * Available since API v19. + */ + @XmlElement + public long getTableProcessed() { + return tableProcessed; + } + + public void setTableProcessed(long tableProcessed) { + this.tableProcessed = tableProcessed; + } + + /** + * Number of Partitions Imported/Exported. + * Available since API v19. + */ + @XmlElement + public long getPartitionProcessed() { + return partitionProcessed; + } + + public void setPartitionProcessed(long partitionProcessed) { + this.partitionProcessed = partitionProcessed; + } + + /** + * Number of Functions Imported/Exported. + * Available since API v19. + */ + @XmlElement + public long getFunctionProcessed() { + return functionProcessed; + } + + public void setFunctionProcessed(long functionProcessed) { + this.functionProcessed = functionProcessed; + } + + /** + * Number of Indexes Imported/Exported. + * Available since API v19. + */ + @XmlElement + public long getIndexProcessed() { + return indexProcessed; + } + + public void setIndexProcessed(long indexProcessed) { + this.indexProcessed = indexProcessed; + } + + /** + * Number of Table and Partitions Statistics Imported/Exported. + * Available since API v19. + */ + @XmlElement + public long getStatsProcessed() { + return statsProcessed; + } + + public void setStatsProcessed(long statsProcessed) { + this.statsProcessed = statsProcessed; + } + + /** + * Number of Db's Expected. + * Available since API v19. + */ + @XmlElement + public long getDbExpected() { + return dbExpected; + } + + public void setDbExpected(long dbExpected) { + this.dbExpected = dbExpected; + } + + /** + * Number of Tables Expected. + * Available since API v19. + */ + @XmlElement + public long getTableExpected() { + return tableExpected; + } + + public void setTableExpected(long tableExpected) { + this.tableExpected = tableExpected; + } + + /** + * Number of Partitions Expected. + * Available since API v19. + */ + @XmlElement + public long getPartitionExpected() { + return partitionExpected; + } + + public void setPartitionExpected(long partitionExpected) { + this.partitionExpected = partitionExpected; + } + + /** + * Number of Functions Expected. + * Available since API v19. + */ + @XmlElement + public long getFunctionExpected() { + return functionExpected; + } + + public void setFunctionExpected(long functionExpected) { + this.functionExpected = functionExpected; + } + + /** + * Number of Indexes Expected. + * Available since API v19. + */ + @XmlElement + public long getIndexExpected() { + return indexExpected; + } + + public void setIndexExpected(long indexExpected) { + this.indexExpected = indexExpected; + } + + /** + * Number of Table and Partition Statistics Expected. + * Available since API v19. + */ + @XmlElement + public long getStatsExpected() { + return statsExpected; + } + + public void setStatsExpected(long statsExpected) { + this.statsExpected = statsExpected; + } + @Override public boolean equals(Object o) { ApiHiveReplicationResult that = ApiUtils.baseEquals(this, o); @@ -171,13 +410,17 @@ 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()) && + Objects.equal(runOnSourceAsUser, that.getRunOnSourceAsUser())); } @Override public int hashCode() { - return Objects.hashCode(phase, tables, impalaUDFs, errors, dryRun); + return Objects.hashCode(phase, tables, impalaUDFs, hiveUDFs, errors, dryRun, + runAsUser, runOnSourceAsUser); } @Override @@ -186,8 +429,11 @@ public String toString() { .add("phase", phase) .add("tables", tables) .add("impalaUDFs", impalaUDFs) + .add("hiveUDFs", hiveUDFs) .add("errors", errors) .add("dryRun", dryRun) + .add("runAsUser", runAsUser) + .add("runOnSourceAsUser", runOnSourceAsUser) .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..7d066d07 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,8 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; + +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -49,6 +51,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 +85,7 @@ public ApiHost(ApiHost host) { this.numCores = host.getNumCores(); this.numPhysicalCores = host.getNumPhysicalCores(); this.totalPhysMemBytes = host.getTotalPhysMemBytes(); + this.clusterRef = host.clusterRef; } @Override @@ -94,6 +99,7 @@ public String toString() { .add("healthSummary", healthSummary) .add("healthChecks", healthChecks) .add("roleRefs", roleRefs) + .add("clusterRef", clusterRef) .toString(); } @@ -255,7 +261,9 @@ public List getMaintenanceOwners() { } public void setMaintenanceOwners(List maintenanceOwners) { - this.maintenanceOwners = Lists.newArrayList(maintenanceOwners); + this.maintenanceOwners = (null == maintenanceOwners) + ? new ArrayList() + : Lists.newArrayList(maintenanceOwners); } @XmlElement @@ -308,4 +316,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/ApiHostRecommissionType.java b/java/src/main/java/com/cloudera/api/model/ApiHostRecommissionType.java new file mode 100644 index 00000000..d952ad7d --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiHostRecommissionType.java @@ -0,0 +1,26 @@ +// Copyright (c) 2017 Cloudera, Inc. All rights reserved. + +package com.cloudera.api.model; + +import com.google.common.base.Joiner; + +public enum ApiHostRecommissionType { + RECOMMISSION, + RECOMMISSION_WITH_START; + + private static final String SUPPORTED_TYPES = + Joiner.on(", ").join(values()).toLowerCase(); + + public static ApiHostRecommissionType fromString(String s) { + if (s == null || s.isEmpty()) { + return RECOMMISSION; + } + try { + return valueOf(s.toUpperCase()); + } catch (IllegalArgumentException t) { + throw new IllegalArgumentException( + String.format("Illegal type='%s'. Supported types: %s", + SUPPORTED_TYPES)); + } + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiImpalaTenantUtilization.java b/java/src/main/java/com/cloudera/api/model/ApiImpalaTenantUtilization.java new file mode 100644 index 00000000..7d66c6d3 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiImpalaTenantUtilization.java @@ -0,0 +1,357 @@ +// 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 javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Utilization report information of a tenant of Impala application. + */ +@XmlRootElement(name = "impalaTenantUtilization") +public class ApiImpalaTenantUtilization { + private String tenantName; + private Double totalQueries; + private Double successfulQueries; + private Double oomQueries; + private Double timeOutQueries; + private Double rejectedQueries; + private Double avgWaitTimeInQueue; + private Long peakAllocationTimestampMS; + private Double maxAllocatedMemory; + private Double maxAllocatedMemoryPercentage; + private Double utilizedAtMaxAllocated; + private Double utilizedAtMaxAllocatedPercentage; + private Long peakUsageTimestampMS; + private Double maxUtilizedMemory; + private Double maxUtilizedMemoryPercentage; + private Double allocatedAtMaxUtilized; + private Double allocatedAtMaxUtilizedPercentage; + private ApiImpalaUtilizationHistogram distributionAllocatedByImpalaDaemon; + private ApiImpalaUtilizationHistogram distributionUtilizedByImpalaDaemon; + private Double avgSpilledMemory; + private Double maxSpilledMemory; + + public ApiImpalaTenantUtilization() { + // For JAX-B + } + + /** + * Name of the tenant. + */ + @XmlElement + public String getTenantName() { + return tenantName; + } + + public void setTenantName( + String tenantName) { + this.tenantName = tenantName; + } + + /** + * Total number of queries submitted to Impala. + */ + @XmlElement + public Double getTotalQueries() { + return totalQueries; + } + + public void setTotalQueries( + Double totalQueries) { + this.totalQueries = totalQueries; + } + + /** + * Number of queries that finished successfully. + */ + @XmlElement + public Double getSuccessfulQueries() { + return successfulQueries; + } + + public void setSuccessfulQueries( + Double successfulQueries) { + this.successfulQueries = successfulQueries; + } + + /** + * Number of queries that failed due to insufficient memory. + */ + @XmlElement + public Double getOomQueries() { + return oomQueries; + } + + public void setOomQueries( + Double oomQueries) { + this.oomQueries = oomQueries; + } + + /** + * Number of queries that timed out while waiting for resources in a pool. + */ + @XmlElement + public Double getTimeOutQueries() { + return timeOutQueries; + } + + public void setTimeOutQueries( + Double timeOutQueries) { + this.timeOutQueries = timeOutQueries; + } + + /** + * Number of queries that were rejected by Impala because the pool was full. + */ + @XmlElement + public Double getRejectedQueries() { + return rejectedQueries; + } + + public void setRejectedQueries( + Double rejectedQueries) { + this.rejectedQueries = rejectedQueries; + } + + /** + * Average time, in milliseconds, spent by a query in an Impala pool while waiting for resources. + */ + @XmlElement + public Double getAvgWaitTimeInQueue() { + return avgWaitTimeInQueue; + } + + public void setAvgWaitTimeInQueue( + Double avgWaitTimeInQueue) { + this.avgWaitTimeInQueue = avgWaitTimeInQueue; + } + + /** + * The time when Impala reserved the maximum amount of memory for queries. + */ + @XmlElement + public Long getPeakAllocationTimestampMS() { + return peakAllocationTimestampMS; + } + + public void setPeakAllocationTimestampMS( + Long peakAllocationTimestampMS) { + this.peakAllocationTimestampMS = peakAllocationTimestampMS; + } + + /** + * The maximum memory (in bytes) that was reserved by Impala for executing queries. + */ + @XmlElement + public Double getMaxAllocatedMemory() { + return maxAllocatedMemory; + } + + public void setMaxAllocatedMemory( + Double maxAllocatedMemory) { + this.maxAllocatedMemory = maxAllocatedMemory; + } + + /** + * The maximum percentage of memory that was reserved by Impala for executing queries. + */ + @XmlElement + public Double getMaxAllocatedMemoryPercentage() { + return maxAllocatedMemoryPercentage; + } + + public void setMaxAllocatedMemoryPercentage( + Double maxAllocatedMemoryPercentage) { + this.maxAllocatedMemoryPercentage = maxAllocatedMemoryPercentage; + } + + /** + * The amount of memory (in bytes) used by Impala for running queries at the + * time when maximum memory was reserved. + */ + @XmlElement + public Double getUtilizedAtMaxAllocated() { + return utilizedAtMaxAllocated; + } + + public void setUtilizedAtMaxAllocated( + Double utilizedAtMaxAllocated) { + this.utilizedAtMaxAllocated = utilizedAtMaxAllocated; + } + + /** + * The percentage of memory used by Impala for running queries at the + * time when maximum memory was reserved. + */ + @XmlElement + public Double getUtilizedAtMaxAllocatedPercentage() { + return utilizedAtMaxAllocatedPercentage; + } + + public void setUtilizedAtMaxAllocatedPercentage( + Double utilizedAtMaxAllocatedPercentage) { + this.utilizedAtMaxAllocatedPercentage = utilizedAtMaxAllocatedPercentage; + } + + /** + * The time when Impala used the maximum amount of memory for queries. + */ + @XmlElement + public Long getPeakUsageTimestampMS() { + return peakUsageTimestampMS; + } + + public void setPeakUsageTimestampMS( + Long peakUsageTimestampMS) { + this.peakUsageTimestampMS = peakUsageTimestampMS; + } + + /** + * The maximum memory (in bytes) that was used by Impala for executing queries. + */ + @XmlElement + public Double getMaxUtilizedMemory() { + return maxUtilizedMemory; + } + + public void setMaxUtilizedMemory( + Double maxUtilizedMemory) { + this.maxUtilizedMemory = maxUtilizedMemory; + } + + /** + * The maximum percentage of memory that was used by Impala for executing queries. + */ + @XmlElement + public Double getMaxUtilizedMemoryPercentage() { + return maxUtilizedMemoryPercentage; + } + + public void setMaxUtilizedMemoryPercentage( + Double maxUtilizedMemoryPercentage) { + this.maxUtilizedMemoryPercentage = maxUtilizedMemoryPercentage; + } + + /** + * The amount of memory (in bytes) reserved by Impala at the time when it was using the + * maximum memory for executing queries. + */ + @XmlElement + public Double getAllocatedAtMaxUtilized() { + return allocatedAtMaxUtilized; + } + + public void setAllocatedAtMaxUtilized( + Double allocatedAtMaxUtilized) { + this.allocatedAtMaxUtilized = allocatedAtMaxUtilized; + } + + /** + * The percentage of memory reserved by Impala at the time when it was using the + * maximum memory for executing queries. + */ + @XmlElement + public Double getAllocatedAtMaxUtilizedPercentage() { + return allocatedAtMaxUtilizedPercentage; + } + + public void setAllocatedAtMaxUtilizedPercentage( + Double allocatedAtMaxUtilizedPercentage) { + this.allocatedAtMaxUtilizedPercentage = allocatedAtMaxUtilizedPercentage; + } + + /** + * Distribution of memory used per Impala daemon for executing queries at + * the time Impala used the maximum memory. + */ + @XmlElement + public ApiImpalaUtilizationHistogram getDistributionUtilizedByImpalaDaemon() { + return distributionUtilizedByImpalaDaemon; + } + + public void setDistributionUtilizedByImpalaDaemon(ApiImpalaUtilizationHistogram distributionUtilizedByImpalad) { + this.distributionUtilizedByImpalaDaemon = distributionUtilizedByImpalad; + } + + /** + * Distribution of memory reserved per Impala daemon for executing queries at + * the time Impala used the maximum memory. + */ + @XmlElement + public ApiImpalaUtilizationHistogram getDistributionAllocatedByImpalaDaemon() { + return distributionAllocatedByImpalaDaemon; + } + + public void setDistributionAllocatedByImpalaDaemon(ApiImpalaUtilizationHistogram distributionAllocatedByImpalad) { + this.distributionAllocatedByImpalaDaemon = distributionAllocatedByImpalad; + } + + /** + * Average spill per query. + */ + @XmlElement + public Double getAvgSpilledMemory() { + return avgSpilledMemory; + } + + public void setAvgSpilledMemory( + Double avgSpilledMemory) { + this.avgSpilledMemory = avgSpilledMemory; + } + + /** + * Maximum spill per query. + */ + @XmlElement + public Double getMaxSpilledMemory() { + return maxSpilledMemory; + } + + public void setMaxSpilledMemory( + Double maxSpilledMemory) { + this.maxSpilledMemory = maxSpilledMemory; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("tenantName", tenantName) + .add("totalQueries", totalQueries) + .add("successfulQueries", successfulQueries) + .add("oomQueries", oomQueries) + .add("timeOutQueries", timeOutQueries) + .add("rejectedQueries", rejectedQueries) + .add("avgWaitTimeInQueue", avgWaitTimeInQueue) + .add("peakAllocationTimestampMS", peakAllocationTimestampMS) + .add("maxAllocatedMemory", maxAllocatedMemory) + .add("maxAllocatedMemoryPercentage", maxAllocatedMemoryPercentage) + .add("utilizedAtMaxAllocated", utilizedAtMaxAllocated) + .add("utilizedAtMaxAllocatedPercentage", utilizedAtMaxAllocatedPercentage) + .add("peakUsageTimestampMS", peakUsageTimestampMS) + .add("maxUtilizedMemory", maxUtilizedMemory) + .add("maxUtilizedMemoryPercentage", maxUtilizedMemoryPercentage) + .add("allocatedAtMaxUtilized", allocatedAtMaxUtilized) + .add("allocatedAtMaxUtilizedPercentage", allocatedAtMaxUtilizedPercentage) + .add("distributionAllocatedByImpalad", distributionAllocatedByImpalaDaemon) + .add("distributionUtilizedByImpalad", distributionUtilizedByImpalaDaemon) + .add("avgSpilledMemory", avgSpilledMemory) + .add("maxSpilledMemory", maxSpilledMemory) + .toString(); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiImpalaTenantUtilizationList.java b/java/src/main/java/com/cloudera/api/model/ApiImpalaTenantUtilizationList.java new file mode 100644 index 00000000..2c643e04 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiImpalaTenantUtilizationList.java @@ -0,0 +1,43 @@ +// 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 impala tenant utilization reports. */ +@XmlRootElement(name = "impalaTenantUtilizationList") +public class ApiImpalaTenantUtilizationList extends ApiListBase { + + public ApiImpalaTenantUtilizationList() { + // For JAX-B. + } + + public ApiImpalaTenantUtilizationList(List impalaTenantUtilizations) { + super(impalaTenantUtilizations); + } + + @XmlElementWrapper(name = ApiListBase.ITEMS_ATTR) + public List getImpalaTenantUtilizations() { + return values; + } + + public void setImpalaTenantUtilizations(List impalaTenantUtilizations) { + values = impalaTenantUtilizations; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiImpalaUtilization.java b/java/src/main/java/com/cloudera/api/model/ApiImpalaUtilization.java new file mode 100644 index 00000000..6ee0cba9 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiImpalaUtilization.java @@ -0,0 +1,403 @@ +// 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 javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Utilization report information of a Impala application service. + */ +@XmlRootElement(name = "impalaUtilization") +public class ApiImpalaUtilization { + private Double totalQueries; + private Double successfulQueries; + private Double oomQueries; + private Double timeOutQueries; + private Double rejectedQueries; + private Double successfulQueriesPercentage; + private Double oomQueriesPercentage; + private Double timeOutQueriesPercentage; + private Double rejectedQueriesPercentage; + private Double avgWaitTimeInQueue; + private Long peakAllocationTimestampMS; + private Double maxAllocatedMemory; + private Double maxAllocatedMemoryPercentage; + private Double utilizedAtMaxAllocated; + private Double utilizedAtMaxAllocatedPercentage; + private Long peakUsageTimestampMS; + private Double maxUtilizedMemory; + private Double maxUtilizedMemoryPercentage; + private Double allocatedAtMaxUtilized; + private Double allocatedAtMaxUtilizedPercentage; + private ApiImpalaUtilizationHistogram distributionAllocatedByImpalaDaemon; + private ApiImpalaUtilizationHistogram distributionUtilizedByImpalaDaemon; + private ApiImpalaTenantUtilizationList tenantUtilizations; + private String errorMessage; + + /** + * Total number of queries submitted to Impala. + */ + @XmlElement + public Double getTotalQueries() { + return totalQueries; + } + + public void setTotalQueries( + Double totalQueries) { + this.totalQueries = totalQueries; + } + + /** + * Number of queries that finished successfully. + */ + @XmlElement + public Double getSuccessfulQueries() { + return successfulQueries; + } + + public void setSuccessfulQueries( + Double successfulQueries) { + this.successfulQueries = successfulQueries; + } + + /** + * Number of queries that failed due to insufficient memory. + */ + @XmlElement + public Double getOomQueries() { + return oomQueries; + } + + public void setOomQueries( + Double oomQueries) { + this.oomQueries = oomQueries; + } + + /** + * Number of queries that timed out while waiting for resources in a pool. + */ + @XmlElement + public Double getTimeOutQueries() { + return timeOutQueries; + } + + public void setTimeOutQueries( + Double timeOutQueries) { + this.timeOutQueries = timeOutQueries; + } + + /** + * Number of queries that were rejected by Impala because the pool was full. + */ + @XmlElement + public Double getRejectedQueries() { + return rejectedQueries; + } + + public void setRejectedQueries( + Double rejectedQueries) { + this.rejectedQueries = rejectedQueries; + } + + + /** + * Percentage of queries that finished successfully. + */ + @XmlElement + public Double getSuccessfulQueriesPercentage() { + return successfulQueriesPercentage; + } + + public void setSuccessfulQueriesPercentage( + Double successfulQueriesPercentage) { + this.successfulQueriesPercentage = successfulQueriesPercentage; + } + + /** + * Percentage of queries that failed due to insufficient memory. + */ + @XmlElement + public Double getOomQueriesPercentage() { + return oomQueriesPercentage; + } + + public void setOomQueriesPercentage( + Double oomQueriesPercentage) { + this.oomQueriesPercentage = oomQueriesPercentage; + } + + /** + * Percentage of queries that timed out while waiting for resources in a pool. + */ + @XmlElement + public Double getTimeOutQueriesPercentage() { + return timeOutQueriesPercentage; + } + + public void setTimeOutQueriesPercentage( + Double timeOutQueriesPercentage) { + this.timeOutQueriesPercentage = timeOutQueriesPercentage; + } + + /** + * Percentage of queries that were rejected by Impala because the pool was full. + */ + @XmlElement + public Double getRejectedQueriesPercentage() { + return rejectedQueriesPercentage; + } + + public void setRejectedQueriesPercentage( + Double rejectedQueriesPercentage) { + this.rejectedQueriesPercentage = rejectedQueriesPercentage; + } + + /** + * Average time, in milliseconds, spent by a query in an Impala pool while waiting for resources. + */ + @XmlElement + public Double getAvgWaitTimeInQueue() { + return avgWaitTimeInQueue; + } + + public void setAvgWaitTimeInQueue( + Double avgWaitTimeInQueue) { + this.avgWaitTimeInQueue = avgWaitTimeInQueue; + } + + /** + * The time when Impala reserved the maximum amount of memory for queries. + */ + @XmlElement + public Long getPeakAllocationTimestampMS() { + return peakAllocationTimestampMS; + } + + public void setPeakAllocationTimestampMS( + Long peakAllocationTimestampMS) { + this.peakAllocationTimestampMS = peakAllocationTimestampMS; + } + + /** + * The maximum memory (in bytes) that was reserved by Impala for executing queries. + */ + @XmlElement + public Double getMaxAllocatedMemory() { + return maxAllocatedMemory; + } + + public void setMaxAllocatedMemory( + Double maxAllocatedMemory) { + this.maxAllocatedMemory = maxAllocatedMemory; + } + + /** + * The maximum percentage of memory that was reserved by Impala for executing queries. + */ + @XmlElement + public Double getMaxAllocatedMemoryPercentage() { + return maxAllocatedMemoryPercentage; + } + + public void setMaxAllocatedMemoryPercentage( + Double maxAllocatedMemoryPercentage) { + this.maxAllocatedMemoryPercentage = maxAllocatedMemoryPercentage; + } + + /** + * The amount of memory (in bytes) used by Impala for running queries at the + * time when maximum memory was reserved. + */ + @XmlElement + public Double getUtilizedAtMaxAllocated() { + return utilizedAtMaxAllocated; + } + + public void setUtilizedAtMaxAllocated( + Double utilizedAtMaxAllocated) { + this.utilizedAtMaxAllocated = utilizedAtMaxAllocated; + } + + /** + * The percentage of memory used by Impala for running queries at the + * time when maximum memory was reserved. + */ + @XmlElement + public Double getUtilizedAtMaxAllocatedPercentage() { + return utilizedAtMaxAllocatedPercentage; + } + + public void setUtilizedAtMaxAllocatedPercentage( + Double utilizedAtMaxAllocatedPercentage) { + this.utilizedAtMaxAllocatedPercentage = utilizedAtMaxAllocatedPercentage; + } + + /** + * The time when Impala used the maximum amount of memory for queries. + */ + @XmlElement + public Long getPeakUsageTimestampMS() { + return peakUsageTimestampMS; + } + + public void setPeakUsageTimestampMS( + Long peakUsageTimestampMS) { + this.peakUsageTimestampMS = peakUsageTimestampMS; + } + + /** + * The maximum memory (in bytes) that was used by Impala for executing queries. + */ + @XmlElement + public Double getMaxUtilizedMemory() { + return maxUtilizedMemory; + } + + public void setMaxUtilizedMemory( + Double maxUtilizedMemory) { + this.maxUtilizedMemory = maxUtilizedMemory; + } + + /** + * The maximum percentage of memory that was used by Impala for executing queries. + */ + @XmlElement + public Double getMaxUtilizedMemoryPercentage() { + return maxUtilizedMemoryPercentage; + } + + public void setMaxUtilizedMemoryPercentage( + Double maxUtilizedMemoryPercentage) { + this.maxUtilizedMemoryPercentage = maxUtilizedMemoryPercentage; + } + + /** + * The amount of memory (in bytes) reserved by Impala at the time when it was using the + * maximum memory for executing queries. + */ + @XmlElement + public Double getAllocatedAtMaxUtilized() { + return allocatedAtMaxUtilized; + } + + public void setAllocatedAtMaxUtilized( + Double allocatedAtMaxUtilized) { + this.allocatedAtMaxUtilized = allocatedAtMaxUtilized; + } + + /** + * The percentage of memory reserved by Impala at the time when it was using the + * maximum memory for executing queries. + */ + @XmlElement + public Double getAllocatedAtMaxUtilizedPercentage() { + return allocatedAtMaxUtilizedPercentage; + } + + public void setAllocatedAtMaxUtilizedPercentage( + Double allocatedAtMaxUtilizedPercentage) { + this.allocatedAtMaxUtilizedPercentage = allocatedAtMaxUtilizedPercentage; + } + + /** + * Distribution of memory used per Impala daemon for executing queries at + * the time Impala used the maximum memory. + */ + @XmlElement + public ApiImpalaUtilizationHistogram getDistributionUtilizedByImpalaDaemon() { + return distributionUtilizedByImpalaDaemon; + } + + public void setDistributionUtilizedByImpalaDaemon( + ApiImpalaUtilizationHistogram distributionUtilizedByImpalaDaemon) { + this.distributionUtilizedByImpalaDaemon = distributionUtilizedByImpalaDaemon; + } + + /** + * Distribution of memory reserved per Impala daemon for executing queries at + * the time Impala used the maximum memory. + */ + @XmlElement + public ApiImpalaUtilizationHistogram getDistributionAllocatedByImpalaDaemon() { + return distributionAllocatedByImpalaDaemon; + } + + public void setDistributionAllocatedByImpalaDaemon( + ApiImpalaUtilizationHistogram distributionAllocatedByImpalaDaemon) { + this.distributionAllocatedByImpalaDaemon = distributionAllocatedByImpalaDaemon; + } + + /** + * A list of tenant utilization reports. + */ + @XmlElement + public ApiImpalaTenantUtilizationList getTenantUtilizations() { + return tenantUtilizations; + } + + public void setTenantUtilizations( + ApiImpalaTenantUtilizationList tenantUtilizations) { + this.tenantUtilizations = tenantUtilizations; + } + + /** + * error message of utilization report. + */ + @XmlElement + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("totalQueries", totalQueries) + .add("successfulQueries", successfulQueries) + .add("oomQueries", oomQueries) + .add("timeOutQueries", timeOutQueries) + .add("rejectedQueries", rejectedQueries) + .add("successfulQueriesPercentage", successfulQueriesPercentage) + .add("oomQueriesPercentage", oomQueriesPercentage) + .add("timeOutQueriesPercentage", timeOutQueriesPercentage) + .add("rejectedQueriesPercentage", rejectedQueriesPercentage) + .add("avgWaitTimeInQueue", avgWaitTimeInQueue) + .add("peakAllocationTimestampMS", peakAllocationTimestampMS) + .add("maxAllocatedMemory", maxAllocatedMemory) + .add("maxAllocatedMemoryPercentage", maxAllocatedMemoryPercentage) + .add("utilizedAtMaxAllocated", utilizedAtMaxAllocated) + .add("utilizedAtMaxAllocatedPercentage", utilizedAtMaxAllocatedPercentage) + .add("peakUsageTimestampMS", peakUsageTimestampMS) + .add("maxUtilizedMemory", maxUtilizedMemory) + .add("maxUtilizedMemoryPercentage", maxUtilizedMemoryPercentage) + .add("allocatedAtMaxUtilized", allocatedAtMaxUtilized) + .add("allocatedAtMaxUtilizedPercentage", allocatedAtMaxUtilizedPercentage) + .add("distributionAllocatedByImpalad", distributionAllocatedByImpalaDaemon) + .add("distributionUtilizedByImpalad", distributionUtilizedByImpalaDaemon) + .add("tenantUtilizations", tenantUtilizations) + .add("errorMessage", errorMessage) + .toString(); + } + + +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiImpalaUtilizationHistogram.java b/java/src/main/java/com/cloudera/api/model/ApiImpalaUtilizationHistogram.java new file mode 100644 index 00000000..1f8d5490 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiImpalaUtilizationHistogram.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.google.common.base.Objects; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Histogram of Impala utilization. + */ +@XmlRootElement(name = "impalaUtilizationHistogram") +public class ApiImpalaUtilizationHistogram { + ApiImpalaUtilizationHistogramBinList bins; + + public ApiImpalaUtilizationHistogram() { + // For JAX-B + } + + /** + * Bins of the histogram. + */ + @XmlElement + public ApiImpalaUtilizationHistogramBinList getBins() { + return bins; + } + + public void setBins( + ApiImpalaUtilizationHistogramBinList bins) { + this.bins = bins; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("bins", bins) + .toString(); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiImpalaUtilizationHistogramBin.java b/java/src/main/java/com/cloudera/api/model/ApiImpalaUtilizationHistogramBin.java new file mode 100644 index 00000000..71d833c9 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiImpalaUtilizationHistogramBin.java @@ -0,0 +1,100 @@ +// 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; + +/** + * Histogram bin of Impala utilization. + */ +@XmlRootElement(name = "impalaUtilizationHistogramBin") +public class ApiImpalaUtilizationHistogramBin { + Double startPointInclusive; + Double endPointExclusive; + Long numberOfImpalaDaemons; + + public ApiImpalaUtilizationHistogramBin() { + // For JAX-B + } + + /** + * start point (inclusive) of the histogram bin. + */ + @XmlElement + public Double getStartPointInclusive() { + return startPointInclusive; + } + + public void setStartPointInclusive( + Double startPointInclusive) { + this.startPointInclusive = startPointInclusive; + } + + /** + * end point (exclusive) of the histogram bin. + */ + @XmlElement + public Double getEndPointExclusive() { + return endPointExclusive; + } + + public void setEndPointExclusive( + Double endPointExclusive) { + this.endPointExclusive = endPointExclusive; + } + + /** + * Number of Impala daemons. + */ + @XmlElement + public Long getNumberOfImpalaDaemons() { + return numberOfImpalaDaemons; + } + + public void setNumberOfImpalaDaemons( + Long numberOfImpalaDs) { + this.numberOfImpalaDaemons = numberOfImpalaDs; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("startPointInclusive", startPointInclusive) + .add("endPointExclusive", endPointExclusive) + .add("numberOfImpalaDaemons", numberOfImpalaDaemons) + .toString(); + } + + @Override + public int hashCode() { + return Objects.hashCode(startPointInclusive, + endPointExclusive, + numberOfImpalaDaemons); + } + + @Override + public boolean equals(Object obj) { + ApiImpalaUtilizationHistogramBin that = ApiUtils.baseEquals(this, obj); + return this == that || (that != null && + Objects.equal(startPointInclusive, that.startPointInclusive) && + Objects.equal(endPointExclusive, that.endPointExclusive) && + Objects.equal(numberOfImpalaDaemons, that.numberOfImpalaDaemons)); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiImpalaUtilizationHistogramBinList.java b/java/src/main/java/com/cloudera/api/model/ApiImpalaUtilizationHistogramBinList.java new file mode 100644 index 00000000..60a38b95 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiImpalaUtilizationHistogramBinList.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.model; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElementWrapper; + +public class ApiImpalaUtilizationHistogramBinList extends + ApiListBase { + + public ApiImpalaUtilizationHistogramBinList() { + // For JAX-B + } + + public ApiImpalaUtilizationHistogramBinList( + List bins) { + super(bins); + } + + @XmlElementWrapper(name = ApiListBase.ITEMS_ATTR) + public List getImpalaTenantUtilizations() { + return values; + } + + public void setImpalaTenantUtilizations(List bins) { + values = bins; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiKerberosInfo.java b/java/src/main/java/com/cloudera/api/model/ApiKerberosInfo.java new file mode 100644 index 00000000..9c2c5545 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiKerberosInfo.java @@ -0,0 +1,133 @@ +// 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.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Kerberos information of a Cluster or Cloudera Manager. + */ +@XmlRootElement(name = "kerberosInfo") +public class ApiKerberosInfo { + + private boolean isKerberized; + private String kdcType; + private String kerberosRealm; + private String kdcHost; + private String adminHost; + private List domain; + + public ApiKerberosInfo() { + /* JAX-B */ + } + + public ApiKerberosInfo(boolean isKerberized) { + this.isKerberized = isKerberized; + } + + /* + * Whether the cluster is configured with Kerberos + */ + @XmlElement + public boolean isKerberized() { + return isKerberized; + } + + public void setKerberized(boolean isKerberized) { + this.isKerberized = isKerberized; + } + + /* + * KDC Type (MIT/AD Kerberos), it will be null if the cluster is not + * configured with Kerberos + */ + @XmlElement + public String getKdcType() { + return kdcType; + } + + public void setKdcType(String kdcType) { + this.kdcType = kdcType; + } + + /* + * Kerberos Realm, it will be null if the cluster is not configured with + * Kerberos + */ + @XmlElement + public String getKerberosRealm() { + return kerberosRealm; + } + + public void setKerberosRealm(String kerberosRealm) { + this.kerberosRealm = kerberosRealm; + } + + /* + * Kerberos KDC Host, it will be null if the cluster is not configured with + * Kerberos + */ + @XmlElement + public String getKdcHost() { + return kdcHost; + } + + public void setKdcHost(String kdcHost) { + this.kdcHost = kdcHost; + } + + /* + * Kerberos Admin Server Host, it will be null if the cluster is not configured with + * Kerberos + */ + @XmlElement + public String getAdminHost() { + return adminHost; + } + + public void setAdminHost(String adminHost) { + this.adminHost = adminHost; + } + + /* + * Kerberos Domain, it will be null if the cluster is not configured with + * Kerberos + */ + @XmlElement + public List getDomain() { + return domain; + } + + public void setDomain(List domain) { + this.domain = domain; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("isKerberized", isKerberized) + .add("kdcType", kdcType) + .add("kerberosRealm", kerberosRealm) + .add("kdcHost", kdcHost) + .add("adminHost", adminHost) + .toString(); + } +} 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..1ba8a0a7 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiRole.java +++ b/java/src/main/java/com/cloudera/api/model/ApiRole.java @@ -16,6 +16,7 @@ package com.cloudera.api.model; +import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlElement; @@ -52,6 +53,7 @@ public class ApiRole { private ApiConfigList config; private ApiRoleConfigGroupRef roleConfigGroupRef; private ZooKeeperServerMode zooKeeperServerMode; + private ApiEntityStatus entityStatus; public enum HaStatus { ACTIVE, @@ -93,6 +95,7 @@ public ApiRole() { // For JAX-B } + @Override public String toString() { return Objects.toStringHelper(this) .add("name", name) @@ -299,7 +302,9 @@ public List getMaintenanceOwners() { } public void setMaintenanceOwners(List maintenanceOwners) { - this.maintenanceOwners = Lists.newArrayList(maintenanceOwners); + this.maintenanceOwners = (null == maintenanceOwners) + ? new ArrayList() + : Lists.newArrayList(maintenanceOwners); } /** @@ -340,4 +345,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/ApiSchedule.java b/java/src/main/java/com/cloudera/api/model/ApiSchedule.java index f5612ac3..32cf2b4f 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiSchedule.java +++ b/java/src/main/java/com/cloudera/api/model/ApiSchedule.java @@ -29,6 +29,8 @@ */ public abstract class ApiSchedule { private Long id; + private String displayName; + private String description; private Date startTime; private Date endTime; private long interval; @@ -64,6 +66,26 @@ public void setId(Long id) { this.id = id; } + /** The schedule display name. */ + @XmlElement + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + /** The schedule description. */ + @XmlElement + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + /** * The time at which the scheduled activity is triggered for the first * time. @@ -179,6 +201,8 @@ public String toString() { protected Objects.ToStringHelper toStringHelper() { return Objects.toStringHelper(this) .add("id", id) + .add("displayName", displayName) + .add("description", description) .add("startTime", startTime) .add("endTime", endTime) .add("interval", interval) @@ -195,6 +219,8 @@ public boolean equals(Object o) { ApiSchedule other = ApiUtils.baseEquals(this, o); return other != null && Objects.equal(id, other.getId()) && + Objects.equal(displayName, other.getDisplayName()) && + Objects.equal(description, other.getDescription()) && Objects.equal(startTime, other.getStartTime()) && Objects.equal(endTime, other.getEndTime()) && Objects.equal(interval, other.getInterval()) && @@ -208,8 +234,8 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hashCode(id, startTime, endTime, interval, - intervalUnit, paused, alertOnStart, alertOnSuccess, alertOnFail, - alertOnAbort); + return Objects.hashCode(id, displayName, description, startTime, endTime, + interval, intervalUnit, paused, alertOnStart, alertOnSuccess, + alertOnFail, alertOnAbort); } } 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..4a23749e 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,8 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; + +import java.util.ArrayList; import java.util.List; /** @@ -46,6 +48,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 +63,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 +216,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 +227,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. @@ -247,7 +265,9 @@ public List getMaintenanceOwners() { } public void setMaintenanceOwners(List maintenanceOwners) { - this.maintenanceOwners = Lists.newArrayList(maintenanceOwners); + this.maintenanceOwners = (null == maintenanceOwners) + ? new ArrayList() + : Lists.newArrayList(maintenanceOwners); } /** Configuration of the service being created. Optional. */ @@ -321,4 +341,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/ApiSimpleRollingRestartClusterArgs.java b/java/src/main/java/com/cloudera/api/model/ApiSimpleRollingRestartClusterArgs.java new file mode 100644 index 00000000..cb6ceb23 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiSimpleRollingRestartClusterArgs.java @@ -0,0 +1,102 @@ +// 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; + +/** + * Basic arguments used for Rolling Restart Cluster commands. + */ +@XmlRootElement(name = "simpleRollingRestartClusterArgs") +public class ApiSimpleRollingRestartClusterArgs { + + private Integer slaveBatchSize; + private Integer sleepSeconds; + private Integer slaveFailCountThreshold; + + /** + * Number of hosts with slave roles to restart at a time. + * Must be greater than zero. Default is 1. + */ + @XmlElement + 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 + * to restart before the entire command is considered failed. + *

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

+ * This argument is for ADVANCED users only. + *

+ */ + @XmlElement + public Integer getSlaveFailCountThreshold() { + return slaveFailCountThreshold; + } + + public void setSlaveFailCountThreshold(Integer slaveFailCountThreshold) { + this.slaveFailCountThreshold = slaveFailCountThreshold; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("slaveBatchSize", slaveBatchSize) + .add("sleepSeconds", sleepSeconds) + .add("slaveFailCountThreshold", slaveFailCountThreshold) + .toString(); + } + + @Override + public boolean equals(Object o) { + ApiSimpleRollingRestartClusterArgs that = ApiUtils.baseEquals(this, o); + return this == that || (that != null && + Objects.equal(slaveBatchSize, that.slaveBatchSize) && + Objects.equal(sleepSeconds, that.sleepSeconds) && + Objects.equal(slaveFailCountThreshold, that.slaveFailCountThreshold)); + } + + @Override + public int hashCode() { + return Objects.hashCode(slaveBatchSize, sleepSeconds, + slaveFailCountThreshold); + } +} 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/ApiTenantUtilization.java b/java/src/main/java/com/cloudera/api/model/ApiTenantUtilization.java new file mode 100644 index 00000000..2208e7f9 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiTenantUtilization.java @@ -0,0 +1,85 @@ +// 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 javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Utilization report information of a tenant. + */ +@XmlRootElement(name = "tenantUtilization") +public class ApiTenantUtilization { + + private String tenantName; + private Double cpuUtilizationPercentage; + private Double memoryUtilizationPercentage; + + public ApiTenantUtilization() { + // For JAX-B + } + + /** + * Name of the tenant. + */ + @XmlElement + public String getTenantName() { + return tenantName; + } + + public void setTenantName( + String tenantName) { + this.tenantName = tenantName; + } + + /** + * Percentage of CPU resource used by workloads. + */ + @XmlElement + public Double getCpuUtilizationPercentage() { + return cpuUtilizationPercentage; + } + + public void setCpuUtilizationPercentage( + Double cpuUtilizationPercentage) { + this.cpuUtilizationPercentage = cpuUtilizationPercentage; + } + + /** + * Percentage of memory used by workloads. + */ + @XmlElement + public Double getMemoryUtilizationPercentage() { + return memoryUtilizationPercentage; + } + + public void setMemoryUtilizationPercentage( + Double memoryUtilizationPercentage) { + this.memoryUtilizationPercentage = memoryUtilizationPercentage; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("tenantName", tenantName) + .add("cpuUtilizationPercentage", cpuUtilizationPercentage) + .add("memoryUtilizationPercentage", + memoryUtilizationPercentage) + .toString(); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiTenantUtilizationList.java b/java/src/main/java/com/cloudera/api/model/ApiTenantUtilizationList.java new file mode 100644 index 00000000..ff5f467f --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiTenantUtilizationList.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; + +/** A list of tenant utilization reports. */ +@XmlRootElement(name = "tenantUtilizationList") +public class ApiTenantUtilizationList extends ApiListBase { + + + public ApiTenantUtilizationList() { + // For JAX-B. + } + + public ApiTenantUtilizationList(List tenantUtilizations) { + super(tenantUtilizations); + } + + + @XmlElementWrapper(name = ApiListBase.ITEMS_ATTR) + public List getTenantUtilizations() { + return values; + } + + public void setTenantUtilizations(List tenantUtilizations) { + values = tenantUtilizations; + } +} 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..9f8555d9 --- /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); + } +} 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..71891231 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,19 @@ 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 containerUsedMemoryMax; + private Double containerUsedCpuSeconds; + private Double containerUsedVcoreSeconds; + private Double containerAllocatedMemorySeconds; + private Double containerAllocatedVcoreSeconds; public ApiYarnApplication() { // For JAX-B @@ -55,7 +71,19 @@ 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 containerUsedMemoryMax, + Double containerUsedCpuSeconds, + Double containerUsedVcoreSeconds, + Double containerAllocatedMemorySeconds, + Double containerAllocatedVcoreSeconds) { Preconditions.checkNotNull(applicationId); Preconditions.checkNotNull(name); Preconditions.checkNotNull(startTime); @@ -71,6 +99,90 @@ 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.containerUsedMemoryMax = containerUsedMemoryMax; + 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 +291,98 @@ 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; + } + + /** + * Maximum memory 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 v16 + */ + @XmlElement + public Double getContainerUsedMemoryMax() { + return containerUsedMemoryMax; + } + + public void setContainerUsedMemoryMax(Double containerUsedMemoryMax) { + this.containerUsedMemoryMax = containerUsedMemoryMax; + } + + /** + * 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 +395,18 @@ 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("containerUsedMemoryMax", containerUsedMemoryMax) + .add("containerUsedCpuSeconds", containerUsedCpuSeconds) + .add("containerUsedVcoreSeconds", containerUsedVcoreSeconds) + .add("containerAllocatedMemorySeconds", containerAllocatedMemorySeconds) + .add("containerAllocatedVcoreSeconds", containerAllocatedVcoreSeconds) .toString(); } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiYarnTenantUtilization.java b/java/src/main/java/com/cloudera/api/model/ApiYarnTenantUtilization.java new file mode 100644 index 00000000..40a0cd9e --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiYarnTenantUtilization.java @@ -0,0 +1,286 @@ +// 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 javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Utilization report information of a tenant of Yarn application. + */ +@XmlRootElement(name = "yarnTenantUtilization") +public class ApiYarnTenantUtilization { + private String tenantName; + private Double avgYarnCpuAllocation; + private Double avgYarnCpuUtilization; + private Double avgYarnCpuUnusedCapacity; + private Double avgYarnCpuSteadyFairShare; + private Double avgYarnPoolAllocatedCpuDuringContention; + private Double avgYarnPoolFairShareCpuDuringContention; + private Double avgYarnPoolSteadyFairShareCpuDuringContention; + + private Double avgYarnMemoryAllocation; + private Double avgYarnMemoryUtilization; + private Double avgYarnMemoryUnusedCapacity; + private Double avgYarnMemorySteadyFairShare; + private Double avgYarnPoolAllocatedMemoryDuringContention; + private Double avgYarnPoolFairShareMemoryDuringContention; + private Double avgYarnPoolSteadyFairShareMemoryDuringContention; + + private Double avgYarnContainerWaitRatio; + + public ApiYarnTenantUtilization() { + // For JAX-B + } + + /** + * Name of the tenant. + */ + @XmlElement + public String getTenantName() { + return tenantName; + } + + public void setTenantName( + String tenantName) { + this.tenantName = tenantName; + } + + /** + * Average number of VCores allocated to YARN applications of the tenant. + */ + @XmlElement + public Double getAvgYarnCpuAllocation() { + return avgYarnCpuAllocation; + } + + public void setAvgYarnCpuAllocation( + Double avgYarnCpuAllocation) { + this.avgYarnCpuAllocation = avgYarnCpuAllocation; + } + + /** + * Average number of VCores used by YARN applications of the tenant. + */ + @XmlElement + public Double getAvgYarnCpuUtilization() { + return avgYarnCpuUtilization; + } + + public void setAvgYarnCpuUtilization( + Double avgYarnCpuUtilization) { + this.avgYarnCpuUtilization = avgYarnCpuUtilization; + } + + /** + * Average unused VCores of the tenant. + */ + @XmlElement + public Double getAvgYarnCpuUnusedCapacity() { + return avgYarnCpuUnusedCapacity; + } + + public void setAvgYarnCpuUnusedCapacity( + Double avgYarnCpuUnusedCapacity) { + this.avgYarnCpuUnusedCapacity = avgYarnCpuUnusedCapacity; + } + + /** + * Average steady fair share VCores. + */ + @XmlElement + public Double getAvgYarnCpuSteadyFairShare() { + return avgYarnCpuSteadyFairShare; + } + + public void setAvgYarnCpuSteadyFairShare( + Double avgYarnCpuSteadyFairShare) { + this.avgYarnCpuSteadyFairShare = avgYarnCpuSteadyFairShare; + } + + /** + * Average allocated Vcores with pending containers. + */ + @XmlElement + public Double getAvgYarnPoolAllocatedCpuDuringContention() { + return avgYarnPoolAllocatedCpuDuringContention; + } + + public void setAvgYarnPoolAllocatedCpuDuringContention( + Double avgYarnPoolAllocatedCpuDuringContention) { + this.avgYarnPoolAllocatedCpuDuringContention = avgYarnPoolAllocatedCpuDuringContention; + } + + /** + * Average fair share VCores with pending containers. + */ + @XmlElement + public Double getAvgYarnPoolFairShareCpuDuringContention() { + return avgYarnPoolFairShareCpuDuringContention; + } + + public void setAvgYarnPoolFairShareCpuDuringContention( + Double avgYarnPoolFairShareCpuDuringContention) { + this.avgYarnPoolFairShareCpuDuringContention = avgYarnPoolFairShareCpuDuringContention; + } + + /** + * Average steady fair share VCores with pending containers. + */ + @XmlElement + public Double getAvgYarnPoolSteadyFairShareCpuDuringContention() { + return avgYarnPoolSteadyFairShareCpuDuringContention; + } + + public void setAvgYarnPoolSteadyFairShareCpuDuringContention( + Double avgYarnPoolSteadyFairShareCpuDuringContention) { + this.avgYarnPoolSteadyFairShareCpuDuringContention = avgYarnPoolSteadyFairShareCpuDuringContention; + } + + /** + * Average percentage of pending containers for the pool during periods of + * contention. + */ + @XmlElement + public Double getAvgYarnContainerWaitRatio() { + return avgYarnContainerWaitRatio; + } + + public void setAvgYarnContainerWaitRatio( + Double avgYarnContainerWaitRatio) { + this.avgYarnContainerWaitRatio = avgYarnContainerWaitRatio; + } + + /** + * Average memory allocated to YARN applications of the tenant. + */ + @XmlElement + public Double getAvgYarnMemoryAllocation() { + return avgYarnMemoryAllocation; + } + + public void setAvgYarnMemoryAllocation( + Double avgYarnMemoryAllocation) { + this.avgYarnMemoryAllocation = avgYarnMemoryAllocation; + } + + /** + * Average memory used by YARN applications of the tenant. + */ + @XmlElement + public Double getAvgYarnMemoryUtilization() { + return avgYarnMemoryUtilization; + } + + public void setAvgYarnMemoryUtilization( + Double avgYarnMemoryUtilization) { + this.avgYarnMemoryUtilization = avgYarnMemoryUtilization; + } + + /** + * Average unused memory of the tenant. + */ + @XmlElement + public Double getAvgYarnMemoryUnusedCapacity() { + return avgYarnMemoryUnusedCapacity; + } + + public void setAvgYarnMemoryUnusedCapacity( + Double avgYarnMemoryUnusedCapacity) { + this.avgYarnMemoryUnusedCapacity = avgYarnMemoryUnusedCapacity; + } + + /** + * Average steady fair share memory. + */ + @XmlElement + public Double getAvgYarnMemorySteadyFairShare() { + return avgYarnMemorySteadyFairShare; + } + + public void setAvgYarnMemorySteadyFairShare( + Double avgYarnMemorySteadyFairShare) { + this.avgYarnMemorySteadyFairShare = avgYarnMemorySteadyFairShare; + } + + /** + * Average allocated memory with pending containers. + */ + @XmlElement + public Double getAvgYarnPoolAllocatedMemoryDuringContention() { + return avgYarnPoolAllocatedMemoryDuringContention; + } + + public void setAvgYarnPoolAllocatedMemoryDuringContention( + Double avgYarnPoolAllocatedMemoryDuringContention) { + this.avgYarnPoolAllocatedMemoryDuringContention = avgYarnPoolAllocatedMemoryDuringContention; + } + + /** + * Average fair share memory with pending containers. + */ + @XmlElement + public Double getAvgYarnPoolFairShareMemoryDuringContention() { + return avgYarnPoolFairShareMemoryDuringContention; + } + + public void setAvgYarnPoolFairShareMemoryDuringContention( + Double avgYarnPoolFairShareMemoryDuringContention) { + this.avgYarnPoolFairShareMemoryDuringContention = avgYarnPoolFairShareMemoryDuringContention; + } + + /** + * Average steady fair share memory with pending containers. + */ + @XmlElement + public Double getAvgYarnPoolSteadyFairShareMemoryDuringContention() { + return avgYarnPoolSteadyFairShareMemoryDuringContention; + } + + public void setAvgYarnPoolSteadyFairShareMemoryDuringContention( + Double avgYarnPoolSteadyFairShareMemoryDuringContention) { + this.avgYarnPoolSteadyFairShareMemoryDuringContention = avgYarnPoolSteadyFairShareMemoryDuringContention; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("avgYarnCpuAllocation", avgYarnCpuAllocation) + .add("avgYarnCpuUtilization", avgYarnCpuUtilization) + .add("avgYarnCpuUnusedCapacity", avgYarnCpuUnusedCapacity) + .add("avgYarnCpuSteadyFairShare", avgYarnCpuSteadyFairShare) + .add("avgYarnPoolAllocatedCpuDuringContention", + avgYarnPoolAllocatedCpuDuringContention) + .add("avgYarnPoolFairShareCpuDuringContention", + avgYarnPoolFairShareCpuDuringContention) + .add("avgYarnPoolSteadyFairShareCpuDuringContention", + avgYarnPoolSteadyFairShareCpuDuringContention) + .add("avgYarnMemoryAllocation", avgYarnMemoryAllocation) + .add("avgYarnMemoryUtilization", avgYarnMemoryUtilization) + .add("avgYarnMemoryUnusedCapacity", avgYarnMemoryUnusedCapacity) + .add("avgYarnMemorySteadyFairShare", avgYarnMemorySteadyFairShare) + .add("avgYarnPoolAllocatedMemoryDuringContention", + avgYarnPoolAllocatedMemoryDuringContention) + .add("avgYarnPoolFairShareMemoryDuringContention", + avgYarnPoolFairShareMemoryDuringContention) + .add("avgYarnPoolSteadyFairShareMemoryDuringContention", + avgYarnPoolSteadyFairShareMemoryDuringContention) + .add("avgYarnContainerWaitRatio", avgYarnContainerWaitRatio) + .toString(); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiYarnTenantUtilizationList.java b/java/src/main/java/com/cloudera/api/model/ApiYarnTenantUtilizationList.java new file mode 100644 index 00000000..d496988a --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiYarnTenantUtilizationList.java @@ -0,0 +1,43 @@ +// 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 yarn tenant utilization reports. */ +@XmlRootElement(name = "yarnTenantUtilizationList") +public class ApiYarnTenantUtilizationList extends ApiListBase { + + public ApiYarnTenantUtilizationList() { + // For JAX-B. + } + + public ApiYarnTenantUtilizationList(List yarnTenantUtilizations) { + super(yarnTenantUtilizations); + } + + @XmlElementWrapper(name = ApiListBase.ITEMS_ATTR) + public List getYarnTenantUtilizations() { + return values; + } + + public void setYarnTenantUtilizations(List yarnTenantUtilizations) { + values = yarnTenantUtilizations; + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiYarnUtilization.java b/java/src/main/java/com/cloudera/api/model/ApiYarnUtilization.java new file mode 100644 index 00000000..1574a216 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiYarnUtilization.java @@ -0,0 +1,280 @@ +// 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 javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Utilization report information of a Yarn application service. + */ +@XmlRootElement(name = "yarnUtilization") +public class ApiYarnUtilization { + private Double avgCpuUtilization; + private Double maxCpuUtilization; + private Double avgCpuDailyPeak; + private Long maxCpuUtilizationTimestampMs; + private Double avgCpuUtilizationPercentage; + private Double maxCpuUtilizationPercentage; + private Double avgCpuDailyPeakPercentage; + + private Double avgMemoryUtilization; + private Double maxMemoryUtilization; + private Double avgMemoryDailyPeak; + private Long maxMemoryUtilizationTimestampMs; + private Double avgMemoryUtilizationPercentage; + private Double maxMemoryUtilizationPercentage; + private Double avgMemoryDailyPeakPercentage; + private ApiYarnTenantUtilizationList tenantUtilizations; + private String errorMessage; + + public ApiYarnUtilization() { + // For JAX-B + } + + /** + * Average number of VCores used by YARN applications during the report + * window. + */ + @XmlElement + public Double getAvgCpuUtilization() { + return avgCpuUtilization; + } + + public void setAvgCpuUtilization(Double avgCpuUtilization) { + this.avgCpuUtilization = avgCpuUtilization; + } + + /** + * Maximum number of VCores used by YARN applications during the report + * window. + */ + @XmlElement + public Double getMaxCpuUtilization() { + return maxCpuUtilization; + } + + public void setMaxCpuUtilization(Double maxCpuUtilization) { + this.maxCpuUtilization = maxCpuUtilization; + } + + /** + * Average daily peak VCores used by YARN applications during the report + * window. The number is computed by first finding the maximum resource + * consumption per day and then taking their mean. + */ + @XmlElement + public Double getAvgCpuDailyPeak() { + return avgCpuDailyPeak; + } + + public void setAvgCpuDailyPeak(Double avgCpuDailyPeak) { + this.avgCpuDailyPeak = avgCpuDailyPeak; + } + + /** + * Timestamp corresponds to maximum number of VCores used by YARN applications + * during the report window. + */ + @XmlElement + public Long getMaxCpuUtilizationTimestampMs() { + return maxCpuUtilizationTimestampMs; + } + + public void setMaxCpuUtilizationTimestampMs( + Long maxCpuUtilizationTimestampMs) { + this.maxCpuUtilizationTimestampMs = maxCpuUtilizationTimestampMs; + } + + /** + * Average percentage of VCores used by YARN applications during the report + * window. + */ + @XmlElement + public Double getAvgCpuUtilizationPercentage() { + return avgCpuUtilizationPercentage; + } + + public void setAvgCpuUtilizationPercentage( + Double avgCpuUtilizationPercentage) { + this.avgCpuUtilizationPercentage = avgCpuUtilizationPercentage; + } + + /** + * Maximum percentage of VCores used by YARN applications during the report + * window. + */ + @XmlElement + public Double getMaxCpuUtilizationPercentage() { + return maxCpuUtilizationPercentage; + } + + public void setMaxCpuUtilizationPercentage( + Double maxCpuUtilizationPercentage) { + this.maxCpuUtilizationPercentage = maxCpuUtilizationPercentage; + } + + /** + * Average daily peak percentage of VCores used by YARN applications during + * the report window. + */ + @XmlElement + public Double getAvgCpuDailyPeakPercentage() { + return avgCpuDailyPeakPercentage; + } + + public void setAvgCpuDailyPeakPercentage(Double avgCpuDailyPeakPercentage) { + this.avgCpuDailyPeakPercentage = avgCpuDailyPeakPercentage; + } + + /** + * Average memory used by YARN applications during the report window. + */ + @XmlElement + public Double getAvgMemoryUtilization() { + return avgMemoryUtilization; + } + + public void setAvgMemoryUtilization(Double avgMemoryUtilization) { + this.avgMemoryUtilization = avgMemoryUtilization; + } + + /** + * Maximum memory used by YARN applications during the report window. + */ + @XmlElement + public Double getMaxMemoryUtilization() { + return maxMemoryUtilization; + } + + public void setMaxMemoryUtilization(Double maxMemoryUtilization) { + this.maxMemoryUtilization = maxMemoryUtilization; + } + + /** + * Average daily peak memory used by YARN applications during the report + * window. The number is computed by first finding the maximum resource + * consumption per day and then taking their mean. + */ + @XmlElement + public Double getAvgMemoryDailyPeak() { + return avgMemoryDailyPeak; + } + + public void setAvgMemoryDailyPeak(Double avgMemoryDailyPeak) { + this.avgMemoryDailyPeak = avgMemoryDailyPeak; + } + + /** + * Timestamp corresponds to maximum memory used by YARN applications during + * the report window. + */ + @XmlElement + public Long getMaxMemoryUtilizationTimestampMs() { + return maxMemoryUtilizationTimestampMs; + } + + public void setMaxMemoryUtilizationTimestampMs( + Long maxMemoryUtilizationTimestampMs) { + this.maxMemoryUtilizationTimestampMs = maxMemoryUtilizationTimestampMs; + } + + /** + * Average percentage memory used by YARN applications during the report window. + */ + @XmlElement + public Double getAvgMemoryUtilizationPercentage() { + return avgMemoryUtilizationPercentage; + } + + public void setAvgMemoryUtilizationPercentage(Double avgMemoryUtilizationPercentage) { + this.avgMemoryUtilizationPercentage = avgMemoryUtilizationPercentage; + } + + /** + * Maximum percentage of memory used by YARN applications during the report window. + */ + @XmlElement + public Double getMaxMemoryUtilizationPercentage() { + return maxMemoryUtilizationPercentage; + } + + public void setMaxMemoryUtilizationPercentage(Double maxMemoryUtilizationPercentage) { + this.maxMemoryUtilizationPercentage = maxMemoryUtilizationPercentage; + } + + /** + * Average daily peak percentage of memory used by YARN applications during the report + * window. + */ + @XmlElement + public Double getAvgMemoryDailyPeakPercentage() { + return avgMemoryDailyPeakPercentage; + } + + public void setAvgMemoryDailyPeakPercentage(Double avgMemoryDailyPeakPercentage) { + this.avgMemoryDailyPeakPercentage = avgMemoryDailyPeakPercentage; + } + + /** + * A list of tenant utilization reports. + */ + @XmlElement + public ApiYarnTenantUtilizationList getTenantUtilizations() { + return tenantUtilizations; + } + + public void setTenantUtilizations( + ApiYarnTenantUtilizationList tenantUtilizations) { + this.tenantUtilizations = tenantUtilizations; + } + + /** + * error message of utilization report. + */ + @XmlElement + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("avgCpuUtilization", avgCpuUtilization) + .add("maxCpuUtilization", maxCpuUtilization) + .add("avgCpuDailyPeak", avgCpuDailyPeak) + .add("avgMemoryUtilization", avgMemoryUtilization) + .add("maxMemoryUtilization", maxMemoryUtilization) + .add("avgMemoryDailyPeak", avgMemoryDailyPeak) + .add("maxCpuUtilizationTimestampMs", maxCpuUtilizationTimestampMs) + .add("maxMemoryUtilizationTimestampMs", maxMemoryUtilizationTimestampMs) + .add("avgCpuUtilizationPercentage", avgCpuUtilizationPercentage) + .add("maxCpuUtilizationPercentage", maxCpuUtilizationPercentage) + .add("avgCpuDailyPeakPercentage", avgCpuDailyPeakPercentage) + .add("avgMemoryUtilizationPercentage", avgMemoryUtilizationPercentage) + .add("maxMemoryUtilizationPercentage", maxMemoryUtilizationPercentage) + .add("avgMemoryDailyPeakPercentage", avgMemoryDailyPeakPercentage) + .add("tenantUtilizations", tenantUtilizations) + .add("errorMessage", errorMessage) + .toString(); + } +} diff --git a/java/src/main/java/com/cloudera/api/v1/HostsResource.java b/java/src/main/java/com/cloudera/api/v1/HostsResource.java index 2a7d0258..58e32bf8 100644 --- a/java/src/main/java/com/cloudera/api/v1/HostsResource.java +++ b/java/src/main/java/com/cloudera/api/v1/HostsResource.java @@ -209,7 +209,7 @@ public ApiConfigList updateHostConfig( * 'select $METRIC_NAME1, $METRIC_NAME2 where hostId = $HOST_ID'. *
    *
    - * For more information see the + * For more information see the * tsquery language documentation.

    */ @Deprecated 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/v1/NameservicesResource.java b/java/src/main/java/com/cloudera/api/v1/NameservicesResource.java index 2766c49f..56181341 100644 --- a/java/src/main/java/com/cloudera/api/v1/NameservicesResource.java +++ b/java/src/main/java/com/cloudera/api/v1/NameservicesResource.java @@ -103,7 +103,7 @@ public ApiNameservice readNameservice( * 'select $METRIC_NAME1, $METRIC_NAME2 where nameserviceName = $NAMESERVICE_NAME'. *
    *
    - * For more information see the + * For more information see the * tsquery language documentation.

    */ @Deprecated diff --git a/java/src/main/java/com/cloudera/api/v1/RolesResource.java b/java/src/main/java/com/cloudera/api/v1/RolesResource.java index 1646f96d..cee8d6d5 100644 --- a/java/src/main/java/com/cloudera/api/v1/RolesResource.java +++ b/java/src/main/java/com/cloudera/api/v1/RolesResource.java @@ -104,6 +104,10 @@ public interface RolesResource { * HUE_SERVER, KT_RENEWER * * + * HUE (CDH5 5.5+) + * HUE_SERVER, KT_RENEWER, HUE_LOAD_BALANCER + * + * * FLUME * AGENT * @@ -282,7 +286,7 @@ public ApiConfigList updateRoleConfig( * 'select $METRIC_NAME1, $METRIC_NAME2 where roleName = $ROLE_NAME'. *
    *
    - * For more information see the + * For more information see the * tsquery language documentation.

    */ @Deprecated diff --git a/java/src/main/java/com/cloudera/api/v1/ServicesResource.java b/java/src/main/java/com/cloudera/api/v1/ServicesResource.java index 544c2605..f92bf349 100644 --- a/java/src/main/java/com/cloudera/api/v1/ServicesResource.java +++ b/java/src/main/java/com/cloudera/api/v1/ServicesResource.java @@ -237,7 +237,7 @@ public ApiRoleTypeList listRoleTypes( * 'select $METRIC_NAME1, $METRIC_NAME2 where serviceName = $SERVICE_NAME'. *
    *
    - * For more information see the + * For more information see the * tsquery language documentation.

    */ @Deprecated 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..fc03e41e --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/RolesResourceV11.java @@ -0,0 +1,80 @@ +// 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 com.cloudera.api.DataView; +import com.cloudera.api.Parameters; +import com.cloudera.api.model.ApiRole; +import com.cloudera.api.model.ApiRoleList; +import com.cloudera.api.v8.RolesResourceV8; + +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 RolesResourceV11 extends RolesResourceV8 { + + /** + * Lists all roles of a given service. + * + * @param filter + * Optional query to filter the roles by. + *

    + * The query specifies the intersection of a list of constraints, + * joined together with semicolons (without spaces). For example: + * hostname==host1.abc.com;type==DATANODE + *

    + * + * Currently supports filtering by: + *
      + *
    • hostname: The hostname of the host the role is running on.
    • + *
    • hostId: The unique identifier of the host the role is running on.
    • + *
    • type: The role's type.
    • + *
    + * @param dataView DataView for getting roles. Defaults to 'summary'. + * @return List of roles. + */ + @GET + @Path("/") + public ApiRoleList readRoles( + @QueryParam(Parameters.FILTER) @DefaultValue(Parameters.FILTER_DEFAULT) String filter, + @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..2e33cbab --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v15/ClouderaManagerResourceV15.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.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; +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); + + + /** + * 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 new file mode 100644 index 00000000..56177a57 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v15/RootResourceV15.java @@ -0,0 +1,36 @@ +// 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(); + + /** + * @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); +} 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/v16/ClouderaManagerResourceV16.java b/java/src/main/java/com/cloudera/api/v16/ClouderaManagerResourceV16.java new file mode 100644 index 00000000..31e01fb8 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v16/ClouderaManagerResourceV16.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.v16; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.v15.ClouderaManagerResourceV15; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +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 ClouderaManagerResourceV16 extends ClouderaManagerResourceV15 { + + /** + *

    + * Submit a command to refresh parcels information. + *

    + *

    + * This API could be used following two scenarios.
    + * - User updated Cloudera Manager's local parcel repository.
    + * - User updated remote parcel locations. + *

    + * User wants to invoke this API to make sure that Cloudera Manager gets + * latest parcels information. User can then monitor the returned command + * before proceeding to the next step. + *

    + * + * @return Information about the submitted command. + */ + @POST + @Path("/commands/refreshParcelRepos") + public ApiCommand refreshParcelRepos(); +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v16/ClustersResourceV16.java b/java/src/main/java/com/cloudera/api/v16/ClustersResourceV16.java new file mode 100644 index 00000000..c43b70d7 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v16/ClustersResourceV16.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.v16; + +import static com.cloudera.api.Parameters.*; + +import com.cloudera.api.v15.ClustersResourceV15; + +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 ClustersResourceV16 extends ClustersResourceV15 { + /** + * @return The services resource handler. + */ + @Override + @Path("/{clusterName}/services") + public ServicesResourceV16 getServicesResource( + @PathParam(CLUSTER_NAME) String clusterName); + +} diff --git a/java/src/main/java/com/cloudera/api/v16/ExternalAccountsResourceV16.java b/java/src/main/java/com/cloudera/api/v16/ExternalAccountsResourceV16.java new file mode 100644 index 00000000..d3d56000 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v16/ExternalAccountsResourceV16.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.v16; + +import static com.cloudera.api.Parameters.COMMAND_NAME; +import static com.cloudera.api.Parameters.DATA_VIEW_DEFAULT; +import static com.cloudera.api.Parameters.EXTERNAL_ACCOUNT_NAME; +import static com.cloudera.api.Parameters.EXTERNAL_ACCOUNT_TYPE_NAME; + +import com.cloudera.api.DataView; +import com.cloudera.api.Parameters; +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.model.ApiCommandMetadataList; +import com.cloudera.api.model.ApiConfigList; +import com.cloudera.api.v14.ExternalAccountsResourceV14; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +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 ExternalAccountsResourceV16 + extends ExternalAccountsResourceV14 { + + /** + * Get configs of external account for the given account name. + * + * @param external account name + * @param view The view to materialize, either "summary" or "full". + * @return the current external account configurations. + */ + @GET + @Path("/account/{" + Parameters.EXTERNAL_ACCOUNT_NAME + "}" + "/config") + ApiConfigList readConfig( + @PathParam(Parameters.EXTERNAL_ACCOUNT_NAME) String name, + @QueryParam(Parameters.DATA_VIEW) @DefaultValue(DATA_VIEW_DEFAULT) DataView view); + + /** + * Upadate configs of external account for the given account name. + * + * @param external account name + * @param config Settings to update. + * @param message Optional message describing the changes. + * @return The updated configuration. + */ + @PUT + @Path("/account/{" + Parameters.EXTERNAL_ACCOUNT_NAME + "}" + "/config") + ApiConfigList updateConfig( + @PathParam(Parameters.EXTERNAL_ACCOUNT_NAME) String name, + ApiConfigList config, + @QueryParam(Parameters.MESSAGE) String message); + + /** + * Executes a command on the external account specified + * by name. + *

    + * Available since API v16. + * + * @param name The external account name. + * @param commandName The command name. + * @return Information about the submitted command. + */ + @POST + @Path("/account/{" + Parameters.EXTERNAL_ACCOUNT_NAME + "}/commands/{" + + Parameters.COMMAND_NAME + "}") + public ApiCommand externalAccountCommandByName( + @PathParam(EXTERNAL_ACCOUNT_NAME) String name, + @PathParam(COMMAND_NAME) String commandName); + + /** + * Lists all the commands that can be executed by name on the + * provided external account type. + *

    + * Available since API v16. + * + * @param typeName The external account type name + * @return a list of command metadata objects + */ + @GET + @Path(("/typeInfo/{" + Parameters.EXTERNAL_ACCOUNT_TYPE_NAME + + "}/commandsByName")) + public ApiCommandMetadataList listExternalAccountCommands( + @PathParam(EXTERNAL_ACCOUNT_TYPE_NAME) String typeName); +} diff --git a/java/src/main/java/com/cloudera/api/v16/RootResourceV16.java b/java/src/main/java/com/cloudera/api/v16/RootResourceV16.java new file mode 100644 index 00000000..7c468cb5 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v16/RootResourceV16.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.v16; + +import com.cloudera.api.v15.RootResourceV15; + +import javax.ws.rs.Path; + +@Path("") +public interface RootResourceV16 extends RootResourceV15 { + + /** + * @return The clusters resource handler. + */ + @Override + @Path("/clusters") + public ClustersResourceV16 getClustersResource(); + + /** + * @return The external accounts resource handler. + */ + @Path("/externalAccounts") + ExternalAccountsResourceV16 getExternalAccountsResource(); +} diff --git a/java/src/main/java/com/cloudera/api/v16/ServicesResourceV16.java b/java/src/main/java/com/cloudera/api/v16/ServicesResourceV16.java new file mode 100644 index 00000000..eef20e56 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v16/ServicesResourceV16.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.v16; + +import com.cloudera.api.v15.ServicesResourceV15; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ServicesResourceV16 extends ServicesResourceV15 { + +} diff --git a/java/src/main/java/com/cloudera/api/v16/package-info.java b/java/src/main/java/com/cloudera/api/v16/package-info.java new file mode 100644 index 00000000..84f50ef0 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v16/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 16, introduced in Cloudera Manager 5.11.0. + */ + +package com.cloudera.api.v16; diff --git a/java/src/main/java/com/cloudera/api/v17/ClouderaManagerResourceV17.java b/java/src/main/java/com/cloudera/api/v17/ClouderaManagerResourceV17.java new file mode 100644 index 00000000..95e6efaf --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v17/ClouderaManagerResourceV17.java @@ -0,0 +1,84 @@ +// 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.v17; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.model.ApiHostNameList; +import com.cloudera.api.model.ApiKerberosInfo; +import com.cloudera.api.v16.ClouderaManagerResourceV16; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +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 ClouderaManagerResourceV17 extends ClouderaManagerResourceV16 { + + /** + * Provides Cloudera Manager Kerberos information + * + * @return Cloudera Manager Kerberos information + */ + @GET + @Path("kerberosInfo") + public ApiKerberosInfo getKerberosInfo(); + + /** + * Delete existing Kerberos credentials. + *

    + * This command will affect all services that have been configured to use + * Kerberos, and have existing credentials. + * + * @return Information about the submitted command. + */ + @POST + @Consumes() + @Path("/commands/deleteCredentials") + public ApiCommand deleteCredentialsCommand(); + + /** + * Decommission the given hosts. + * All slave roles on the hosts will be offlined or decommissioned with + * preference being offlined if supported by the service. + *

    + * Currently the offline operation is only supported by HDFS, where + * the offline operation will put DataNodes into HDFS IN MAINTENANCE state which + * prevents unnecessary re-replication which could occur if decommissioned. + *

    + * All other roles on the hosts will be stopped. + *

    + * The offlineTimeout parameter is used to specify a timeout for offline. For HDFS, when the + * timeout expires, the DataNode will automatically transition out of HDFS IN MAINTENANCE state, + * back to HDFS IN SERVICE state. + *

    + * @param hostNameList list of host names to decommission. + * @param offlineTimeout offline timeout in seconds. Specify as null to get the default timeout (4 hours). + * Ignored if service does not support he offline operation. + * @return Information about the submitted command. + */ + @POST + @Consumes + @Path("/commands/hostsOfflineOrDecommission") + public ApiCommand hostsOfflineOrDecommissionCommand( + ApiHostNameList hostNameList, + @QueryParam("offlineTimeout") Long offlineTimeout); +} diff --git a/java/src/main/java/com/cloudera/api/v17/ClustersResourceV17.java b/java/src/main/java/com/cloudera/api/v17/ClustersResourceV17.java new file mode 100644 index 00000000..a95e612f --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v17/ClustersResourceV17.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.v17; + +import static com.cloudera.api.Parameters.*; + +import com.cloudera.api.model.ApiKerberosInfo; +import com.cloudera.api.v16.ClustersResourceV16; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +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 ClustersResourceV17 extends ClustersResourceV16 { + + /** + * Provides Cluster Kerberos information + * @param Cluster Name + * @return Cluster Kerberos information + */ + @GET + @Path("/{clusterName}/kerberosInfo") + public ApiKerberosInfo getKerberosInfo( + @PathParam(CLUSTER_NAME) String clusterName); + + /** + * @return The services resource handler. + */ + @Override + @Path("/{clusterName}/services") + public ServicesResourceV17 getServicesResource( + @PathParam(CLUSTER_NAME) String clusterName); +} diff --git a/java/src/main/java/com/cloudera/api/v17/RootResourceV17.java b/java/src/main/java/com/cloudera/api/v17/RootResourceV17.java new file mode 100644 index 00000000..4c1d261c --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v17/RootResourceV17.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.v17; + +import com.cloudera.api.v1.CommandsResource; +import com.cloudera.api.v16.RootResourceV16; + +import javax.ws.rs.Path; + +@Path("") +public interface RootResourceV17 extends RootResourceV16 { + + /** + * @return The clusters resource handler. + */ + @Override + @Path("/clusters") + public ClustersResourceV17 getClustersResource(); + + /** + * @return The cloudera manager resource handler. + */ + @Override + @Path("/cm") + public ClouderaManagerResourceV17 getClouderaManagerResource(); +} diff --git a/java/src/main/java/com/cloudera/api/v17/ServicesResourceV17.java b/java/src/main/java/com/cloudera/api/v17/ServicesResourceV17.java new file mode 100644 index 00000000..7eaaaaee --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v17/ServicesResourceV17.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.v17; + +import static com.cloudera.api.Parameters.*; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.model.ApiRoleNameList; +import com.cloudera.api.v16.ServicesResourceV16; + +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.QueryParam; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ServicesResourceV17 extends ServicesResourceV16 { + /** + * Offline roles of a service. + *

    + * Currently the offline operation is only supported by HDFS. + *

    + * For HDFS, the offline operation will put DataNodes into HDFS IN MAINTENANCE state which + * prevents unnecessary re-replication which could occur if decommissioned. + *

    + * The timeout parameter is used to specify a timeout for offline. For HDFS, when the + * timeout expires, the DataNode will automatically transition out of HDFS IN MAINTENANCE + * state, back to HDFS IN SERVICE state. + *

    + * @param serviceName The service name. + * @param roleNames List of role names to offline. + * @param timeout Offline timeout in seconds. Offlined roles will automatically transition from offline + * state to normal state after timeout. + * Specify as null to get the default timeout (4 hours). + * @return Information about the submitted command. + */ + @POST + @Path("/{serviceName}/commands/offline") + public ApiCommand offlineCommand( + @PathParam(SERVICE_NAME) String serviceName, + ApiRoleNameList roleNames, + @QueryParam("timeout") Long timeout); + + /** + * Validate the Hive Metastore Schema. + *

    + * This command checks the Hive metastore schema for any errors and corruptions. + * This command is to be run on two instances: + *

  • After the Hive Metastore database tables are created.
  • + *
  • Both before and after upgrading the Hive metastore database schema./li> + * *

    + * Available since API v17. + * + * @param serviceName Name of the Hive service on which to run the command. + * @return Information about the submitted command. + */ + @POST + @Path("/{serviceName}/commands/hiveValidateMetastoreSchema") + public ApiCommand hiveValidateMetastoreSchemaCommand( + @PathParam(SERVICE_NAME) String serviceName); +} diff --git a/java/src/main/java/com/cloudera/api/v17/package-info.java b/java/src/main/java/com/cloudera/api/v17/package-info.java new file mode 100644 index 00000000..9a7c2d49 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v17/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 17, introduced in Cloudera Manager 5.12.0. + */ + +package com.cloudera.api.v17; diff --git a/java/src/main/java/com/cloudera/api/v18/ClouderaManagerResourceV18.java b/java/src/main/java/com/cloudera/api/v18/ClouderaManagerResourceV18.java new file mode 100644 index 00000000..ce994979 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v18/ClouderaManagerResourceV18.java @@ -0,0 +1,64 @@ +// 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.v18; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.v17.ClouderaManagerResourceV17; + +import static com.cloudera.api.Parameters.DELETE_CREDENTIALS_MODE; +import static com.cloudera.api.Parameters.DELETE_CREDENTIALS_MODE_DEFAULT; + +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 ClouderaManagerResourceV18 extends ClouderaManagerResourceV17 { + + /** + * Return the Cloudera Management Services resource. + * + * @return The Cloudera Management Services resource. + */ + @Override + @Path("/service") + public MgmtServiceResourceV18 getMgmtServiceResource(); + + /** + * Delete existing Kerberos credentials. + *

    + * This command will affect all services that have been configured to use + * Kerberos, and have existing credentials. In V18 this takes a new + * paramater to determine whether it needs to delete all credentials + * or just unused ones. + * + * @param mode this can be set to "all" or "unused" + * + * @return Information about the submitted command. + */ + @POST + @Consumes() + @Path("/commands/deleteCredentials") + public ApiCommand deleteCredentialsCommand( + @QueryParam(DELETE_CREDENTIALS_MODE) + @DefaultValue(DELETE_CREDENTIALS_MODE_DEFAULT) String mode); +} diff --git a/java/src/main/java/com/cloudera/api/v18/ClustersResourceV18.java b/java/src/main/java/com/cloudera/api/v18/ClustersResourceV18.java new file mode 100644 index 00000000..af6e9981 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v18/ClustersResourceV18.java @@ -0,0 +1,90 @@ +// 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.v18; + +import static com.cloudera.api.Parameters.*; + +import com.cloudera.api.model.ApiClusterUtilization; +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.v17.ClustersResourceV17; + +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; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ClustersResourceV18 extends ClustersResourceV17 { + + /** + * @return The services resource handler. + */ + @Override + @Path("/{clusterName}/services") + public ServicesResourceV18 getServicesResource( + @PathParam(CLUSTER_NAME) String clusterName); + + /** + * Provides the resource utilization of the entire cluster as well as the + * resource utilization per tenant. Only available with Cloudera Manager Enterprise Edition. + * + * @param clusterName cluster name + * @param from Start of the time range to report utilization in ISO 8601 format. + * @param to End of the the time range to report utilization in ISO 8601 format (defaults to now). + * @param tenantType The type of the tenant (POOL or USER). + * @param daysOfWeek The days of the week for which the user wants to report utilization. + * Days is a list of number between 1 to 7, where 1 corresponds to Monday, + * and 7 corrensponds to Sunday. All 7 days are included if this is not specified. + * @param startHourOfDay The start hour of a day for which the user wants to report utilization. + * The hour is a number between [0-23]. Default value is 0 if this is not specified. + * @param endHourOfDay The end hour of a day for which the user wants to report utilization. + * The hour is a number between [0-23]. Default value is 23 if this is not specified. + * @return Cluster utilization report resource handler. + */ + @GET + @Path("/{clusterName}/utilization") + public ApiClusterUtilization getUtilizationReport( + @PathParam(CLUSTER_NAME) String clusterName, + @QueryParam(FROM) String from, + @QueryParam(TO) @DefaultValue(DATE_TIME_NOW) String to, + @QueryParam(TENANT_TYPE) @DefaultValue(POOL) String tenantType, + @QueryParam(DAYS_OF_WEEK) List daysOfWeek, + @QueryParam(START_HOUR_OF_DAY) @DefaultValue("0") int startHourOfDay, + @QueryParam(END_HOUR_OF_DAY) @DefaultValue("23") int endHourOfDay); + + /** + * Delete existing Kerberos credentials for the cluster. + *

    + * This command will affect all services that have been configured to use + * Kerberos, and have existing credentials. + * + * @param clusterName cluster name + * @return Information about the submitted command. + */ + @POST + @Consumes() + @Path("/{clusterName}/commands/deleteCredentials") + public ApiCommand deleteClusterCredentialsCommand( + @PathParam(CLUSTER_NAME) String clusterName); +} diff --git a/java/src/main/java/com/cloudera/api/v18/MgmtRolesResourceV18.java b/java/src/main/java/com/cloudera/api/v18/MgmtRolesResourceV18.java new file mode 100644 index 00000000..9f9764b1 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v18/MgmtRolesResourceV18.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.v18; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.v8.MgmtRolesResourceV8; + +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; + +import static com.cloudera.api.Parameters.ROLE_NAME; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface MgmtRolesResourceV18 extends MgmtRolesResourceV8 { + + /** + * Put the Cloudera Management Service role into maintenance mode.This is a + * synchronous command. The result is known immediately upon return. + * + *

    + * Available since API v18. + *

    + * + * @param roleName The role name. + * @return Synchronous command result. + */ + @POST + @Consumes + @Path("/{roleName}/commands/enterMaintenanceMode") + public ApiCommand enterMaintenanceMode(@PathParam(ROLE_NAME) String roleName); + + /** + * Take the Cloudera Management Service role out of maintenance mode. This is + * a synchronous command. The result is known immediately upon return. + * + *

    + * Available since API v18. + *

    + * + * @param roleName The role name. + * @return Synchronous command result. + */ + @POST + @Consumes + @Path("/{roleName}/commands/exitMaintenanceMode") + public ApiCommand exitMaintenanceMode(@PathParam(ROLE_NAME) String roleName); + +} diff --git a/java/src/main/java/com/cloudera/api/v18/MgmtServiceResourceV18.java b/java/src/main/java/com/cloudera/api/v18/MgmtServiceResourceV18.java new file mode 100644 index 00000000..d7a70403 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v18/MgmtServiceResourceV18.java @@ -0,0 +1,65 @@ +// 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.v18; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.v8.MgmtServiceResourceV8; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +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 MgmtServiceResourceV18 extends MgmtServiceResourceV8 { + + /** + * Return the management roles resource handler. + * + * @return The roles resource handler. + */ + @Path("/roles") + public MgmtRolesResourceV18 getRolesResource(); + + /** + * Put Cloudera Management Service into maintenance mode. This is a + * synchronous command. The result is known immediately upon return. + * + *

    Available since API v18.

    + * + * @return Synchronous command result. + */ + @POST + @Consumes + @Path("/commands/enterMaintenanceMode") + public ApiCommand enterMaintenanceMode(); + + /** + * Take Cloudera Management Service out of maintenance mode. This is a + * synchronous command. The result is known immediately upon return. + * + *

    Available since API v18.

    + * + * @return Synchronous command result. + */ + @POST + @Consumes + @Path("/commands/exitMaintenanceMode") + public ApiCommand exitMaintenanceMode(); +} diff --git a/java/src/main/java/com/cloudera/api/v18/ReplicationsResourceV18.java b/java/src/main/java/com/cloudera/api/v18/ReplicationsResourceV18.java new file mode 100644 index 00000000..55d96687 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v18/ReplicationsResourceV18.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.v18; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.v13.ReplicationsResourceV13; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; + +public interface ReplicationsResourceV18 extends ReplicationsResourceV13 { + + /** + * Run the hdfs copy listing command + *

    + * The copy listing command will be triggered with the provided arguments + *

    + * Available since API v18. Only available with Cloudera Manager Enterprise + * Edition. + * + * @return Information about the submitted command. + */ + @POST + @Path("/hdfsCopyListing") + @Consumes + public ApiCommand runCopyListing(String cmdArgs); +} diff --git a/java/src/main/java/com/cloudera/api/v18/RootResourceV18.java b/java/src/main/java/com/cloudera/api/v18/RootResourceV18.java new file mode 100644 index 00000000..2a5404e2 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v18/RootResourceV18.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.v18; + +import com.cloudera.api.v17.RootResourceV17; + +import javax.ws.rs.Path; + +@Path("") +public interface RootResourceV18 extends RootResourceV17 { + + /** + * @return The clusters resource handler. + */ + @Override + @Path("/clusters") + public ClustersResourceV18 getClustersResource(); + + /** + * @return The Cloudera Manager resource handler. + */ + @Override + @Path("/cm") + public ClouderaManagerResourceV18 getClouderaManagerResource(); + +} diff --git a/java/src/main/java/com/cloudera/api/v18/ServicesResourceV18.java b/java/src/main/java/com/cloudera/api/v18/ServicesResourceV18.java new file mode 100644 index 00000000..47282476 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v18/ServicesResourceV18.java @@ -0,0 +1,156 @@ +// 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.v18; + +import static com.cloudera.api.Parameters.*; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.model.ApiDisableSentryHaArgs; +import com.cloudera.api.model.ApiEnableSentryHaArgs; +import com.cloudera.api.model.ApiImpalaUtilization; +import com.cloudera.api.model.ApiYarnUtilization; +import com.cloudera.api.v17.ServicesResourceV17; + +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; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ServicesResourceV18 extends ServicesResourceV17{ + + /** + * Enable high availability (HA) for Sentry service. + *

    + * This command only applies to CDH 5.13+ Sentry services. + *

    + * The command will create a new Sentry server on the specified host + * and set the ZooKeeper configs needed for Sentry HA. + *

    + * As part of enabling HA, all services that depend on HDFS will be + * restarted after enabling Sentry HA. + *

    + * Note: Sentry doesn't support Rolling Restart. + * + * @param serviceName A String representing the Sentry service name. + * @param args An instance of {@link ApiEnableSentryHaArgs} + * representing the arguments to the command. + * @return the created command instance + */ + @POST + @Path("/{serviceName}/commands/enableSentryHa") + ApiCommand enableSentryHaCommand( + @PathParam(SERVICE_NAME) String serviceName, + ApiEnableSentryHaArgs args); + + /** + * Disable high availability (HA) for Sentry service. + *

    + * This command only applies to CDH 5.13+ Sentry services. + *

    + * The command will keep exactly one Sentry server, on the specified host, + * and update the ZooKeeper configs needed for Sentry. + *

    + * All services that depend on HDFS will be restarted after enabling Sentry HA. + *

    + * Note: Sentry doesn't support Rolling Restart. + * + * @param serviceName A String representing the Sentry service name. + * @param args An instance of {@link ApiDisableSentryHaArgs} + * representing the arguments to the command. + * @return the created command instance + */ + @POST + @Path("/{serviceName}/commands/disableSentryHa") + ApiCommand disableSentryHaCommand( + @PathParam(SERVICE_NAME) String serviceName, + ApiDisableSentryHaArgs args); + + /** + * Provides the resource utilization of the yarn service as well as the + * resource utilization per tenant. Only available with Cloudera Manager Enterprise Edition. + * + * @param serviceName service name + * @param from Start of the time range to report utilization in ISO 8601 format. + * @param to End of the the time range to report utilization in ISO 8601 format (defaults to now). + * @param tenantType The type of the tenant (POOL or USER). + * @param daysOfWeek The days of the week for which the user wants to report utilization. + * Days is a list of number between 1 to 7, where 1 corresponds to Mon. and 7 corresponds to Sun. + * All 7 days are included if this is not specified. + * @param startHourOfDay The start hour of a day for which the user wants to report utilization. + * The hour is a number between [0-23]. Default value is 0 if this is not specified. + * @param endHourOfDay The end hour of a day for which the user wants to report utilization. + * The hour is a number between [0-23]. Default value is 23 if this is not specified. + * @return utilization report of yarn service. + */ + @GET + @Path("/{serviceName}/yarnUtilization") + public ApiYarnUtilization getYarnUtilization( + @PathParam(SERVICE_NAME) String serviceName, + @QueryParam(FROM) String from, + @QueryParam(TO) @DefaultValue(DATE_TIME_NOW) String to, + @QueryParam(TENANT_TYPE) @DefaultValue("POOL") String tenantType, + @QueryParam(DAYS_OF_WEEK) List daysOfWeek, + @QueryParam(START_HOUR_OF_DAY) @DefaultValue("0") int startHourOfDay, + @QueryParam(END_HOUR_OF_DAY) @DefaultValue("23") int endHourOfDay); + + /** + * Provides the resource utilization of the Impala service as well as the + * resource utilization per tenant. Only available with Cloudera Manager Enterprise Edition. + * + * @param serviceName service name + * @param from Start of the time range to report utilization in ISO 8601 format. + * @param to End of the the time range to report utilization in ISO 8601 format (defaults to now). + * @param tenantType The type of the tenant (POOL or USER). + * @param daysOfWeek The days of the week for which the user wants to report utilization. + * Days is a list of number between 1 to 7, where 1 corresponds to Mon. and 7 corresponds to Sun. + * All 7 days are included if this is not specified. + * @param startHourOfDay The start hour of a day for which the user wants to report utilization. + * The hour is a number between [0-23]. Default value is 0 if this is not specified. + * @param endHourOfDay The end hour of a day for which the user wants to report utilization. + * The hour is a number between [0-23]. Default value is 23 if this is not specified. + * @return utilization report of Impala service. + */ + @GET + @Path("/{serviceName}/impalaUtilization") + public ApiImpalaUtilization getImpalaUtilization( + @PathParam(SERVICE_NAME) String serviceName, + @QueryParam(FROM) String from, + @QueryParam(TO) @DefaultValue(DATE_TIME_NOW) String to, + @QueryParam(TENANT_TYPE) @DefaultValue("POOL") String tenantType, + @QueryParam(DAYS_OF_WEEK) List daysOfWeek, + @QueryParam(START_HOUR_OF_DAY) @DefaultValue("0") int startHourOfDay, + @QueryParam(END_HOUR_OF_DAY) @DefaultValue("23") int endHourOfDay); + + /** + * 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 ReplicationsResourceV18 getReplicationsResource( + @PathParam(SERVICE_NAME) String serviceName); +} diff --git a/java/src/main/java/com/cloudera/api/v18/package-info.java b/java/src/main/java/com/cloudera/api/v18/package-info.java new file mode 100644 index 00000000..714985e4 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v18/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 18, introduced in Cloudera Manager 5.13.0. + */ + +package com.cloudera.api.v18; diff --git a/java/src/main/java/com/cloudera/api/v19/ClouderaManagerResourceV19.java b/java/src/main/java/com/cloudera/api/v19/ClouderaManagerResourceV19.java new file mode 100644 index 00000000..b02ee4c4 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v19/ClouderaManagerResourceV19.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.v19; + +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.model.ApiHostNameList; +import com.cloudera.api.model.ApiHostRecommissionType; +import com.cloudera.api.v18.ClouderaManagerResourceV18; + +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 ClouderaManagerResourceV19 extends ClouderaManagerResourceV18 { + + /** + * Recommission and exit maintenance on the given hosts. + * The recommission step may optionally start roles as well. + * + * @return Information about the submitted command. + */ + @POST + @Consumes + @Path("/commands/hostsRecommissionAndExitMaintenanceMode") + public ApiCommand hostsRecommissionAndExitMaintenanceModeCommand( + ApiHostNameList hostNameList, + @QueryParam("recommissionType") @DefaultValue("recommission") ApiHostRecommissionType recommissionType); +} diff --git a/java/src/main/java/com/cloudera/api/v19/RootResourceV19.java b/java/src/main/java/com/cloudera/api/v19/RootResourceV19.java new file mode 100644 index 00000000..63296e07 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v19/RootResourceV19.java @@ -0,0 +1,31 @@ +// 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.v19; + +import com.cloudera.api.v18.RootResourceV18; + +import javax.ws.rs.Path; + +@Path("") +public interface RootResourceV19 extends RootResourceV18 { + + /** + * @return The Cloudera Manager resource handler. + */ + @Override + @Path("/cm") + public ClouderaManagerResourceV19 getClouderaManagerResource(); +} diff --git a/java/src/main/java/com/cloudera/api/v19/package-info.java b/java/src/main/java/com/cloudera/api/v19/package-info.java new file mode 100644 index 00000000..5f4133ee --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v19/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 19, introduced in Cloudera Manager 5.14.0. + */ + +package com.cloudera.api.v19; 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..ea49c438 100644 --- a/java/src/main/java/com/cloudera/api/v4/TimeSeriesResource.java +++ b/java/src/main/java/com/cloudera/api/v4/TimeSeriesResource.java @@ -40,14 +40,15 @@ public interface TimeSeriesResource { * data store using a tsquery. *

      * 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..6876a9a5 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..bb6da6b7 100644 --- a/java/src/test/java/com/cloudera/api/ClouderaManagerClientBuilderTest.java +++ b/java/src/test/java/com/cloudera/api/ClouderaManagerClientBuilderTest.java @@ -16,17 +16,40 @@ 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.lang.reflect.InvocationHandler; +import java.lang.reflect.Proxy; import java.net.MalformedURLException; import java.net.URL; 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 { + /** + * Replacement for WebClient.getConfig() on delegated proxy. + * + * Because we use dynamic proxy mechanism to delegate call from {@link ApiRootResource} + * to {@link ApiRootResourceExternal}, instanceof operator doesn't work since they don't + * share any common interface. Hence need for this method. + */ + private ClientConfiguration getClientConfigFromProxy(ApiRootResource proxy) { + InvocationHandler invocationHandler = Proxy.getInvocationHandler(proxy); + assertTrue(invocationHandler instanceof ApiRootResourceInvocationHandler); + return WebClient.getConfig( + ((ApiRootResourceInvocationHandler)invocationHandler).getDelegateRootResource()); + } + @Test public void testURLGeneration() throws MalformedURLException { assertEquals("Wrong address generated from base url", @@ -96,4 +119,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 = getClientConfigFromProxy(proxy); + assertNotNull(cfg); + Boolean maintainSession = (Boolean)cfg.getRequestContext().get(Message.MAINTAIN_SESSION); + assertNull(maintainSession); + + proxy = builder.setMaintainSessionAcrossRequests(true).build(); + cfg = getClientConfigFromProxy(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 = getClientConfigFromProxy(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 = getClientConfigFromProxy(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 = getClientConfigFromProxy(proxy); + assertNotNull(cfg); + Boolean autoClosure = (Boolean)cfg.getRequestContext().get("response.stream.auto.close"); + assertNull(autoClosure); + + proxy = builder.enableStreamAutoClosure().build(); + cfg = getClientConfigFromProxy(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..3fe10a6d 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); } @@ -611,10 +624,13 @@ public void testDeployment() throws Exception { public void testHdfsReplication() throws Exception { ApiHdfsReplicationArguments hdfsArgs = newHdfsReplicationArguments(); ApiReplicationSchedule hdfsInfo = - new ApiReplicationSchedule(20L, new Date(1234), new Date(5678), 10, - ApiScheduleInterval.MONTH, true); + new ApiReplicationSchedule(20L, new Date(1234), new Date(5678), 10, + ApiScheduleInterval.MONTH, true); + hdfsInfo.setDisplayName("hdfs replication schedule"); + hdfsInfo.setDescription("hdfs replication description"); hdfsInfo.setHdfsArguments(hdfsArgs); hdfsInfo.setNextRun(new Date(12345)); + hdfsInfo.setActive(true); ApiReplicationCommand cmd = new ApiReplicationCommand(); fillInCommand(cmd); @@ -655,15 +671,20 @@ public void testHiveReplication() throws Exception { args.setForce(true); args.setReplicateData(true); args.setReplicateImpalaMetadata(true); + args.setRunInvalidateMetadata(true); + args.setNumThreads(4); ApiHdfsReplicationArguments hdfsArgs = newHdfsReplicationArguments(); args.setHdfsArguments(hdfsArgs); checkJsonXML(args); - ApiReplicationSchedule sch = new ApiReplicationSchedule(20L, - new Date(1234), new Date(5678), 10, ApiScheduleInterval.MONTH, true); + ApiReplicationSchedule sch = new ApiReplicationSchedule(20L, new Date(1234), + new Date(5678), 10, ApiScheduleInterval.MONTH, true); + sch.setDisplayName("hive replication schedule"); + sch.setDescription("hive replication description"); sch.setHiveArguments(args); + sch.setActive(true); checkJsonXML(sch); ApiHiveReplicationResult res = new ApiHiveReplicationResult(); @@ -671,11 +692,15 @@ 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"); + res.setRunOnSourceAsUser("hdfs"); ApiHdfsReplicationResult hdfsRes = newHdfsReplicationResult(); res.setDataReplicationResult(hdfsRes); @@ -833,6 +858,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 +868,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, 1.5d, 2d, 3d, 4d, 5d); checkJsonXML(application); ApiYarnApplicationResponse response = new ApiYarnApplicationResponse( @@ -896,8 +924,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 +935,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() { @@ -925,9 +961,13 @@ private ApiHdfsReplicationArguments newHdfsReplicationArguments() { hdfsArgs.setPreservePermissions(true); hdfsArgs.setLogPath("log1"); hdfsArgs.setSkipChecksumChecks(true); + hdfsArgs.setSkipListingChecksumChecks(true); hdfsArgs.setSkipTrash(true); hdfsArgs.setPreserveXAttrs(true); hdfsArgs.setReplicationStrategy(ReplicationStrategy.DYNAMIC); + hdfsArgs.setExclusionFilters(Lists.newArrayList("/a/.*", "/b/.*")); + hdfsArgs.setSourceUser("hdfs"); + hdfsArgs.setRaiseSnapshotDiffFailures(true); return hdfsArgs; } @@ -946,6 +986,10 @@ private ApiHdfsReplicationResult newHdfsReplicationResult() { result.setNumBytesCopyFailed(400); result.setSetupError("error"); result.setSnapshottedDirs(Arrays.asList("/user/a")); + result.setFailedFiles(Arrays.asList("path1")); + result.setRunAsUser("systest"); + result.setRunOnSourceAsUser("hdfs"); + result.setEstimatedCompletionTime(new Date()); return result; } @@ -958,6 +1002,7 @@ private void fillInCommand(ApiCommand cmd) { cmd.setSuccess(false); cmd.setResultMessage("message"); cmd.setResultDataUrl("url"); + cmd.setCanRetry(false); } private ApiCluster newCluster() { @@ -966,9 +1011,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 +1028,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 +1041,7 @@ private ApiHost newHost() { host.setRackId("/default"); host.setRoleRefs(roleRefs); host.setTotalPhysMemBytes(1234L); + host.setClusterRef(new ApiClusterRef("clusterName")); return host; } @@ -1006,4 +1056,167 @@ private ApiUser newUser() { return user; } + @Test + public void testApiClusterUtilization() throws IllegalAccessException, InstantiationException, IOException, JAXBException { + ApiClusterUtilization util = new ApiClusterUtilization(); + util.setTotalCpuCores(1d); + util.setAvgCpuUtilization(2d); + util.setMaxCpuUtilization(3d); + util.setMaxCpuUtilizationTimestampMs(4l); + util.setAvgCpuDailyPeak(5d); + util.setAvgWorkloadCpu(6d); + util.setMaxWorkloadCpu(7d); + util.setMaxWorkloadCpuTimestampMs(8l); + util.setAvgWorkloadCpuDailyPeak(9d); + + util.setTotalMemory(1d); + util.setAvgMemoryUtilization(2d); + util.setMaxMemoryUtilization(3d); + util.setMaxMemoryUtilizationTimestampMs(4l); + util.setAvgMemoryDailyPeak(5d); + util.setAvgWorkloadMemory(6d); + util.setMaxWorkloadMemory(7d); + util.setMaxWorkloadMemoryTimestampMs(8l); + util.setAvgWorkloadMemoryDailyPeak(9d); + + util.setErrorMessage("foo"); + + ApiTenantUtilization t1 = new ApiTenantUtilization(); + t1.setTenantName("t1"); + t1.setCpuUtilizationPercentage(10d); + t1.setMemoryUtilizationPercentage(20d); + + ApiTenantUtilizationList tList = new ApiTenantUtilizationList(); + tList.add(t1); + util.setTenantUtilizations(tList); + + checkJsonXML(util); + } + + @Test + public void testApiYarnUtilization() throws IllegalAccessException, InstantiationException, IOException, JAXBException { + ApiYarnUtilization util = new ApiYarnUtilization(); + + util.setAvgCpuUtilization(2d); + util.setMaxCpuUtilization(3d); + util.setMaxCpuUtilizationTimestampMs(4l); + util.setAvgCpuDailyPeak(5d); + util.setAvgCpuUtilizationPercentage(6d); + util.setMaxCpuUtilizationPercentage(7d); + util.setAvgCpuDailyPeakPercentage(8d); + + util.setAvgMemoryUtilization(2d); + util.setMaxMemoryUtilization(3d); + util.setMaxMemoryUtilizationTimestampMs(4l); + util.setAvgMemoryDailyPeak(5d); + util.setAvgMemoryUtilizationPercentage(6d); + util.setMaxMemoryUtilizationPercentage(7d); + util.setAvgMemoryDailyPeakPercentage(8d); + + util.setErrorMessage("foo"); + + ApiYarnTenantUtilization t1 = new ApiYarnTenantUtilization(); + t1.setTenantName("t1"); + + t1.setAvgYarnCpuAllocation(1d); + t1.setAvgYarnCpuUtilization(2d); + t1.setAvgYarnCpuUnusedCapacity(3d); + t1.setAvgYarnCpuSteadyFairShare(4d); + t1.setAvgYarnPoolAllocatedCpuDuringContention(5d); + t1.setAvgYarnPoolFairShareCpuDuringContention(6d); + t1.setAvgYarnPoolSteadyFairShareCpuDuringContention(7d); + + t1.setAvgYarnMemoryAllocation(1d); + t1.setAvgYarnMemoryUtilization(2d); + t1.setAvgYarnMemoryUnusedCapacity(3d); + t1.setAvgYarnMemorySteadyFairShare(4d); + t1.setAvgYarnPoolAllocatedMemoryDuringContention(5d); + t1.setAvgYarnPoolFairShareMemoryDuringContention(6d); + t1.setAvgYarnPoolSteadyFairShareMemoryDuringContention(7d); + + t1.setAvgYarnContainerWaitRatio(8d); + + ApiYarnTenantUtilizationList tList = new ApiYarnTenantUtilizationList(); + tList.add(t1); + util.setTenantUtilizations(tList); + + checkJsonXML(util); + } + + @Test + public void testApiImpalaUtilization() throws IllegalAccessException, InstantiationException, IOException, JAXBException { + ApiImpalaUtilization util = new ApiImpalaUtilization(); + + util.setTotalQueries(1d); + util.setSuccessfulQueries(2d); + util.setOomQueries(3d); + util.setTimeOutQueries(4d); + util.setRejectedQueries(5d); + + util.setSuccessfulQueriesPercentage(2d); + util.setOomQueriesPercentage(3d); + util.setTimeOutQueriesPercentage(4d); + util.setRejectedQueriesPercentage(5d); + + util.setAvgWaitTimeInQueue(6d); + util.setPeakAllocationTimestampMS(7l); + util.setMaxAllocatedMemory(8d); + util.setMaxAllocatedMemoryPercentage(9d); + util.setUtilizedAtMaxAllocated(10d); + util.setUtilizedAtMaxAllocatedPercentage(11d); + util.setPeakUsageTimestampMS(12l); + util.setMaxUtilizedMemory(13d); + util.setMaxUtilizedMemoryPercentage(14d); + util.setAllocatedAtMaxUtilized(15d); + util.setAllocatedAtMaxUtilizedPercentage(16d); + + util.setErrorMessage("foo"); + + ApiImpalaUtilizationHistogramBin bin = new ApiImpalaUtilizationHistogramBin(); + bin.setStartPointInclusive(1d); + bin.setEndPointExclusive(2d); + bin.setNumberOfImpalaDaemons(3l); + + ApiImpalaUtilizationHistogramBinList bins = new ApiImpalaUtilizationHistogramBinList(); + bins.add(bin); + + ApiImpalaUtilizationHistogram hist = new ApiImpalaUtilizationHistogram(); + hist.setBins(bins); + + util.setDistributionAllocatedByImpalaDaemon(hist); + util.setDistributionUtilizedByImpalaDaemon(hist); + + ApiImpalaTenantUtilization tenantUtil = new ApiImpalaTenantUtilization(); + + tenantUtil.setTenantName("t1"); + tenantUtil.setTotalQueries(1d); + tenantUtil.setSuccessfulQueries(2d); + tenantUtil.setOomQueries(3d); + tenantUtil.setTimeOutQueries(4d); + tenantUtil.setRejectedQueries(5d); + tenantUtil.setAvgWaitTimeInQueue(6d); + + tenantUtil.setPeakAllocationTimestampMS(7l); + tenantUtil.setMaxAllocatedMemory(8d); + tenantUtil.setMaxAllocatedMemoryPercentage(9d); + tenantUtil.setUtilizedAtMaxAllocated(10d); + tenantUtil.setUtilizedAtMaxAllocatedPercentage(11d); + tenantUtil.setPeakUsageTimestampMS(12l); + tenantUtil.setMaxUtilizedMemory(13d); + tenantUtil.setMaxUtilizedMemoryPercentage(14d); + tenantUtil.setAllocatedAtMaxUtilized(15d); + tenantUtil.setAllocatedAtMaxUtilizedPercentage(16d); + + tenantUtil.setDistributionAllocatedByImpalaDaemon(hist); + tenantUtil.setDistributionUtilizedByImpalaDaemon(hist); + + tenantUtil.setAvgSpilledMemory(10d); + tenantUtil.setMaxSpilledMemory(11d); + + ApiImpalaTenantUtilizationList tList = new ApiImpalaTenantUtilizationList(); + tList.add(tenantUtil); + util.setTenantUtilizations(tList); + + checkJsonXML(util); + } } From 1fe50b7c1bb3fb43aa3f546dbf389191da7e089a Mon Sep 17 00:00:00 2001 From: Bankim Bhavsar Date: Wed, 11 Jul 2018 12:59:57 -0700 Subject: [PATCH 2/2] OPSAPS-46858 Fix API version for 5.15.0 pip installation for cm-api client is failing after CM API client was updated in 5.15.0 to v20. This appears to be due to incorrect upload of python egg package to external pypi. For 5.15, there was no API version bump to v20, no new API endpoints added/modified/deleted. However there were changes to argument classes for missing fields mainly for BDR. OPSAPS-46448. Historically we appear to be bumping up CM API version every release which wasn't the case for 5.15. For customers to get more recent version of cm-api python package from external pypi we'll need to bump up the version to like 19.1.0 to avoid confusion with CM API version. The version here is simply cm-api python package version. There are more problems. Since the internal starship/cm_api repo was updated to version v30 for cdep and internal consumption that has made it's way into external cm_api repository. This change fixes it. This change will go directly to external cm_api repository. Tests: - sudo python ./setup.py install (From cm_api/python directory) Copying cm_api-19.1.0-py2.7.egg to /usr/local/lib/python2.7/dist-packages Adding cm-api 19.1.0 to easy-install.pth file Installing cmps script to /usr/local/bin Installed /usr/local/lib/python2.7/dist-packages/cm_api-19.1.0-py2.7.egg Processing dependencies for cm-api==19.1.0 Finished processing dependencies for cm-api==19.1.0 --- python/setup.py | 10 +--------- python/src/cm_api/api_client.py | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/python/setup.py b/python/setup.py index 0289ba26..6d68181e 100644 --- a/python/setup.py +++ b/python/setup.py @@ -20,14 +20,6 @@ from sys import version_info, platform -# Append a timestamp to the version for local PyPI publication -# USE_TIMESTAMP=1 python ./setup.py sdist upload -r local -if "USE_TIMESTAMP" in os.environ: - stamp = "." + datetime.datetime.now().strftime("%Y%m%d%H%M") -else: - stamp = "" - - if version_info[:2] > (2, 5): install_requires = [] else: @@ -52,7 +44,7 @@ setup( name = 'cm_api', - version = '30.0.0' + stamp, # Compatible with API v30 (CM 6.0) + version = '19.1.0', # Compatible with API v10 (CM 5.15.0) packages = find_packages(src_dir, exclude=['cm_api_tests']), package_dir = {'': src_dir }, zip_safe = True, diff --git a/python/src/cm_api/api_client.py b/python/src/cm_api/api_client.py index 1e1b9e66..fa7cda93 100644 --- a/python/src/cm_api/api_client.py +++ b/python/src/cm_api/api_client.py @@ -30,7 +30,7 @@ LOG = logging.getLogger(__name__) API_AUTH_REALM = "Cloudera Manager" -API_CURRENT_VERSION = 30 +API_CURRENT_VERSION = 19 class ApiException(RestException): """