diff options
author | 2018-03-05 12:57:22 -0800 | |
---|---|---|
committer | 2018-03-05 13:31:01 -0800 | |
commit | 5a4dfbf75e292a03d73c5a7690d78547b45ffc88 (patch) | |
tree | c497f4c0326ed545166651b187ef3351e4e079b2 /sms-service | |
parent | 7f0c6c6ff3a180827c539d696d33df44abd7491e (diff) |
Updating api documentation
Updating API documentation to add login, status and unseal end points
Issue-ID: AAF-121
Change-Id: I073d970aa779353a34236e61692ca67f380084b6
Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'sms-service')
-rw-r--r-- | sms-service/doc/api_swagger.html | 724 | ||||
-rw-r--r-- | sms-service/doc/api_swagger.yaml | 144 | ||||
-rw-r--r-- | sms-service/src/sms/handler/handler.go | 4 |
3 files changed, 816 insertions, 56 deletions
diff --git a/sms-service/doc/api_swagger.html b/sms-service/doc/api_swagger.html new file mode 100644 index 0000000..94a72aa --- /dev/null +++ b/sms-service/doc/api_swagger.html @@ -0,0 +1,724 @@ +<!doctype html> +<html> + <head> + <title>Secret Management Service</title> + <style type="text/css"> + body { + font-family: Trebuchet MS, sans-serif; + font-size: 15px; + color: #444; + margin-right: 24px; +} + +h1 { + font-size: 25px; +} +h2 { + font-size: 20px; +} +h3 { + font-size: 16px; + font-weight: bold; +} +hr { + height: 1px; + border: 0; + color: #ddd; + background-color: #ddd; +} + +.app-desc { + clear: both; + margin-left: 20px; +} +.param-name { + width: 100%; +} +.license-info { + margin-left: 20px; +} + +.license-url { + margin-left: 20px; +} + +.model { + margin: 0 0 0px 20px; +} + +.method { + margin-left: 20px; +} + +.method-notes { + margin: 10px 0 20px 0; + font-size: 90%; + color: #555; +} + +pre { + padding: 10px; + margin-bottom: 2px; +} + +.http-method { + text-transform: uppercase; +} + +pre.get { + background-color: #0f6ab4; +} + +pre.post { + background-color: #10a54a; +} + +pre.put { + background-color: #c5862b; +} + +pre.delete { + background-color: #a41e22; +} + +.huge { + color: #fff; +} + +pre.example { + background-color: #f3f3f3; + padding: 10px; + border: 1px solid #ddd; +} + +code { + white-space: pre; +} + +.nickname { + font-weight: bold; +} + +.method-path { + font-size: 1.5em; + background-color: #0f6ab4; +} + +.up { + float:right; +} + +.parameter { + width: 500px; +} + +.param { + width: 500px; + padding: 10px 0 0 20px; + font-weight: bold; +} + +.param-desc { + width: 700px; + padding: 0 0 0 20px; + color: #777; +} + +.param-type { + font-style: italic; +} + +.param-enum-header { +width: 700px; +padding: 0 0 0 60px; +color: #777; +font-weight: bold; +} + +.param-enum { +width: 700px; +padding: 0 0 0 80px; +color: #777; +font-style: italic; +} + +.field-label { + padding: 0; + margin: 0; + clear: both; +} + +.field-items { + padding: 0 0 15px 0; + margin-bottom: 15px; +} + +.return-type { + clear: both; + padding-bottom: 10px; +} + +.param-header { + font-weight: bold; +} + +.method-tags { + text-align: right; +} + +.method-tag { + background: none repeat scroll 0% 0% #24A600; + border-radius: 3px; + padding: 2px 10px; + margin: 2px; + color: #FFF; + display: inline-block; + text-decoration: none; +} + + </style> + </head> + <body> + <h1>Secret Management Service</h1> + <div class="app-desc">This is a service that provides secret management facilities</div> + <div class="app-desc">More information: <a href=""></a></div> + <div class="app-desc">Contact Info: <a href="kiran.k.kamineni@intel.com">kiran.k.kamineni@intel.com</a></div> + <div class="app-desc">Version: 1.0.0</div> + <div class="app-desc">BasePath:/v1/sms/</div> + <div class="license-info">Apache 2.0</div> + <div class="license-url">http://www.apache.org/licenses/LICENSE-2.0.html</div> + <h2>Access</h2> + <ol> + <li>APIKey KeyParamName:token KeyInQuery:false KeyInHeader:true</li> + </ol> + + <h2><a name="__Methods">Methods</a></h2> + [ Jump to <a href="#__Models">Models</a> ] + + <h3>Table of Contents </h3> + <div class="method-summary"></div> + <h4><a href="#Domain">Domain</a></h4> + <ul> + <li><a href="#domainDomainNameDelete"><code><span class="http-method">delete</span> /domain/{domainName}</code></a></li> + <li><a href="#domainPost"><code><span class="http-method">post</span> /domain</code></a></li> + </ul> + <h4><a href="#Login">Login</a></h4> + <ul> + <li><a href="#loginPost"><code><span class="http-method">post</span> /login</code></a></li> + </ul> + <h4><a href="#Secret">Secret</a></h4> + <ul> + <li><a href="#domainDomainNameSecretGet"><code><span class="http-method">get</span> /domain/{domainName}/secret</code></a></li> + <li><a href="#domainDomainNameSecretPost"><code><span class="http-method">post</span> /domain/{domainName}/secret</code></a></li> + <li><a href="#domainDomainNameSecretSecretNameDelete"><code><span class="http-method">delete</span> /domain/{domainName}/secret/{secretName}</code></a></li> + <li><a href="#domainDomainNameSecretSecretNameGet"><code><span class="http-method">get</span> /domain/{domainName}/secret/{secretName}</code></a></li> + </ul> + <h4><a href="#System">System</a></h4> + <ul> + <li><a href="#statusGet"><code><span class="http-method">get</span> /status</code></a></li> + <li><a href="#unsealPost"><code><span class="http-method">post</span> /unseal</code></a></li> + </ul> + + <h1><a name="Domain">Domain</a></h1> + <div class="method"><a name="domainDomainNameDelete"/> + <div class="method-path"> + <a class="up" href="#__Methods">Up</a> + <pre class="delete"><code class="huge"><span class="http-method">delete</span> /domain/{domainName}</code></pre></div> + <div class="method-summary">Deletes a domain by name (<span class="nickname">domainDomainNameDelete</span>)</div> + <div class="method-notes">Deletes a domain with provided name</div> + + <h3 class="field-label">Path parameters</h3> + <div class="field-items"> + <div class="param">domainName (required)</div> + + <div class="param-desc"><span class="param-type">Path Parameter</span> — Name of the domain </div> + </div> <!-- field-items --> + + + + + + + + <!--Todo: process Response Object and its headers, schema, examples --> + + + <h3 class="field-label">Produces</h3> + This API call produces the following media types according to the <span class="header">Accept</span> request header; + the media type will be conveyed by the <span class="heaader">Content-Type</span> response header. + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Responses</h3> + <h4 class="field-label">204</h4> + Successful Deletion + <a href="#"></a> + <h4 class="field-label">404</h4> + Invalid Path or Path not found + <a href="#"></a> + </div> <!-- method --> + <hr/> + <div class="method"><a name="domainPost"/> + <div class="method-path"> + <a class="up" href="#__Methods">Up</a> + <pre class="post"><code class="huge"><span class="http-method">post</span> /domain</code></pre></div> + <div class="method-summary">Add a new domain (<span class="nickname">domainPost</span>)</div> + <div class="method-notes"></div> + + + <h3 class="field-label">Consumes</h3> + This API call consumes the following media types via the <span class="heaader">Content-Type</span> request header: + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Request body</h3> + <div class="field-items"> + <div class="param">body <a href="#Domain">Domain</a> (required)</div> + + <div class="param-desc"><span class="param-type">Body Parameter</span> — </div> + + </div> <!-- field-items --> + + + + + <h3 class="field-label">Return type</h3> + <div class="return-type"> + <a href="#Domain">Domain</a> + + </div> + + <!--Todo: process Response Object and its headers, schema, examples --> + + <h3 class="field-label">Example data</h3> + <div class="example-data-content-type">Content-Type: application/json</div> + <pre class="example"><code>{ + "name" : "aeiou", + "uuid" : "aeiou" +}</code></pre> + + <h3 class="field-label">Produces</h3> + This API call produces the following media types according to the <span class="header">Accept</span> request header; + the media type will be conveyed by the <span class="heaader">Content-Type</span> response header. + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Responses</h3> + <h4 class="field-label">201</h4> + Successful Creation + <a href="#Domain">Domain</a> + <h4 class="field-label">400</h4> + Invalid input + <a href="#"></a> + <h4 class="field-label">500</h4> + Internal Server Error + <a href="#"></a> + </div> <!-- method --> + <hr/> + <h1><a name="Login">Login</a></h1> + <div class="method"><a name="loginPost"/> + <div class="method-path"> + <a class="up" href="#__Methods">Up</a> + <pre class="post"><code class="huge"><span class="http-method">post</span> /login</code></pre></div> + <div class="method-summary">Login with username and password (<span class="nickname">loginPost</span>)</div> + <div class="method-notes">Operations related to logging in via username and Password</div> + + + <h3 class="field-label">Consumes</h3> + This API call consumes the following media types via the <span class="heaader">Content-Type</span> request header: + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Request body</h3> + <div class="field-items"> + <div class="param">body <a href="#Credential">Credential</a> (required)</div> + + <div class="param-desc"><span class="param-type">Body Parameter</span> — </div> + + </div> <!-- field-items --> + + + + + <h3 class="field-label">Return type</h3> + <div class="return-type"> + <a href="#inline_response_200">inline_response_200</a> + + </div> + + <!--Todo: process Response Object and its headers, schema, examples --> + + <h3 class="field-label">Example data</h3> + <div class="example-data-content-type">Content-Type: application/json</div> + <pre class="example"><code>{ + "ttl" : 0, + "token" : "aeiou" +}</code></pre> + + <h3 class="field-label">Produces</h3> + This API call produces the following media types according to the <span class="header">Accept</span> request header; + the media type will be conveyed by the <span class="heaader">Content-Type</span> response header. + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Responses</h3> + <h4 class="field-label">200</h4> + Successful Login returns a token + <a href="#inline_response_200">inline_response_200</a> + <h4 class="field-label">404</h4> + Invalid Username or Password + <a href="#"></a> + </div> <!-- method --> + <hr/> + <h1><a name="Secret">Secret</a></h1> + <div class="method"><a name="domainDomainNameSecretGet"/> + <div class="method-path"> + <a class="up" href="#__Methods">Up</a> + <pre class="get"><code class="huge"><span class="http-method">get</span> /domain/{domainName}/secret</code></pre></div> + <div class="method-summary">List secret Names in this domain (<span class="nickname">domainDomainNameSecretGet</span>)</div> + <div class="method-notes">Gets all secret names in this domain</div> + + <h3 class="field-label">Path parameters</h3> + <div class="field-items"> + <div class="param">domainName (required)</div> + + <div class="param-desc"><span class="param-type">Path Parameter</span> — Name of the domain in which to look at </div> + </div> <!-- field-items --> + + + + + + + <h3 class="field-label">Return type</h3> + <div class="return-type"> + + array[String] + </div> + + <!--Todo: process Response Object and its headers, schema, examples --> + + <h3 class="field-label">Example data</h3> + <div class="example-data-content-type">Content-Type: application/json</div> + <pre class="example"><code>[ "secret1", "secret2", "secret3" ]</code></pre> + + <h3 class="field-label">Produces</h3> + This API call produces the following media types according to the <span class="header">Accept</span> request header; + the media type will be conveyed by the <span class="heaader">Content-Type</span> response header. + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Responses</h3> + <h4 class="field-label">200</h4> + Successful operation + + <h4 class="field-label">404</h4> + Invalid Path or Path not found + <a href="#"></a> + </div> <!-- method --> + <hr/> + <div class="method"><a name="domainDomainNameSecretPost"/> + <div class="method-path"> + <a class="up" href="#__Methods">Up</a> + <pre class="post"><code class="huge"><span class="http-method">post</span> /domain/{domainName}/secret</code></pre></div> + <div class="method-summary">Add a new secret (<span class="nickname">domainDomainNameSecretPost</span>)</div> + <div class="method-notes"></div> + + <h3 class="field-label">Path parameters</h3> + <div class="field-items"> + <div class="param">domainName (required)</div> + + <div class="param-desc"><span class="param-type">Path Parameter</span> — Name of the domain </div> + </div> <!-- field-items --> + + <h3 class="field-label">Consumes</h3> + This API call consumes the following media types via the <span class="heaader">Content-Type</span> request header: + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Request body</h3> + <div class="field-items"> + <div class="param">body <a href="#Secret">Secret</a> (required)</div> + + <div class="param-desc"><span class="param-type">Body Parameter</span> — </div> + + </div> <!-- field-items --> + + + + + + <!--Todo: process Response Object and its headers, schema, examples --> + + + <h3 class="field-label">Produces</h3> + This API call produces the following media types according to the <span class="header">Accept</span> request header; + the media type will be conveyed by the <span class="heaader">Content-Type</span> response header. + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Responses</h3> + <h4 class="field-label">201</h4> + Successful Creation + <a href="#"></a> + <h4 class="field-label">404</h4> + Invalid Path or Path not found + <a href="#"></a> + </div> <!-- method --> + <hr/> + <div class="method"><a name="domainDomainNameSecretSecretNameDelete"/> + <div class="method-path"> + <a class="up" href="#__Methods">Up</a> + <pre class="delete"><code class="huge"><span class="http-method">delete</span> /domain/{domainName}/secret/{secretName}</code></pre></div> + <div class="method-summary">Deletes a Secret (<span class="nickname">domainDomainNameSecretSecretNameDelete</span>)</div> + <div class="method-notes"></div> + + <h3 class="field-label">Path parameters</h3> + <div class="field-items"> + <div class="param">secretName (required)</div> + + <div class="param-desc"><span class="param-type">Path Parameter</span> — Name of Secret to Delete </div><div class="param">domainName (required)</div> + + <div class="param-desc"><span class="param-type">Path Parameter</span> — Path to the SecretDomain which contains the Secret </div> + </div> <!-- field-items --> + + + + + + + + <!--Todo: process Response Object and its headers, schema, examples --> + + + <h3 class="field-label">Produces</h3> + This API call produces the following media types according to the <span class="header">Accept</span> request header; + the media type will be conveyed by the <span class="heaader">Content-Type</span> response header. + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Responses</h3> + <h4 class="field-label">204</h4> + Successful Deletion + <a href="#"></a> + <h4 class="field-label">404</h4> + Invalid Path or Path not found + <a href="#"></a> + </div> <!-- method --> + <hr/> + <div class="method"><a name="domainDomainNameSecretSecretNameGet"/> + <div class="method-path"> + <a class="up" href="#__Methods">Up</a> + <pre class="get"><code class="huge"><span class="http-method">get</span> /domain/{domainName}/secret/{secretName}</code></pre></div> + <div class="method-summary">Find Secret by Name (<span class="nickname">domainDomainNameSecretSecretNameGet</span>)</div> + <div class="method-notes">Returns a single secret</div> + + <h3 class="field-label">Path parameters</h3> + <div class="field-items"> + <div class="param">domainName (required)</div> + + <div class="param-desc"><span class="param-type">Path Parameter</span> — Name of the domain in which to look at </div><div class="param">secretName (required)</div> + + <div class="param-desc"><span class="param-type">Path Parameter</span> — Name of the secret which is needed </div> + </div> <!-- field-items --> + + + + + + + <h3 class="field-label">Return type</h3> + <div class="return-type"> + <a href="#Secret">Secret</a> + + </div> + + <!--Todo: process Response Object and its headers, schema, examples --> + + <h3 class="field-label">Example data</h3> + <div class="example-data-content-type">Content-Type: application/json</div> + <pre class="example"><code>{ + "values" : { + "name" : "john", + "Age" : 40, + "admin" : true + }, + "name" : "aeiou" +}</code></pre> + + <h3 class="field-label">Produces</h3> + This API call produces the following media types according to the <span class="header">Accept</span> request header; + the media type will be conveyed by the <span class="heaader">Content-Type</span> response header. + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Responses</h3> + <h4 class="field-label">200</h4> + successful operation + <a href="#Secret">Secret</a> + <h4 class="field-label">404</h4> + Invalid Path or Path not found + <a href="#"></a> + </div> <!-- method --> + <hr/> + <h1><a name="System">System</a></h1> + <div class="method"><a name="statusGet"/> + <div class="method-path"> + <a class="up" href="#__Methods">Up</a> + <pre class="get"><code class="huge"><span class="http-method">get</span> /status</code></pre></div> + <div class="method-summary">Get backend status (<span class="nickname">statusGet</span>)</div> + <div class="method-notes">Gets current backend status. This API is used only by quorum clients</div> + + + + + + + + <h3 class="field-label">Return type</h3> + <div class="return-type"> + <a href="#inline_response_200_1">inline_response_200_1</a> + + </div> + + <!--Todo: process Response Object and its headers, schema, examples --> + + <h3 class="field-label">Example data</h3> + <div class="example-data-content-type">Content-Type: application/json</div> + <pre class="example"><code>{ + "sealstatus" : "aeiou" +}</code></pre> + + <h3 class="field-label">Produces</h3> + This API call produces the following media types according to the <span class="header">Accept</span> request header; + the media type will be conveyed by the <span class="heaader">Content-Type</span> response header. + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Responses</h3> + <h4 class="field-label">200</h4> + Successful operation + <a href="#inline_response_200_1">inline_response_200_1</a> + <h4 class="field-label">404</h4> + Invalid Path or Path not found + <a href="#"></a> + </div> <!-- method --> + <hr/> + <div class="method"><a name="unsealPost"/> + <div class="method-path"> + <a class="up" href="#__Methods">Up</a> + <pre class="post"><code class="huge"><span class="http-method">post</span> /unseal</code></pre></div> + <div class="method-summary">Unseal backend (<span class="nickname">unsealPost</span>)</div> + <div class="method-notes">Sends unseal shard to unseal if backend is sealed</div> + + + <h3 class="field-label">Consumes</h3> + This API call consumes the following media types via the <span class="heaader">Content-Type</span> request header: + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Request body</h3> + <div class="field-items"> + <div class="param">body <a href="#body">body</a> (required)</div> + + <div class="param-desc"><span class="param-type">Body Parameter</span> — </div> + + </div> <!-- field-items --> + + + + + + <!--Todo: process Response Object and its headers, schema, examples --> + + + <h3 class="field-label">Produces</h3> + This API call produces the following media types according to the <span class="header">Accept</span> request header; + the media type will be conveyed by the <span class="heaader">Content-Type</span> response header. + <ul> + <li><code>application/json</code></li> + </ul> + + <h3 class="field-label">Responses</h3> + <h4 class="field-label">201</h4> + Submitted unseal key + <a href="#"></a> + <h4 class="field-label">404</h4> + Invalid Path or Path not found + <a href="#"></a> + </div> <!-- method --> + <hr/> + + <h2><a name="__Models">Models</a></h2> + [ Jump to <a href="#__Methods">Methods</a> ] + + <h3>Table of Contents</h3> + <ol> + <li><a href="#Credential"><code>Credential</code> - </a></li> + <li><a href="#Domain"><code>Domain</code> - </a></li> + <li><a href="#Secret"><code>Secret</code> - </a></li> + <li><a href="#body"><code>body</code> - </a></li> + <li><a href="#inline_response_200"><code>inline_response_200</code> - </a></li> + <li><a href="#inline_response_200_1"><code>inline_response_200_1</code> - </a></li> + </ol> + + <div class="model"> + <h3><a name="Credential"><code>Credential</code> - </a> <a class="up" href="#__Models">Up</a></h3> + <div class='model-description'></div> + <div class="field-items"> + <div class="param">username (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> </div> +<div class="param">password (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> </div> + </div> <!-- field-items --> + </div> + <div class="model"> + <h3><a name="Domain"><code>Domain</code> - </a> <a class="up" href="#__Models">Up</a></h3> + <div class='model-description'></div> + <div class="field-items"> + <div class="param">uuid (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> Optional value provided by user. If user does not provide, server will auto generate </div> +<div class="param">name (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> Name of the secret domain under which all secrets will be stored </div> + </div> <!-- field-items --> + </div> + <div class="model"> + <h3><a name="Secret"><code>Secret</code> - </a> <a class="up" href="#__Models">Up</a></h3> + <div class='model-description'></div> + <div class="field-items"> + <div class="param">name (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> Name of the secret </div> +<div class="param">values (optional)</div><div class="param-desc"><span class="param-type"><a href="#object">map[String, Object]</a></span> Map of key value pairs that constitute the secret </div> + </div> <!-- field-items --> + </div> + <div class="model"> + <h3><a name="body"><code>body</code> - </a> <a class="up" href="#__Models">Up</a></h3> + + <div class="field-items"> + <div class="param">unsealshard (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> Unseal shard that will be used along with other shards to unseal backend </div> + </div> <!-- field-items --> + </div> + <div class="model"> + <h3><a name="inline_response_200"><code>inline_response_200</code> - </a> <a class="up" href="#__Models">Up</a></h3> + + <div class="field-items"> + <div class="param">token (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> </div> +<div class="param">ttl (optional)</div><div class="param-desc"><span class="param-type"><a href="#integer">Integer</a></span> ttl of returned token in seconds </div> + </div> <!-- field-items --> + </div> + <div class="model"> + <h3><a name="inline_response_200_1"><code>inline_response_200_1</code> - </a> <a class="up" href="#__Models">Up</a></h3> + + <div class="field-items"> + <div class="param">sealstatus (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> seal status of backend </div> + </div> <!-- field-items --> + </div> + </body> +</html> diff --git a/sms-service/doc/api_swagger.yaml b/sms-service/doc/api_swagger.yaml index 5e0b792..08e3c18 100644 --- a/sms-service/doc/api_swagger.yaml +++ b/sms-service/doc/api_swagger.yaml @@ -8,9 +8,11 @@ info: license: name: Apache 2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' -host: 'aaf.onap.org:8000' +host: 'aaf.onap.org:10443' basePath: /v1/sms/ tags: + - name: system + description: Operations related to quorum client which are not useful to clients - name: login description: Operations related to username password based authentication - name: domain @@ -24,9 +26,8 @@ paths: post: tags: - login - summary: "Login with username and password" - description: 'Operations related to logging in via username and Password' - operationId: loginUser + summary: Login with username and password + description: Operations related to logging in via username and Password consumes: - application/json produces: @@ -39,18 +40,67 @@ paths: $ref: '#/definitions/Credential' responses: '200': - description: "Successful Login" + description: Successful Login returns a token schema: - type: "string" + type: object + properties: + token: + type: string + ttl: + type: integer + description: ttl of returned token in seconds '404': - description: "Invalid Username or Password" + description: Invalid Username or Password + /status: + get: + tags: + - system + description: Gets current backend status. This API is used only by quorum clients + summary: Get backend status + produces: + - application/json + responses: + '200': + description: Successful operation + schema: + type: object + properties: + sealstatus: + type: string + description: seal status of backend + '404': + description: Invalid Path or Path not found + /unseal: + post: + tags: + - system + description: Sends unseal shard to unseal if backend is sealed + summary: Unseal backend + consumes: + - application/json + produces: + - application/json + parameters: + - in: body + name: body + required: true + schema: + type: object + properties: + unsealshard: + type: string + description: Unseal shard that will be used along with other shards to unseal backend + responses: + '201': + description: Submitted unseal key + '404': + description: Invalid Path or Path not found /domain: post: tags: - domain summary: Add a new domain description: '' - operationId: addDomain consumes: - application/json produces: @@ -62,38 +112,20 @@ paths: schema: $ref: '#/definitions/Domain' responses: - '200': + '201': description: Successful Creation schema: $ref: '#/definitions/Domain' - '405': + '400': description: Invalid input + '500': + description: Internal Server Error '/domain/{domainName}': - get: - tags: - - domain - description: Gets domain information by name - operationId: getDomainByName - produces: - - application/json - parameters: - - name: domainName - in: path - description: Name of the domain - required: true - type: string - responses: - '200': - description: successful operation - schema: - $ref: '#/definitions/Domain' - '404': - description: Invalid Path or Path not found delete: tags: - domain description: Deletes a domain with provided name - operationId: deleteDomainByName + summary: Deletes a domain by name produces: - application/json parameters: @@ -113,7 +145,6 @@ paths: - secret summary: Add a new secret description: '' - operationId: addSecretInDomain consumes: - application/json produces: @@ -130,17 +161,15 @@ paths: schema: $ref: '#/definitions/Secret' responses: - '200': + '201': description: Successful Creation - schema: - $ref: '#/definitions/Secret' '404': description: Invalid Path or Path not found get: tags: - secret - description: Gets all secrets in this domain - operationId: getAllSecretsInDomain + description: Gets all secret names in this domain + summary: List secret Names in this domain produces: - application/json parameters: @@ -151,11 +180,12 @@ paths: type: string responses: '200': - description: successful operation + description: Successful operation schema: - type: "array" + type: array items: - $ref: '#/definitions/Secret' + type: string + example: ['secret1', 'secret2', 'secret3'] '404': description: Invalid Path or Path not found '/domain/{domainName}/secret/{secretName}': @@ -164,7 +194,6 @@ paths: - secret summary: Find Secret by Name description: Returns a single secret - operationId: getSecretByName produces: - application/json parameters: @@ -190,7 +219,6 @@ paths: - secret summary: Deletes a Secret description: '' - operationId: deleteSecret produces: - application/json parameters: @@ -209,14 +237,19 @@ paths: description: Successful Deletion '404': description: Invalid Path or Path not found +securityDefinitions: + token: + type: "apiKey" + name: "token" + in: "header" definitions: Credential: type: object properties: username: - type: "string" + type: string password: - type: "string" + type: string Domain: type: object properties: @@ -229,21 +262,20 @@ definitions: type: string description: Name of the secret domain under which all secrets will be stored Secret: - type: "object" + type: object properties: name: - type: "string" + type: string description: Name of the secret - value: - type: "array" - description: Array of key value pairs that constitute the secret - items: - type: "object" - properties: - key: - type: "string" - value: - type: "string" + values: + description: Map of key value pairs that constitute the secret + type: object + additionalProperties: + type: object + example: + "name": "john" + "Age": 40 + "admin": true externalDocs: description: Find out more about Swagger url: 'http://swagger.io' diff --git a/sms-service/src/sms/handler/handler.go b/sms-service/src/sms/handler/handler.go index dd124e9..fde6718 100644 --- a/sms-service/src/sms/handler/handler.go +++ b/sms-service/src/sms/handler/handler.go @@ -52,6 +52,8 @@ func (h handler) createSecretDomainHandler(w http.ResponseWriter, r *http.Reques http.Error(w, err.Error(), http.StatusInternalServerError) return } + + w.WriteHeader(http.StatusCreated) } // deleteSecretDomainHandler deletes a secret domain with the name provided @@ -64,6 +66,8 @@ func (h handler) deleteSecretDomainHandler(w http.ResponseWriter, r *http.Reques http.Error(w, err.Error(), http.StatusInternalServerError) return } + + w.WriteHeader(http.StatusNoContent) } // createSecretHandler handles creation of secrets on a given domain name |