[Rust Server] Allow more than 32 configured paths (#3494)

This commit is contained in:
Richard Whitehouse
2019-08-04 12:55:33 +01:00
committed by GitHub
parent 6963e5eeb0
commit 83f17941b9
26 changed files with 7967 additions and 4 deletions

View File

@@ -63,7 +63,7 @@ mod paths {
extern crate regex;
lazy_static! {
pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(&[
pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(vec![
{{#pathSet}}
r"^{{{basePathWithoutHost}}}{{{pathRegEx}}}"{{^-last}},{{/-last}}
{{/pathSet}}

View File

@@ -0,0 +1,192 @@
# Test large number of configured operations
openapi: 3.0.1
info:
title: Regression test for large number of operations
version: 0.0.1
paths:
/op1:
get:
responses:
'200':
description: 'OK'
/op2:
get:
responses:
'200':
description: 'OK'
/op3:
get:
responses:
'200':
description: 'OK'
/op4:
get:
responses:
'200':
description: 'OK'
/op5:
get:
responses:
'200':
description: 'OK'
/op6:
get:
responses:
'200':
description: 'OK'
/op7:
get:
responses:
'200':
description: 'OK'
/op8:
get:
responses:
'200':
description: 'OK'
/op9:
get:
responses:
'200':
description: 'OK'
/op10:
get:
responses:
'200':
description: 'OK'
/op11:
get:
responses:
'200':
description: 'OK'
/op12:
get:
responses:
'200':
description: 'OK'
/op13:
get:
responses:
'200':
description: 'OK'
/op14:
get:
responses:
'200':
description: 'OK'
/op15:
get:
responses:
'200':
description: 'OK'
/op16:
get:
responses:
'200':
description: 'OK'
/op17:
get:
responses:
'200':
description: 'OK'
/op18:
get:
responses:
'200':
description: 'OK'
/op19:
get:
responses:
'200':
description: 'OK'
/op20:
get:
responses:
'200':
description: 'OK'
/op21:
get:
responses:
'200':
description: 'OK'
/op22:
get:
responses:
'200':
description: 'OK'
/op23:
get:
responses:
'200':
description: 'OK'
/op24:
get:
responses:
'200':
description: 'OK'
/op25:
get:
responses:
'200':
description: 'OK'
/op26:
get:
responses:
'200':
description: 'OK'
/op27:
get:
responses:
'200':
description: 'OK'
/op28:
get:
responses:
'200':
description: 'OK'
/op29:
get:
responses:
'200':
description: 'OK'
/op30:
get:
responses:
'200':
description: 'OK'
/op31:
get:
responses:
'200':
description: 'OK'
/op32:
get:
responses:
'200':
description: 'OK'
/op33:
get:
responses:
'200':
description: 'OK'
/op34:
get:
responses:
'200':
description: 'OK'
/op35:
get:
responses:
'200':
description: 'OK'
/op36:
get:
responses:
'200':
description: 'OK'
/op37:
get:
responses:
'200':
description: 'OK'

View File

@@ -54,7 +54,7 @@ mod paths {
extern crate regex;
lazy_static! {
pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(&[
pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(vec![
r"^/required_octet_stream$",
r"^/uuid$",
r"^/xml$",

View File

@@ -0,0 +1,18 @@
[build]
rustflags = [
"-W", "missing_docs", # detects missing documentation for public members
"-W", "trivial_casts", # detects trivial casts which could be removed
"-W", "trivial_numeric_casts", # detects trivial casts of numeric types which could be removed
"-W", "unsafe_code", # usage of `unsafe` code
"-W", "unused_qualifications", # detects unnecessarily qualified names
"-W", "unused_extern_crates", # extern crates that are never used
"-W", "unused_import_braces", # unnecessary braces around an imported item
"-D", "warnings", # all warnings should be denied
]

View File

@@ -0,0 +1,2 @@
target
Cargo.lock

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -0,0 +1 @@
4.1.0-SNAPSHOT

View File

@@ -0,0 +1,48 @@
[package]
name = "ops-v3"
version = "0.0.1"
authors = []
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
license = "Unlicense"
[features]
default = ["client", "server"]
client = ["serde_json", "serde_ignored", "hyper", "hyper-tls", "native-tls", "openssl", "tokio-core", "url", "uuid"]
server = ["serde_json", "serde_ignored", "hyper", "hyper-tls", "native-tls", "openssl", "tokio-core", "tokio-proto", "tokio-tls", "regex", "percent-encoding", "url", "uuid"]
[dependencies]
# Required by example server.
#
chrono = { version = "0.4", features = ["serde"] }
futures = "0.1"
hyper = {version = "0.11", optional = true}
hyper-tls = {version = "0.1.2", optional = true}
swagger = "2"
# Not required by example server.
#
lazy_static = "0.2"
log = "0.3.0"
mime = "0.3.3"
multipart = {version = "0.13.3", optional = true}
native-tls = {version = "0.1.4", optional = true}
openssl = {version = "0.9.14", optional = true}
percent-encoding = {version = "1.0.0", optional = true}
regex = {version = "0.2", optional = true}
serde = "1.0"
serde_derive = "1.0"
serde_ignored = {version = "0.0.4", optional = true}
serde_json = {version = "1.0", optional = true}
serde_urlencoded = {version = "0.5.1", optional = true}
tokio-core = {version = "0.1.6", optional = true}
tokio-proto = {version = "0.1.1", optional = true}
tokio-tls = {version = "0.1.3", optional = true, features = ["tokio-proto"]}
url = {version = "1.5", optional = true}
uuid = {version = "0.5", optional = true, features = ["serde", "v4"]}
# ToDo: this should be updated to point at the official crate once
# https://github.com/RReverser/serde-xml-rs/pull/45 is accepted upstream
[dev-dependencies]
clap = "2.25"
error-chain = "0.12"

View File

@@ -0,0 +1,198 @@
# Rust API for ops-v3
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
## Overview
This client/server was generated by the [openapi-generator]
(https://openapi-generator.tech) project.
By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub.
-
To see how to make this your own, look here:
[README]((https://openapi-generator.tech))
- API version: 0.0.1
This autogenerated project defines an API crate `ops-v3` which contains:
* An `Api` trait defining the API in Rust.
* Data types representing the underlying data model.
* A `Client` type which implements `Api` and issues HTTP requests for each operation.
* A router which accepts HTTP requests and invokes the appropriate `Api` method for each operation.
It also contains an example server and client which make use of `ops-v3`:
* The example server starts up a web server using the `ops-v3` router,
and supplies a trivial implementation of `Api` which returns failure for every operation.
* The example client provides a CLI which lets you invoke any single operation on the
`ops-v3` client by passing appropriate arguments on the command line.
You can use the example server and client as a basis for your own code.
See below for [more detail on implementing a server](#writing-a-server).
## Examples
Run examples with:
```
cargo run --example <example-name>
```
To pass in arguments to the examples, put them after `--`, for example:
```
cargo run --example client -- --help
```
### Running the server
To run the server, follow these simple steps:
```
cargo run --example server
```
### Running a client
To run a client, follow one of the following simple steps:
```
cargo run --example client Op10Get
cargo run --example client Op11Get
cargo run --example client Op12Get
cargo run --example client Op13Get
cargo run --example client Op14Get
cargo run --example client Op15Get
cargo run --example client Op16Get
cargo run --example client Op17Get
cargo run --example client Op18Get
cargo run --example client Op19Get
cargo run --example client Op1Get
cargo run --example client Op20Get
cargo run --example client Op21Get
cargo run --example client Op22Get
cargo run --example client Op23Get
cargo run --example client Op24Get
cargo run --example client Op25Get
cargo run --example client Op26Get
cargo run --example client Op27Get
cargo run --example client Op28Get
cargo run --example client Op29Get
cargo run --example client Op2Get
cargo run --example client Op30Get
cargo run --example client Op31Get
cargo run --example client Op32Get
cargo run --example client Op33Get
cargo run --example client Op34Get
cargo run --example client Op35Get
cargo run --example client Op36Get
cargo run --example client Op37Get
cargo run --example client Op3Get
cargo run --example client Op4Get
cargo run --example client Op5Get
cargo run --example client Op6Get
cargo run --example client Op7Get
cargo run --example client Op8Get
cargo run --example client Op9Get
```
### HTTPS
The examples can be run in HTTPS mode by passing in the flag `--https`, for example:
```
cargo run --example server -- --https
```
This will use the keys/certificates from the examples directory. Note that the server chain is signed with
`CN=localhost`.
## Writing a server
The server example is designed to form the basis for implementing your own server. Simply follow these steps.
* Set up a new Rust project, e.g., with `cargo init --bin`.
* Insert `ops-v3` into the `members` array under [workspace] in the root `Cargo.toml`, e.g., `members = [ "ops-v3" ]`.
* Add `ops-v3 = {version = "0.0.1", path = "ops-v3"}` under `[dependencies]` in the root `Cargo.toml`.
* Copy the `[dependencies]` and `[dev-dependencies]` from `ops-v3/Cargo.toml` into the root `Cargo.toml`'s `[dependencies]` section.
* Copy all of the `[dev-dependencies]`, but only the `[dependencies]` that are required by the example server. These should be clearly indicated by comments.
* Remove `"optional = true"` from each of these lines if present.
Each autogenerated API will contain an implementation stub and main entry point, which should be copied into your project the first time:
```
cp ops-v3/examples/server.rs src/main.rs
cp ops-v3/examples/server_lib/mod.rs src/lib.rs
cp ops-v3/examples/server_lib/server.rs src/server.rs
```
Now
* From `src/main.rs`, remove the `mod server_lib;` line, and uncomment and fill in the `extern crate` line with the name of this server crate.
* Move the block of imports "required by the service library" from `src/main.rs` to `src/lib.rs` and uncomment.
* Change the `let server = server::Server {};` line to `let server = SERVICE_NAME::server().unwrap();` where `SERVICE_NAME` is the name of the server crate.
* Run `cargo build` to check it builds.
* Run `cargo fmt` to reformat the code.
* Commit the result before making any further changes (lest format changes get confused with your own updates).
Now replace the implementations in `src/server.rs` with your own code as required.
## Updating your server to track API changes
Later, if the API changes, you can copy new sections from the autogenerated API stub into your implementation.
Alternatively, implement the now-missing methods based on the compiler's error messages.
## Documentation for API Endpoints
All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[****](docs/default_api.md#) | **GET** /op10 |
[****](docs/default_api.md#) | **GET** /op11 |
[****](docs/default_api.md#) | **GET** /op12 |
[****](docs/default_api.md#) | **GET** /op13 |
[****](docs/default_api.md#) | **GET** /op14 |
[****](docs/default_api.md#) | **GET** /op15 |
[****](docs/default_api.md#) | **GET** /op16 |
[****](docs/default_api.md#) | **GET** /op17 |
[****](docs/default_api.md#) | **GET** /op18 |
[****](docs/default_api.md#) | **GET** /op19 |
[****](docs/default_api.md#) | **GET** /op1 |
[****](docs/default_api.md#) | **GET** /op20 |
[****](docs/default_api.md#) | **GET** /op21 |
[****](docs/default_api.md#) | **GET** /op22 |
[****](docs/default_api.md#) | **GET** /op23 |
[****](docs/default_api.md#) | **GET** /op24 |
[****](docs/default_api.md#) | **GET** /op25 |
[****](docs/default_api.md#) | **GET** /op26 |
[****](docs/default_api.md#) | **GET** /op27 |
[****](docs/default_api.md#) | **GET** /op28 |
[****](docs/default_api.md#) | **GET** /op29 |
[****](docs/default_api.md#) | **GET** /op2 |
[****](docs/default_api.md#) | **GET** /op30 |
[****](docs/default_api.md#) | **GET** /op31 |
[****](docs/default_api.md#) | **GET** /op32 |
[****](docs/default_api.md#) | **GET** /op33 |
[****](docs/default_api.md#) | **GET** /op34 |
[****](docs/default_api.md#) | **GET** /op35 |
[****](docs/default_api.md#) | **GET** /op36 |
[****](docs/default_api.md#) | **GET** /op37 |
[****](docs/default_api.md#) | **GET** /op3 |
[****](docs/default_api.md#) | **GET** /op4 |
[****](docs/default_api.md#) | **GET** /op5 |
[****](docs/default_api.md#) | **GET** /op6 |
[****](docs/default_api.md#) | **GET** /op7 |
[****](docs/default_api.md#) | **GET** /op8 |
[****](docs/default_api.md#) | **GET** /op9 |
## Documentation For Models
## Documentation For Authorization
Endpoints do not require authorization.
## Author

View File

@@ -0,0 +1,195 @@
openapi: 3.0.1
info:
title: Regression test for large number of operations
version: 0.0.1
servers:
- url: /
paths:
/op1:
get:
responses:
200:
description: OK
/op2:
get:
responses:
200:
description: OK
/op3:
get:
responses:
200:
description: OK
/op4:
get:
responses:
200:
description: OK
/op5:
get:
responses:
200:
description: OK
/op6:
get:
responses:
200:
description: OK
/op7:
get:
responses:
200:
description: OK
/op8:
get:
responses:
200:
description: OK
/op9:
get:
responses:
200:
description: OK
/op10:
get:
responses:
200:
description: OK
/op11:
get:
responses:
200:
description: OK
/op12:
get:
responses:
200:
description: OK
/op13:
get:
responses:
200:
description: OK
/op14:
get:
responses:
200:
description: OK
/op15:
get:
responses:
200:
description: OK
/op16:
get:
responses:
200:
description: OK
/op17:
get:
responses:
200:
description: OK
/op18:
get:
responses:
200:
description: OK
/op19:
get:
responses:
200:
description: OK
/op20:
get:
responses:
200:
description: OK
/op21:
get:
responses:
200:
description: OK
/op22:
get:
responses:
200:
description: OK
/op23:
get:
responses:
200:
description: OK
/op24:
get:
responses:
200:
description: OK
/op25:
get:
responses:
200:
description: OK
/op26:
get:
responses:
200:
description: OK
/op27:
get:
responses:
200:
description: OK
/op28:
get:
responses:
200:
description: OK
/op29:
get:
responses:
200:
description: OK
/op30:
get:
responses:
200:
description: OK
/op31:
get:
responses:
200:
description: OK
/op32:
get:
responses:
200:
description: OK
/op33:
get:
responses:
200:
description: OK
/op34:
get:
responses:
200:
description: OK
/op35:
get:
responses:
200:
description: OK
/op36:
get:
responses:
200:
description: OK
/op37:
get:
responses:
200:
description: OK
components:
schemas: {}

View File

@@ -0,0 +1,859 @@
# default_api
All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
****](default_api.md#) | **GET** /op10 |
****](default_api.md#) | **GET** /op11 |
****](default_api.md#) | **GET** /op12 |
****](default_api.md#) | **GET** /op13 |
****](default_api.md#) | **GET** /op14 |
****](default_api.md#) | **GET** /op15 |
****](default_api.md#) | **GET** /op16 |
****](default_api.md#) | **GET** /op17 |
****](default_api.md#) | **GET** /op18 |
****](default_api.md#) | **GET** /op19 |
****](default_api.md#) | **GET** /op1 |
****](default_api.md#) | **GET** /op20 |
****](default_api.md#) | **GET** /op21 |
****](default_api.md#) | **GET** /op22 |
****](default_api.md#) | **GET** /op23 |
****](default_api.md#) | **GET** /op24 |
****](default_api.md#) | **GET** /op25 |
****](default_api.md#) | **GET** /op26 |
****](default_api.md#) | **GET** /op27 |
****](default_api.md#) | **GET** /op28 |
****](default_api.md#) | **GET** /op29 |
****](default_api.md#) | **GET** /op2 |
****](default_api.md#) | **GET** /op30 |
****](default_api.md#) | **GET** /op31 |
****](default_api.md#) | **GET** /op32 |
****](default_api.md#) | **GET** /op33 |
****](default_api.md#) | **GET** /op34 |
****](default_api.md#) | **GET** /op35 |
****](default_api.md#) | **GET** /op36 |
****](default_api.md#) | **GET** /op37 |
****](default_api.md#) | **GET** /op3 |
****](default_api.md#) | **GET** /op4 |
****](default_api.md#) | **GET** /op5 |
****](default_api.md#) | **GET** /op6 |
****](default_api.md#) | **GET** /op7 |
****](default_api.md#) | **GET** /op8 |
****](default_api.md#) | **GET** /op9 |
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# ****
> ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,17 @@
-----BEGIN CERTIFICATE-----
MIICtjCCAZ4CCQDpKecRERZ0xDANBgkqhkiG9w0BAQsFADAdMQswCQYDVQQGEwJV
UzEOMAwGA1UEAxMFTXkgQ0EwHhcNMTcwNTIzMTYwMDIzWhcNMTcwNjIyMTYwMDIz
WjAdMQswCQYDVQQGEwJVUzEOMAwGA1UEAxMFTXkgQ0EwggEiMA0GCSqGSIb3DQEB
AQUAA4IBDwAwggEKAoIBAQCt66py3x7sCSASRF2D05L5wkNDxAUjQKYx23W8Gbwv
GMGykk89BIdU5LX1JB1cKiUOkoIxfwAYuWc2V/wzTvVV7+11besnk3uX1c9KiqUF
LIX7kn/z5hzS4aelhKvH+MJlSZCSlp1ytpZbwo5GB5Pi2SGH56jDBiBoDRNBVdWL
z4wH7TdrQjqWwNxIZumD5OGMtcfJyuX08iPiEOaslOeoMqzObhvjc9aUgjVjhqyA
FkJGTXsi0oaD7oml+NE+mTNfEeZvEJQpLSjBY0OvQHzuHkyGBShBnfu/9x7/NRwd
WaqsLiF7/re9KDGYdJwP7Cu6uxYfKAyWarp6h2mG/GIdAgMBAAEwDQYJKoZIhvcN
AQELBQADggEBAGIl/VVIafeq/AJOQ9r7TzzB2ABJYr7NZa6bTu5O1jSp1Fonac15
SZ8gvRxODgH22ZYSqghPG4xzq4J3hkytlQqm57ZEt2I2M3OqIp17Ndcc1xDYzpLl
tA0FrVn6crQTM8vQkTDtGesaCWX+7Fir5dK7HnYWzfpSmsOpST07PfbNisEXKOxG
Dj4lBL1OnhTjsJeymVS1pFvkKkrcEJO+IxFiHL3CDsWjcXB0Z+E1zBtPoYyYsNsO
rBrjUxcZewF4xqWZhpW90Mt61fY2nRgU0uUwHcvDQUqvmzKcsqYa4mPKzfBI5mxo
01Ta96cDD6pS5Y1hOflZ0g84f2g/7xBLLDA=
-----END CERTIFICATE-----

View File

@@ -0,0 +1,334 @@
#![allow(missing_docs, unused_variables, trivial_casts)]
extern crate ops_v3;
#[allow(unused_extern_crates)]
extern crate futures;
#[allow(unused_extern_crates)]
#[macro_use]
extern crate swagger;
#[allow(unused_extern_crates)]
extern crate uuid;
extern crate clap;
extern crate tokio_core;
use swagger::{ContextBuilder, EmptyContext, XSpanIdString, Has, Push, AuthData};
#[allow(unused_imports)]
use futures::{Future, future, Stream, stream};
use tokio_core::reactor;
#[allow(unused_imports)]
use ops_v3::{ApiNoContext, ContextWrapperExt,
ApiError,
Op10GetResponse,
Op11GetResponse,
Op12GetResponse,
Op13GetResponse,
Op14GetResponse,
Op15GetResponse,
Op16GetResponse,
Op17GetResponse,
Op18GetResponse,
Op19GetResponse,
Op1GetResponse,
Op20GetResponse,
Op21GetResponse,
Op22GetResponse,
Op23GetResponse,
Op24GetResponse,
Op25GetResponse,
Op26GetResponse,
Op27GetResponse,
Op28GetResponse,
Op29GetResponse,
Op2GetResponse,
Op30GetResponse,
Op31GetResponse,
Op32GetResponse,
Op33GetResponse,
Op34GetResponse,
Op35GetResponse,
Op36GetResponse,
Op37GetResponse,
Op3GetResponse,
Op4GetResponse,
Op5GetResponse,
Op6GetResponse,
Op7GetResponse,
Op8GetResponse,
Op9GetResponse
};
use clap::{App, Arg};
fn main() {
let matches = App::new("client")
.arg(Arg::with_name("operation")
.help("Sets the operation to run")
.possible_values(&[
"Op10Get",
"Op11Get",
"Op12Get",
"Op13Get",
"Op14Get",
"Op15Get",
"Op16Get",
"Op17Get",
"Op18Get",
"Op19Get",
"Op1Get",
"Op20Get",
"Op21Get",
"Op22Get",
"Op23Get",
"Op24Get",
"Op25Get",
"Op26Get",
"Op27Get",
"Op28Get",
"Op29Get",
"Op2Get",
"Op30Get",
"Op31Get",
"Op32Get",
"Op33Get",
"Op34Get",
"Op35Get",
"Op36Get",
"Op37Get",
"Op3Get",
"Op4Get",
"Op5Get",
"Op6Get",
"Op7Get",
"Op8Get",
"Op9Get",
])
.required(true)
.index(1))
.arg(Arg::with_name("https")
.long("https")
.help("Whether to use HTTPS or not"))
.arg(Arg::with_name("host")
.long("host")
.takes_value(true)
.default_value("localhost")
.help("Hostname to contact"))
.arg(Arg::with_name("port")
.long("port")
.takes_value(true)
.default_value("80")
.help("Port to contact"))
.get_matches();
let mut core = reactor::Core::new().unwrap();
let is_https = matches.is_present("https");
let base_url = format!("{}://{}:{}",
if is_https { "https" } else { "http" },
matches.value_of("host").unwrap(),
matches.value_of("port").unwrap());
let client = if matches.is_present("https") {
// Using Simple HTTPS
ops_v3::Client::try_new_https(core.handle(), &base_url, "examples/ca.pem")
.expect("Failed to create HTTPS client")
} else {
// Using HTTP
ops_v3::Client::try_new_http(core.handle(), &base_url)
.expect("Failed to create HTTP client")
};
let context: make_context_ty!(ContextBuilder, EmptyContext, Option<AuthData>, XSpanIdString) =
make_context!(ContextBuilder, EmptyContext, None as Option<AuthData>, XSpanIdString(self::uuid::Uuid::new_v4().to_string()));
let client = client.with_context(context);
match matches.value_of("operation") {
Some("Op10Get") => {
let result = core.run(client.op10_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op11Get") => {
let result = core.run(client.op11_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op12Get") => {
let result = core.run(client.op12_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op13Get") => {
let result = core.run(client.op13_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op14Get") => {
let result = core.run(client.op14_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op15Get") => {
let result = core.run(client.op15_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op16Get") => {
let result = core.run(client.op16_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op17Get") => {
let result = core.run(client.op17_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op18Get") => {
let result = core.run(client.op18_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op19Get") => {
let result = core.run(client.op19_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op1Get") => {
let result = core.run(client.op1_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op20Get") => {
let result = core.run(client.op20_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op21Get") => {
let result = core.run(client.op21_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op22Get") => {
let result = core.run(client.op22_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op23Get") => {
let result = core.run(client.op23_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op24Get") => {
let result = core.run(client.op24_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op25Get") => {
let result = core.run(client.op25_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op26Get") => {
let result = core.run(client.op26_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op27Get") => {
let result = core.run(client.op27_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op28Get") => {
let result = core.run(client.op28_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op29Get") => {
let result = core.run(client.op29_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op2Get") => {
let result = core.run(client.op2_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op30Get") => {
let result = core.run(client.op30_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op31Get") => {
let result = core.run(client.op31_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op32Get") => {
let result = core.run(client.op32_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op33Get") => {
let result = core.run(client.op33_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op34Get") => {
let result = core.run(client.op34_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op35Get") => {
let result = core.run(client.op35_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op36Get") => {
let result = core.run(client.op36_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op37Get") => {
let result = core.run(client.op37_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op3Get") => {
let result = core.run(client.op3_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op4Get") => {
let result = core.run(client.op4_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op5Get") => {
let result = core.run(client.op5_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op6Get") => {
let result = core.run(client.op6_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op7Get") => {
let result = core.run(client.op7_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op8Get") => {
let result = core.run(client.op8_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("Op9Get") => {
let result = core.run(client.op9_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
_ => {
panic!("Invalid operation provided")
}
}
}

View File

@@ -0,0 +1,66 @@
Certificate:
Data:
Version: 1 (0x0)
Serial Number: 4096 (0x1000)
Signature Algorithm: sha256WithRSAEncryption
Issuer: C=US, CN=My CA
Validity
Not Before: May 23 16:00:23 2017 GMT
Not After : Apr 29 16:00:23 2117 GMT
Subject: CN=localhost, C=US
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:c9:d4:43:60:50:fc:d6:0f:38:4d:5d:5e:aa:7c:
c0:5e:a9:ec:d9:93:78:d3:93:72:28:41:f5:08:a5:
ea:ac:67:07:d7:1f:f7:7d:74:69:7e:46:89:20:4b:
7a:2d:9b:02:08:e7:6f:0f:1d:0c:0f:c7:60:69:19:
4b:df:7e:ca:75:94:0b:49:71:e3:6d:f2:e8:79:fd:
ed:0a:94:67:55:f3:ca:6b:61:ba:58:b7:2e:dd:7b:
ca:b9:02:9f:24:36:ac:26:8f:04:8f:81:c8:35:10:
f4:aa:33:b2:24:16:f8:f7:1e:ea:f7:16:fe:fa:34:
c3:dd:bb:2c:ba:7a:df:4d:e2:da:1e:e5:d2:28:44:
6e:c8:96:e0:fd:09:0c:14:0c:31:dc:e0:ca:c1:a7:
9b:bf:16:8c:f7:36:3f:1b:2e:dd:90:eb:45:78:51:
bf:59:22:1e:c6:8c:0a:69:88:e5:03:5e:73:b7:fc:
93:7f:1b:46:1b:97:68:c5:c0:8b:35:1f:bb:1e:67:
7f:55:b7:3b:55:3f:ea:f2:ca:db:cc:52:cd:16:89:
db:15:47:bd:f2:cd:6c:7a:d7:b4:1a:ac:c8:15:6c:
6a:fb:77:c4:e9:f2:30:e0:14:24:66:65:6f:2a:e5:
2d:cc:f6:81:ae:57:c8:d1:9b:38:90:dc:60:93:02:
5e:cb
Exponent: 65537 (0x10001)
Signature Algorithm: sha256WithRSAEncryption
1c:7c:39:e8:3d:49:b2:09:1e:68:5a:2f:74:18:f4:63:b5:8c:
f6:e6:a1:e3:4d:95:90:99:ef:32:5c:34:40:e8:55:13:0e:e0:
1c:be:cd:ab:3f:64:38:99:5e:2b:c1:81:53:a0:18:a8:f6:ee:
6a:33:73:6c:9a:73:9d:86:08:5d:c7:11:38:46:4c:cd:a0:47:
37:8f:fe:a6:50:a9:02:21:99:42:86:5e:47:fe:65:56:60:1d:
16:53:86:bd:e4:63:c5:69:cf:fa:30:51:ab:a1:c3:50:53:cc:
66:1c:4c:ff:3f:2a:39:4d:a2:8f:9d:d1:a7:8b:22:e4:78:69:
24:06:83:4d:cc:0a:c0:87:69:9b:bc:80:a9:d2:b7:a5:23:84:
7e:a2:32:26:7c:78:0e:bd:db:cd:3b:69:18:33:b8:44:ef:96:
b4:99:86:ee:06:bd:51:1c:c7:a1:a4:0c:c4:4c:51:a0:df:ac:
14:07:88:8e:d7:39:45:fe:52:e0:a3:4c:db:5d:7a:ab:4d:e4:
ca:06:e8:bd:74:6f:46:e7:93:4a:4f:1b:67:e7:a5:9f:ef:9c:
02:49:d1:f2:d5:e9:53:ee:09:21:ac:08:c8:15:f7:af:35:b9:
4f:11:0f:43:ae:46:8e:fd:5b:8d:a3:4e:a7:2c:b7:25:ed:e4:
e5:94:1d:e3
-----BEGIN CERTIFICATE-----
MIICtTCCAZ0CAhAAMA0GCSqGSIb3DQEBCwUAMB0xCzAJBgNVBAYTAlVTMQ4wDAYD
VQQDEwVNeSBDQTAgFw0xNzA1MjMxNjAwMjNaGA8yMTE3MDQyOTE2MDAyM1owITES
MBAGA1UEAxMJbG9jYWxob3N0MQswCQYDVQQGEwJVUzCCASIwDQYJKoZIhvcNAQEB
BQADggEPADCCAQoCggEBAMnUQ2BQ/NYPOE1dXqp8wF6p7NmTeNOTcihB9Qil6qxn
B9cf9310aX5GiSBLei2bAgjnbw8dDA/HYGkZS99+ynWUC0lx423y6Hn97QqUZ1Xz
ymthuli3Lt17yrkCnyQ2rCaPBI+ByDUQ9KozsiQW+Pce6vcW/vo0w927LLp6303i
2h7l0ihEbsiW4P0JDBQMMdzgysGnm78WjPc2Pxsu3ZDrRXhRv1kiHsaMCmmI5QNe
c7f8k38bRhuXaMXAizUfux5nf1W3O1U/6vLK28xSzRaJ2xVHvfLNbHrXtBqsyBVs
avt3xOnyMOAUJGZlbyrlLcz2ga5XyNGbOJDcYJMCXssCAwEAATANBgkqhkiG9w0B
AQsFAAOCAQEAHHw56D1JsgkeaFovdBj0Y7WM9uah402VkJnvMlw0QOhVEw7gHL7N
qz9kOJleK8GBU6AYqPbuajNzbJpznYYIXccROEZMzaBHN4/+plCpAiGZQoZeR/5l
VmAdFlOGveRjxWnP+jBRq6HDUFPMZhxM/z8qOU2ij53Rp4si5HhpJAaDTcwKwIdp
m7yAqdK3pSOEfqIyJnx4Dr3bzTtpGDO4RO+WtJmG7ga9URzHoaQMxExRoN+sFAeI
jtc5Rf5S4KNM2116q03kygbovXRvRueTSk8bZ+eln++cAknR8tXpU+4JIawIyBX3
rzW5TxEPQ65Gjv1bjaNOpyy3Je3k5ZQd4w==
-----END CERTIFICATE-----

View File

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDJ1ENgUPzWDzhN
XV6qfMBeqezZk3jTk3IoQfUIpeqsZwfXH/d9dGl+RokgS3otmwII528PHQwPx2Bp
GUvffsp1lAtJceNt8uh5/e0KlGdV88prYbpYty7de8q5Ap8kNqwmjwSPgcg1EPSq
M7IkFvj3Hur3Fv76NMPduyy6et9N4toe5dIoRG7IluD9CQwUDDHc4MrBp5u/Foz3
Nj8bLt2Q60V4Ub9ZIh7GjAppiOUDXnO3/JN/G0Ybl2jFwIs1H7seZ39VtztVP+ry
ytvMUs0WidsVR73yzWx617QarMgVbGr7d8Tp8jDgFCRmZW8q5S3M9oGuV8jRmziQ
3GCTAl7LAgMBAAECggEBAKEd1q9j14KWYc64s6KLthGbutyxsinMMbxbct11fdIk
6YhdF3fJ35ETg9IJDr6rWEN9ZRX+jStncNpVfFEs6ThVd3Eo/nI+EEGaaIkikR93
X2a7fEPn7/yVHu70XdBN6L1bPDvHUeiy4W2hmRrgT90OjGm1rNRWHOm7yugOwIZu
HclzbR9Ca7EInFnotUiDQm9sw9VKHbJHqWx6OORdZrxR2ytYs0Qkq0XpGMvti2HW
7WAmKTg5QM8myXW7+/4iqb/u68wVBR2BBalShKmIf7lim9O3W2a1RjDdsvm/wNe9
I+D+Iq825vpqkKXcrxYlpVg7hYiaQaW/MNsEb7lQRjECgYEA/RJYby0POW+/k0Jn
jO8UmJVEMiuGa8WIUu/JJWMOmzRCukjSRNQOkt7niQrZPJYE8W6clM6RJTolWf9L
IL6mIb+mRaoudUk8SHGDq7ho1iMg9GK8lhYxvKh1Q6uv8EyVSkgLknAEY0NANKC1
zNdU5Dhven9aRX2gq9vP4XwMz2MCgYEAzCogQ7IFk+gkp3k491dOZnrGRoRCfuzo
4CJtyKFgOSd7BjmpcKkj0IPfVBjw6GjMIxfQRMTQmxAjjWevH45vG8l0Iiwz/gSp
81b5nsDEX5uv2Olcmcz5zxRFy36jOZ9ihMWinxcIlT2oDbyCdbruDKZq9ieJ9S8g
4qGx0OkwE3kCgYEA7CmAiU89U9YqqttfEq/RQoqY91CSwmO10d+ej9seuEtOsdRf
FIfnibulycdr7hP5TOxyBpO1802NqayJiWcgVYIpQf2MGTtcnCYCP+95NcvWZvj1
EAJqK6nwtFO1fcOZ1ZXh5qfOEGujsPkAbsXLnKXlsiTCMvMHSxl3pu5Cbg0CgYBf
JjbZNctRrjv+7Qj2hPLd4dQsIxGWc7ToWENP4J2mpVa5hQAJqFovoHXhjKohtk2F
AWEn243Y5oGbMjo0e74edhmwn2cvuF64MM2vBem/ISCn98IXT6cQskMA3qkVfsl8
VVs/x41ReGWs2TD3y0GMFbb9t1mdMfSiincDhNnKCQKBgGfeT4jKyYeCoCw4OLI1
G75Gd0METt/IkppwODPpNwj3Rp9I5jctWZFA/3wCX/zk0HgBeou5AFNS4nQZ/X/L
L9axbSdR7UJTGkT1r4gu3rLkPV4Tk+8XM03/JT2cofMlzQBuhvl1Pn4SgKowz7hl
lS76ECw4Av3T0S34VW9Z5oye
-----END PRIVATE KEY-----

View File

@@ -0,0 +1,75 @@
//! Main binary entry point for ops_v3 implementation.
#![allow(missing_docs)]
// Imports required by this file.
// extern crate <name of this crate>;
extern crate ops_v3;
extern crate swagger;
extern crate hyper;
extern crate openssl;
extern crate native_tls;
extern crate tokio_proto;
extern crate tokio_tls;
extern crate clap;
// Imports required by server library.
// extern crate ops_v3;
// extern crate swagger;
extern crate futures;
extern crate chrono;
#[macro_use]
extern crate error_chain;
use openssl::x509::X509_FILETYPE_PEM;
use openssl::ssl::{SslAcceptorBuilder, SslMethod};
use openssl::error::ErrorStack;
use hyper::server::Http;
use tokio_proto::TcpServer;
use clap::{App, Arg};
use swagger::auth::AllowAllAuthenticator;
use swagger::EmptyContext;
mod server_lib;
// Builds an SSL implementation for Simple HTTPS from some hard-coded file names
fn ssl() -> Result<SslAcceptorBuilder, ErrorStack> {
let mut ssl = SslAcceptorBuilder::mozilla_intermediate_raw(SslMethod::tls())?;
// Server authentication
ssl.set_private_key_file("examples/server-key.pem", X509_FILETYPE_PEM)?;
ssl.set_certificate_chain_file("examples/server-chain.pem")?;
ssl.check_private_key()?;
Ok(ssl)
}
/// Create custom server, wire it to the autogenerated router,
/// and pass it to the web server.
fn main() {
let matches = App::new("server")
.arg(Arg::with_name("https")
.long("https")
.help("Whether to use HTTPS or not"))
.get_matches();
let service_fn =
ops_v3::server::context::NewAddContext::<_, EmptyContext>::new(
AllowAllAuthenticator::new(
server_lib::NewService::new(),
"cosmo"
)
);
let addr = "127.0.0.1:80".parse().expect("Failed to parse bind address");
if matches.is_present("https") {
let ssl = ssl().expect("Failed to load SSL keys");
let builder: native_tls::TlsAcceptorBuilder = native_tls::backend::openssl::TlsAcceptorBuilderExt::from_openssl(ssl);
let tls_acceptor = builder.build().expect("Failed to build TLS acceptor");
TcpServer::new(tokio_tls::proto::Server::new(Http::new(), tls_acceptor), addr).serve(service_fn);
} else {
// Using HTTP
TcpServer::new(Http::new(), addr).serve(service_fn);
}
}

View File

@@ -0,0 +1,37 @@
//! Main library entry point for ops_v3 implementation.
mod server;
mod errors {
error_chain!{}
}
pub use self::errors::*;
use std::io;
use std::clone::Clone;
use std::marker::PhantomData;
use hyper;
use ops_v3;
use swagger::{Has, XSpanIdString};
pub struct NewService<C>{
marker: PhantomData<C>
}
impl<C> NewService<C>{
pub fn new() -> Self {
NewService{marker:PhantomData}
}
}
impl<C> hyper::server::NewService for NewService<C> where C: Has<XSpanIdString> + Clone + 'static {
type Request = (hyper::Request, C);
type Response = hyper::Response;
type Error = hyper::Error;
type Instance = ops_v3::server::Service<server::Server<C>, C>;
/// Instantiate a new server.
fn new_service(&self) -> io::Result<Self::Instance> {
Ok(ops_v3::server::Service::new(server::Server::new()))
}
}

View File

@@ -0,0 +1,326 @@
//! Server implementation of ops_v3.
#![allow(unused_imports)]
use futures::{self, Future};
use chrono;
use std::collections::HashMap;
use std::marker::PhantomData;
use swagger;
use swagger::{Has, XSpanIdString};
use ops_v3::{Api, ApiError,
Op10GetResponse,
Op11GetResponse,
Op12GetResponse,
Op13GetResponse,
Op14GetResponse,
Op15GetResponse,
Op16GetResponse,
Op17GetResponse,
Op18GetResponse,
Op19GetResponse,
Op1GetResponse,
Op20GetResponse,
Op21GetResponse,
Op22GetResponse,
Op23GetResponse,
Op24GetResponse,
Op25GetResponse,
Op26GetResponse,
Op27GetResponse,
Op28GetResponse,
Op29GetResponse,
Op2GetResponse,
Op30GetResponse,
Op31GetResponse,
Op32GetResponse,
Op33GetResponse,
Op34GetResponse,
Op35GetResponse,
Op36GetResponse,
Op37GetResponse,
Op3GetResponse,
Op4GetResponse,
Op5GetResponse,
Op6GetResponse,
Op7GetResponse,
Op8GetResponse,
Op9GetResponse
};
use ops_v3::models;
#[derive(Copy, Clone)]
pub struct Server<C> {
marker: PhantomData<C>,
}
impl<C> Server<C> {
pub fn new() -> Self {
Server{marker: PhantomData}
}
}
impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
fn op10_get(&self, context: &C) -> Box<Future<Item=Op10GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op10_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op11_get(&self, context: &C) -> Box<Future<Item=Op11GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op11_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op12_get(&self, context: &C) -> Box<Future<Item=Op12GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op12_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op13_get(&self, context: &C) -> Box<Future<Item=Op13GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op13_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op14_get(&self, context: &C) -> Box<Future<Item=Op14GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op14_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op15_get(&self, context: &C) -> Box<Future<Item=Op15GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op15_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op16_get(&self, context: &C) -> Box<Future<Item=Op16GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op16_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op17_get(&self, context: &C) -> Box<Future<Item=Op17GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op17_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op18_get(&self, context: &C) -> Box<Future<Item=Op18GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op18_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op19_get(&self, context: &C) -> Box<Future<Item=Op19GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op19_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op1_get(&self, context: &C) -> Box<Future<Item=Op1GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op1_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op20_get(&self, context: &C) -> Box<Future<Item=Op20GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op20_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op21_get(&self, context: &C) -> Box<Future<Item=Op21GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op21_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op22_get(&self, context: &C) -> Box<Future<Item=Op22GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op22_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op23_get(&self, context: &C) -> Box<Future<Item=Op23GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op23_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op24_get(&self, context: &C) -> Box<Future<Item=Op24GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op24_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op25_get(&self, context: &C) -> Box<Future<Item=Op25GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op25_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op26_get(&self, context: &C) -> Box<Future<Item=Op26GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op26_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op27_get(&self, context: &C) -> Box<Future<Item=Op27GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op27_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op28_get(&self, context: &C) -> Box<Future<Item=Op28GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op28_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op29_get(&self, context: &C) -> Box<Future<Item=Op29GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op29_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op2_get(&self, context: &C) -> Box<Future<Item=Op2GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op2_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op30_get(&self, context: &C) -> Box<Future<Item=Op30GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op30_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op31_get(&self, context: &C) -> Box<Future<Item=Op31GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op31_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op32_get(&self, context: &C) -> Box<Future<Item=Op32GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op32_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op33_get(&self, context: &C) -> Box<Future<Item=Op33GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op33_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op34_get(&self, context: &C) -> Box<Future<Item=Op34GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op34_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op35_get(&self, context: &C) -> Box<Future<Item=Op35GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op35_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op36_get(&self, context: &C) -> Box<Future<Item=Op36GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op36_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op37_get(&self, context: &C) -> Box<Future<Item=Op37GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op37_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op3_get(&self, context: &C) -> Box<Future<Item=Op3GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op3_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op4_get(&self, context: &C) -> Box<Future<Item=Op4GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op4_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op5_get(&self, context: &C) -> Box<Future<Item=Op5GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op5_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op6_get(&self, context: &C) -> Box<Future<Item=Op6GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op6_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op7_get(&self, context: &C) -> Box<Future<Item=Op7GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op7_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op8_get(&self, context: &C) -> Box<Future<Item=Op8GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op8_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
fn op9_get(&self, context: &C) -> Box<Future<Item=Op9GetResponse, Error=ApiError>> {
let context = context.clone();
println!("op9_get() - X-Span-ID: {:?}", context.get().0.clone());
Box::new(futures::failed("Generic failure".into()))
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,712 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate futures;
extern crate chrono;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
// Logically this should be in the client and server modules, but rust doesn't allow `macro_use` from a module.
#[cfg(any(feature = "client", feature = "server"))]
#[macro_use]
extern crate hyper;
extern crate swagger;
#[macro_use]
extern crate url;
use futures::Stream;
use std::io::Error;
#[allow(unused_imports)]
use std::collections::HashMap;
pub use futures::Future;
#[cfg(any(feature = "client", feature = "server"))]
mod mimetypes;
pub use swagger::{ApiError, ContextWrapper};
pub const BASE_PATH: &'static str = "";
pub const API_VERSION: &'static str = "0.0.1";
#[derive(Debug, PartialEq)]
pub enum Op10GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op11GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op12GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op13GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op14GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op15GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op16GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op17GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op18GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op19GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op1GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op20GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op21GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op22GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op23GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op24GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op25GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op26GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op27GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op28GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op29GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op2GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op30GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op31GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op32GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op33GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op34GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op35GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op36GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op37GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op3GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op4GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op5GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op6GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op7GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op8GetResponse {
/// OK
OK ,
}
#[derive(Debug, PartialEq)]
pub enum Op9GetResponse {
/// OK
OK ,
}
/// API
pub trait Api<C> {
fn op10_get(&self, context: &C) -> Box<Future<Item=Op10GetResponse, Error=ApiError>>;
fn op11_get(&self, context: &C) -> Box<Future<Item=Op11GetResponse, Error=ApiError>>;
fn op12_get(&self, context: &C) -> Box<Future<Item=Op12GetResponse, Error=ApiError>>;
fn op13_get(&self, context: &C) -> Box<Future<Item=Op13GetResponse, Error=ApiError>>;
fn op14_get(&self, context: &C) -> Box<Future<Item=Op14GetResponse, Error=ApiError>>;
fn op15_get(&self, context: &C) -> Box<Future<Item=Op15GetResponse, Error=ApiError>>;
fn op16_get(&self, context: &C) -> Box<Future<Item=Op16GetResponse, Error=ApiError>>;
fn op17_get(&self, context: &C) -> Box<Future<Item=Op17GetResponse, Error=ApiError>>;
fn op18_get(&self, context: &C) -> Box<Future<Item=Op18GetResponse, Error=ApiError>>;
fn op19_get(&self, context: &C) -> Box<Future<Item=Op19GetResponse, Error=ApiError>>;
fn op1_get(&self, context: &C) -> Box<Future<Item=Op1GetResponse, Error=ApiError>>;
fn op20_get(&self, context: &C) -> Box<Future<Item=Op20GetResponse, Error=ApiError>>;
fn op21_get(&self, context: &C) -> Box<Future<Item=Op21GetResponse, Error=ApiError>>;
fn op22_get(&self, context: &C) -> Box<Future<Item=Op22GetResponse, Error=ApiError>>;
fn op23_get(&self, context: &C) -> Box<Future<Item=Op23GetResponse, Error=ApiError>>;
fn op24_get(&self, context: &C) -> Box<Future<Item=Op24GetResponse, Error=ApiError>>;
fn op25_get(&self, context: &C) -> Box<Future<Item=Op25GetResponse, Error=ApiError>>;
fn op26_get(&self, context: &C) -> Box<Future<Item=Op26GetResponse, Error=ApiError>>;
fn op27_get(&self, context: &C) -> Box<Future<Item=Op27GetResponse, Error=ApiError>>;
fn op28_get(&self, context: &C) -> Box<Future<Item=Op28GetResponse, Error=ApiError>>;
fn op29_get(&self, context: &C) -> Box<Future<Item=Op29GetResponse, Error=ApiError>>;
fn op2_get(&self, context: &C) -> Box<Future<Item=Op2GetResponse, Error=ApiError>>;
fn op30_get(&self, context: &C) -> Box<Future<Item=Op30GetResponse, Error=ApiError>>;
fn op31_get(&self, context: &C) -> Box<Future<Item=Op31GetResponse, Error=ApiError>>;
fn op32_get(&self, context: &C) -> Box<Future<Item=Op32GetResponse, Error=ApiError>>;
fn op33_get(&self, context: &C) -> Box<Future<Item=Op33GetResponse, Error=ApiError>>;
fn op34_get(&self, context: &C) -> Box<Future<Item=Op34GetResponse, Error=ApiError>>;
fn op35_get(&self, context: &C) -> Box<Future<Item=Op35GetResponse, Error=ApiError>>;
fn op36_get(&self, context: &C) -> Box<Future<Item=Op36GetResponse, Error=ApiError>>;
fn op37_get(&self, context: &C) -> Box<Future<Item=Op37GetResponse, Error=ApiError>>;
fn op3_get(&self, context: &C) -> Box<Future<Item=Op3GetResponse, Error=ApiError>>;
fn op4_get(&self, context: &C) -> Box<Future<Item=Op4GetResponse, Error=ApiError>>;
fn op5_get(&self, context: &C) -> Box<Future<Item=Op5GetResponse, Error=ApiError>>;
fn op6_get(&self, context: &C) -> Box<Future<Item=Op6GetResponse, Error=ApiError>>;
fn op7_get(&self, context: &C) -> Box<Future<Item=Op7GetResponse, Error=ApiError>>;
fn op8_get(&self, context: &C) -> Box<Future<Item=Op8GetResponse, Error=ApiError>>;
fn op9_get(&self, context: &C) -> Box<Future<Item=Op9GetResponse, Error=ApiError>>;
}
/// API without a `Context`
pub trait ApiNoContext {
fn op10_get(&self) -> Box<Future<Item=Op10GetResponse, Error=ApiError>>;
fn op11_get(&self) -> Box<Future<Item=Op11GetResponse, Error=ApiError>>;
fn op12_get(&self) -> Box<Future<Item=Op12GetResponse, Error=ApiError>>;
fn op13_get(&self) -> Box<Future<Item=Op13GetResponse, Error=ApiError>>;
fn op14_get(&self) -> Box<Future<Item=Op14GetResponse, Error=ApiError>>;
fn op15_get(&self) -> Box<Future<Item=Op15GetResponse, Error=ApiError>>;
fn op16_get(&self) -> Box<Future<Item=Op16GetResponse, Error=ApiError>>;
fn op17_get(&self) -> Box<Future<Item=Op17GetResponse, Error=ApiError>>;
fn op18_get(&self) -> Box<Future<Item=Op18GetResponse, Error=ApiError>>;
fn op19_get(&self) -> Box<Future<Item=Op19GetResponse, Error=ApiError>>;
fn op1_get(&self) -> Box<Future<Item=Op1GetResponse, Error=ApiError>>;
fn op20_get(&self) -> Box<Future<Item=Op20GetResponse, Error=ApiError>>;
fn op21_get(&self) -> Box<Future<Item=Op21GetResponse, Error=ApiError>>;
fn op22_get(&self) -> Box<Future<Item=Op22GetResponse, Error=ApiError>>;
fn op23_get(&self) -> Box<Future<Item=Op23GetResponse, Error=ApiError>>;
fn op24_get(&self) -> Box<Future<Item=Op24GetResponse, Error=ApiError>>;
fn op25_get(&self) -> Box<Future<Item=Op25GetResponse, Error=ApiError>>;
fn op26_get(&self) -> Box<Future<Item=Op26GetResponse, Error=ApiError>>;
fn op27_get(&self) -> Box<Future<Item=Op27GetResponse, Error=ApiError>>;
fn op28_get(&self) -> Box<Future<Item=Op28GetResponse, Error=ApiError>>;
fn op29_get(&self) -> Box<Future<Item=Op29GetResponse, Error=ApiError>>;
fn op2_get(&self) -> Box<Future<Item=Op2GetResponse, Error=ApiError>>;
fn op30_get(&self) -> Box<Future<Item=Op30GetResponse, Error=ApiError>>;
fn op31_get(&self) -> Box<Future<Item=Op31GetResponse, Error=ApiError>>;
fn op32_get(&self) -> Box<Future<Item=Op32GetResponse, Error=ApiError>>;
fn op33_get(&self) -> Box<Future<Item=Op33GetResponse, Error=ApiError>>;
fn op34_get(&self) -> Box<Future<Item=Op34GetResponse, Error=ApiError>>;
fn op35_get(&self) -> Box<Future<Item=Op35GetResponse, Error=ApiError>>;
fn op36_get(&self) -> Box<Future<Item=Op36GetResponse, Error=ApiError>>;
fn op37_get(&self) -> Box<Future<Item=Op37GetResponse, Error=ApiError>>;
fn op3_get(&self) -> Box<Future<Item=Op3GetResponse, Error=ApiError>>;
fn op4_get(&self) -> Box<Future<Item=Op4GetResponse, Error=ApiError>>;
fn op5_get(&self) -> Box<Future<Item=Op5GetResponse, Error=ApiError>>;
fn op6_get(&self) -> Box<Future<Item=Op6GetResponse, Error=ApiError>>;
fn op7_get(&self) -> Box<Future<Item=Op7GetResponse, Error=ApiError>>;
fn op8_get(&self) -> Box<Future<Item=Op8GetResponse, Error=ApiError>>;
fn op9_get(&self) -> Box<Future<Item=Op9GetResponse, Error=ApiError>>;
}
/// Trait to extend an API to make it easy to bind it to a context.
pub trait ContextWrapperExt<'a, C> where Self: Sized {
/// Binds this API to a context.
fn with_context(self: &'a Self, context: C) -> ContextWrapper<'a, Self, C>;
}
impl<'a, T: Api<C> + Sized, C> ContextWrapperExt<'a, C> for T {
fn with_context(self: &'a T, context: C) -> ContextWrapper<'a, T, C> {
ContextWrapper::<T, C>::new(self, context)
}
}
impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> {
fn op10_get(&self) -> Box<Future<Item=Op10GetResponse, Error=ApiError>> {
self.api().op10_get(&self.context())
}
fn op11_get(&self) -> Box<Future<Item=Op11GetResponse, Error=ApiError>> {
self.api().op11_get(&self.context())
}
fn op12_get(&self) -> Box<Future<Item=Op12GetResponse, Error=ApiError>> {
self.api().op12_get(&self.context())
}
fn op13_get(&self) -> Box<Future<Item=Op13GetResponse, Error=ApiError>> {
self.api().op13_get(&self.context())
}
fn op14_get(&self) -> Box<Future<Item=Op14GetResponse, Error=ApiError>> {
self.api().op14_get(&self.context())
}
fn op15_get(&self) -> Box<Future<Item=Op15GetResponse, Error=ApiError>> {
self.api().op15_get(&self.context())
}
fn op16_get(&self) -> Box<Future<Item=Op16GetResponse, Error=ApiError>> {
self.api().op16_get(&self.context())
}
fn op17_get(&self) -> Box<Future<Item=Op17GetResponse, Error=ApiError>> {
self.api().op17_get(&self.context())
}
fn op18_get(&self) -> Box<Future<Item=Op18GetResponse, Error=ApiError>> {
self.api().op18_get(&self.context())
}
fn op19_get(&self) -> Box<Future<Item=Op19GetResponse, Error=ApiError>> {
self.api().op19_get(&self.context())
}
fn op1_get(&self) -> Box<Future<Item=Op1GetResponse, Error=ApiError>> {
self.api().op1_get(&self.context())
}
fn op20_get(&self) -> Box<Future<Item=Op20GetResponse, Error=ApiError>> {
self.api().op20_get(&self.context())
}
fn op21_get(&self) -> Box<Future<Item=Op21GetResponse, Error=ApiError>> {
self.api().op21_get(&self.context())
}
fn op22_get(&self) -> Box<Future<Item=Op22GetResponse, Error=ApiError>> {
self.api().op22_get(&self.context())
}
fn op23_get(&self) -> Box<Future<Item=Op23GetResponse, Error=ApiError>> {
self.api().op23_get(&self.context())
}
fn op24_get(&self) -> Box<Future<Item=Op24GetResponse, Error=ApiError>> {
self.api().op24_get(&self.context())
}
fn op25_get(&self) -> Box<Future<Item=Op25GetResponse, Error=ApiError>> {
self.api().op25_get(&self.context())
}
fn op26_get(&self) -> Box<Future<Item=Op26GetResponse, Error=ApiError>> {
self.api().op26_get(&self.context())
}
fn op27_get(&self) -> Box<Future<Item=Op27GetResponse, Error=ApiError>> {
self.api().op27_get(&self.context())
}
fn op28_get(&self) -> Box<Future<Item=Op28GetResponse, Error=ApiError>> {
self.api().op28_get(&self.context())
}
fn op29_get(&self) -> Box<Future<Item=Op29GetResponse, Error=ApiError>> {
self.api().op29_get(&self.context())
}
fn op2_get(&self) -> Box<Future<Item=Op2GetResponse, Error=ApiError>> {
self.api().op2_get(&self.context())
}
fn op30_get(&self) -> Box<Future<Item=Op30GetResponse, Error=ApiError>> {
self.api().op30_get(&self.context())
}
fn op31_get(&self) -> Box<Future<Item=Op31GetResponse, Error=ApiError>> {
self.api().op31_get(&self.context())
}
fn op32_get(&self) -> Box<Future<Item=Op32GetResponse, Error=ApiError>> {
self.api().op32_get(&self.context())
}
fn op33_get(&self) -> Box<Future<Item=Op33GetResponse, Error=ApiError>> {
self.api().op33_get(&self.context())
}
fn op34_get(&self) -> Box<Future<Item=Op34GetResponse, Error=ApiError>> {
self.api().op34_get(&self.context())
}
fn op35_get(&self) -> Box<Future<Item=Op35GetResponse, Error=ApiError>> {
self.api().op35_get(&self.context())
}
fn op36_get(&self) -> Box<Future<Item=Op36GetResponse, Error=ApiError>> {
self.api().op36_get(&self.context())
}
fn op37_get(&self) -> Box<Future<Item=Op37GetResponse, Error=ApiError>> {
self.api().op37_get(&self.context())
}
fn op3_get(&self) -> Box<Future<Item=Op3GetResponse, Error=ApiError>> {
self.api().op3_get(&self.context())
}
fn op4_get(&self) -> Box<Future<Item=Op4GetResponse, Error=ApiError>> {
self.api().op4_get(&self.context())
}
fn op5_get(&self) -> Box<Future<Item=Op5GetResponse, Error=ApiError>> {
self.api().op5_get(&self.context())
}
fn op6_get(&self) -> Box<Future<Item=Op6GetResponse, Error=ApiError>> {
self.api().op6_get(&self.context())
}
fn op7_get(&self) -> Box<Future<Item=Op7GetResponse, Error=ApiError>> {
self.api().op7_get(&self.context())
}
fn op8_get(&self) -> Box<Future<Item=Op8GetResponse, Error=ApiError>> {
self.api().op8_get(&self.context())
}
fn op9_get(&self) -> Box<Future<Item=Op9GetResponse, Error=ApiError>> {
self.api().op9_get(&self.context())
}
}
#[cfg(feature = "client")]
pub mod client;
// Re-export Client as a top-level name
#[cfg(feature = "client")]
pub use self::client::Client;
#[cfg(feature = "server")]
pub mod server;
// Re-export router() as a top-level name
#[cfg(feature = "server")]
pub use self::server::Service;
pub mod models;

View File

@@ -0,0 +1,13 @@
/// mime types for requests and responses
pub mod responses {
use hyper::mime::*;
// The macro is called per-operation to beat the recursion limit
}
pub mod requests {
use hyper::mime::*;
}

View File

@@ -0,0 +1,12 @@
#![allow(unused_imports, unused_qualifications, unused_extern_crates)]
extern crate chrono;
extern crate uuid;
use serde::ser::Serializer;
use std::collections::HashMap;
use models;
use swagger;
use std::string::ParseError;

View File

@@ -0,0 +1,91 @@
use std::io;
use std::marker::PhantomData;
use std::default::Default;
use hyper;
use hyper::{Request, Response, Error, StatusCode};
use server::url::form_urlencoded;
use swagger::auth::{Authorization, AuthData, Scopes};
use swagger::{Has, Pop, Push, XSpanIdString};
use Api;
pub struct NewAddContext<T, A>
{
inner: T,
marker: PhantomData<A>,
}
impl<T, A, B, C, D> NewAddContext<T, A>
where
A: Default + Push<XSpanIdString, Result=B>,
B: Push<Option<AuthData>, Result=C>,
C: Push<Option<Authorization>, Result=D>,
T: hyper::server::NewService<Request = (Request, D), Response = Response, Error = Error> + 'static,
{
pub fn new(inner: T) -> NewAddContext<T, A> {
NewAddContext {
inner,
marker: PhantomData,
}
}
}
impl<T, A, B, C, D> hyper::server::NewService for NewAddContext<T, A>
where
A: Default + Push<XSpanIdString, Result=B>,
B: Push<Option<AuthData>, Result=C>,
C: Push<Option<Authorization>, Result=D>,
T: hyper::server::NewService<Request = (Request, D), Response = Response, Error = Error> + 'static,
{
type Request = Request;
type Response = Response;
type Error = Error;
type Instance = AddContext<T::Instance, A>;
fn new_service(&self) -> Result<Self::Instance, io::Error> {
self.inner.new_service().map(|s| AddContext::new(s))
}
}
/// Middleware to extract authentication data from request
pub struct AddContext<T, A>
{
inner: T,
marker: PhantomData<A>,
}
impl<T, A, B, C, D> AddContext<T, A>
where
A: Default + Push<XSpanIdString, Result=B>,
B: Push<Option<AuthData>, Result=C>,
C: Push<Option<Authorization>, Result=D>,
T: hyper::server::Service<Request = (Request, D), Response = Response, Error = Error>,
{
pub fn new(inner: T) -> AddContext<T, A> {
AddContext {
inner,
marker: PhantomData,
}
}
}
impl<T, A, B, C, D> hyper::server::Service for AddContext<T, A>
where
A: Default + Push<XSpanIdString, Result=B>,
B: Push<Option<AuthData>, Result=C>,
C: Push<Option<Authorization>, Result=D>,
T: hyper::server::Service<Request = (Request, D), Response = Response, Error = Error>,
{
type Request = Request;
type Response = Response;
type Error = Error;
type Future = T::Future;
fn call(&self, req: Self::Request) -> Self::Future {
let context = A::default().push(XSpanIdString::get_or_generate(&req));
let context = context.push(None::<AuthData>);
let context = context.push(None::<Authorization>);
return self.inner.call((req, context));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -83,7 +83,7 @@ mod paths {
extern crate regex;
lazy_static! {
pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(&[
pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(vec![
r"^/v2/another-fake/dummy$",
r"^/v2/fake$",
r"^/v2/fake/body-with-query-params$",

View File

@@ -51,7 +51,7 @@ mod paths {
extern crate regex;
lazy_static! {
pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(&[
pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(vec![
r"^/dummy$",
r"^/file_response$",
r"^/html$",