cloudera / cm_api

Cloudera Manager API Client
Apache License 2.0
305 stars 284 forks source link

Is a Swagger spec available? #76

Open loganlinn opened 5 years ago

loganlinn commented 5 years ago

The documentation says that the Java and Python libraries in this repo are based on Swagger. Is there a Swagger JSON or YAML spec that could be used to generate a client in another language?

My current CM install doesn’t expose API Explorer/Swagger UI under the Support menu; just has API Documentation.

bbhavsar commented 5 years ago

Cloudera Manager API client released with Cloudera Manager 6.0, not the one in this repo, is indeed generated using Swagger.

You can find more information about new Swagger based Cloudera Manager API Client here https://cloudera.github.io/cm_api/docs/python-client-swagger/

On a running Cloudera Manager instance, swagger input specification json is available at http://cm-host:7180/static/apidocs/ui/swagger.json

In future for those who don't have access to a running Cloudera Manager instance, we'll link the swagger input specification from static site http://cloudera.github.io/cm_api/docs/releases/

Smithx10 commented 4 years ago

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#operationObject

The Spec isn't valid.

operationId must be Unique Globally.

arch@9d46dd2d-1178-ce83-cbc4-d396e4a24060 ~/g/s/g/b/go-cdm ❯❯❯ ./swagger_linux_amd64 generate  client swagger.json                                                                                                                      ✘ 1
2020/04/10 14:24:30 validating spec /home/arch/go/src/git.bdf-cloud.iqvia.net/bdf-cloud/go-cdm/swagger.json
The swagger spec at "/home/arch/go/src/git.bdf-cloud.iqvia.net/bdf-cloud/go-cdm/swagger.json" is invalid against swagger specification 2.0. see errors :
- "readRoleConfigGroups" is defined 3 times
- "deleteRole" is defined 3 times
- "updateRoleConfig" is defined 3 times
- "readHistory" is defined 2 times
- "readRoleConfigGroup" is defined 3 times
- "listRoleTypes" is defined 3 times
- "startCommand" is defined 7 times
- "readRoles" is defined 6 times
- "createRoles" is defined 3 times
- "zooKeeperCleanupCommand" is defined 2 times
- "getFullLog" is defined 3 times
- "updateConfig" is defined 6 times
- "getStandardError" is defined 3 times
- "getStandardOutput" is defined 3 times
- "jmapHisto" is defined 2 times
- "updateServiceConfig" is defined 3 times
- "readRoleConfig" is defined 3 times
- "inspectHostsCommand" is defined 2 times
- "restartCommand" is defined 7 times
- "stopCommand" is defined 7 times
- "rollingRestart" is defined 2 times
- "getStacksLogsBundle" is defined 3 times
- "readService" is defined 3 times
- "firstRun" is defined 2 times
- "updateRoleConfigGroup" is defined 3 times
- "lsof" is defined 2 times
- "getClientConfig" is defined 2 times
- "exitMaintenanceMode" is defined 8 times
- "jmapDump" is defined 2 times
- "autoConfigure" is defined 3 times
- "readAuthRolesMetadata" is defined 2 times
- "autoAssignRoles" is defined 3 times
- "jstack" is defined 2 times
- "queryTimeSeries" is defined 2 times
- "getMetrics" is defined 5 times
- "zooKeeperInitCommand" is defined 2 times
- "readConfig" is defined 5 times
- "readServiceConfig" is defined 3 times
- "readRole" is defined 3 times
- "listActiveCommands" is defined 8 times
- "enterMaintenanceMode" is defined 8 times
- "getKerberosInfo" is defined 2 times
- "getStacksLog" is defined 3 times
Smithx10 commented 4 years ago

That example was wit go-swagger.

It seems https://github.com/swagger-api/swagger-codegen is a little bit less strict on following the API standard and resulted in something that needed less modifications before becoming usable.