refactor: expose generated code and client business logic to share with Kapacitor (#103)
* refactor: take clients out of internal * refactor: move stdio to pkg * Move internal/api to api * refactor: final changes for Kapacitor to access shared functionality * chore: regenerate mocks * fix: bad automated refactor * chore: extra formatting not caught by make fmt
This commit is contained in:
81
api/contract/overrides/paths/query.yml
Normal file
81
api/contract/overrides/paths/query.yml
Normal file
@ -0,0 +1,81 @@
|
||||
post:
|
||||
operationId: PostQuery
|
||||
tags:
|
||||
- Query
|
||||
summary: Query InfluxDB
|
||||
parameters:
|
||||
- $ref: "../../openapi/src/common/parameters/TraceSpan.yml"
|
||||
- in: header
|
||||
name: Accept-Encoding
|
||||
description: The Accept-Encoding request HTTP header advertises which content encoding, usually a compression algorithm, the client is able to understand.
|
||||
schema:
|
||||
type: string
|
||||
description: Specifies that the query response in the body should be encoded with gzip or not encoded with identity.
|
||||
default: identity
|
||||
enum:
|
||||
- gzip
|
||||
- identity
|
||||
- in: header
|
||||
name: Content-Type
|
||||
schema:
|
||||
type: string
|
||||
enum:
|
||||
- application/json
|
||||
- in: query
|
||||
name: org
|
||||
description: Specifies the name of the organization executing the query. Takes either the ID or Name interchangeably. If both `orgID` and `org` are specified, `org` takes precedence.
|
||||
schema:
|
||||
type: string
|
||||
- in: query
|
||||
name: orgID
|
||||
description: Specifies the ID of the organization executing the query. If both `orgID` and `org` are specified, `org` takes precedence.
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
description: Flux query or specification to execute
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../schemas/Query.yml"
|
||||
responses:
|
||||
"200":
|
||||
description: Query results
|
||||
headers:
|
||||
Content-Encoding:
|
||||
description: The Content-Encoding entity header is used to compress the media-type. When present, its value indicates which encodings were applied to the entity-body
|
||||
schema:
|
||||
type: string
|
||||
description: Specifies that the response in the body is encoded with gzip or not encoded with identity.
|
||||
default: identity
|
||||
enum:
|
||||
- gzip
|
||||
- identity
|
||||
Trace-Id:
|
||||
description: The Trace-Id header reports the request's trace ID, if one was generated.
|
||||
schema:
|
||||
type: string
|
||||
description: Specifies the request's trace ID.
|
||||
content:
|
||||
text/csv:
|
||||
schema:
|
||||
type: string
|
||||
format: binary
|
||||
example: >
|
||||
result,table,_start,_stop,_time,region,host,_value
|
||||
mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:00Z,east,A,15.43
|
||||
mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:20Z,east,B,59.25
|
||||
mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:40Z,east,C,52.62
|
||||
"429":
|
||||
description: Token is temporarily over quota. The Retry-After header describes when to try the read again.
|
||||
headers:
|
||||
Retry-After:
|
||||
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
default:
|
||||
description: Error processing query
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "../../openapi/src/common/schemas/Error.yml"
|
12
api/contract/overrides/schemas/Extern.yml
Normal file
12
api/contract/overrides/schemas/Extern.yml
Normal file
@ -0,0 +1,12 @@
|
||||
description: Free-form Flux AST to prepend to query requests
|
||||
type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [File]
|
||||
default: File
|
||||
# NOTE: Intentionally type-less here because the boilerplate produced
|
||||
# by codegen off the Flux AST spec is unmangeable. The CLI only needs
|
||||
# to use a small subset of the AST and rarely changes what it sends,
|
||||
# so we can live with a generic map in the codegen request body.
|
||||
additionalProperties: true
|
22
api/contract/overrides/schemas/Query.yml
Normal file
22
api/contract/overrides/schemas/Query.yml
Normal file
@ -0,0 +1,22 @@
|
||||
description: Query influx using the Flux language
|
||||
type: object
|
||||
required:
|
||||
- query
|
||||
properties:
|
||||
extern:
|
||||
$ref: "./Extern.yml"
|
||||
query:
|
||||
description: Query script to execute.
|
||||
type: string
|
||||
type:
|
||||
description: The type of query. Must be "flux".
|
||||
type: string
|
||||
enum:
|
||||
- flux
|
||||
default: flux
|
||||
dialect:
|
||||
$ref: "../../openapi/src/common/schemas/Dialect.yml"
|
||||
now:
|
||||
description: Specifies the time that should be reported as "now" in the query. Default is the server's now time.
|
||||
type: string
|
||||
format: date-time
|
Reference in New Issue
Block a user