diff --git a/java/api-docs.fmt b/java/api-docs.fmt index 6c49f15a..188eb6e9 100644 --- a/java/api-docs.fmt +++ b/java/api-docs.fmt @@ -1064,10 +1064,10 @@ A service is an abstract entity providing a capability in a cluster. Examples of services are HDFS, MapReduce, YARN, and HBase. A service is usually distributed, and contains a set of roles that physically - run on the cluster. A service has its own configuration, status, - metrics, and roles. You may issue commands against a service, or - against a set of roles in bulk. Additionally, an HDFS service has - nameservices, and a MapReduce service has activities. + run on the cluster. A service has its own configuration, status and + roles. You may issue commands against a service, or against a set + of roles in bulk. Additionally, an HDFS service has nameservices, + and a MapReduce service has activities.

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

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

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

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

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

Debugging the API

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

Metrics

+

Querying metric data

-

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

+ Getting dfs capacity metric data for service HDFS-1. $ curl -u admin:admin \ - 'http://localhost:7180/api/v1/clusters/Cluster%201%20-%20CDH4/services/hdfs1/metrics?metrics=dfs_capacity_used_non_hdfs&metrics=dfs_capacity' + 'http://localhost:7180/api/v11/timeseries?query=select%20dfs_capacity,%20dfs_capacity_used,%20dfs_capacity_used_non_hdfs%20where%20entityName=HDFS-1' { "items" : [ { - "name" : "dfs_capacity_used_non_hdfs", - "context" : "hdfs1:nameservice1", - "data" : [ { - "value" : 0.0, - "timestamp" : "2012-05-06T10:25:46.000Z" - }, { - "value" : 0.0, - "timestamp" : "2012-05-06T10:26:46.000Z" - }, { - "value" : 0.0, - "timestamp" : "2012-05-06T10:27:46.000Z" - }, { - "value" : 0.0, - "timestamp" : "2012-05-06T10:28:46.000Z" - }, { - "value" : 0.0, - "timestamp" : "2012-05-06T10:29:46.000Z" - } ], - "unit" : "bytes" - }, { - "name" : "dfs_capacity", - "context" : "hdfs1:nameservice1", - "data" : [ { - "value" : 3.2103841792E10, - "timestamp" : "2012-05-06T10:25:46.000Z" - }, { - "value" : 3.2103841792E10, - "timestamp" : "2012-05-06T10:26:46.000Z" - }, { - "value" : 3.2103841792E10, - "timestamp" : "2012-05-06T10:27:46.000Z" + "timeSeries": [ { + "metadata": { + "metricName": "dfs_capacity", + "entityName": "HDFS-1", + "startTime": "2015-09-17T23:42:22.533Z", + "endTime": "2015-09-17T23:47:22.533Z", + "attributes": { + "clusterName": "Cluster 1", + "category": "SERVICE", + "clusterDisplayName": "Cluster 1", + "active": "true", + "serviceType": "HDFS", + "serviceDisplayName": "HDFS-1", + "version": "CDH 5.7.0", + "serviceName": "HDFS-1", + "entityName": "HDFS-1" + }, + "unitNumerators": [ + "bytes" + ], + "unitDenominators": [], + "expression": "SELECT dfs_capacity WHERE entityName = \"HDFS-1\" AND category = SERVICE", + "metricCollectionFrequencyMs": 60000, + "rollupUsed": "RAW" + }, + "data": [ { + "timestamp": "2015-09-17T23:43:10.599Z", + "value": 86909397813, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:44:10.605Z", + "value": 86909397813, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:45:10.608Z", + "value": 86909397813, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:46:10.615Z", + "value": 86909397813, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:47:15.613Z", + "value": 86909397813, + "type": "SAMPLE" + } ] }, { - "value" : 3.2103841792E10, - "timestamp" : "2012-05-06T10:28:46.000Z" + "metadata": { + "metricName": "dfs_capacity_used", + "entityName": "HDFS-1", + "startTime": "2015-09-17T23:42:22.533Z", + "endTime": "2015-09-17T23:47:22.533Z", + "attributes": { + "clusterName": "Cluster 1", + "category": "SERVICE", + "clusterDisplayName": "Cluster 1", + "active": "true", + "serviceType": "HDFS", + "serviceDisplayName": "HDFS-1", + "version": "CDH 5.7.0", + "serviceName": "HDFS-1", + "entityName": "HDFS-1" + }, + "unitNumerators": [ + "bytes" + ], + "unitDenominators": [], + "expression": "SELECT dfs_capacity_used WHERE entityName = \"HDFS-1\" AND category = SERVICE", + "metricCollectionFrequencyMs": 60000, + "rollupUsed": "RAW" + }, + "data": [ { + "timestamp": "2015-09-17T23:43:10.599Z", + "value": 1728884736, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:44:10.605Z", + "value": 1728884736, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:45:10.608Z", + "value": 1728884736, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:46:10.615Z", + "value": 1728884736, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:47:15.613Z", + "value": 1728884736, + "type": "SAMPLE" + } ] }, { - "value" : 3.2103841792E10, - "timestamp" : "2012-05-06T10:29:46.000Z" + "metadata": { + "metricName": "dfs_capacity_used_non_hdfs", + "entityName": "HDFS-1", + "startTime": "2015-09-17T23:42:22.533Z", + "endTime": "2015-09-17T23:47:22.533Z", + "attributes": { + "clusterName": "Cluster 1", + "category": "SERVICE", + "clusterDisplayName": "Cluster 1", + "active": "true", + "serviceType": "HDFS", + "serviceDisplayName": "HDFS-1", + "version": "CDH 5.7.0", + "serviceName": "HDFS-1", + "entityName": "HDFS-1" + }, + "unitNumerators": [ + "bytes" + ], + "unitDenominators": [], + "expression": "SELECT dfs_capacity_used_non_hdfs WHERE entityName = \"HDFS-1\" AND category = SERVICE", + "metricCollectionFrequencyMs": 60000, + "rollupUsed": "RAW" + }, + "data": [ { + "timestamp": "2015-09-17T23:43:10.599Z", + "value": 1610609973, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:44:10.605Z", + "value": 1610609973, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:45:10.608Z", + "value": 1610609973, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:46:10.615Z", + "value": 1610609973, + "type": "SAMPLE" + }, { + "timestamp": "2015-09-17T23:47:15.613Z", + "value": 1610609973, + "type": "SAMPLE" + } ] } ], - "unit" : "bytes" + "warnings": [], + "timeSeriesQuery": "select dfs_capacity, dfs_capacity_used, dfs_capacity_used_non_hdfs where entityName=HDFS-1" } ] [/@boilerplate] diff --git a/java/enunciate.xml b/java/enunciate.xml index b8f56f4e..42eb3a95 100644 --- a/java/enunciate.xml +++ b/java/enunciate.xml @@ -2,18 +2,18 @@ xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.27.xsd"> - + - + com.cloudera.api cloudera-manager-api Cloudera Manager API - 5.7.0-SNAPSHOT + 5.7.0 - 2.7.5 + 2.7.7 14.0 - 2.1.0 + 2.6.7 2.1 4.11 UTF-8 @@ -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.** diff --git a/java/src/main/java/com/cloudera/api/.ApiObjectMapper.java.swp b/java/src/main/java/com/cloudera/api/.ApiObjectMapper.java.swp new file mode 100644 index 00000000..ebd2d3f9 Binary files /dev/null and b/java/src/main/java/com/cloudera/api/.ApiObjectMapper.java.swp differ diff --git a/java/src/main/java/com/cloudera/api/ApiObjectMapper.java b/java/src/main/java/com/cloudera/api/ApiObjectMapper.java index 5e55b2c9..db17ef70 100644 --- a/java/src/main/java/com/cloudera/api/ApiObjectMapper.java +++ b/java/src/main/java/com/cloudera/api/ApiObjectMapper.java @@ -17,6 +17,7 @@ package com.cloudera.api; import com.fasterxml.jackson.databind.AnnotationIntrospector; +import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -38,7 +39,7 @@ public ApiObjectMapper() { // Allow JAX-B annotations. setAnnotationIntrospector( - new AnnotationIntrospector.Pair( + new AnnotationIntrospectorPair( getSerializationConfig().getAnnotationIntrospector(), new JaxbAnnotationIntrospector())); diff --git a/java/src/main/java/com/cloudera/api/ApiRootResource.java b/java/src/main/java/com/cloudera/api/ApiRootResource.java index f3029e20..912efea3 100644 --- a/java/src/main/java/com/cloudera/api/ApiRootResource.java +++ b/java/src/main/java/com/cloudera/api/ApiRootResource.java @@ -16,6 +16,9 @@ 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.v2.RootResourceV2; import com.cloudera.api.v3.RootResourceV3; import com.cloudera.api.v4.RootResourceV4; @@ -24,7 +27,7 @@ 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 com.cloudera.api.v12.RootResourceV12; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -101,6 +104,18 @@ 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(); + /** * Fetch the current API version supported by the server. *

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

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

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

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

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

+ * When updating peers, if 'clouderaManagerCreatedUser' is true and + * username/password are set, a new remote user will be created. If + * 'clouderaManagerCreatedUser' is false and username/password are set, the + * stored username/password will be updated. */ @XmlRootElement(name = "cmPeer") public class ApiCmPeer { private String name; + private ApiCmPeerType type; private String url; private String username; private String password; + private Boolean clouderaManagerCreatedUser; - /** The name of the link. */ + /** The name of the remote CM instance. Immutable during update.*/ @XmlElement public String getName() { return name; @@ -49,7 +61,21 @@ public void setName(String name) { this.name = name; } - /** The URL of the remote CM instance. */ + /** + * The type of the remote CM instance. Immutable during update. + * + * Available since API v11. + **/ + @XmlElement + public ApiCmPeerType getType() { + return type; + } + + public void setType(ApiCmPeerType type) { + this.type = type; + } + + /** The URL of the remote CM instance. Mutable during update.*/ @XmlElement public String getUrl() { return url; @@ -59,7 +85,22 @@ public void setUrl(String url) { this.url = url; } - /** The remote admin username, for setting up the link. */ + /** + * When creating peers, if 'clouderaManagerCreatedUser' is true, this should be + * the remote admin username for creating a user in remote Cloudera Manager. The + * created remote user will then be stored in the local Cloudera Manager DB and + * used in later communication. If 'clouderaManagerCreatedUser' is false, which + * is not applicable to REPLICATION peer type, Cloudera Manager will store this + * username in the local DB directly and use it together with 'password' for + * communication. + * + * Mutable during update. + * When set during update, if 'clouderaManagerCreatedUser' is true, a new user + * in remote Cloudera Manager is created, the newly created remote user will be + * stored in the local DB. An attempt to delete the previously created remote + * user will be made; If 'clouderaManagerCreatedUser' is false, the + * username/password in the local DB will be updated. + **/ @XmlElement public String getUsername() { return username; @@ -69,7 +110,22 @@ public void setUsername(String username) { this.username = username; } - /** The remote admin password, for setting up the link. */ + /** + * When creating peers, if 'clouderaManagerCreatedUser' is true, this should be + * the remote admin password for creating a user in remote Cloudera Manager. The + * created remote user will then be stored in the local Cloudera Manager DB and + * used in later communication. If 'clouderaManagerCreatedUser' is false, which + * is not applicable to REPLICATION peer type, Cloudera Manager will store this + * password in the local DB directly and use it together with 'username' for + * communication. + * + * Mutable during update. + * When set during update, if 'clouderaManagerCreatedUser' is true, a new user + * in remote Cloudera Manager is created, the newly created remote user will be + * stored in the local DB. An attempt to delete the previously created remote + * user will be made; If 'clouderaManagerCreatedUser' is false, the + * username/password in the local DB will be updated. + **/ @XmlElement public String getPassword() { return password; @@ -79,11 +135,36 @@ public void setPassword(String password) { this.password = password; } + /** + * If true, Cloudera Manager creates a remote user using the given + * username/password and stores the created user in local DB for use in later + * communication. Cloudera Manager will also try to delete the created remote + * user when deleting such peers. + * + * If false, Cloudera Manager will store the provided username/password in + * the local DB and use them in later communication. 'false' value on this + * field is not applicable to REPLICATION peer type. + * + * Available since API v11. + * + * Immutable during update. Should not be set when updating peers. + **/ + @XmlElement + public Boolean getClouderaManagerCreatedUser() { + return clouderaManagerCreatedUser; + } + + public void setClouderaManagerCreatedUser(Boolean clouderaManagerCreatedUser) { + this.clouderaManagerCreatedUser = clouderaManagerCreatedUser; + } + @Override public String toString() { return Objects.toStringHelper(this) .add("name", name) .add("url", url) + .add("type", type) + .add("clouderaManagerCreatedUser", clouderaManagerCreatedUser) .toString(); } @@ -92,12 +173,14 @@ public boolean equals(Object o) { ApiCmPeer other = ApiUtils.baseEquals(this, o); return this == other || (other != null && Objects.equal(name, other.getName()) && - Objects.equal(url, other.getUrl())); + Objects.equal(url, other.getUrl()) && + Objects.equal(type, other.getType()) && + Objects.equal(clouderaManagerCreatedUser, + other.getClouderaManagerCreatedUser())); } @Override public int hashCode() { - return Objects.hashCode(name, url); + return Objects.hashCode(name, url, type, clouderaManagerCreatedUser); } - } diff --git a/java/src/main/java/com/cloudera/api/model/ApiCmPeerType.java b/java/src/main/java/com/cloudera/api/model/ApiCmPeerType.java new file mode 100644 index 00000000..f3232062 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiCmPeerType.java @@ -0,0 +1,24 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +/** + * Enum for CM peer types. + */ +public enum ApiCmPeerType { + REPLICATION, // Remote CM is used in replication. + STATUS_AGGREGATION // Remote CM is used in status aggregation. +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiCommand.java b/java/src/main/java/com/cloudera/api/model/ApiCommand.java index f9dc78d0..f31c6fa8 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiCommand.java +++ b/java/src/main/java/com/cloudera/api/model/ApiCommand.java @@ -40,7 +40,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 +60,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 +73,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 +89,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 +258,18 @@ public void setChildren(ApiCommandList children) { this.children = children; } + /** + * Available since V11 + */ + @XmlElement + public Boolean isCanRetry() { + 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 +286,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.isCanRetry())); } @Override public int hashCode() { return Objects.hashCode(id, name, startTime, endTime, active, success, resultMessage, resultDataUrl, serviceRef, roleRef, hostRef, clusterRef, - parent); + parent, canRetry); } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiConfig.java b/java/src/main/java/com/cloudera/api/model/ApiConfig.java index 99dc6e6a..ca4931d3 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,16 @@ * 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", + "validationState", + "validationMessage", + "validationWarningsSuppressed" }) public class ApiConfig { private String name; @@ -47,6 +54,7 @@ public class ApiConfig { private Boolean required; private ValidationState validationState; private String validationMessage; + private Boolean validationWarningsSuppressed; public static enum ValidationState { OK, @@ -65,9 +73,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 +92,7 @@ public ApiConfig(String name, String value, Boolean required, this.relatedName = relatedName; this.validationState = validationState; this.validationMessage = validationMessage; + this.validationWarningsSuppressed = null; } public ApiConfig(String name, String value) { @@ -93,6 +109,7 @@ public ApiConfig() { this.relatedName = null; this.validationState = null; this.validationMessage = null; + this.validationWarningsSuppressed = null; } public String toString() { @@ -238,4 +255,21 @@ 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; + } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiConfigureForKerberosArguments.java b/java/src/main/java/com/cloudera/api/model/ApiConfigureForKerberosArguments.java new file mode 100644 index 00000000..a837c55d --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiConfigureForKerberosArguments.java @@ -0,0 +1,78 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +import com.cloudera.api.ApiUtils; +import com.google.common.base.Objects; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Arguments used to configure a cluster for Kerberos. + */ +@XmlRootElement(name="configureForKerberosArgs") +public class ApiConfigureForKerberosArguments { + private Long datanodeTransceiverPort; + private Long datanodeWebPort; + + /** + * The HDFS DataNode transceiver port to use. This will be applied to all DataNode + * role configuration groups. If not specified, this will default to 1004. + */ + @XmlElement + public Long getDatanodeTransceiverPort() { + return datanodeTransceiverPort; + } + + public void setDatanodeTransceiverPort(Long datanodeTransceiverPort) { + this.datanodeTransceiverPort = datanodeTransceiverPort; + } + + /** + * The HDFS DataNode web port to use. This will be applied to all DataNode + * role configuration groups. If not specified, this will default to 1006. + */ + @XmlElement + public Long getDatanodeWebPort() { + return datanodeWebPort; + } + + public void setDatanodeWebPort(Long datanodeWebPort) { + this.datanodeWebPort = datanodeWebPort; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("datanodeTransceiverPort", datanodeTransceiverPort) + .add("datanodeWebPort", datanodeWebPort) + .toString(); + } + + @Override + public boolean equals(Object o) { + ApiConfigureForKerberosArguments other = ApiUtils.baseEquals(this, o); + return this == other || (other != null && + Objects.equal(this.datanodeTransceiverPort, other.datanodeTransceiverPort) && + Objects.equal(this.datanodeWebPort, other.datanodeWebPort)); + } + + @Override + public int hashCode() { + return Objects.hashCode(datanodeTransceiverPort, datanodeWebPort); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiEntityStatus.java b/java/src/main/java/com/cloudera/api/model/ApiEntityStatus.java new file mode 100644 index 00000000..992077bb --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiEntityStatus.java @@ -0,0 +1,53 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.model; + +/** + * The single value used by the Cloudera Manager UI to represent the status of + * the entity. It is computed from a variety of other entity-specific states, + * not all values apply to all entities. For example, STARTING/STOPPING do not + * apply to a host. + */ +public enum ApiEntityStatus { + // There is not enough information to determine the entity status. + UNKNOWN, + // The entity in question does not have a entity status. For example, it is + // not something that can be running and it cannot have health. + NONE, + // The entity in question is not running, as expected. + STOPPED, + // The entity in question is not running, but it is expected to be running. + DOWN, + // The entity in question is running, but we do not have enough information + // to determine its health. + UNKNOWN_HEALTH, + // The entity in question is running, but all of its health checks are + // disabled. + DISABLED_HEALTH, + // The entity in question is running with concerning health. + CONCERNING_HEALTH, + // The entity in question is running with bad health. + BAD_HEALTH, + // The entity in question is running with good health. + GOOD_HEALTH, + // The entity in question is starting. + STARTING, + // The entity in question is stopping. + STOPPING, + // The application is in historical mode, and the entity in question does not + // have historical monitoring support. + HISTORY_NOT_AVAILABLE; +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationArguments.java b/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationArguments.java index 29b4a61b..5892abb4 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationArguments.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationArguments.java @@ -15,11 +15,14 @@ // limitations under the License. package com.cloudera.api.model; +import com.cloudera.api.ApiUtils; +import com.google.common.base.Objects; + +import java.util.List; + import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import com.cloudera.api.ApiUtils; -import com.google.common.base.Objects; /** * Replication arguments for HDFS. @@ -45,6 +48,7 @@ public class ApiHdfsReplicationArguments { private Boolean skipTrash; private ReplicationStrategy replicationStrategy; private Boolean preserveXAttrs; + private List exclusionFilters; /** * The strategy for distributing the file replication tasks among the mappers @@ -277,7 +281,7 @@ public void setSkipTrash(Boolean skipTrash) { /** * The strategy for distributing the file replication tasks among the mappers * of the MR job associated with a replication. Default is - * {@link ReplicationStrategy.STATIC}. + * {@link ReplicationStrategy#STATIC}. */ @XmlElement public ReplicationStrategy getReplicationStrategy() { @@ -303,6 +307,21 @@ 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; + } + @Override public String toString() { return Objects.toStringHelper(this) @@ -324,6 +343,7 @@ public String toString() { .add("skipTrash", skipTrash) .add("replicationStrategy", replicationStrategy) .add("preserveXAttrs", preserveXAttrs) + .add("exclusionFilters", exclusionFilters) .toString(); } @@ -348,7 +368,8 @@ public boolean equals(Object o) { skipChecksumChecks == other.getSkipChecksumChecks() && Objects.equal(skipTrash, other.getSkipTrash()) && Objects.equal(replicationStrategy, other.getReplicationStrategy()) && - Objects.equal(preserveXAttrs, other.getPreserveXAttrs())); + Objects.equal(preserveXAttrs, other.getPreserveXAttrs())) && + Objects.equal(exclusionFilters, other.getExclusionFilters()); } @Override @@ -358,6 +379,6 @@ public int hashCode() { bandwidthPerMap, abortOnError, removeMissingFiles, preserveReplicationCount, preserveBlockSize, preservePermissions, logPath, skipChecksumChecks, skipTrash, replicationStrategy, - preserveXAttrs); + preserveXAttrs, exclusionFilters); } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationResult.java b/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationResult.java index 50fe8479..91ecaded 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationResult.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHdfsReplicationResult.java @@ -48,6 +48,8 @@ public class ApiHdfsReplicationResult { private String jobDetailsUri; private boolean dryRun; private List snapshottedDirs; + private List failedFiles; + private String runAsUser; /** The file copy progress percentage. */ @XmlElement @@ -257,6 +259,32 @@ public void setSnapshottedDirs(List snapshottedDirs) { this.snapshottedDirs = snapshottedDirs; } + /** + * Returns run-as user name. + * Available since API v11. + */ + @XmlElement + public String getRunAsUser() { + return runAsUser; + } + + public void setRunAsUser(String runAsUser) { + this.runAsUser = runAsUser; + } + + /** + * The list of files that failed during replication. + * Available since API v11. + */ + @XmlElement + public List getFailedFiles() { + return failedFiles; + } + + public void setFailedFiles(List failedFiles) { + this.failedFiles = failedFiles; + } + @Override public boolean equals(Object o) { ApiHdfsReplicationResult that = ApiUtils.baseEquals(this, o); @@ -265,13 +293,15 @@ public boolean equals(Object o) { Objects.equal(counters, that.getCounters()) && Objects.equal(setupError, that.getSetupError()) && dryRun == that.isDryRun() && - Objects.equal(snapshottedDirs, that.getSnapshottedDirs())); + Objects.equal(snapshottedDirs, that.getSnapshottedDirs())) && + Objects.equal(failedFiles, that.getFailedFiles()) && + Objects.equal(runAsUser, that.getRunAsUser()); } @Override public int hashCode() { return Objects.hashCode(progress, counters, setupError, dryRun, - snapshottedDirs); + snapshottedDirs, failedFiles, runAsUser); } @Override @@ -282,6 +312,8 @@ public String toString() { .add("setupError", setupError) .add("dryRun", dryRun) .add("snapshottedDirs", snapshottedDirs) + .add("failedFiles", failedFiles) + .add("runAsUser", runAsUser) .toString(); } diff --git a/java/src/main/java/com/cloudera/api/model/ApiHealthCheck.java b/java/src/main/java/com/cloudera/api/model/ApiHealthCheck.java index 04772591..f78cdfcd 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHealthCheck.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHealthCheck.java @@ -19,10 +19,16 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +/** + * Represents a result from a health test performed by Cloudera Manager for an + * entity. + */ @XmlRootElement(name = "healthCheck") public class ApiHealthCheck { private String name; private ApiHealthSummary summary; + private String explanation; + private Boolean suppressed; public ApiHealthCheck() { // For JAX-B @@ -33,6 +39,15 @@ public ApiHealthCheck(String name, ApiHealthSummary summary) { this.summary = summary; } + public ApiHealthCheck(String name, + ApiHealthSummary summary, + String explanation, + boolean suppressed) { + this(name, summary); + this.explanation = explanation; + this.suppressed = suppressed; + } + /** Unique name of this health check. */ @XmlElement public String getName() { @@ -52,4 +67,31 @@ public ApiHealthSummary getSummary() { public void setSummary(ApiHealthSummary summary) { this.summary = summary; } + + /** + * The explanation of this health check. + * Available since v11. + **/ + @XmlElement + public String getExplanation() { + return explanation; + } + + public void setExplanation(String explanation) { + this.explanation = explanation; + } + + /** + * Whether this health test is suppressed. A suppressed health test is not + * considered when computing an entity's overall health. + * Available since v11. + **/ + @XmlElement + public Boolean getSuppressed() { + return suppressed; + } + + public void setSuppressed(Boolean suppressed) { + this.suppressed = suppressed; + } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationResult.java b/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationResult.java index 72c12dd8..49ef2872 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationResult.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHiveReplicationResult.java @@ -38,6 +38,7 @@ public class ApiHiveReplicationResult { private List errors; private ApiHdfsReplicationResult dataReplicationResult; private boolean dryRun; + private String runAsUser; public ApiHiveReplicationResult() { // For JAX-B @@ -164,6 +165,19 @@ public void setDryRun(boolean dryRun) { this.dryRun = dryRun; } + /** + * Name of the of proxy user, if any. + * Available since API v11. + */ + @XmlElement + public String getRunAsUser() { + return runAsUser; + } + + public void setRunAsUser(String runAsUser) { + this.runAsUser = runAsUser; + } + @Override public boolean equals(Object o) { ApiHiveReplicationResult that = ApiUtils.baseEquals(this, o); @@ -172,12 +186,14 @@ public boolean equals(Object o) { Objects.equal(tables, that.getTables()) && Objects.equal(impalaUDFs, that.getImpalaUDFs()) && Objects.equal(errors, that.getErrors()) && - dryRun == that.isDryRun()); + dryRun == that.isDryRun() && + Objects.equal(runAsUser, that.getRunAsUser())); } @Override public int hashCode() { - return Objects.hashCode(phase, tables, impalaUDFs, errors, dryRun); + return Objects.hashCode(phase, tables, impalaUDFs, errors, dryRun, + runAsUser); } @Override @@ -188,6 +204,7 @@ public String toString() { .add("impalaUDFs", impalaUDFs) .add("errors", errors) .add("dryRun", dryRun) + .add("runAsUser", runAsUser) .toString(); } diff --git a/java/src/main/java/com/cloudera/api/model/ApiHost.java b/java/src/main/java/com/cloudera/api/model/ApiHost.java index ed727278..7c145ba3 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHost.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHost.java @@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; + import java.util.Date; import java.util.List; @@ -49,6 +50,8 @@ public class ApiHost { private Long numCores; private Long numPhysicalCores; private Long totalPhysMemBytes; + private ApiEntityStatus entityStatus; + private ApiClusterRef clusterRef; public ApiHost() { // for JAX-B @@ -81,6 +84,7 @@ public ApiHost(ApiHost host) { this.numCores = host.getNumCores(); this.numPhysicalCores = host.getNumPhysicalCores(); this.totalPhysMemBytes = host.getTotalPhysMemBytes(); + this.clusterRef = host.clusterRef; } @Override @@ -94,6 +98,7 @@ public String toString() { .add("healthSummary", healthSummary) .add("healthChecks", healthChecks) .add("roleRefs", roleRefs) + .add("clusterRef", clusterRef) .toString(); } @@ -308,4 +313,31 @@ public Long getTotalPhysMemBytes() { public void setTotalPhysMemBytes(Long totalPhysMemBytes) { this.totalPhysMemBytes = totalPhysMemBytes; } + + /** + * Readonly. The entity status for this host. + * Available since API v11. + */ + @XmlElement + public ApiEntityStatus getEntityStatus() { + return entityStatus; + } + + public void setEntityStatus(ApiEntityStatus entityStatus) { + this.entityStatus = entityStatus; + } + + /** + * Readonly. A reference to the enclosing cluster. This might be null if the + * host is not yet assigned to a cluster. + * Available since API v11. + */ + @XmlElement + public ApiClusterRef getClusterRef() { + return clusterRef; + } + + public void setClusterRef(ApiClusterRef clusterRef) { + this.clusterRef = clusterRef; + } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiHostInstallArguments.java b/java/src/main/java/com/cloudera/api/model/ApiHostInstallArguments.java index d632f756..c7b22420 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiHostInstallArguments.java +++ b/java/src/main/java/com/cloudera/api/model/ApiHostInstallArguments.java @@ -192,9 +192,9 @@ public void setParallelInstallCount(Integer parallelInstallCount) { /** * The Cloudera Manager repository URL to use (optional). * Example for SLES, Redhat or other RPM based distributions: - * http://archive.cloudera.com/cm5/redhat/5/x86_64/cm/5/ + * https://archive.cloudera.com/cm5/redhat/5/x86_64/cm/5/ * Example for Ubuntu or other Debian based distributions: - * "deb http://archive.cloudera.com/cm5/ubuntu/lucid/amd64/cm lucid-cm5 contrib" + * "deb https://archive.cloudera.com/cm5/ubuntu/lucid/amd64/cm lucid-cm5 contrib" */ @XmlElement public String getCmRepoUrl() { @@ -208,9 +208,9 @@ public void setCmRepoUrl(String cmRepoUrl) { /** * The Cloudera Manager public GPG key (optional). * Example for SLES, Redhat or other RPM based distributions: - * http://archive.cloudera.com/cm5/redhat/5/x86_64/cm/RPM-GPG-KEY-cloudera + * https://archive.cloudera.com/cm5/redhat/5/x86_64/cm/RPM-GPG-KEY-cloudera * Example for Ubuntu or other Debian based distributions: - * http://archive.cloudera.com/cm5/ubuntu/lucid/amd64/cm/archive.key + * https://archive.cloudera.com/cm5/ubuntu/lucid/amd64/cm/archive.key */ @XmlElement public String getGpgKeyCustomUrl() { diff --git a/java/src/main/java/com/cloudera/api/model/ApiMrUsageReportRow.java b/java/src/main/java/com/cloudera/api/model/ApiMrUsageReportRow.java index 5dd0d578..35770ea0 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiMrUsageReportRow.java +++ b/java/src/main/java/com/cloudera/api/model/ApiMrUsageReportRow.java @@ -23,11 +23,23 @@ public class ApiMrUsageReportRow { private String timePeriod; private String user; private String group; - private long cpuSec; - private long memoryBytes; - private long jobCount; - private long taskCount; - private long durationSec; + private Long cpuSec; + private Long memoryBytes; + private Long jobCount; + private Long taskCount; + private Long durationSec; + private Long failedMaps; + private Long totalMaps; + private Long failedReduces; + private Long totalReduces; + private Long mapInputBytes; + private Long mapOutputBytes; + private Long hdfsBytesRead; + private Long hdfsBytesWritten; + private Long localBytesRead; + private Long localBytesWritten; + private Long dataLocalMaps; + private Long rackLocalMaps; public ApiMrUsageReportRow() { } @@ -45,6 +57,28 @@ public ApiMrUsageReportRow(String timePeriod, String user, String group, this.durationSec = durationSec; } + public ApiMrUsageReportRow(String timePeriod, String user, String group, + long cpuSec, long memoryBytes, long jobCount, long taskCount, + long durationSec, long failedMaps, long totalMaps, long failedReduces, + long totalReduces, long mapInputBytes, long mapOutputBytes, + long hdfsBytesRead, long hdfsBytesWritten, long localBytesRead, + long localBytesWritten, long dataLocalMaps, long rackLocalMaps) { + this(timePeriod, user, group, cpuSec, memoryBytes, jobCount, taskCount, + durationSec); + this.failedMaps = failedMaps; + this.totalMaps = totalMaps; + this.failedReduces = failedReduces; + this.totalReduces = totalReduces; + this.mapInputBytes = mapInputBytes; + this.mapOutputBytes = mapOutputBytes; + this.hdfsBytesRead = hdfsBytesRead; + this.hdfsBytesWritten = hdfsBytesWritten; + this.localBytesRead = localBytesRead; + this.localBytesWritten = localBytesWritten; + this.dataLocalMaps = dataLocalMaps; + this.rackLocalMaps = rackLocalMaps; + } + /** * The time period over which this report is generated. */ @@ -86,7 +120,7 @@ public void setGroup(String group) { * jobs. */ @XmlElement - public long getCpuSec() { + public Long getCpuSec() { return cpuSec; } @@ -99,7 +133,7 @@ public void setCpuSec(long cpuSec) { * MapReduce jobs. */ @XmlElement - public long getMemoryBytes() { + public Long getMemoryBytes() { return memoryBytes; } @@ -111,7 +145,7 @@ public void setMemoryBytes(long memoryBytes) { * Number of jobs. */ @XmlElement - public long getJobCount() { + public Long getJobCount() { return jobCount; } @@ -123,7 +157,7 @@ public void setJobCount(long jobCount) { * Number of tasks. */ @XmlElement - public long getTaskCount() { + public Long getTaskCount() { return taskCount; } @@ -135,11 +169,167 @@ public void setTaskCount(long taskCount) { * Total duration of this user's MapReduce jobs. */ @XmlElement - public long getDurationSec() { + public Long getDurationSec() { return durationSec; } public void setDurationSec(long durationSec) { this.durationSec = durationSec; } + + /** + * Failed maps of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getFailedMaps() { + return failedMaps; + } + + public void setFailedMaps(long failedMaps) { + this.failedMaps = failedMaps; + } + + /** + * Total maps of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getTotalMaps() { + return totalMaps; + } + + public void setTotalMaps(long totalMaps) { + this.totalMaps = totalMaps; + } + + /** + * Failed reduces of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getFailedReduces() { + return failedReduces; + } + + public void setFailedReduces(long failedReduces) { + this.failedReduces = failedReduces; + } + + /** + * Total reduces of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getTotalReduces() { + return totalReduces; + } + + public void setTotalReduces(long totalReduces) { + this.totalReduces = totalReduces; + } + + /** + * Map input bytes of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getMapInputBytes() { + return mapInputBytes; + } + + public void setMapInputBytes(long mapInputBytes) { + this.mapInputBytes = mapInputBytes; + } + + /** + * Map output bytes of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getMapOutputBytes() { + return mapOutputBytes; + } + + public void setMapOutputBytes(long mapOutputBytes) { + this.mapOutputBytes = mapOutputBytes; + } + + /** + * HDFS bytes read of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getHdfsBytesRead() { + return hdfsBytesRead; + } + + public void setHdfsBytesRead(long hdfsBytesRead) { + this.hdfsBytesRead = hdfsBytesRead; + } + + /** + * HDFS bytes written of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getHdfsBytesWritten() { + return hdfsBytesWritten; + } + + public void setHdfsBytesWritten(long hdfsBytesWritten) { + this.hdfsBytesWritten = hdfsBytesWritten; + } + + /** + * Local bytes read of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getLocalBytesRead() { + return localBytesRead; + } + + public void setLocalBytesRead(long localBytesRead) { + this.localBytesRead = localBytesRead; + } + + /** + * Local bytes written of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getLocalBytesWritten() { + return localBytesWritten; + } + + public void setLocalBytesWritten(long localBytesWritten) { + this.localBytesWritten = localBytesWritten; + } + + /** + * Data local maps of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getDataLocalMaps() { + return dataLocalMaps; + } + + public void setDataLocalMaps(long dataLocalMaps) { + this.dataLocalMaps = dataLocalMaps; + } + + /** + * Rack local maps of this user's MapReduce jobs. + * Available since v11. + */ + @XmlElement + public Long getRackLocalMaps() { + return rackLocalMaps; + } + + public void setRackLocalMaps(long rackLocalMaps) { + this.rackLocalMaps = rackLocalMaps; + } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiProductVersion.java b/java/src/main/java/com/cloudera/api/model/ApiProductVersion.java new file mode 100644 index 00000000..0a537a85 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiProductVersion.java @@ -0,0 +1,53 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.cloudera.api.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +import javax.xml.bind.annotation.XmlRootElement; + +@JsonInclude(Include.NON_EMPTY) +@XmlRootElement(name = "productVersion") +public class ApiProductVersion { + /** + * Product version + */ + private String version; + + /** + * Product name + */ + private String product; + + public String getVersion() { + return this.version; + } + + public String getProduct() { + return this.product; + } + + public void setVersion(String version) { + this.version = version; + } + + public void setProduct(String product) { + this.product = product; + } + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiReplicationDiagnosticsCollectionArgs.java b/java/src/main/java/com/cloudera/api/model/ApiReplicationDiagnosticsCollectionArgs.java new file mode 100644 index 00000000..3c31a366 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/model/ApiReplicationDiagnosticsCollectionArgs.java @@ -0,0 +1,88 @@ +// Copyright (c) 2015 Cloudera, Inc. All rights reserved. +package com.cloudera.api.model; + +import com.google.common.base.Objects; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Optional arguments for diagnostics collection. + */ +@XmlRootElement(name = "replicationDiagnosticsCollectionArgs") +public class ApiReplicationDiagnosticsCollectionArgs { + private ApiCommandList commands; + private String ticketNumber; + private String comments; + private Boolean phoneHome; + + // For jackson/JAXB. + public ApiReplicationDiagnosticsCollectionArgs() { + } + + /** + * Commands to limit diagnostics to. + * By default, the most recent 10 commands on the schedule will be used. + */ + @XmlElement + public ApiCommandList getCommands() { + return commands; + } + + public void setCommands(ApiCommandList commands) { + this.commands = commands; + } + + /** + * Ticket number to which this bundle must be associated with. + */ + @XmlElement + public String getTicketNumber() { + return ticketNumber; + } + + public void setTicketNumber(String ticketNumber) { + this.ticketNumber = ticketNumber; + } + + /** + * Additional comments for the bundle. + */ + @XmlElement + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } + + /** + * Whether the diagnostics bundle must be uploaded to Cloudera. + */ + @XmlElement + public Boolean getPhoneHome() { + return phoneHome; + } + + public void setPhoneHome(Boolean phoneHome) { + this.phoneHome = phoneHome; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ApiReplicationDiagnosticsCollectionArgs that = (ApiReplicationDiagnosticsCollectionArgs) o; + return Objects.equal(this.commands, that.commands) && + Objects.equal(this.phoneHome, that.phoneHome) && + Objects.equal(this.comments, that.comments) && + Objects.equal(this.ticketNumber, that.ticketNumber); + } + + @Override + public int hashCode() { + return 31 * Objects.hashCode( + this.commands, this.phoneHome, this.comments, this.ticketNumber); + } +} diff --git a/java/src/main/java/com/cloudera/api/model/ApiReplicationSchedule.java b/java/src/main/java/com/cloudera/api/model/ApiReplicationSchedule.java index f8d925e9..e24b01a6 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiReplicationSchedule.java +++ b/java/src/main/java/com/cloudera/api/model/ApiReplicationSchedule.java @@ -42,6 +42,7 @@ public class ApiReplicationSchedule extends ApiSchedule { private ApiHdfsReplicationArguments hdfsArguments; private ApiHiveReplicationArguments hiveArguments; private List history; + private Boolean active; public ApiReplicationSchedule() { // For JAX-B. @@ -82,6 +83,19 @@ 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; + } + @Override public boolean equals(Object o) { if (!super.equals(o)) { 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/ApiRestartClusterArgs.java b/java/src/main/java/com/cloudera/api/model/ApiRestartClusterArgs.java index 03dd7c99..cc5f8e36 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiRestartClusterArgs.java +++ b/java/src/main/java/com/cloudera/api/model/ApiRestartClusterArgs.java @@ -15,6 +15,8 @@ // limitations under the License. package com.cloudera.api.model; +import java.util.List; + import com.cloudera.api.ApiUtils; import com.google.common.base.Objects; @@ -23,12 +25,18 @@ /** * Arguments used for Cluster Restart command. + * + * Since V11: + * If both restartOnlyStaleServices and restartServiceNames are specified, + * a service must be specified in restartServiceNames and also be stale, + * in order to be restarted. */ @XmlRootElement(name="restartClusterArgs") public class ApiRestartClusterArgs { private Boolean restartOnlyStaleServices; private Boolean redeployClientConfiguration; + private List restartServiceNames; /** * Only restart services that have stale configuration and their dependent @@ -55,11 +63,25 @@ public void setRedeployClientConfiguration(Boolean redeployClientConfiguration) this.redeployClientConfiguration = redeployClientConfiguration; } + /** + * Only restart services that are specified and their dependent services. + * Available since V11. + */ + @XmlElement + public List getRestartServiceNames() { + return restartServiceNames; + } + + public void setRestartServiceNames(List restartServiceNames) { + this.restartServiceNames = restartServiceNames; + } + @Override public String toString() { return Objects.toStringHelper(this) .add("restartOnlyStaleServices", restartOnlyStaleServices) .add("redeployClientConfiguration", redeployClientConfiguration) + .add("restartServiceNames", restartServiceNames) .toString(); } @@ -68,11 +90,13 @@ public boolean equals(Object o) { ApiRestartClusterArgs other = ApiUtils.baseEquals(this, o); return this == other || (other != null && Objects.equal(restartOnlyStaleServices, other.restartOnlyStaleServices)) && - Objects.equal(redeployClientConfiguration, other.redeployClientConfiguration); + Objects.equal(redeployClientConfiguration, other.redeployClientConfiguration) && + Objects.equal(restartServiceNames, other.restartServiceNames); } @Override public int hashCode() { - return Objects.hashCode(restartOnlyStaleServices, redeployClientConfiguration); + return Objects.hashCode(restartOnlyStaleServices, redeployClientConfiguration, + restartServiceNames); } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiRole.java b/java/src/main/java/com/cloudera/api/model/ApiRole.java index baf33c23..0ef0f14c 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiRole.java +++ b/java/src/main/java/com/cloudera/api/model/ApiRole.java @@ -52,6 +52,7 @@ public class ApiRole { private ApiConfigList config; private ApiRoleConfigGroupRef roleConfigGroupRef; private ZooKeeperServerMode zooKeeperServerMode; + private ApiEntityStatus entityStatus; public enum HaStatus { ACTIVE, @@ -93,6 +94,7 @@ public ApiRole() { // For JAX-B } + @Override public String toString() { return Objects.toStringHelper(this) .add("name", name) @@ -340,4 +342,17 @@ public ZooKeeperServerMode getZooKeeperServerMode() { public void setZooKeeperServerMode(ZooKeeperServerMode zooKeeperServerMode) { this.zooKeeperServerMode = zooKeeperServerMode; } + + /** + * Readonly. The entity status for this role. + * Available since API v11. + */ + @XmlElement + public ApiEntityStatus getEntityStatus() { + return entityStatus; + } + + public void setEntityStatus(ApiEntityStatus entityStatus) { + this.entityStatus = entityStatus; + } } \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/model/ApiService.java b/java/src/main/java/com/cloudera/api/model/ApiService.java index 3e617a74..1152942b 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiService.java +++ b/java/src/main/java/com/cloudera/api/model/ApiService.java @@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; + import java.util.List; /** @@ -46,6 +47,7 @@ public class ApiService { private String type; private ApiClusterRef clusterRef; private String serviceUrl; + private String roleInstancesUrl; private ApiServiceState serviceState; private ApiHealthSummary healthSummary; private List healthChecks; @@ -60,11 +62,13 @@ public class ApiService { private List roleConfigGroups; private List replicationSchedules; private List snapshotPolicies; + private ApiEntityStatus entityStatus; public ApiService() { // For JAX-B } + @Override public String toString() { return Objects.toStringHelper(this) .add("name", name) @@ -211,8 +215,7 @@ public void setHealthChecks(List healthChecks) { } /** - * Readonly. - * Link into the Cloudera Manager web UI for this specific service. + * Readonly. Link into the Cloudera Manager web UI for this specific service. */ @XmlElement public String getServiceUrl() { @@ -223,6 +226,20 @@ public void setServiceUrl(String serviceUrl) { this.serviceUrl = serviceUrl; } + /** + * Readonly. Link into the Cloudera Manager web UI for role instances table for + * this specific service. + * Available since API v11. + */ + @XmlElement + public String getRoleInstancesUrl() { + return roleInstancesUrl; + } + + public void setRoleInstancesUrl(String roleInstancesUrl) { + this.roleInstancesUrl = roleInstancesUrl; + } + /** * Readonly. Whether the service is in maintenance mode. * Available since API v2. @@ -321,4 +338,17 @@ public List getSnapshotPolicies() { public void setSnapshotPolicies(List snapshotPolicies) { this.snapshotPolicies = snapshotPolicies; } + + /** + * Readonly. The entity status for this service. + * Available since API v11. + */ + @XmlElement + public ApiEntityStatus getEntityStatus() { + return entityStatus; + } + + public void setEntityStatus(ApiEntityStatus entityStatus) { + this.entityStatus = entityStatus; + } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiSnapshotPolicy.java b/java/src/main/java/com/cloudera/api/model/ApiSnapshotPolicy.java index 4108d073..6030912f 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiSnapshotPolicy.java +++ b/java/src/main/java/com/cloudera/api/model/ApiSnapshotPolicy.java @@ -58,6 +58,7 @@ public class ApiSnapshotPolicy { private boolean alertOnSuccess; private boolean alertOnFail; private boolean alertOnAbort; + private Boolean paused; private ApiHBaseSnapshotPolicyArguments hbaseArguments; private ApiHdfsSnapshotPolicyArguments hdfsArguments; @@ -340,6 +341,16 @@ public void setLastSuccessfulCommand(ApiSnapshotCommand lastSuccessfulCommand) { this.lastSuccessfulCommand = lastSuccessfulCommand; } + /** Whether to pause a snapshot policy, available since V11. */ + @XmlElement + public Boolean getPaused() { + return paused; + } + + public void setPaused(Boolean paused) { + this.paused = paused; + } + @Override public String toString() { return Objects.toStringHelper(this) @@ -364,6 +375,7 @@ public String toString() { .add("hdfsArguments", hdfsArguments) .add("lastCommand", lastCommand) .add("lastSuccessfulCommand", lastSuccessfulCommand) + .add("paused", paused) .toString(); } @@ -392,7 +404,8 @@ public boolean equals(Object o) { Objects.equal(hbaseArguments, other.getHBaseArguments()) && Objects.equal(hdfsArguments, other.getHdfsArguments()) && Objects.equal(lastCommand, other.lastCommand) && - Objects.equal(lastSuccessfulCommand, other.lastSuccessfulCommand); + Objects.equal(lastSuccessfulCommand, other.lastSuccessfulCommand) && + Objects.equal(paused, other.paused); } @Override @@ -401,6 +414,7 @@ public int hashCode() { weeklySnapshots, monthlySnapshots, yearlySnapshots, minuteOfHour, hourOfDay, dayOfWeek, dayOfMonth, monthOfYear, hoursForHourlySnapshots, alertOnStart, alertOnSuccess, alertOnFail, alertOnAbort, - hbaseArguments, hdfsArguments, lastCommand, lastSuccessfulCommand); + hbaseArguments, hdfsArguments, lastCommand, lastSuccessfulCommand, + paused); } } diff --git a/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesCrossEntityMetadata.java b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesCrossEntityMetadata.java index ead1cc18..8d8b0dac 100644 --- a/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesCrossEntityMetadata.java +++ b/java/src/main/java/com/cloudera/api/model/ApiTimeSeriesCrossEntityMetadata.java @@ -26,7 +26,9 @@ public class ApiTimeSeriesCrossEntityMetadata { private String maxEntityDisplayName; + private String maxEntityName; private String minEntityDisplayName; + private String minEntityName; private Double numEntities; /** @@ -42,6 +44,21 @@ public void setMaxEntityDisplayName(String maxEntityDisplayName) { this.maxEntityDisplayName = maxEntityDisplayName; } + /** + * The name of the entity that had the maximum value for the + * cross-entity aggregate metric. + *

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

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

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

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

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

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

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

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

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

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

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

    + * Note: Only command that supports retry is UpgradeCluster. + * {@link ApiCommand#isCanRetry()} will be true for only + * UpgradeCluster command. + *

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

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

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

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

    + * Note that these sessions are only associated with users who log into the + * web interface. API users will not appear. + * + * @return A list of user sessions + */ + @GET + @Path("/sessions") + public ApiUserSessionList getSessions(); +} diff --git a/java/src/main/java/com/cloudera/api/v11/package-info.java b/java/src/main/java/com/cloudera/api/v11/package-info.java new file mode 100644 index 00000000..70c3d726 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v11/package-info.java @@ -0,0 +1,21 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * API version 11, introduced in Cloudera Manager 5.5.0. + */ + +package com.cloudera.api.v11; diff --git a/java/src/main/java/com/cloudera/api/v12/ClouderaManagerResourceV12.java b/java/src/main/java/com/cloudera/api/v12/ClouderaManagerResourceV12.java new file mode 100644 index 00000000..dc6a92ef --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v12/ClouderaManagerResourceV12.java @@ -0,0 +1,34 @@ +// Copyright (c) 2015 Cloudera, Inc. All rights reserved. +package com.cloudera.api.v12; + +import com.cloudera.api.model.ApiClusterTemplate; +import com.cloudera.api.model.ApiCommand; +import com.cloudera.api.v11.ClouderaManagerResourceV11; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ClouderaManagerResourceV12 extends ClouderaManagerResourceV11 { + + /** + * Create cluster as per the given cluster template + * + * @param apiClusterTemplate cluster template + * @param addRepositories if true the parcels repositories in the cluster + * template will be added. + * @return The command performing import task + */ + @POST + @Path("importClusterTemplate") + public ApiCommand importClusterTemplate( + ApiClusterTemplate apiClusterTemplate, + @QueryParam("addRepositories") @DefaultValue("false") boolean addRepositories); + +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v12/ClustersResourceV12.java b/java/src/main/java/com/cloudera/api/v12/ClustersResourceV12.java new file mode 100644 index 00000000..7b2d3141 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v12/ClustersResourceV12.java @@ -0,0 +1,69 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v12; + +import static com.cloudera.api.Parameters.CLUSTER_NAME; +import static com.cloudera.api.Parameters.DATA_VIEW; +import static com.cloudera.api.Parameters.DATA_VIEW_DEFAULT; + +import com.cloudera.api.DataView; +import com.cloudera.api.model.ApiClusterTemplate; +import com.cloudera.api.model.ApiServiceList; +import com.cloudera.api.v11.ClustersResourceV11; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Consumes({ MediaType.APPLICATION_JSON }) +@Produces({ MediaType.APPLICATION_JSON }) +public interface ClustersResourceV12 extends ClustersResourceV11 { + + /** + * Export the cluster template for the given cluster. If cluster does not have + * host templates defined it will export host templates based on roles + * assignment. + * + * @param clusterName cluster name + * @param exportAutoConfig export configs set by the auto configuration + * @return Cluster template + */ + @GET + @Consumes + @Path("/{clusterName}/export") + public ApiClusterTemplate export( + @PathParam(CLUSTER_NAME) String clusterName, + @QueryParam("exportAutoConfig") @DefaultValue("false") boolean exportAutoConfig); + + + /** + * List the services that can provide distributed file system (DFS) capabilities in this cluster. + * + * @param clusterName cluster name + * @param view data view required for matching services + * @return Services that provide DFS capabilities in this cluster + */ + @GET + @Path("/{clusterName}/dfsServices") + public ApiServiceList listDfsServices( + @PathParam(CLUSTER_NAME) String clusterName, + @QueryParam(DATA_VIEW) @DefaultValue(DATA_VIEW_DEFAULT) DataView view); +} \ No newline at end of file diff --git a/java/src/main/java/com/cloudera/api/v12/RootResourceV12.java b/java/src/main/java/com/cloudera/api/v12/RootResourceV12.java new file mode 100644 index 00000000..f2ed1cc0 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v12/RootResourceV12.java @@ -0,0 +1,33 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.cloudera.api.v12; + +import com.cloudera.api.v11.RootResourceV11; + +import javax.ws.rs.Path; + +@Path("") +public interface RootResourceV12 extends RootResourceV11 { + + @Override + @Path("/cm") + public ClouderaManagerResourceV12 getClouderaManagerResource(); + + @Override + @Path("/clusters") + public ClustersResourceV12 getClustersResource(); + +} diff --git a/java/src/main/java/com/cloudera/api/v12/package-info.java b/java/src/main/java/com/cloudera/api/v12/package-info.java new file mode 100644 index 00000000..78dcdcd0 --- /dev/null +++ b/java/src/main/java/com/cloudera/api/v12/package-info.java @@ -0,0 +1,21 @@ +// Licensed to Cloudera, Inc. under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. Cloudera, Inc. licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * API version 12, introduced in Cloudera Manager 5.7.0. + */ + +package com.cloudera.api.v12; diff --git a/java/src/main/java/com/cloudera/api/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..4942e3db 100644 --- a/java/src/main/java/com/cloudera/api/v4/ImpalaQueriesResource.java +++ b/java/src/main/java/com/cloudera/api/v4/ImpalaQueriesResource.java @@ -52,8 +52,10 @@ public interface ImpalaQueriesResource { * 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 + * @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: *

    *

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

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

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

    + * tsquery language documentation. + *

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