-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add datahub commands * fix(test): support integers in autogen test code * feat(gen): support mapping common flags to custom query parameters * feat(spec): Support skipping a whole spec
- Loading branch information
1 parent
25427a4
commit 5509776
Showing
48 changed files
with
2,521 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"information": { | ||
"name": "datahub", | ||
"description": "Cumulocity IoT Data Hub api", | ||
"descriptionLong": "Data Hub api", | ||
"link": "https://cumulocity.com/guides/datahub/datahub-overview/" | ||
}, | ||
"endpoints": [ | ||
{ | ||
"name": "query", | ||
"method": "POST", | ||
"path": "service/datahub/sql", | ||
"accept": "application/json", | ||
"description": "Execute a SQL query and retrieve the results", | ||
"descriptionLong": "Execute a SQL query and retrieve the results", | ||
"collectionProperty": "rows", | ||
"alias": { | ||
"go": "query", | ||
"powershell": "Get-DataHubQueryResult" | ||
}, | ||
"examples": { | ||
"powershell": [ | ||
{ | ||
"description": "Get a list of alarms from datahub", | ||
"command": "Get-DataHubQueryResult -Sql \"SELECT * FROM myTenantIdDataLake.Dremio.myTenantId.alarms\"", | ||
"skipTest": true | ||
} | ||
], | ||
"go": [ | ||
{ | ||
"description": "Get a list of alarms from datahub", | ||
"command": "c8y datahub query --sql \"SELECT * FROM myTenantIdDataLake.Dremio.myTenantId.alarms\"" | ||
}, | ||
{ | ||
"description": "Get a list of alarms from datahub with custom limit", | ||
"command": "c8y datahub query --sql \"SELECT * FROM myTenantIdDataLake.Dremio.myTenantId.alarms\" --limit 2000" | ||
}, | ||
{ | ||
"description": "Get a list of alarms from datahub using the PANDAS format (note the raw format is necessary here)", | ||
"command": "c8y datahub query --sql \"SELECT * FROM myTenantIdDataLake.Dremio.myTenantId.alarms\" --format PANDAS --raw" | ||
} | ||
] | ||
}, | ||
"queryParameters": [ | ||
{ | ||
"name": "version", | ||
"type": "string", | ||
"default": "v1", | ||
"description": "The version of the high-performance API" | ||
} | ||
], | ||
"body": [ | ||
{ | ||
"name": "sql", | ||
"type": "string", | ||
"required": false, | ||
"description": "The SQL query to execute", | ||
"pipeline": true | ||
}, | ||
{ | ||
"name": "limit", | ||
"type": "integer", | ||
"default": "1000", | ||
"required": false, | ||
"description": "The maximum number of query results" | ||
}, | ||
{ | ||
"name": "format", | ||
"type": "string", | ||
"validationSet": [ | ||
"DREMIO", | ||
"PANDAS" | ||
], | ||
"required": false, | ||
"description": "The response format, which is either DREMIO or PANDAS. The DREMIO format is the same response format as provided by the sql endpoint of the Standard API. The PANDAS format fits to the data format the Pandas library for Python expects." | ||
}, | ||
{ | ||
"name": "data", | ||
"type": "json", | ||
"description": "Additional properties" | ||
} | ||
], | ||
"bodyRequiredKeys": [ | ||
"sql", | ||
"limit" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"information": { | ||
"name": "datahub/configuration", | ||
"description": "Cumulocity IoT DataHub Configurations", | ||
"descriptionLong": "Cumulocity IoT DataHub Configurations", | ||
"link": "https://cumulocity.com/guides/datahub/datahub-overview/", | ||
"skip": true | ||
}, | ||
"endpoints": [ | ||
{ | ||
"name": "list", | ||
"method": "GET", | ||
"path": "service/datahub/offloadingconfigurations", | ||
"accept": "application/json", | ||
"description": "Get offloading configurations", | ||
"descriptionLong": "Get offloading configurations", | ||
"collectionProperty": "data.offloadingConfigurations", | ||
"alias": { | ||
"go": "list", | ||
"powershell": "Get-DataHubConfigurationCollection" | ||
}, | ||
"examples": { | ||
"powershell": [ | ||
{ | ||
"description": "List the datahub offloading configurations", | ||
"command": "Get-DataHubConfigurationCollection", | ||
"skipTest": true | ||
} | ||
], | ||
"go": [ | ||
{ | ||
"description": "List the datahub offloading configurations", | ||
"command": "c8y datahub configuration list" | ||
} | ||
] | ||
}, | ||
"flagMapping": [ | ||
{ | ||
"name": "pageSize", | ||
"property": "limit" | ||
} | ||
], | ||
"queryParameters": [ | ||
{ | ||
"name": "lastMaxReportedUUID", | ||
"type": "string", | ||
"description": "Last max reported UUID" | ||
}, | ||
{ | ||
"name": "locale", | ||
"type": "string", | ||
"description": "Locale", | ||
"default": "en" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
{ | ||
"information": { | ||
"name": "datahub/jobs", | ||
"description": "Cumulocity IoT DataHub Jobs", | ||
"descriptionLong": "Cumulocity IoT DataHub Jobs", | ||
"link": "https://cumulocity.com/guides/datahub/datahub-overview/" | ||
}, | ||
"endpoints": [ | ||
{ | ||
"name": "createJob", | ||
"method": "POST", | ||
"path": "service/datahub/dremio/api/v3/sql", | ||
"accept": "application/json", | ||
"description": "Submit a SQL query and retrieve the ID of the Dremio job executing this query", | ||
"descriptionLong": "Submit a SQL query and retrieve the ID of the Dremio job executing this query. The request is asynchronous, i.e., the response does not wait for the query execution to complete.", | ||
"collectionProperty": "-", | ||
"alias": { | ||
"go": "create", | ||
"powershell": "New-DataHubJob" | ||
}, | ||
"examples": { | ||
"powershell": [ | ||
{ | ||
"description": "Create a new datahub job", | ||
"command": "New-DataHubJob -Sql \"SELECT * FROM myTenantIdDataLake.Dremio.myTenantId.alarms\"", | ||
"skipTest": true | ||
}, | ||
{ | ||
"description": "Create a new datahub job using context", | ||
"command": "New-DataHubJob -Sql \"SELECT * FROM alarms\" -Context \"myTenantIdDataLake\", \"Dremio\", \"myTenantId\"", | ||
"skipTest": true | ||
} | ||
], | ||
"go": [ | ||
{ | ||
"description": "Create a new datahub job", | ||
"command": "c8y datahub jobs create --sql \"SELECT * FROM myTenantIdDataLake.Dremio.myTenantId.alarms\"" | ||
}, | ||
{ | ||
"description": "Create a new datahub job using context", | ||
"command": "c8y datahub jobs create --sql \"SELECT * FROM alarms\" --context myTenantIdDataLake,Dremio,myTenantId", | ||
"assertStdOut": { | ||
"json": { | ||
"body.sql": "SELECT * FROM alarms", | ||
"body.context.0": "myTenantIdDataLake", | ||
"body.context.1": "Dremio", | ||
"body.context.2": "myTenantId", | ||
"body.context.#": "3", | ||
"method": "POST", | ||
"path": "/service/datahub/dremio/api/v3/sql" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"body": [ | ||
{ | ||
"name": "sql", | ||
"type": "string", | ||
"required": false, | ||
"description": "The SQL query to execute. The table to query is either referred to with the full path or with the table name if the context defines the path", | ||
"pipeline": true | ||
}, | ||
{ | ||
"name": "context", | ||
"type": "[]string", | ||
"required": false, | ||
"description": "The context in which the query is executed" | ||
}, | ||
{ | ||
"name": "data", | ||
"type": "json", | ||
"description": "Additional properties" | ||
} | ||
], | ||
"bodyRequiredKeys": [ | ||
"sql" | ||
] | ||
}, | ||
{ | ||
"name": "getJob", | ||
"method": "GET", | ||
"path": "service/datahub/dremio/api/v3/job/{id}", | ||
"accept": "application/json", | ||
"description": "Retrieve the status of a query job", | ||
"descriptionLong": "Retrieve the status of a query given the ID of the Dremio job executing the query", | ||
"collectionProperty": "-", | ||
"alias": { | ||
"go": "get", | ||
"powershell": "Get-DataHubJob" | ||
}, | ||
"examples": { | ||
"powershell": [ | ||
{ | ||
"description": "Retrieve a datahub job", | ||
"command": "Get-DataHubJob -Id \"22feee74-875a-561c-5508-04114bdda000\"", | ||
"skipTest": true | ||
} | ||
], | ||
"go": [ | ||
{ | ||
"description": "Retrieve a datahub job", | ||
"command": "c8y datahub jobs get --id \"22feee74-875a-561c-5508-04114bdda000\"" | ||
} | ||
] | ||
}, | ||
"pathParameters": [ | ||
{ | ||
"name": "id", | ||
"type": "string", | ||
"required": true, | ||
"description": "The unique identifier of a Dremio job", | ||
"pipeline": true, | ||
"pipelineAliases": [ | ||
"id" | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "cancelJob", | ||
"method": "POST", | ||
"path": "service/datahub/dremio/api/v3/job/{id}/cancel", | ||
"accept": "application/json", | ||
"description": "Cancel a query job given the ID of the Dremio job executing the query", | ||
"descriptionLong": "Cancel a query job given the ID of the Dremio job executing the query", | ||
"collectionProperty": "-", | ||
"alias": { | ||
"go": "cancel", | ||
"powershell": "Stop-DataHubJob" | ||
}, | ||
"examples": { | ||
"powershell": [ | ||
{ | ||
"description": "Cancel a datahub job", | ||
"command": "Stop-DataHubJob -Id \"22feee74-875a-561c-5508-04114bdda000\"", | ||
"skipTest": true | ||
} | ||
], | ||
"go": [ | ||
{ | ||
"description": "Cancel a datahub job", | ||
"command": "c8y datahub jobs cancel --id \"22feee74-875a-561c-5508-04114bdda000\"" | ||
} | ||
] | ||
}, | ||
"pathParameters": [ | ||
{ | ||
"name": "id", | ||
"type": "string", | ||
"required": true, | ||
"description": "The unique identifier of a Dremio job", | ||
"pipeline": true, | ||
"pipelineAliases": [ | ||
"id" | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "getResults", | ||
"method": "GET", | ||
"path": "service/datahub/dremio/api/v3/job/{id}/results", | ||
"accept": "application/json", | ||
"description": "Retrieve the query results given the ID of the Dremio job that has executed the query", | ||
"descriptionLong": "Retrieve the query results given the ID of the Dremio job that has executed the query", | ||
"collectionProperty": "rows", | ||
"alias": { | ||
"go": "listResults", | ||
"powershell": "Get-DataHubJobResult" | ||
}, | ||
"examples": { | ||
"powershell": [ | ||
{ | ||
"description": "Retrieve a datahub job", | ||
"command": "Get-DataHubJobResult -Id \"22feee74-875a-561c-5508-04114bdda000\"", | ||
"skipTest": true | ||
} | ||
], | ||
"go": [ | ||
{ | ||
"description": "Retrieve results from a datahub job", | ||
"command": "c8y datahub jobs listResults --id \"22feee74-875a-561c-5508-04114bdda000\"" | ||
}, | ||
{ | ||
"description": "Retrieve results from a datahub job with custom datahub pagination", | ||
"command": "c8y datahub jobs listResults --id \"22feee74-875a-561c-5508-04114bdda000\" --offset 2 --pageSize 100" | ||
} | ||
] | ||
}, | ||
"pathParameters": [ | ||
{ | ||
"name": "id", | ||
"type": "string", | ||
"required": true, | ||
"description": "The unique identifier of a Dremio job", | ||
"pipeline": true, | ||
"pipelineAliases": [ | ||
"id" | ||
] | ||
} | ||
], | ||
"flagMapping": [ | ||
{ | ||
"name": "pageSize", | ||
"property": "limit" | ||
} | ||
], | ||
"queryParameters": [ | ||
{ | ||
"name": "offset", | ||
"type": "integer", | ||
"description": "The offset of the paginated results" | ||
} | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.