Cloudera Manager API Migration Notes
This document outlines the transition of the Cloudera Manager REST API from Swagger 2 to OpenAPI 3.0 starting with Cloudera Manager version 7.13.2.0. It details necessary code changes for Java and Python clients, including data type shifts and authentication changes, ensuring your integrations remain compatible while leveraging the improved performance and strict typing of the new specification.
Overview and Compatibility
-
The Cloudera Manager server traditionally provides its public REST API through Swagger 2 specifications.
Starting with Cloudera Manager 7.13.2.0, the REST API moves to the OpenAPI 3.0 specification because Java 8 is no longer supported. The OpenAPI specification introduces differences that require changes in the updated REST API implementation.
-
Client Compatibility: Older API clients continue to work with the Cloudera Manager 7.13.2.0 server. You only need to migrate your code if you require access to new endpoints introduced in Cloudera Manager 7.13.2.0.
-
Python Support: This version officially removes support for Python 2.x.
- Data Type Changes: A key change in OpenAPI 3.0 is the removal of the
filetype. Because code generators require this type to create client code, this change affects all API endpoints that currently referencefile.
Cloudera offers pre-built client bindings in Java and Python for the REST API. Use the following steps to migrate your code to the new API clients.
-
Java Client Updates
- Numerical Data Type Shift: BigDecimal to Long
-
In the previous client, many method signatures use the BigDecimal type for numerical arguments. Because OpenAPI 3.0 specifications require precise type definitions, the current client uses Long in place of BigDecimal.
- AuditsResourceApi Change: Stream Audits
-
The AuditsResourceApi.streamAudits method now returns a String instead of a File. This change follows OpenAPI 3.0 compliance rules and might impact performance.
- ControlPlanesResourceApi Change: Get Manifest JSON
-
The ControlPlanesResourceApi.getManifestJson method now returns a String instead of a File. This update follows OpenAPI 3.0 compliance rules.
- ControlPlanesResourceApi Change: Get Log Content
-
The ControlPlanesResourceApi.getLogContent method now returns a String and accepts a Long type for the command ID. This update follows OpenAPI 3.0 compliance rules.
Python Client Updates
- Python Client Setup and Configuration
-
The current client code no longer accepts a URL as an argument for the cm_client.ApiClient constructor. You must use a
Configurationobject to set the host and configure Basic Authentication.Follow these steps to configure the connection and use Basic Authentication for all subsequent requests.
- Python ApiException Import Change
-
Previous Python clients import ApiException within ApiClient automatically. The current client no longer performs this import. To fix this, update your code with one of the following options:
- Persistent File Support for Legacy APIs
-
Cloudera simplified the transition for APIs that previously returned a 'file', meaning you do not need to make any changes.
The new compatibility layer automatically handles file returns so your current code continues to work without any manual updates.
To prevent widespread breaks for users following the removal of
filefrom OpenAPI, Cloudera built a code layer. This layer allows you to use client APIs exactly as you did in the past. For specific APIs, a transparent adapter handles the task of reading response data and writing it to a file.This ensures the caller avoids any modifications. The logic within this adapter replicates the exact process found in the previous client code. - Persistent Text Support for Legacy APIs
-
Cloudera provides a new internal adapter that automatically processes UTF-8 text responses to ensure current code remains compatible without any manual updates.
For the Simplified API Transition, you do not need to make any changes to APIs that provide text content.
