From c303fbecf229e029d264de08b78a11d1b469677e Mon Sep 17 00:00:00 2001 From: Chris Hambridge Date: Wed, 13 Sep 2017 10:14:08 -0400 Subject: [PATCH] Initial swagger documentation. Covers host credential basic API. Closes #6. --- docs/swagger.yml | 172 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 docs/swagger.yml diff --git a/docs/swagger.yml b/docs/swagger.yml new file mode 100644 index 000000000..774224d6b --- /dev/null +++ b/docs/swagger.yml @@ -0,0 +1,172 @@ +swagger: "2.0" +info: + description: "The models and API for the Quipucords server." + version: "1.0.0" + title: "Quipucords API" + contact: + email: "quipucords@redhat.com" + license: + name: "GPL 3.0" + url: "https://www.gnu.org/licenses/gpl-3.0.txt" + +basePath: "/api/v1" + +tags: +- name: "Host Credential" + description: "API related to the Host Credential model" + +paths: + /credentials/hosts: + post: + tags: + - "Host Credential" + summary: "Add a new host credential" + description: "Create a new host credential for use when connecting to a target system." + operationId: "addHostCredential" + consumes: + - "application/json" + produces: + - "application/json" + parameters: + - in: "body" + name: "body" + description: "Host credential object that needs to be stored" + required: true + schema: + $ref: "#/definitions/HostCredential" + responses: + 201: + description: "Host credential created" + 400: + description: "Invalid input" + get: + tags: + - "Host Credential" + summary: "List exsiting host credentials" + description: "List all host credential for use when connecting to a target system." + operationId: "listHostCredentials" + consumes: + - "application/json" + produces: + - "application/json" + responses: + 200: + description: "Host credential retrieved" + schema: + type: "array" + items: + $ref: "#/definitions/HostCredentialExt" + /credentials/hosts/{host_cred_id}: + get: + tags: + - "Host Credential" + summary: "Get an existing host credential" + description: "Get a host credential for use when connecting to a target system." + operationId: "getHostCredential" + consumes: + - "application/json" + produces: + - "application/json" + parameters: + - name: "host_cred_id" + in: "path" + description: "ID of host credential to retrieve" + required: true + type: "integer" + format: "int64" + responses: + 200: + description: "Host credential retrieved" + schema: + $ref: "#/definitions/HostCredentialExt" + 404: + description: "Host credential not found" + put: + tags: + - "Host Credential" + summary: "Update an existing host credential" + description: "Update a host credential for use when connecting to a target system." + operationId: "updateHostCredential" + consumes: + - "application/json" + produces: + - "application/json" + parameters: + - name: "host_cred_id" + in: "path" + description: "ID of host credential to update" + required: true + type: "integer" + format: "int64" + - in: "body" + name: "body" + description: "Host credential object that needs to be modified" + required: true + schema: + $ref: "#/definitions/HostCredential" + responses: + 200: + description: "Host credential updated" + schema: + $ref: "#/definitions/HostCredentialExt" + 400: + description: "Invalid input" + 404: + description: "Host credential not found" + delete: + tags: + - "Host Credential" + summary: "Delete an existing host credential" + description: "Delete a host credential for use when connecting to a target system." + operationId: "deleteHostCredential" + consumes: + - "application/json" + produces: + - "application/json" + parameters: + - name: "host_cred_id" + in: "path" + description: "ID of host credential to delete" + required: true + type: "integer" + format: "int64" + responses: + 204: + description: "Host credential deleted" + 404: + description: "Host credential not found" + +definitions: + HostCredential: + type: "object" + required: + - name + - username + - password + - sshkeyfile + properties: + name: + type: "string" + description: "The name of the host credential" + username: + type: "string" + description: "The connection username for the host credential" + password: + type: "string" + description: "The connection password for the host credential" + sshkeyfile: + type: "string" + description: "The connection private ssh keyfile for the host credential" + sudo_password: + type: "string" + description: "The password for sudo permission escalation after connection for the host credential" + HostCredentialExt: + allOf: + - $ref: "#/definitions/HostCredential" + - type: "object" + required: + - id + properties: + id: + type: "integer" + format: "int64"