This server was generated by the swagger-codegen project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub. This is an example of building a swagger-enabled Flask server.
This example uses the Connexion library on top of Flask.
Python 3.5.2+
To run the server, please execute the following from the root directory:
pip3 install -r requirements.txt
python3 -m kingpick
and open your browser to here:
http://localhost:8080/v1/ui/
Your Swagger definition lives here:
http://localhost:8080/v1/swagger.json
To launch the integration tests, use tox:
sudo pip install tox
tox
To run the server on a Docker container, please execute the following from the root directory:
# building the image
docker build -t kingpick .
# starting up a container
docker run -p 8080:8080 kingpick
export GCP_PROJECT_ID=proj && docker-compose up
# new tenant
curl -X POST localhost:5000/v1/tenants -H "Content-Type:application/json" -d '{
"id":"acme",
"name":"Acme Inc.",
"description":"The supper acme tenant",
"settings": {
"sourceBucket":"buck1",
"targetBucket":"targBuck2",
"serviceAccountCredentials": "asdfasfasdfdasfdasfdasfdasf"
}
}'
# get tenant by id
curl localhost:8081/v1/tenants/acme
# get all tenants
curl localhost:8081/v1/tenants
# create project
curl -X POST localhost:5000/v1/projects?tenant_id=acme -H "Content-Type:application/json" -d '{
"id":"project-x",
"name":"Project X",
"description":"The supper project-x",
"settings": {
"prop1":"value1",
"prop2":"v2"
}
}'
# create image hash
curl -X POST "localhost:8082/v1/image-hashes?tenant_id=acme&project_id=project-x" -H "Content-Type:application/json" -d '{
"filepath":"project-x",
"url":"https://lh3.googleusercontent.com/P1-JR5ZNo5TBo3ZlwFR-WsgxFZn6UiLlaRdzSlJuvah5PpcyOKOR8QgZlx6xRRMH7jMVFcH-IdLpQ0EQ5rk50GY=s0"
}'
curl -X POST "localhost:8082/v1/image-hashes/search?tenant_id=acme&project_id=project-x" -H "Content-Type:application/json" -d '{
"url":"https://lh3.googleusercontent.com/P1-JR5ZNo5TBo3ZlwFR-WsgxFZn6UiLlaRdzSlJuvah5PpcyOKOR8QgZlx6xRRMH7jMVFcH-IdLpQ0EQ5rk50GY=s0"
}'
curl -X POST "localhost:8082/v1/image-hashes/search?tenant_id=acme&project_id=project-x" -H "Content-Type:application/json" -d '{
"url":"https://lh3.googleusercontent.com/P1-JR5ZNo5TBo3ZlwFR-WsgxFZn6UiLlaRdzSlJuvah5PpcyOKOR8QgZlx6xRRMH7jMVFcH-IdLpQ0EQ5rk50GY=s0-fv",
"all_orientations": true
}'
curl -X POST "localhost:8082/v1/image-hashes/search?tenant_id=acme&project_id=project-x" -H "Content-Type:application/json" -d '{
"url":"https://lh3.googleusercontent.com/P1-JR5ZNo5TBo3ZlwFR-WsgxFZn6UiLlaRdzSlJuvah5PpcyOKOR8QgZlx6xRRMH7jMVFcH-IdLpQ0EQ5rk50GY=s0-r90",
"all_orientations": true
}'
curl -X POST "localhost:5000/v1/jobs?tenant_id=acme&project_id=project-x" -H "Content-Type:application/json" -d '{
"type": "csv",
"auto_start": true
}'
curl -X POST "localhost:8082/v1/image-hashes/search?tenant_id=acme&project_id=project-x" -H "Content-Type:application/json" -d '{
"url": "https://lh3.googleusercontent.com/P1-JR5ZNo5TBo3ZlwFR-WsgxFZn6UiLlaRdzSlJuvah5PpcyOKOR8QgZlx6xRRMH7jMVFcH-IdLpQ0EQ5rk50GY=c0xffff0000-b20-r90",
"all_orientations": true
}'
https://lh3.googleusercontent.com/4NGm0B7yk0G40s01axI34vgfvbcd8zgYvzlfFuFDn8VepfLH8exethu5x_qTZEB4RlFObwbiF8ZH7DvW_3dLU70
https://lh3.googleusercontent.com/DB4KC-nkr7RfcrOBESe_miI-tSMNxZd1_OfrgR7fPZL8L-xQ4VD5iA8SejyZEUigqIEfJf_qSEkx_S6pT3UxlQ=w272-v1-e365