Commit 4d751d96 authored by Spiros Koulouzis's avatar Spiros Koulouzis

Changed key to KeyPair

parent 0ab2be69
......@@ -72,7 +72,7 @@
<h1 class="page-header">Files and Libraries</h1>
<h3 id="artifact_gwt_json_overlay">GWT JSON Overlay</h3>
<p class="lead">Created April 4, 2017</p>
<p class="lead">Created April 6, 2017</p>
<p> <p>
The <a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a> JSON Overlay library provides the JSON Overlays that
can be used to access the Web service API for this application.
......@@ -91,13 +91,13 @@
<tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-gwt-json-overlay.jar">
<td><span class="downloadfile-name">drip-api-gwt-json-overlay.jar</span></td>
<td><span class="downloadfile-size">9.53K</span></td>
<td><span class="downloadfile-size">9.50K</span></td>
<td><span class="downloadfile-description">The sources for the GWT JSON overlay.</span></td>
</tr>
</tbody>
</table>
<h3 id="artifact_java_json_client_library">Java JSON Client Library</h3>
<p class="lead">Created April 4, 2017</p>
<p class="lead">Created April 6, 2017</p>
<p><p>
The Java client-side library is used to provide the set of Java objects that can be serialized
to/from JSON using <a href="http://jackson.codehaus.org/">Jackson</a>. This is useful for accessing the
......@@ -116,18 +116,18 @@
<tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-json-client.jar">
<td><span class="downloadfile-name">drip-api-json-client.jar</span></td>
<td><span class="downloadfile-size">12.49K</span></td>
<td><span class="downloadfile-size">12.44K</span></td>
<td><span class="downloadfile-description">The binaries for the Java JSON client library.</span></td>
</tr>
<tr class="clickable-row" data-href="drip-api-json-client-json-sources.jar">
<td><span class="downloadfile-name">drip-api-json-client-json-sources.jar</span></td>
<td><span class="downloadfile-size">9.87K</span></td>
<td><span class="downloadfile-size">9.84K</span></td>
<td><span class="downloadfile-description">The sources for the Java JSON client library.</span></td>
</tr>
</tbody>
</table>
<h3 id="artifact_java_xml_client_library">Java XML Client Library</h3>
<p class="lead">Created April 4, 2017</p>
<p class="lead">Created April 6, 2017</p>
<p><p>
The Java client-side library is used to access the Web service API for this application using Java.
</p>
......@@ -144,18 +144,18 @@
<tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-xml-client.jar">
<td><span class="downloadfile-name">drip-api-xml-client.jar</span></td>
<td><span class="downloadfile-size">20.45K</span></td>
<td><span class="downloadfile-size">20.41K</span></td>
<td><span class="downloadfile-description">The binaries for the Java XML client library.</span></td>
</tr>
<tr class="clickable-row" data-href="drip-api-xml-client-xml-sources.jar">
<td><span class="downloadfile-name">drip-api-xml-client-xml-sources.jar</span></td>
<td><span class="downloadfile-size">18.44K</span></td>
<td><span class="downloadfile-size">18.40K</span></td>
<td><span class="downloadfile-description">The sources for the Java XML client library.</span></td>
</tr>
</tbody>
</table>
<h3 id="artifact_js_client_library">JavaScript Client Library</h3>
<p class="lead">Created April 4, 2017</p>
<p class="lead">Created April 6, 2017</p>
<p><p>
The JavaScript client-side library defines classes that can be (de)serialized to/from JSON.
This is useful for accessing the resources that are published by this application, but only
......@@ -184,13 +184,13 @@
<tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-js.zip">
<td><span class="downloadfile-name">drip-api-js.zip</span></td>
<td><span class="downloadfile-size">3.57K</span></td>
<td><span class="downloadfile-size">3.56K</span></td>
<td><span class="downloadfile-description">&nbsp;</span></td>
</tr>
</tbody>
</table>
<h3 id="artifact_php_json_client_library">PHP JSON Client Library</h3>
<p class="lead">Created April 4, 2017</p>
<p class="lead">Created April 6, 2017</p>
<p><p>
The PHP JSON client-side library defines the PHP classes that can be (de)serialized to/from JSON.
This is useful for accessing the resources that are published by this application, but only
......@@ -213,13 +213,13 @@
<tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-php.zip">
<td><span class="downloadfile-name">drip-api-php.zip</span></td>
<td><span class="downloadfile-size">3.76K</span></td>
<td><span class="downloadfile-size">3.74K</span></td>
<td><span class="downloadfile-description">&nbsp;</span></td>
</tr>
</tbody>
</table>
<h3 id="artifact_php_xml_client_library">PHP XML Client Library</h3>
<p class="lead">Created April 4, 2017</p>
<p class="lead">Created April 6, 2017</p>
<p><p>
The PHP client-side library defines the PHP classes that can be (de)serialized to/from XML.
This is useful for accessing the resources that are published by this application, but only
......@@ -245,13 +245,13 @@
<tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-php.zip">
<td><span class="downloadfile-name">drip-api-php.zip</span></td>
<td><span class="downloadfile-size">7.62K</span></td>
<td><span class="downloadfile-size">7.60K</span></td>
<td><span class="downloadfile-description">&nbsp;</span></td>
</tr>
</tbody>
</table>
<h3 id="artifact_ruby_json_client_library">Ruby JSON Client Library</h3>
<p class="lead">Created April 4, 2017</p>
<p class="lead">Created April 6, 2017</p>
<p><p>
The Ruby JSON client-side library defines the Ruby classes that can be (de)serialized to/from JSON.
This is useful for accessing the REST endpoints that are published by this application, but only
......@@ -276,7 +276,7 @@
<tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api.rb">
<td><span class="downloadfile-name">drip-api.rb</span></td>
<td><span class="downloadfile-size">48.54K</span></td>
<td><span class="downloadfile-size">47.76K</span></td>
<td><span class="downloadfile-description">&nbsp;</span></td>
</tr>
</tbody>
......
......@@ -988,8 +988,6 @@ module Types
#
attr_accessor :name
# the id
attr_accessor :id
# the type
attr_accessor :type
# the attributes
......@@ -1001,7 +999,6 @@ module Types
def to_jaxb_json_hash
_h = super
_h['name'] = name.to_jaxb_json_hash unless name.nil?
_h['id'] = id.to_jaxb_json_hash unless id.nil?
_h['type'] = type.to_jaxb_json_hash unless type.nil?
_h['attributes'] = attributes.to_jaxb_json_hash unless attributes.nil?
_h['key'] = key.to_jaxb_json_hash unless key.nil?
......@@ -1030,25 +1027,6 @@ module Types
@name = _oa
end
end
if !_o['id'].nil?
_oa = _o['id']
if(_oa.is_a? Hash)
@id = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@id = String.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@id = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@id.push String.from_json(_item)
else
@id.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@id = _oa
end
end
if !_o['type'].nil?
_oa = _o['type']
if(_oa.is_a? Hash)
......@@ -1417,65 +1395,43 @@ module V1
module Types
# (no documentation provided)
class DeployResponse < Nl::Uva::Sne::Drip::Commons::V1::Types::DeployRequest
class ToscaRepresentation < Nl::Uva::Sne::Drip::Commons::V1::Types::KeyValueHolder
# (no documentation provided)
attr_accessor :key
# the id
attr_accessor :id
# the name
attr_accessor :name
# the json hash for this DeployResponse
# the json hash for this ToscaRepresentation
def to_jaxb_json_hash
_h = super
_h['key'] = key.to_jaxb_json_hash unless key.nil?
_h['id'] = id.to_jaxb_json_hash unless id.nil?
_h['name'] = name.to_jaxb_json_hash unless name.nil?
return _h
end
#initializes this DeployResponse with a json hash
#initializes this ToscaRepresentation with a json hash
def init_jaxb_json_hash(_o)
super _o
if !_o['key'].nil?
_oa = _o['key']
if(_oa.is_a? Hash)
@key = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@key = Nl::Uva::Sne::Drip::Commons::V1::Types::Key.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@key = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@key.push Nl::Uva::Sne::Drip::Commons::V1::Types::Key.from_json(_item)
else
@key.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@key = _oa
end
end
if !_o['id'].nil?
_oa = _o['id']
if !_o['name'].nil?
_oa = _o['name']
if(_oa.is_a? Hash)
@id = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@id = String.from_json(_oa) unless _oa['@class']
@name = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@name = String.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@id = Array.new
@name = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@id.push String.from_json(_item)
@name.push String.from_json(_item)
else
@id.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
@name.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@id = _oa
@name = _oa
end
end
end
# constructs a DeployResponse from a (parsed) JSON hash
# constructs a ToscaRepresentation from a (parsed) JSON hash
def self.from_json(o)
if o.nil?
return nil
......@@ -1516,43 +1472,65 @@ module V1
module Types
# (no documentation provided)
class ToscaRepresentation < Nl::Uva::Sne::Drip::Commons::V1::Types::KeyValueHolder
class DeployResponse < Nl::Uva::Sne::Drip::Commons::V1::Types::DeployRequest
# the name
attr_accessor :name
# (no documentation provided)
attr_accessor :key
# the id
attr_accessor :id
# the json hash for this ToscaRepresentation
# the json hash for this DeployResponse
def to_jaxb_json_hash
_h = super
_h['name'] = name.to_jaxb_json_hash unless name.nil?
_h['key'] = key.to_jaxb_json_hash unless key.nil?
_h['id'] = id.to_jaxb_json_hash unless id.nil?
return _h
end
#initializes this ToscaRepresentation with a json hash
#initializes this DeployResponse with a json hash
def init_jaxb_json_hash(_o)
super _o
if !_o['name'].nil?
_oa = _o['name']
if !_o['key'].nil?
_oa = _o['key']
if(_oa.is_a? Hash)
@name = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@name = String.from_json(_oa) unless _oa['@class']
@key = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@key = Nl::Uva::Sne::Drip::Commons::V1::Types::Key.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@name = Array.new
@key = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@name.push String.from_json(_item)
@key.push Nl::Uva::Sne::Drip::Commons::V1::Types::Key.from_json(_item)
else
@name.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
@key.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@name = _oa
@key = _oa
end
end
if !_o['id'].nil?
_oa = _o['id']
if(_oa.is_a? Hash)
@id = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@id = String.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@id = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@id.push String.from_json(_item)
else
@id.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@id = _oa
end
end
end
# constructs a ToscaRepresentation from a (parsed) JSON hash
# constructs a DeployResponse from a (parsed) JSON hash
def self.from_json(o)
if o.nil?
return nil
......
......@@ -139,7 +139,6 @@
<pre class="prettyprint language-js example">{
&quot;key&quot; : {
&quot;name&quot; : &quot;id_dsa.pub&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : {
&quot;property1&quot; : &quot;domain_name:Virginia&quot;,
......
......@@ -88,15 +88,6 @@ from the machine the keys correspond to.</p>
</span>
</td>
<td> <span class="property-description">The name of the key.</span>
</td>
</tr>
<tr>
<td> <span class="property-name">id</span>
</td>
<td> <span class="datatype-reference">string
</span>
</td>
<td> <span class="property-description"></span>
</td>
</tr>
<tr>
......@@ -145,7 +136,6 @@ to specify the domain name for ec2</span>
<pre class="prettyprint language-js example">{
&quot;name&quot; : &quot;id_dsa.pub&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : {
&quot;property1&quot; : &quot;domain_name:Virginia&quot;,
......
......@@ -68,7 +68,7 @@
<dl class="dl-horizontal">
<dt>Subtypes</dt>
<dd><a href="json_PlaybookRepresentation.html">PlaybookRepresentation</a>, <a href="json_Script.html">Script</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_ToscaRepresentation.html">ToscaRepresentation</a>, <a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_PlanResponse.html">PlanResponse</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a>, <a href="json_Key.html">Key</a>, <a href="json_CloudCredentials.html">CloudCredentials</a></dd>
<dd><a href="json_Script.html">Script</a>, <a href="json_PlaybookRepresentation.html">PlaybookRepresentation</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_ToscaRepresentation.html">ToscaRepresentation</a>, <a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_PlanResponse.html">PlanResponse</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_Key.html">Key</a>, <a href="json_CloudCredentials.html">CloudCredentials</a></dd>
</dl>
<table class="table datatype-properties">
......
......@@ -339,8 +339,6 @@ from the machine the keys correspond to.]]>
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="id" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="type" type="type" minOccurs="0">
<xs:annotation>
<xs:documentation>
......
......@@ -489,7 +489,6 @@ Content-Type: application/json
{
&quot;key&quot; : {
&quot;name&quot; : &quot;id_dsa.pub&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : {
&quot;property1&quot; : &quot;domain_name:Virginia&quot;,
......
......@@ -163,7 +163,6 @@ Accept: application/json
<code class="prettyprint language-js">
{
&quot;name&quot; : &quot;id_dsa.pub&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : {
&quot;property1&quot; : &quot;domain_name:Virginia&quot;,
......@@ -360,7 +359,6 @@ Content-Type: application/json
<code class="prettyprint language-js">
{
&quot;name&quot; : &quot;id_dsa.pub&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : {
&quot;property1&quot; : &quot;domain_name:Virginia&quot;,
......@@ -604,7 +602,6 @@ Content-Type: application/json
<code class="prettyprint language-js">
{
&quot;name&quot; : &quot;id_dsa.pub&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : {
&quot;property1&quot; : &quot;domain_name:Virginia&quot;,
......
......@@ -188,7 +188,6 @@
<pre class="prettyprint language-xml example">&lt;d-----&gt;
&lt;key&gt;
&lt;name&gt;id_dsa.pub&lt;/name&gt;
&lt;id&gt;...&lt;/id&gt;
&lt;type&gt;PRIVATE&lt;/type&gt;
&lt;attributes&gt;domain_name:Virginia&lt;/attributes&gt;
&lt;key&gt;-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAm6AALYxkJFNzD3bfVJ4+hMY5j0/kqM9CURLKXMlYuAysnvoG8wZKx9Bedefm\neNSse4zTg798ZA2kDMZFIrwp1AseTwtj8DDu5fhG5DjyI3g6iJltS5zFQdMXneDlHXBX8cncSzNY\nRx0NdjEMAe7YttvI8FNlxL0VnMFli/HB/ftzYMe5+AmkSROncVGHiwoiUpj+vtobCFOYtXsCf6ri\nd4lgWA5wv6DZT/JKCYymiBqgSXu3ueFcEzw5SAukARWVjn1xccjZkokFfBbO/FpYY00TrUTBw9S6\nD3iM+gj8RT6EKILOmhrt71D21S95WAWIT7h2YBsy1KAvMixhNf9VaQIDAQABAoIBAHhVYK3Xl3tr\nN1Xm0ctJTQg3ijxhR2qsUBgGUokqezpdOoD2zbbOz7XvTYsX1GLr967U9pwxzUpELexexwiTvDgk\nnLv8D7ui6qbRsmc4DSsWBRSophVIVFKQmftO8Xow6x+fuYJAYmsicM1KIYHBILtL+PSzV8anenWq\nKQ3r0tfCiQhEzKEk4b1uT3SJWQyHE++JAhVkO7lIeb6S9Dg1jAaAeMnJ/NiMxTarpPRnxe6hsTsH\ngG1iKWo+Skcl4SknOc+CMEfyDjG4FL7MGhKduahsO8vMUrgGsDD7EH3NiX/FweB8La6qpDYAwFpC\nycrooyhiyzw8Wb5gGaYnmvr9l70CgYEAx74O8JleXaHpxEAmh4h7VbLmJ3mOylfBmOdzcHeedJQw\nack2SAv65WBI9S9MEQ7J/vFuyw5HNk3C/mcWgzDQXSNIhHLvl/Z9sux/Qpm3SQWLzBxKV3dJ4r\nwcAxzVA93+/L1Nee+VOKnlyRumvVa6+XLsLagpap2AVcTqlerMcCgYEAx3T2pXtqkCE9eU/ov22r\npdaKjgHoGOUg1CMEfWi/Ch6sYIIRyrHz6dhy+yR1pXNgPbLWdrn8l88F3+IsmbaMupMgRmqwEC3G\n9Y2FglGIVvRdZaagvRxLzRCcvcN4v6OYs9ST4o1xlv7Qxphld+0XDKv7VSCv/rASuK8BqlFL3E8C\ngYArMXJRnRjG7qh6g9TRIjZphdI3XxX9s5Rt2D8iZvuhAhqmBZjzY4PR7kxYmO2+EpCjzNnEl0XW\n/GHaWbiIjhnAykx4N9KP7gGom3O5lzwHUme1XnFKcO2wDjQwJbufRmba8iQF1srN577mF+Z7ha4V\nJ1duCTzvWF1KFX6sk/uhKQKBgAcDFai7rgNjJ8YcCRKxyFcMM9LKPl6hr4XFtWKzTAQPEABUkkuN\n9gVClsg9f+VRKRECOIf0Ae1UWeCFEwxUXp4wjfHrzkTDVztKvmbWdvSXorDwKrZ7SC7tZpVFSfly\nxuuLjadpUZT9YFmbAfY1X5oSccOMYqORjRbxEB3svb4BAoGAGTgFuq9Zojh/KIqY8b4HpEfmh6CQ\nhLVfD98Nqd6GDbxgvIM0v4mFXE92x2jn35Ia0JdFyh3B8Vkl7sqQZfxDFXI9O9pte2mxY9ICaY\n55+X/SN1pd53BH+gaPZJy/R+Vpvs5MN48hoUKy5UKpoFeUWrS5QArjtvNCm4SGlXw=\n-----END RSA PRIVATE KEY-----\n&lt;/key&gt;
......
......@@ -105,24 +105,6 @@ from the machine the keys correspond to.</p>
</td>
<td> <span class="property-description">A general use key,value. In the case of the cloud credentials it's used
to specify the domain name for ec2</span>
</td>
</tr>
<tr>
<td> <span class="property-name">id</span>
</td>
<td> <span class="datatype-reference">string
</span>
</td>
<td> <span class="property-type">element
</span>
</td>
<td> <span class="property-namespaceInfo">
</span>
</td>
<td> <span class="property-minMaxOccurs">0/1
</span>
</td>
<td> <span class="property-description">the id</span>
</td>
</tr>
<tr>
......@@ -203,7 +185,6 @@ to specify the domain name for ec2</span>
<pre class="prettyprint language-xml example">&lt;k-----&gt;
&lt;name&gt;id_dsa.pub&lt;/name&gt;
&lt;id&gt;...&lt;/id&gt;
&lt;type&gt;PRIVATE&lt;/type&gt;
&lt;attributes&gt;domain_name:Virginia&lt;/attributes&gt;
&lt;key&gt;-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAm6AALYxkJFNzD3bfVJ4+hMY5j0/kqM9CURLKXMlYuAysnvoG8wZKx9Bedefm\neNSse4zTg798ZA2kDMZFIrwp1AseTwtj8DDu5fhG5DjyI3g6iJltS5zFQdMXneDlHXBX8cncSzNY\nRx0NdjEMAe7YttvI8FNlxL0VnMFli/HB/ftzYMe5+AmkSROncVGHiwoiUpj+vtobCFOYtXsCf6ri\nd4lgWA5wv6DZT/JKCYymiBqgSXu3ueFcEzw5SAukARWVjn1xccjZkokFfBbO/FpYY00TrUTBw9S6\nD3iM+gj8RT6EKILOmhrt71D21S95WAWIT7h2YBsy1KAvMixhNf9VaQIDAQABAoIBAHhVYK3Xl3tr\nN1Xm0ctJTQg3ijxhR2qsUBgGUokqezpdOoD2zbbOz7XvTYsX1GLr967U9pwxzUpELexexwiTvDgk\nnLv8D7ui6qbRsmc4DSsWBRSophVIVFKQmftO8Xow6x+fuYJAYmsicM1KIYHBILtL+PSzV8anenWq\nKQ3r0tfCiQhEzKEk4b1uT3SJWQyHE++JAhVkO7lIeb6S9Dg1jAaAeMnJ/NiMxTarpPRnxe6hsTsH\ngG1iKWo+Skcl4SknOc+CMEfyDjG4FL7MGhKduahsO8vMUrgGsDD7EH3NiX/FweB8La6qpDYAwFpC\nycrooyhiyzw8Wb5gGaYnmvr9l70CgYEAx74O8JleXaHpxEAmh4h7VbLmJ3mOylfBmOdzcHeedJQw\nack2SAv65WBI9S9MEQ7J/vFuyw5HNk3C/mcWgzDQXSNIhHLvl/Z9sux/Qpm3SQWLzBxKV3dJ4r\nwcAxzVA93+/L1Nee+VOKnlyRumvVa6+XLsLagpap2AVcTqlerMcCgYEAx3T2pXtqkCE9eU/ov22r\npdaKjgHoGOUg1CMEfWi/Ch6sYIIRyrHz6dhy+yR1pXNgPbLWdrn8l88F3+IsmbaMupMgRmqwEC3G\n9Y2FglGIVvRdZaagvRxLzRCcvcN4v6OYs9ST4o1xlv7Qxphld+0XDKv7VSCv/rASuK8BqlFL3E8C\ngYArMXJRnRjG7qh6g9TRIjZphdI3XxX9s5Rt2D8iZvuhAhqmBZjzY4PR7kxYmO2+EpCjzNnEl0XW\n/GHaWbiIjhnAykx4N9KP7gGom3O5lzwHUme1XnFKcO2wDjQwJbufRmba8iQF1srN577mF+Z7ha4V\nJ1duCTzvWF1KFX6sk/uhKQKBgAcDFai7rgNjJ8YcCRKxyFcMM9LKPl6hr4XFtWKzTAQPEABUkkuN\n9gVClsg9f+VRKRECOIf0Ae1UWeCFEwxUXp4wjfHrzkTDVztKvmbWdvSXorDwKrZ7SC7tZpVFSfly\nxuuLjadpUZT9YFmbAfY1X5oSccOMYqORjRbxEB3svb4BAoGAGTgFuq9Zojh/KIqY8b4HpEfmh6CQ\nhLVfD98Nqd6GDbxgvIM0v4mFXE92x2jn35Ia0JdFyh3B8Vkl7sqQZfxDFXI9O9pte2mxY9ICaY\n55+X/SN1pd53BH+gaPZJy/R+Vpvs5MN48hoUKy5UKpoFeUWrS5QArjtvNCm4SGlXw=\n-----END RSA PRIVATE KEY-----\n&lt;/key&gt;
......
{
"creationDate": 1488368936945,
"parameters": [
{
"name": "f293ff03-4b82-49e2-871a-899aadf821ce",
"encoding": "UTF-8",
"value": "publicKeyPath: /tmp/Input-4007028381500/user.pem\nuserName: zh9314\nsubnets:\n- {name: s1, subnet: 192.168.10.0, netmask: 255.255.255.0}\ncomponents:\n- name: faab6756-61b6-4800-bffa-ae9d859a9d6c\n type: Switch.nodes.Compute\n nodetype: t2.medium\n OStype: Ubuntu 16.04\n domain: ec2.us-east-1.amazonaws.com\n script: /tmp/Input-4007028381500/guiscipt.sh\n installation: null\n role: master\n dockers: mogswitch/InputDistributor\n public_address: 54.144.0.91\n instanceId: i-0e78cbf853328b820\n ethernet_port:\n - {name: p1, subnet_name: s1, address: 192.168.10.10}\n- name: 1c75eedf-8497-46fe-aeb8-dab6a62154cb\n type: Switch.nodes.Compute\n nodetype: t2.medium\n OStype: Ubuntu 16.04\n domain: ec2.us-east-1.amazonaws.com\n script: /tmp/Input-4007028381500/guiscipt.sh\n installation: null\n role: slave\n dockers: mogswitch/ProxyTranscoder\n public_address: 34.207.254.160\n instanceId: i-0a99ea18fcc77ed7a\n ethernet_port:\n - {name: p1, subnet_name: s1, address: 192.168.10.11}\n"
},
{
"name": "kubernetes",
"encoding": "UTF-8",
"value": "54.144.0.91 ubuntu /tmp/Input-4007028381500/Virginia.pem master\n34.207.254.160 ubuntu /tmp/Input-4007028381500/Virginia.pem slave\n"
}
]
}
{"creationDate":1491377544574,"parameters":[{"name":"4d685363-30c8-4ebd-bd4d-80e9ae297ba9","encoding":"UTF-8","value":"publicKeyPath: ~/.ssh/id_dsa.pub\nuserName: vm_user\nsubnets:\n- {name: s1, subnet: 192.168.10.0, netmask: 255.255.255.0}\ncomponents:\n- name: 2d13d708e3a9441ab8336ce874e08dd1\n type: Switch.nodes.Compute\n nodeType: t2.medium\n OStype: Ubuntu 16.04\n script: null\n domain: ec2.us-east-1.amazonaws.com\n installation: null\n clusterType: swarm\n role: master\n dockers: mogswitch/InputDistributor:1.0\n public_address: 54.236.50.84\n instanceId: i-0ed68d43eeb58b250\n ethernet_port:\n - {name: p1, subnet_name: s1, address: 192.168.10.10}\n- name: 8fcc1788d9ee462c826572c79fdb2a6a\n type: Switch.nodes.Compute\n nodeType: t2.medium\n OStype: Ubuntu 16.04\n script: null\n domain: ec2.us-east-1.amazonaws.com\n installation: null\n clusterType: swarm\n role: slave\n dockers: mogswitch/ProxyTranscoder:1.0\n public_address: 34.204.6.133\n instanceId: i-0a07f9b98dc32e4b4\n ethernet_port:\n - {name: p1, subnet_name: s1, address: 192.168.10.11}\n"},{"name":"kubernetes","encoding":"UTF-8","value":"54.236.50.84 ubuntu /tmp/Input-683169429052/Virginia.pem master\n34.204.6.133 ubuntu /tmp/Input-683169429052/Virginia.pem slave\n"}]}
\ No newline at end of file
......@@ -15,13 +15,13 @@
*/
package nl.uva.sne.drip.api.dao;
import nl.uva.sne.drip.commons.v1.types.Key;
import nl.uva.sne.drip.commons.v1.types.KeyPair;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
*
* @author S. Koulouzis
*/
public interface KeyDao extends MongoRepository<Key, String> {
public interface KeyPairDao extends MongoRepository<KeyPair, String> {
}
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.api.exception;
/**
*
* @author S. Koulouzis
*/
public class KeyException extends Exception{
public KeyException(String message) {
super(message);
}
}
......@@ -45,7 +45,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import nl.uva.sne.drip.api.dao.DeployDao;
import nl.uva.sne.drip.api.dao.KeyDao;
import nl.uva.sne.drip.api.dao.KeyPairDao;
import nl.uva.sne.drip.commons.v1.types.KeyPair;
/**
*
......@@ -59,7 +60,7 @@ public class DeployService {
private DeployDao deployDao;
@Autowired
KeyDao keyDao;
KeyPairDao keyDao;
@Value("${message.broker.host}")
private String messageBrokerHost;
......@@ -145,9 +146,9 @@ public class DeployService {
String cloudConfID = pro.getCloudCredentialsID();
CloudCredentials cCred = cloudCredentialsService.findOne(cloudConfID);
List<String> loginKeysIDs = cCred.getKeyIDs();
List<Key> loginKeys = new ArrayList<>();
List<KeyPair> loginKeys = new ArrayList<>();
for (String keyID : loginKeysIDs) {
Key key = keyDao.findOne(keyID);
KeyPair key = keyDao.findOne(keyID);
loginKeys.add(key);
}
......@@ -178,16 +179,16 @@ public class DeployService {
deployDao.deleteAll();
}
private MessageParameter createCredentialPartameter(DeployParameter dp, List<Key> loginKeys) {
private MessageParameter createCredentialPartameter(DeployParameter dp, List<KeyPair> loginKeys) {
String cName = dp.getCloudCertificateName();
MessageParameter messageParameter = new MessageParameter();
messageParameter.setName("credential");
messageParameter.setEncoding("UTF-8");
String key = null;
for (Key lk : loginKeys) {
String lkName = lk.getAttributes().get("domain_name");
for (KeyPair lk : loginKeys) {
String lkName = lk.getPrivateKey().getAttributes().get("domain_name");
if (lkName.equals(cName)) {
key = lk.getKey();
key = lk.getPrivateKey().getKey();
break;
}
}
......
......@@ -18,34 +18,34 @@ package nl.uva.sne.drip.api.service;
import java.util.ArrayList;
import java.util.List;
import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.commons.v1.types.Key;
import nl.uva.sne.drip.commons.v1.types.KeyPair;
import nl.uva.sne.drip.commons.v1.types.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import nl.uva.sne.drip.api.dao.KeyDao;
import nl.uva.sne.drip.api.dao.KeyPairDao;
import nl.uva.sne.drip.commons.v1.types.KeyPair;
/**
*
* @author S. Koulouzis
*/
@Service
public class KeyService {
public class KeyPairService {
@Autowired
KeyDao dao;
KeyPairDao dao;
@PostFilter("(filterObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))")
public List<Key> findAll() {
public List<KeyPair> findAll() {
return dao.findAll();
}
@PostAuthorize("(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))")
public Key findOne(String id) {
Key key = dao.findOne(id);
public KeyPair findOne(String id) {
KeyPair key = dao.findOne(id);
if (key == null) {
throw new NotFoundException();
}
......@@ -53,13 +53,13 @@ public class KeyService {
}
@PostAuthorize("(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))")
public Key delete(Key k) {
public KeyPair delete(KeyPair k) {
k = dao.findOne(k.getId());
dao.delete(k);
return k;
}
public Key save(Key upk) {
public KeyPair save(KeyPair upk) {
User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
String owner = user.getUsername();
upk.setOwner(owner);
......
......@@ -27,7 +27,6 @@ import java.util.Set;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import nl.uva.sne.drip.api.dao.KeyDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import nl.uva.sne.drip.api.exception.BadRequestException;
......@@ -41,7 +40,6 @@ import nl.uva.sne.drip.api.v1.rest.ProvisionController;
import nl.uva.sne.drip.commons.utils.Converter;
import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import nl.uva.sne.drip.commons.v1.types.DeployParameter;
import nl.uva.sne.drip.commons.v1.types.Key;
import nl.uva.sne.drip.commons.v1.types.Message;
import nl.uva.sne.drip.commons.v1.types.MessageParameter;
import nl.uva.sne.drip.commons.v1.types.PlanResponse;
......@@ -57,6 +55,8 @@ import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContextHolder;
import nl.uva.sne.drip.api.dao.ProvisionResponseDao;
import nl.uva.sne.drip.api.dao.KeyPairDao;
import nl.uva.sne.drip.commons.v1.types.KeyPair;
/**
*
......@@ -70,7 +70,7 @@ public class ProvisionService {
private ProvisionResponseDao provisionDao;
@Autowired
private KeyDao keyDao;
private KeyPairDao keyDao;
@Autowired
private CloudCredentialsService cloudCredentialsService;
......@@ -82,7 +82,7 @@ public class ProvisionService {
private ScriptService userScriptService;
@Autowired
private KeyService userKeysService;
private KeyPairService userKeysService;
@Value("${message.broker.host}")
private String messageBrokerHost;
......@@ -216,24 +216,24 @@ public class ProvisionService {
private List<MessageParameter> buildCertificatesParam(CloudCredentials cred) {
List<String> loginKeysIDs = cred.getKeyIDs();
List<Key> loginKeys = new ArrayList<>();
List<KeyPair> loginKeys = new ArrayList<>();
for (String keyID : loginKeysIDs) {
Key key = keyDao.findOne(keyID);
KeyPair key = keyDao.findOne(keyID);
loginKeys.add(key);
}
if (loginKeys == null || loginKeys.isEmpty()) {
if (loginKeys.isEmpty()) {
throw new BadRequestException("Log in keys can't be empty");
}
List<MessageParameter> parameters = new ArrayList<>();
for (Key lk : loginKeys) {
String domainName = lk.getAttributes().get("domain_name");
for (KeyPair lk : loginKeys) {
String domainName = lk.getPrivateKey().getAttributes().get("domain_name");
if (domainName == null) {
domainName = lk.getAttributes().get("domain_name ");
domainName = lk.getPrivateKey().getAttributes().get("domain_name ");
}
MessageParameter cert = new MessageParameter();
cert.setName("certificate");
cert.setValue(lk.getKey());
cert.setValue(lk.getPrivateKey().getKey());
Map<String, String> attributes = new HashMap<>();
attributes.put("filename", domainName);
cert.setAttributes(attributes);
......@@ -301,14 +301,14 @@ public class ProvisionService {
}
private List<MessageParameter> buildKeysParams(String userKeyID) {
Key key = userKeysService.findOne(userKeyID);
KeyPair key = userKeysService.findOne(userKeyID);
if (key == null) {
throw new BadRequestException("User key: " + userKeyID + " was not found");
}
List<MessageParameter> parameters = new ArrayList();
MessageParameter keyParameter = new MessageParameter();
keyParameter.setName("sshkey");
keyParameter.setValue(key.getKey());
keyParameter.setValue(key.getPublicKey().getKey());
keyParameter.setEncoding("UTF-8");
parameters.add(keyParameter);
return parameters;
......
......@@ -19,7 +19,10 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.security.RolesAllowed;
import nl.uva.sne.drip.api.exception.KeyException;
import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -30,10 +33,11 @@ import org.springframework.web.bind.annotation.RestController;
import nl.uva.sne.drip.api.exception.NullKeyException;
import nl.uva.sne.drip.api.exception.NullKeyIDException;
import nl.uva.sne.drip.api.service.CloudCredentialsService;
import nl.uva.sne.drip.api.service.KeyService;
import nl.uva.sne.drip.api.service.KeyPairService;
import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.v0.types.Configure;
import nl.uva.sne.drip.commons.v1.types.Key;
import nl.uva.sne.drip.commons.v1.types.KeyPair;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -53,7 +57,7 @@ public class CloudConfigurationController0 {
private CloudCredentialsService cloudCredentialsService;
@Autowired
private KeyService keyService;
private KeyPairService keyService;
@RequestMapping(value = "/ec2", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE)
@RolesAllowed({UserService.USER, UserService.ADMIN})
......@@ -72,13 +76,19 @@ public class CloudConfigurationController0 {
List<String> loginKeyIDs = new ArrayList<>();
for (nl.uva.sne.drip.commons.v0.types.LoginKey0 key0 : configure.loginKey) {
nl.uva.sne.drip.commons.v1.types.Key key1 = new nl.uva.sne.drip.commons.v1.types.Key();
key1.setKey(key0.content);
Map<String, String> attributes = new HashMap<>();
attributes.put("domain_name", key0.domain_name);
key1.setAttributes(attributes);
key1 = keyService.save(key1);
loginKeyIDs.add(key1.getId());
try {
nl.uva.sne.drip.commons.v1.types.Key key1 = new nl.uva.sne.drip.commons.v1.types.Key();
KeyPair pair = new KeyPair();
key1.setKey(key0.content);
Map<String, String> attributes = new HashMap<>();
attributes.put("domain_name", key0.domain_name);
key1.setAttributes(attributes);
pair.setPrivateKey(key1);
pair = keyService.save(pair);
loginKeyIDs.add(pair.getId());
} catch (KeyException ex) {
Logger.getLogger(CloudConfigurationController0.class.getName()).log(Level.SEVERE, null, ex);
}
}
cloudCredentials.setKeyIDs(loginKeyIDs);
cloudCredentials.setCloudProviderName("ec2");
......@@ -105,19 +115,31 @@ public class CloudConfigurationController0 {
List<String> loginKeyIDs = new ArrayList<>();
for (nl.uva.sne.drip.commons.v0.types.LoginKey0 key0 : configure.loginPubKey) {
nl.uva.sne.drip.commons.v1.types.Key key1 = new nl.uva.sne.drip.commons.v1.types.Key();
key1.setKey(key0.content);
key1.setType(Key.Type.PUBLIC);
key1 = keyService.save(key1);
loginKeyIDs.add(key1.getId());
try {
nl.uva.sne.drip.commons.v1.types.Key key1 = new nl.uva.sne.drip.commons.v1.types.Key();
key1.setKey(key0.content);
key1.setType(Key.Type.PUBLIC);
KeyPair pair = new KeyPair();
pair.setPublicKey(key1);
pair = keyService.save(pair);
loginKeyIDs.add(pair.getId());
} catch (KeyException ex) {
Logger.getLogger(CloudConfigurationController0.class.getName()).log(Level.SEVERE, null, ex);
}
}
for (nl.uva.sne.drip.commons.v0.types.LoginKey0 key0 : configure.loginPriKey) {
nl.uva.sne.drip.commons.v1.types.Key key1 = new nl.uva.sne.drip.commons.v1.types.Key();
key1.setKey(key0.content);
key1.setType(Key.Type.PRIVATE);
key1 = keyService.save(key1);
loginKeyIDs.add(key1.getId());
try {
nl.uva.sne.drip.commons.v1.types.Key key1 = new nl.uva.sne.drip.commons.v1.types.Key();
key1.setKey(key0.content);
key1.setType(Key.Type.PRIVATE);
KeyPair pair = new KeyPair();
pair.setPrivateKey(key1);
pair = keyService.save(pair);
loginKeyIDs.add(pair.getId());
} catch (KeyException ex) {
Logger.getLogger(CloudConfigurationController0.class.getName()).log(Level.SEVERE, null, ex);
}
}
cloudCredentials.setKeyIDs(loginKeyIDs);
cloudCredentials.setCloudProviderName("geni");
......
......@@ -36,7 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
import nl.uva.sne.drip.api.service.CloudCredentialsService;
import nl.uva.sne.drip.api.service.PlannerService;
import nl.uva.sne.drip.api.service.ProvisionService;
import nl.uva.sne.drip.api.service.KeyService;
import nl.uva.sne.drip.api.service.KeyPairService;
import nl.uva.sne.drip.api.service.ScriptService;
import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.v0.types.Execute;
......@@ -44,9 +44,8 @@ import nl.uva.sne.drip.commons.v0.types.Attribute;
import nl.uva.sne.drip.commons.v0.types.Result;
import nl.uva.sne.drip.commons.v0.types.Upload;
import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import nl.uva.sne.drip.commons.v1.types.Key;
import nl.uva.sne.drip.commons.v1.types.KeyPair;
import nl.uva.sne.drip.commons.v1.types.ProvisionResponse;
import nl.uva.sne.drip.commons.v1.types.Script;
import org.json.JSONException;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
......@@ -68,7 +67,7 @@ public class ProvisionController0 {
private ScriptService userScriptService;
@Autowired
private KeyService userKeysService;
private KeyPairService userKeysService;
@Autowired
private CloudCredentialsService cloudCredentialsService;
......@@ -105,7 +104,7 @@ public class ProvisionController0 {
topLevelPlan = planService.save(topLevelPlan);
String planID = topLevelPlan.getId();
resp.setPlanID(planID);
List<Key> allKeys = userKeysService.findAll();
List<KeyPair> allKeys = userKeysService.findAll();
if (allKeys != null && !allKeys.isEmpty()) {
String userKeyID = allKeys.get(0).getId();
resp.setPublicKeyID(userKeyID);
......
......@@ -15,7 +15,10 @@
*/
package nl.uva.sne.drip.api.v0.rest;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.security.RolesAllowed;
import nl.uva.sne.drip.api.exception.KeyException;
import nl.uva.sne.drip.api.service.ProvisionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -23,10 +26,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import nl.uva.sne.drip.api.service.KeyService;
import nl.uva.sne.drip.api.service.KeyPairService;
import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.v0.types.ConfUserKey;
import nl.uva.sne.drip.commons.v1.types.Key;
import nl.uva.sne.drip.commons.v1.types.KeyPair;
import nl.uva.sne.drip.commons.v1.types.ProvisionRequest;
import nl.uva.sne.drip.commons.v1.types.ProvisionResponse;
import org.springframework.http.MediaType;
......@@ -45,7 +49,7 @@ import org.springframework.web.bind.annotation.RequestBody;
public class UserPublicKeysController0 {
@Autowired
private KeyService service;
private KeyPairService service;
@Autowired
private ProvisionService provisionService;
......@@ -54,17 +58,23 @@ public class UserPublicKeysController0 {
@RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody
String uploadUserPublicKeys(@RequestBody ConfUserKey confUserKey) {
Key upk = new Key();
upk.setKey(confUserKey.file.get(0).content);
upk.setName(confUserKey.file.get(0).name);
upk.setType(Key.Type.PUBLIC);
try {
KeyPair pair = new KeyPair();
Key upk = new Key();
upk.setKey(confUserKey.file.get(0).content);
upk.setName(confUserKey.file.get(0).name);
upk.setType(Key.Type.PUBLIC);
pair.setPublicKey(upk);
pair = service.save(pair);
upk = service.save(upk);
ProvisionResponse provPlan = provisionService.findOne(confUserKey.action);
provPlan.setPublicKeyID(pair.getId());
provisionService.save(provPlan);
ProvisionResponse provPlan = provisionService.findOne(confUserKey.action);
provPlan.setPublicKeyID(upk.getId());
provisionService.save(provPlan);
return "Success: " + upk.getId();
return "Success: " + pair.getId();
} catch (KeyException ex) {
Logger.getLogger(UserPublicKeysController0.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
}
......@@ -33,12 +33,14 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import nl.uva.sne.drip.api.exception.BadRequestException;
import nl.uva.sne.drip.api.exception.KeyException;
import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.api.exception.NullKeyException;
import nl.uva.sne.drip.api.service.CloudCredentialsService;
import nl.uva.sne.drip.api.service.KeyService;
import nl.uva.sne.drip.api.service.KeyPairService;
import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.v1.types.Key;
import nl.uva.sne.drip.commons.v1.types.KeyPair;
import org.apache.commons.io.FilenameUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -61,7 +63,7 @@ public class CloudCredentialsController {
@Autowired
private CloudCredentialsService cloudCredentialsService;
@Autowired
private KeyService keyService;
private KeyPairService keyService;
/**
* Post the cloud credentials.
......@@ -124,13 +126,15 @@ public class CloudCredentialsController {
Map<String, String> attributes = new HashMap<>();
attributes.put("domain_name", FilenameUtils.removeExtension(originalFileName));
key.setAttributes(attributes);
key = keyService.save(key);
loginKeyIDs.add(key.getId());
KeyPair pair = new KeyPair();
pair.setPrivateKey(key);
pair = keyService.save(pair);
loginKeyIDs.add(pair.getId());
}
cloudCredentials.setKeyIDs(loginKeyIDs);
cloudCredentials = cloudCredentialsService.save(cloudCredentials);
return cloudCredentials.getId();
} catch (IOException ex) {
} catch (IOException | KeyException ex) {
Logger.getLogger(CloudCredentialsController.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
......
......@@ -17,8 +17,6 @@ package nl.uva.sne.drip.commons.v1.types;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.util.Map;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* This class represents a key. This key can be used to either login to a VM
......@@ -27,11 +25,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
*
* @author S. Koulouzis
*/
@Document
public class Key extends OwnedObject {
@Id
private String id;
public class Key{
private Map<String, String> attributes;
......@@ -54,20 +48,6 @@ public class Key extends OwnedObject {
this.name = name;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
public static enum Type {
PRIVATE,
PUBLIC
......
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.commons.v1.types;
import nl.uva.sne.drip.api.exception.KeyException;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* This class hold the pair of public private keys. The kyes may be used for
* logging in VMs.
*
* @author S. Koulouzis
*/
@Document
public class KeyPair extends OwnedObject {
@Id
private String id;
private Key privateKey;
private Key publicKey;
/**
* @return the privateKey
*/
public Key getPrivateKey() {
return privateKey;
}
/**
* @param privateKey the privateKey to set
* @throws nl.uva.sne.drip.api.exception.KeyException
*/
public void setPrivateKey(Key privateKey) throws KeyException {
if (privateKey.getType() != Key.Type.PRIVATE) {
throw new KeyException("Trying to add public key to private");
}
this.privateKey = privateKey;
}
/**
* @return the publicKey
*/
public Key getPublicKey() {
return publicKey;
}
/**
* @param publicKey the publicKey to set
* @throws nl.uva.sne.drip.api.exception.KeyException
*/
public void setPublicKey(Key publicKey) throws KeyException {
if (privateKey.getType() != Key.Type.PUBLIC) {
throw new KeyException("Trying to add private to public");
}
this.publicKey = publicKey;
}
/**
* @return the id
*/
public String getId() {
return id;
}
}
......@@ -59,7 +59,8 @@ def install_prerequisites(vm):
stdout.read()
parentDir = os.path.dirname(os.path.abspath(vm.key))
os.chmod(parentDir, 770)
#os.chmod(parentDir, 700)
os.chmod(vm.key, 0o444)
print "Ansible prerequisites installed in: %s " % (vm.ip)
except Exception as e:
print '%s: %s' % (vm.ip, e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment