# # Copyright DataStax, Inc. # # Licensed 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. # swagger: '2.0' info: description: > The simulacron REST API allows one to interact with simulacron, performing operations such as provisioning up clusters, stubbing queries and behaviors, and monitoring driver client connections. version: ${project.version} title: Simulacron REST API basePath: / tags: - name: cluster description: Cluster Provisioning and Metadata - name: prime description: Define how nodes respond to requests - name: log description: View requests sent to nodes - name: connections description: Retrieve and close node connections - name: connection description: Close an individual connection by ip address and port - name: listener description: Enable and disable node's capability to accept new connections - name: pause-reads description: Pause and resume reading on node connections. paths: /cluster: post: tags: - cluster summary: Provision a new cluster description: Provisions a Cluster by setting up listening interfaces for each node. operationId: provisionCluster consumes: - application/json produces: - application/json parameters: - in: query name: data_centers description: > For convenience, use this parameter to provision a cluster by providing a data center specification. Accepts a comma separated list of DC configurations. i.e. `"3,4,5"` sets up 3 data centers with 3, 4, and 5 nodes respectively. **Note**: If this is provided the request body is ignored. required: false type: string example: 10 - in: query name: cassandra_version description: The Cassandra version of this Cluster. This only applies if `data_centers` is specified. required: false type: string - in: query name: dse_version description: The DSE version of this Cluster. This only applies if `data_centers` is specified. required: false type: string example: 5.0.8 - in: query name: name description: The name to give this Cluster. This only applies if `data_centers` is specified. required: false type: string - in: query name: activity_log description: Whether or not to enable activity logging of queries. By default falls back to global behavior (which itself defaults to true). required: false type: boolean - in: query name: num_tokens description: The number of tokens (virtual nodes) for each node. By default is 1. required: false type: int example: 1 - in: body name: body description: > If specified, the complete configuration for a Cluster and its data centers and nodes. Use this in cases where you want to override configuration such as the cassandra version, peer info, or socket addresses bound to nodes. **Note**: Used only if `data_centers` is not provided. required: false schema: $ref: '#/definitions/Cluster' responses: '201': description: Created schema: $ref: '#/definitions/Cluster' '400': description: Bad request schema: $ref: '#/definitions/Error' get: tags: - cluster summary: Retrieve existing clusters operationId: retrieveClusters consumes: - application/json produces: - application/json responses: '200': description: Cluster listing schema: type: array items: $ref: '#/definitions/Cluster' '400': description: Unexpected error schema: $ref: '#/definitions/Error' delete: tags: - cluster summary: Delete all clusters description: Deletes all existing Clusters and unregisters all ips assigned. operationId: unregisterClusters consumes: - application/json produces: - application/json responses: '202': description: Clusters deleted '400': description: Unexpected error schema: $ref: '#/definitions/Error' '/cluster/{id}': get: tags: - cluster summary: Find cluster by id operationId: findClusterById consumes: - application/json produces: - application/json parameters: - name: id in: path description: Id or name of the cluster required: true type: string example: "0" responses: '200': description: Cluster state schema: $ref: '#/definitions/Cluster' '404': description: Not found delete: tags: - cluster summary: Delete cluster by id operationId: unregisterClusterById consumes: - application/json produces: - application/json parameters: - name: id in: path description: Id or name of the cluster required: true type: string example: "0" responses: '202': description: Cluster deleted '400': description: Unexpected error '404': description: Not found '/prime/{clusterId}': post: tags: - prime summary: Primes a response for a given query for all nodes in a cluster operationId: primeQuerySingleByCluster consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: > Contains a when section that defines the matching query text and a then section that defines the result metadata and accompanying rows. required: true schema: $ref: '#/definitions/PrimeQuerySuccess' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQuerySuccess' '400': description: Unable to parse provided query delete: tags: - prime summary: Deletes all primed queries for all nodes in a cluster operationId: deletePrimedQueries consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" responses: '202': description: Primes deleted '/prime/{clusterId}/{dataCenterId}': post: tags: - prime summary: Primes a response for a given query for all nodes in a data center operationId: primeQuerySingleByDataCenter consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: body in: body description: > Contains a when section that defines the matching query text and a then section that defines the result metadata and accompanying rows. required: true schema: $ref: '#/definitions/PrimeQuerySuccess' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQuerySuccess' '400': description: Unable to parse provided query delete: tags: - prime summary: Deletes all primed queries for all nodes in a DC operationId: deletePrimedQueriesByDc consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" responses: '202': description: Primes deleted '/prime/{clusterId}/{dataCenterId}/{nodeId}': post: tags: - prime summary: Primes a response for a given query for a particular node operationId: primeQuerySingleByNode consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: nodeId in: path description: Id or name of the node required: true type: string example: "0" - name: body in: body description: > Contains a when section that defines the matching query text and a then section that defines the result metadata and accompanying rows. required: true schema: $ref: '#/definitions/PrimeQuerySuccess' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQuerySuccess' '400': description: Unable to parse provided query delete: tags: - prime summary: Deletes all primed queries for a node operationId: deletePrimedQueriesByNode consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: nodeId in: path description: Id or name of the node required: true type: string example: "0" responses: '202': description: Primes deleted '/prime/{clusterId}#(no_result)': post: tags: - prime summary: "no_result Primes a query that will not return a response" operationId: primeQuerySingleNoResult consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines an already exists error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryNoResult' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryNoResult' '400': description: Unable to parse provided query '/prime/{clusterId}#(already_exists)': post: tags: - prime summary: Primes an already exists error response operationId: primeQuerySingleAlreadyExists consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines an already exists error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryAlreadyExists' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryAlreadyExists' '400': description: Unable to parse provided query '/prime/{clusterId}#(authentication_error)': post: tags: - prime summary: Primes an authentication error response operationId: primeQuerySingleAuthenticationError consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines an authentication error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryAuthenticationError' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryAuthenticationError' '400': description: Unable to parse provided query '/prime/{clusterId}#(config_error)': post: tags: - prime summary: Primes a config error response operationId: primeQuerySingleConfigError consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines a config error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryConfigError' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryConfigError' '400': description: Unable to parse provided query '/prime/{clusterId}#(function_failure)': post: tags: - prime summary: Primes a function failure response operationId: primeQuerySimpleFunctionFailure consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines a function failure to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryFunctionFailure' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryFunctionFailure' '400': description: Unable to parse provided query '/prime/{clusterId}#(invalid)': post: tags: - prime summary: Primes a invalid error response operationId: primeQuerySingleInvalid consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines a invalid error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryInvalid' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryInvalid' '400': description: Unable to parse provided query '/prime/{clusterId}#(is_bootstrapping)': post: tags: - prime summary: Primes an is bootstraping response operationId: primeQuerySingleIsBootstrapping consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines an is bootstrapping error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryIsBootstrapping' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryIsBootstrapping' '400': description: Unable to parse provided query '/prime/{clusterId}#(overloaded)': post: tags: - prime summary: Primes an overloaded response operationId: primeQuerySingleOverloaded consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines an overloaded error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryOverloaded' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryOverloaded' '400': description: Unable to parse provided query '/prime/{clusterId}#(protocol_error)': post: tags: - prime summary: Primes a protocol error response operationId: primeQuerySingleProtocolError consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines a protocl error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryProtocolError' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryProtocolError' '400': description: Unable to parse provided query '/prime/{clusterId}#(read_failure)': post: tags: - prime summary: Primes a read failure response operationId: primeQuerySingleReadFailure consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines a read failure to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryReadFailure' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryReadFailure' '400': description: Unable to parse provided query '/prime/{clusterId}#(read_timeout)': post: tags: - prime summary: Primes a read timeout response operationId: primeQuerySingleReadTimeout consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines a read timeout to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryReadTimeout' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryReadTimeout' '400': description: Unable to parse provided query '/prime/{clusterId}#(server_error)': post: tags: - prime summary: Primes a server error response operationId: primeQuerySingleServerError consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines a server error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryServerError' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryServerError' '400': description: Unable to parse provided query '/prime/{clusterId}#(syntax_error)': post: tags: - prime summary: Primes a syntax error response operationId: primeQuerySingleSyntaxError consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines a syntax error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQuerySyntaxError' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQuerySyntaxError' '400': description: Unable to parse provided query '/prime/{clusterId}#(truncate_error)': post: tags: - prime summary: Primes a syntax error response operationId: primeQuerySingleTruncateError consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines a truncate error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryTruncateError' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryTruncateError' '400': description: Unable to parse provided query '/prime/{clusterId}#(unauthorized)': post: tags: - prime summary: Primes an unauthorized response operationId: primeQuerySingleUnauthorized consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines an unauthorized error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryUnauthorized' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryUnauthorized' '400': description: Unable to parse provided query '/prime/{clusterId}#(unavailable)': post: tags: - prime summary: Primes an unavailable response operationId: primeQuerySingleUnavailable consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines an unavailable error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryUnavailable' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryUnavailable' '400': description: Unable to parse provided query '/prime/{clusterId}#(unprepared)': post: tags: - prime summary: Primes an unprepared response operationId: primeQuerySingleUnprepared consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines an unprepared error to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryUnprepared' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryUnprepared' '400': description: Unable to parse provided query '/prime/{clusterId}#(write_failure)': post: tags: - prime summary: Primes a write failure response operationId: primeQuerySingleWriteFailure consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines a write failure to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryWriteFailure' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryWriteFailure' '400': description: Unable to parse provided query '/prime/{clusterId}#(write_timeout)': post: tags: - prime summary: Primes a write timeout response operationId: primeQuerySingleWriteTimeout consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines a write timeout to be returned with the given message. required: true schema: $ref: '#/definitions/PrimeQueryWriteTimeout' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryWriteTimeout' '400': description: Unable to parse provided query '/prime/{clusterId}#(close_connection)': post: tags: - prime summary: Primes a scenario such that when a query is received closes client connections operationId: primeQuerySingleCloseConnection consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: Contains a then section that defines how to close connections and which to close. required: true schema: $ref: '#/definitions/PrimeQueryCloseConnection' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQueryCloseConnection' '400': description: Unable to parse provided query '/prime/{clusterId}#(fail heartbeats, options request with no response)': post: tags: - prime summary: Primes a scenario such that when an options request is made, no response is received. operationId: primeQuerySingleOptionsRequest consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: | Contains a when section that matches against options request. Note that the example demonstrates priming an options request that returns no response (for simulating failing heartbeats). required: true schema: $ref: '#/definitions/PrimeOptions' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeOptions' '400': description: Unable to parse provided query '/prime/{clusterId}#(Batch statement)': post: tags: - prime summary: Primes a batch statement with a successful response operationId: primeBatchByCluster consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: body in: body description: > Contains a when section that defines the matching batch statement, and a then section that defines the result metadata and accompanying rows. required: true schema: $ref: '#/definitions/PrimeQuerySuccessBatch' responses: '201': description: PrimedQuery schema: $ref: '#/definitions/PrimeQuerySuccessBatch' '400': description: Unable to parse provided query '/log/{clusterId}': get: tags: - log summary: Return all queries executed by clients on a cluster. operationId: getLogByCluster consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: filter in: query description: > Filter executed queries. Use this paremeter to filter primed or non primed executed queries. Accepts "primed" or "nonprimed" values. If not set it will return all queries. required: false type: string example: primed responses: '200': description: Queries executed schema: $ref: '#/definitions/ClusterQueryLogReport' '404': description: Cluster not found delete: tags: - log summary: Delete all activity log queries executed by clients on a cluster. operationId: deleteLogByCluster consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" responses: '204': description: Log deleted '404': description: Cluster not found '/log/{clusterId}/{dataCenterId}': get: tags: - log summary: Return all queries executed by clients on a data center. operationId: getLogByDataCenter consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: filter in: query description: > Filter executed queries. Use this paremeter to filter primed or non primed executed queries. Accepts "primed" or "nonprimed" values. If not set it will return all queries. required: false type: string example: primed responses: '200': description: Queries executed schema: $ref: '#/definitions/ClusterQueryLogReport' '404': description: Cluster/Datacenter not found delete: tags: - log summary: Delete all activity log queries executed by clients on a data center. operationId: deleteLogByDataCenter consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" responses: '204': description: Log deleted '404': description: Cluster/Datacenter not found '/log/{clusterId}/{dataCenterId}/{nodeId}': get: tags: - log summary: Return all queries executed by clients on a node. operationId: getLogByNode consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: nodeId in: path description: Id or name of the node required: true type: string example: "0" - name: filter in: query description: > Filter executed queries. Use this paremeter to filter primed or non primed executed queries. Accepts "primed" or "nonprimed" values. If not set it will return all queries. required: false type: string example: primed responses: '200': description: Queries executed schema: $ref: '#/definitions/ClusterQueryLogReport' '404': description: Cluster/Datacenter/Node not found delete: tags: - log summary: Delete all activity log queries executed by clients on a node. operationId: deleteLogByNode consumes: - application/json produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: nodeId in: path description: Id or name of the node required: true type: string example: "0" responses: '204': description: Log deleted '404': description: Cluster/Datacenter/Node not found '/connections/{clusterId}': get: tags: - connections summary: retrieve the connections to the cluster operationId: getConnectionsByCluster produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" responses: '200': description: connections schema: $ref: '#/definitions/ClusterConnectionReport' '404': description: Cluster not found '500': description: Internal server error delete: tags: - connections summary: close the connections to the cluster operationId: closeConnectionsByCluster produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: type type: string in: query description: | The way to close the connection. * *disconnect* - Simply disconnects the connection. * *shutdown_read* - Prevents the socket from being able to read any inbound data. Good for testing things like heartbeat failures. * *shutdown_write* - Prevents the socket from being able to write any outbound data. This will typically close the connection so does not have much use over disconnect. Defaults to *disconnect*. enum: - disconnect - shutdown_read - shutdown_write responses: '200': description: closed connections schema: $ref: '#/definitions/ClusterConnectionReport' '404': description: Cluster not found '500': description: Internal server error '/connections/{clusterId}/{dataCenterId}': get: tags: - connections summary: retrieve the connections to the datacenter operationId: getConnectionsByDatacenter produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" responses: '200': description: connections schema: $ref: '#/definitions/ClusterConnectionReport' '404': description: Datacenter not found '500': description: Internal server error delete: tags: - connections summary: close the connections to the datacenter operationId: closeConnectionsByDatacenter produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: type type: string in: query description: | The way to close the connection. * *disconnect* - Simply disconnects the connection. * *shutdown_read* - Prevents the socket from being able to read any inbound data. Good for testing things like heartbeat failures. * *shutdown_write* - Prevents the socket from being able to write any outbound data. This will typically close the connection so does not have much use over disconnect. Defaults to *disconnect*. enum: - disconnect - shutdown_read - shutdown_write responses: '200': description: closed connections schema: $ref: '#/definitions/ClusterConnectionReport' '404': description: Datacenter not found '500': description: Internal server error '/connections/{clusterId}/{dataCenterId}/{nodeId}': get: tags: - connections summary: retrieve the connections to the node operationId: getConnectionsByNode produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: nodeId in: path description: Id or name of the node required: true type: string example: "0" responses: '200': description: connections schema: $ref: '#/definitions/ClusterConnectionReport' '404': description: Node not found '500': description: Internal server error delete: tags: - connections summary: close the connections to the node operationId: closeConnectionsByNode produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: nodeId in: path description: Id or name of the node required: true type: string example: "0" - name: type type: string in: query description: | The way to close the connection. * *disconnect* - Simply disconnects the connection. * *shutdown_read* - Prevents the socket from being able to read any inbound data. Good for testing things like heartbeat failures. * *shutdown_write* - Prevents the socket from being able to write any outbound data. This will typically close the connection so does not have much use over disconnect. Defaults to *disconnect*. enum: - disconnect - shutdown_read - shutdown_write responses: '200': description: closed connections schema: $ref: '#/definitions/ClusterConnectionReport' '404': description: Node not found '500': description: Internal server error '/connection/{clusterId}/{ip}/{port}': delete: tags: - connection summary: close one specific connection operationId: closeOneConnection produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: ip in: path description: source ip of the connection required: true type: string example: "127.0.0.1" - name: port in: path description: source port of the connection required: true type: string example: 8675 - name: type type: string in: query description: | The way to close the connection. * *disconnect* - Simply disconnects the connection. * *shutdown_read* - Prevents the socket from being able to read any inbound data. Good for testing things like heartbeat failures. * *shutdown_write* - Prevents the socket from being able to write any outbound data. This will typically close the connection so does not have much use over disconnect. Defaults to *disconnect*. enum: - disconnect - shutdown_read - shutdown_write responses: '200': description: closed connection schema: $ref: '#/definitions/ClusterConnectionReport' '404': description: Connection not found '500': description: Internal server error '/listener/{clusterId}': put: tags: - listener summary: accept connections to the cluster operationId: acceptConnectionsByCluster parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" responses: '200': description: connections will be accepted '500': description: Internal server error delete: tags: - listener summary: stop accepting connections to the cluster operationId: rejectConnectionsByCluster parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: after in: query description: Number of attempts after which to start rejecting connections (defaults to 0, (immediate)) type: type: integer - name: type in: query description: | The way to reject connections. * *unbind* - Stops listening for new connections. Existing connections stay connected. * *stop* - Meant to simulate the behavior of stopping a node. Closes existing connections and then unbinds to stop listening for new ones. * *reject_startup* - Accepts new connections, but does not respond to 'startup' response. Existing connections stay connected. Meant to simulate behavior of when a cassandra process becomes unresponsive, but the host OS is still able to read off the socket. Defaults to *unbind*. type: string enum: - unbind - stop - reject_startup responses: '200': description: connections will be rejected '500': description: Internal server error '/listener/{clusterId}/{dataCenterId}': put: tags: - listener summary: accept connections to the datacenter operationId: acceptConnectionsByDatacenter produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" responses: '200': description: connections will be accepted '400': description: Internal server error delete: tags: - listener summary: stop accepting connections to the datacenter operationId: rejectConnectionsByDatacenter produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: after in: query description: Number of attempts after which to start rejecting connections (defaults to 0, (immediate)) type: type: integer - name: type in: query description: | The way to reject connections. * *unbind* - Stops listening for new connections. Existing connections stay connected. * *stop* - Meant to simulate the behavior of stopping a node. Closes existing connections and then unbinds to stop listening for new ones. * *reject_startup* - Accepts new connections, but does not respond to 'startup' response. Existing connections stay connected. Meant to simulate behavior of when a cassandra process becomes unresponsive, but the host OS is still able to read off the socket. Defaults to *unbind*. type: string enum: - unbind - stop - reject_startup responses: '200': description: connections will be rejected '500': description: Internal server error '/listener/{clusterId}/{dataCenterId}/{nodeId}': put: tags: - listener summary: accept connections to the node operationId: acceptConnectionsByNode produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: nodeId in: path description: Id or name of the node required: true type: string example: "0" responses: '200': description: connections will be accepted '500': description: Internal server error delete: tags: - listener summary: stop accepting connections to the node operationId: rejectConnectionsByNode produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: nodeId in: path description: Id or name of the node required: true type: string example: "0" - name: after in: query description: Number of attempts after which to start rejecting connections (defaults to 0, (immediate)) type: type: integer - name: type in: query description: | The way to reject connections. * *unbind* - Stops listening for new connections. Existing connections stay connected. * *stop* - Meant to simulate the behavior of stopping a node. Closes existing connections and then unbinds to stop listening for new ones. * *reject_startup* - Accepts new connections, but does not respond to 'startup' response. Existing connections stay connected. Meant to simulate behavior of when a cassandra process becomes unresponsive, but the host OS is still able to read off the socket. Defaults to *unbind*. type: string enum: - unbind - stop - reject_startup responses: '200': description: connections will be rejected '500': description: Internal server error '/pause-reads/{clusterId}': put: tags: - pause-reads summary: pause the connections to the cluster operationId: pauseConnectionsByCluster produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" responses: '200': description: paused connections schema: $ref: '#/definitions/ClusterConnectionReport' '404': description: Cluster not found '500': description: Internal server error delete: tags: - pause-reads summary: resume the connections to the cluster operationId: resumeConnectionsByCluster produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" responses: '200': description: paused connections schema: $ref: '#/definitions/ClusterConnectionReport' '404': description: Cluster not found '500': description: Internal server error '/pause-reads/{clusterId}/{dataCenterId}': put: tags: - pause-reads summary: pause the connections to the datacenter operationId: pauseConnectionsByDc produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" responses: '200': description: paused connections schema: $ref: '#/definitions/DataCenterConnectionReport' '404': description: Cluster not found '500': description: Internal server error delete: tags: - pause-reads summary: resume the connections to the cluster operationId: resumeConnectionsByCluster produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" responses: '200': description: paused connections schema: $ref: '#/definitions/DataCenterConnectionReport' '404': description: Cluster not found '500': description: Internal server error '/pause-reads/{clusterId}/{dataCenterId}/{nodeId}': put: tags: - pause-reads summary: pause the connections to the datacenter operationId: pauseConnectionsByDc produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: nodeId in: path description: Id or name of the node required: true type: string example: "0" responses: '200': description: paused connections schema: $ref: '#/definitions/DataCenterConnectionReport' '404': description: Cluster not found '500': description: Internal server error delete: tags: - pause-reads summary: resume the connections to the cluster operationId: resumeConnectionsByCluster produces: - application/json parameters: - name: clusterId in: path description: Id or name of the cluster required: true type: string example: "0" - name: dataCenterId in: path description: Id or name of the datacenter required: true type: string example: "0" - name: nodeId in: path description: Id or name of the node required: true type: string example: "0" responses: '200': description: paused connections schema: $ref: '#/definitions/NodeConnectionReport' '404': description: Cluster not found '500': description: Internal server error definitions: DataType: type: string description: Indicates a data type for a given column name example: "map" enum: - ascii - bigint - blob - bool - counter - decimal - date - double - float - inet - int - uuid - smallint - time - timestamp - timeuuid - tinyint - varchar - varint - "map" - "list" - "set" - "tuple" Consistency: type: string description: The consistency to apply to data operations example: LOCAL_QUORUM enum: - ANY - ONE - TWO - THREE - QUORUM - ALL - LOCAL_QUORUM - EACH_QUORUM - SERIAL - LOCAL_SERIAL - LOCAL_ONE RequestFailureReason: type: string description: Represents rationale for why a request failed enum: - UNKNOWN - READ_TOO_MANY_TOMBSTONES WriteType: type: string description: The kind of write operation enum: - SIMPLE - BATCH - UNLOGGED_BATCH - COUNTER - BATCH_LOG - CAS - VIEW - CDC CloseType: type: string description: The kind of close operation example: disconnect enum: - disconnect - shutdown_read - shutdown_write CloseScope: type: string description: The scope of the close operation example: connection enum: - connection - node - data_center - cluster PeerInfo: type: object properties: rack: type: string example: rack1 bootstrapped: type: string example: COMPLETED cql_version: type: string example: "3.2.0" token: type: string example: 6148914691236517204 graph: type: boolean example: false protocol_versions: type: list example: - 3 - 4 - 5 description: Protocol versions to support, if not supplied, supported versions are based on cassandra version. Node: type: object required: - name properties: id: type: integer format: int64 name: type: string example: node0 cassandra_version: type: string example: 3.0.13 dse_version: type: string example: 5.0.8 peer_info: $ref: '#/definitions/PeerInfo' DataCenter: type: object required: - name - nodes properties: id: type: integer format: int64 name: type: string example: dc0 nodes: type: array items: $ref: '#/definitions/Node' cassandra_version: type: string example: 3.0.13 dse_version: type: string example: 5.0.8 peer_info: $ref: '#/definitions/PeerInfo' Cluster: type: object required: - name - data_centers properties: id: type: integer format: int64 name: type: string example: cluster0 data_centers: type: array items: $ref: '#/definitions/DataCenter' cassandra_version: type: string example: 3.0.13 dse_version: type: string example: 5.0.8 peer_info: $ref: '#/definitions/PeerInfo' example: name: "cluster0" dse_version: "5.0.8" data_centers: - name: "dc0" nodes: - name: "node0" peer_info: rack: "rack0" - name: "node1" peer_info: rack: "rack1" - name: "node2" peer_info: rack: "rack2" - name: "dc1" nodes: - name: "node0" - name: "node1" Query: type: object required: - query properties: query: type: string example: "SELECT * FROM tbl" consistency_level: type: array items: $ref: '#/definitions/Consistency' params: type: object description: | Each property is a mapping of parameter name to paramter value. The value can be of any type as simulacron will attempt to map the json value to it's native binary format" example: param_name_1: value1 param_name_2: 2 param_types: type: object description: "Each property is a mapping of parameter name to parameter type" additionalProperties: $ref: "#/definitions/DataType" example: param_name_1: ascii param_name_2: bigint example: query: "SELECT * FROM tbl" Options: type: object required: - query properties: request: type: string example: "options" Batch: type: object required: - query properties: request: type: string example: "batch" queries: type: array items: $ref: '#/definitions/Query' consistency_level: type: array items: $ref: '#/definitions/Consistency' example: request: "batch" queries: - query: "INSERT INTO my_table(column1, column2) VALUES(1, 2)" - query: "INSERT INTO your_table(column1, column2) VALUES(?, ?)" params: column1: "value1" column2: "2" paramTypes: column1: "ascii" column2: "int" Then: type: object discriminator: result required: - result - delay_in_ms properties: result: type: string example: success delay_in_ms: type: integer description: Adds delay to send response back to client. example: 0 ignore_on_prepare: type: boolean description: > Whether or not this result be applied to a matching prepare statement. If not specified, defaults to true (does not apply) and applies to the execution of statements tied to that prepared statement. Row: type: object description: | Each property is a mapping of column name to column value. The value can be any type as simulacron will attempt to map the json value to its native binary format. additionalProperties: - type: string SuccessResult: allOf: - $ref: '#/definitions/Then' - type: object required: - rows - column_types properties: rows: type: array items: $ref: "#/definitions/Row" example: - key: 0 description: "Important dates" dates: independence day: "1776-07-04" washington's birthday: "1732-02-22" - key: 1 description: "Other fun dates" dates: new years day: "2017-01-01" leap day: "2020-02-29" end of mayan calendar: "2012-12-21" column_types: type: object description: "Each property is a mapping of column name to column type" additionalProperties: $ref: "#/definitions/DataType" example: key: "bigint" description: "ascii" dates: "map" ErrorResult: allOf: - $ref: '#/definitions/Then' - type: object required: - ignore_on_prepare SuccessResultBatch: allOf: - $ref: '#/definitions/Then' - type: object required: - rows - column_types properties: rows: type: array items: $ref: "#/definitions/Row" example: - applied: true column_types: type: object description: "Each property is a mapping of column name to column type" additionalProperties: $ref: "#/definitions/DataType" example: applied: "boolean" AlreadyExistsResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - message - keyspace properties: result: example: already_exists message: type: string example: The table already exists keyspace: type: string example: ks table: type: string example: tbl AuthenticationErrorResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - message properties: result: example: authentication_error message: type: string example: Invalid username or password! ConfigErrorResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - message properties: result: example: config_error message: type: string example: Invalid Configuration! FunctionFailureResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - function - arg_types - detail properties: result: example: function_failure function: type: string example: fib arg_types: type: array example: [int, varchar] detail: type: string example: Could not execute function! InvalidResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - message properties: result: example: invalid message: type: string example: Invalid Query! IsBootstrappingResult: allOf: - $ref: '#/definitions/Then' - type: object properties: result: example: is_bootstrapping OverloadedResult: allOf: - $ref: '#/definitions/Then' - type: object required: - message properties: result: example: overloaded message: type: string example: Server is overloaded! ProtocolErrorResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - message properties: result: example: protocol_error message: type: string example: Invalid protocol version 98 ReadFailureResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - consistency_level - received - block_for - failure_reasons - data_present properties: result: example: read_failure consistency_level: $ref: '#/definitions/Consistency' received: type: integer example: 1 block_for: type: integer example: 2 failure_reasons: type: object additionalProperties: $ref: '#/definitions/RequestFailureReason' example: 127.0.0.1: READ_TOO_MANY_TOMBSTONES data_present: type: boolean example: true ReadTimeoutResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - consistency_level - received - block_for - data_present properties: result: example: read_timeout consistency_level: $ref: '#/definitions/Consistency' received: type: integer example: 1 block_for: type: integer example: 2 data_present: type: boolean example: true ServerErrorResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - message properties: result: example: server_error message: type: string example: This is a server error SyntaxErrorResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - message properties: result: example: syntax_error message: type: string example: Invalid syntax, expected ')' TruncateErrorResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - message properties: result: example: truncate_error message: type: string example: Could not truncate table UnauthorizedResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - message properties: result: example: unauthorized message: type: string example: User lacks permissions to update table 'x' UnavailableResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - consistency_level - alive - required properties: result: example: unavailable consistency_level: $ref: '#/definitions/Consistency' alive: type: integer example: 1 required: type: integer example: 2 UnpreparedResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - message properties: result: example: unprepared message: type: string example: Prepared query with ID 8657309 not found WriteFailureResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - consistency_level - received - block_for - failure_reasons - write_type properties: result: example: write_failure consistency_level: $ref: '#/definitions/Consistency' received: type: integer example: 1 block_for: type: integer example: 2 failure_reasons: type: object additionalProperties: $ref: '#/definitions/RequestFailureReason' example: 127.0.0.1: UNKNOWN write_type: $ref: '#/definitions/WriteType' WriteTimeoutResult: allOf: - $ref: '#/definitions/ErrorResult' - type: object required: - consistency_level - received - block_for - write_type properties: result: example: write_timeout consistency_level: $ref: '#/definitions/Consistency' received: type: integer example: 1 block_for: type: integer example: 2 write_type: $ref: '#/definitions/WriteType' CloseConnectionResult: allOf: - $ref: '#/definitions/Then' - type: object properties: result: example: close_connection close_type: $ref: '#/definitions/CloseType' scope: $ref: '#/definitions/CloseScope' PrimeQuery: type: object required: - when properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/Then' PrimeQueryNoResult: type: object required: - when properties: when: $ref: '#/definitions/Query' PrimeQuerySuccess: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/SuccessResult' PrimeQuerySuccessBatch: type: object required: - when - then properties: when: $ref: '#/definitions/Batch' then: $ref: '#/definitions/SuccessResultBatch' PrimeQueryAlreadyExists: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/AlreadyExistsResult' PrimeQueryAuthenticationError: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/AuthenticationErrorResult' PrimeQueryConfigError: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/ConfigErrorResult' PrimeQueryFunctionFailure: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/FunctionFailureResult' PrimeQueryInvalid: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/InvalidResult' PrimeQueryIsBootstrapping: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/IsBootstrappingResult' PrimeQueryOverloaded: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/OverloadedResult' PrimeQueryProtocolError: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/ProtocolErrorResult' PrimeQueryReadFailure: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/ReadFailureResult' PrimeQueryReadTimeout: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/ReadTimeoutResult' PrimeQueryServerError: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/ServerErrorResult' PrimeQuerySyntaxError: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/SyntaxErrorResult' PrimeQueryTruncateError: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/TruncateErrorResult' PrimeQueryUnauthorized: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/UnauthorizedResult' PrimeQueryUnavailable: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/UnavailableResult' PrimeQueryUnprepared: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/UnpreparedResult' PrimeQueryWriteFailure: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/WriteFailureResult' PrimeQueryWriteTimeout: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/WriteTimeoutResult' PrimeQueryCloseConnection: type: object required: - when - then properties: when: $ref: '#/definitions/Query' then: $ref: '#/definitions/CloseConnectionResult' PrimeOptions: type: object required: - when properties: when: $ref: '#/definitions/Options' then: $ref: '#/definitions/Then' example: when: request: "options" QueryLog: type: object properties: connection: type: string example: "/127.0.0.1:34662" received_timestamp: type: long description: Timestamp when query was received (Epoch time in milliseconds) example: 1496955368551 primed: type: boolean description: Whether or not the query had a matching prime example: true frame: type: object description: The full native protocol frame, contents depend on the message type. example: protocol_version: 4 beta: false stream_id: 128 tracing_id: null custom_payload: {} warnings: [] message: type: QUERY opcode: 7 is_response: false query: select * from tbl options: consistency: LOCAL_ONE positional_values: [] named_values: {} skip_metadata: false page_size: 5000 paging_state: null serial_consistency: SERIAL default_timestamp: 100 keyspace: null NodeQueryLogReport: type: object required: - id - queries properties: id: type: integer format: int64 queries: type: array items: $ref: '#/definitions/QueryLog' DataCenterQueryLogReport: type: object required: - nodes - id properties: id: type: integer format: int64 nodes: type: array items: $ref: '#/definitions/NodeQueryLogReport' ClusterQueryLogReport: type: object required: - data_centers - id properties: id: type: integer format: int64 data_centers: type: array items: $ref: '#/definitions/DataCenterQueryLogReport' Error: type: object required: - message - status_code properties: message: type: string example: "An error has occurred" status_code: type: string example: 400 NodeConnectionReport: type: object required: - address - connections - id properties: id: type: integer format: int64 connections: type: array items: string example: "127.0.0.1:5468" address: type: string example: "127.0.0.1:9042" DataCenterConnectionReport: type: object required: - nodes - id properties: id: type: integer format: int64 nodes: type: array items: $ref: '#/definitions/NodeConnectionReport' ClusterConnectionReport: type: object required: - data_centers - id properties: id: type: integer format: int64 data_centers: type: array items: $ref: '#/definitions/DataCenterConnectionReport' example: id: "0" data_centers: - id: "0" nodes: - id: "0" connections: - "127.0.0.1:38850" - "127.0.0.1:38852" address: "127.0.0.1:38472" - id: "1" connections: - "127.0.0.1:38472" address: "127.0.0.2:38472" - id: "2" connections: - "127.0.0.1:54282" address: "127.0.0.3:38472" - id: "1" nodes: - id: "0" connections: - "127.0.0.1:18432" address: "127.0.1.1:9042" - id: "1" connections: - "127.0.0.1:7426" address: "127.0.1.2:9042"