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

Changed key to KeyPair

parent 0ab2be69
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<h1 class="page-header">Files and Libraries</h1> <h1 class="page-header">Files and Libraries</h1>
<h3 id="artifact_gwt_json_overlay">GWT JSON Overlay</h3> <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> <p> <p>
The <a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a> JSON Overlay library provides the JSON Overlays that 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. can be used to access the Web service API for this application.
...@@ -91,13 +91,13 @@ ...@@ -91,13 +91,13 @@
<tbody data-link="row" class="rowlink"> <tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-gwt-json-overlay.jar"> <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-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> <td><span class="downloadfile-description">The sources for the GWT JSON overlay.</span></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3 id="artifact_java_json_client_library">Java JSON Client Library</h3> <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> <p><p>
The Java client-side library is used to provide the set of Java objects that can be serialized 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 to/from JSON using <a href="http://jackson.codehaus.org/">Jackson</a>. This is useful for accessing the
...@@ -116,18 +116,18 @@ ...@@ -116,18 +116,18 @@
<tbody data-link="row" class="rowlink"> <tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-json-client.jar"> <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-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> <td><span class="downloadfile-description">The binaries for the Java JSON client library.</span></td>
</tr> </tr>
<tr class="clickable-row" data-href="drip-api-json-client-json-sources.jar"> <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-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> <td><span class="downloadfile-description">The sources for the Java JSON client library.</span></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3 id="artifact_java_xml_client_library">Java XML Client Library</h3> <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> <p><p>
The Java client-side library is used to access the Web service API for this application using Java. The Java client-side library is used to access the Web service API for this application using Java.
</p> </p>
...@@ -144,18 +144,18 @@ ...@@ -144,18 +144,18 @@
<tbody data-link="row" class="rowlink"> <tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-xml-client.jar"> <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-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> <td><span class="downloadfile-description">The binaries for the Java XML client library.</span></td>
</tr> </tr>
<tr class="clickable-row" data-href="drip-api-xml-client-xml-sources.jar"> <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-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> <td><span class="downloadfile-description">The sources for the Java XML client library.</span></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3 id="artifact_js_client_library">JavaScript Client Library</h3> <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> <p><p>
The JavaScript client-side library defines classes that can be (de)serialized to/from JSON. 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 This is useful for accessing the resources that are published by this application, but only
...@@ -184,13 +184,13 @@ ...@@ -184,13 +184,13 @@
<tbody data-link="row" class="rowlink"> <tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-js.zip"> <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-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> <td><span class="downloadfile-description">&nbsp;</span></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3 id="artifact_php_json_client_library">PHP JSON Client Library</h3> <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> <p><p>
The PHP JSON client-side library defines the PHP classes that can be (de)serialized to/from JSON. 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 This is useful for accessing the resources that are published by this application, but only
...@@ -213,13 +213,13 @@ ...@@ -213,13 +213,13 @@
<tbody data-link="row" class="rowlink"> <tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-php.zip"> <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-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> <td><span class="downloadfile-description">&nbsp;</span></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3 id="artifact_php_xml_client_library">PHP XML Client Library</h3> <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> <p><p>
The PHP client-side library defines the PHP classes that can be (de)serialized to/from XML. 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 This is useful for accessing the resources that are published by this application, but only
...@@ -245,13 +245,13 @@ ...@@ -245,13 +245,13 @@
<tbody data-link="row" class="rowlink"> <tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api-php.zip"> <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-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> <td><span class="downloadfile-description">&nbsp;</span></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3 id="artifact_ruby_json_client_library">Ruby JSON Client Library</h3> <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> <p><p>
The Ruby JSON client-side library defines the Ruby classes that can be (de)serialized to/from JSON. 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 This is useful for accessing the REST endpoints that are published by this application, but only
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
<tbody data-link="row" class="rowlink"> <tbody data-link="row" class="rowlink">
<tr class="clickable-row" data-href="drip-api.rb"> <tr class="clickable-row" data-href="drip-api.rb">
<td><span class="downloadfile-name">drip-api.rb</span></td> <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> <td><span class="downloadfile-description">&nbsp;</span></td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -988,8 +988,6 @@ module Types ...@@ -988,8 +988,6 @@ module Types
# #
attr_accessor :name attr_accessor :name
# the id
attr_accessor :id
# the type # the type
attr_accessor :type attr_accessor :type
# the attributes # the attributes
...@@ -1001,7 +999,6 @@ module Types ...@@ -1001,7 +999,6 @@ module Types
def to_jaxb_json_hash def to_jaxb_json_hash
_h = super _h = super
_h['name'] = name.to_jaxb_json_hash unless name.nil? _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['type'] = type.to_jaxb_json_hash unless type.nil?
_h['attributes'] = attributes.to_jaxb_json_hash unless attributes.nil? _h['attributes'] = attributes.to_jaxb_json_hash unless attributes.nil?
_h['key'] = key.to_jaxb_json_hash unless key.nil? _h['key'] = key.to_jaxb_json_hash unless key.nil?
...@@ -1030,25 +1027,6 @@ module Types ...@@ -1030,25 +1027,6 @@ module Types
@name = _oa @name = _oa
end end
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? if !_o['type'].nil?
_oa = _o['type'] _oa = _o['type']
if(_oa.is_a? Hash) if(_oa.is_a? Hash)
...@@ -1417,65 +1395,43 @@ module V1 ...@@ -1417,65 +1395,43 @@ module V1
module Types module Types
# (no documentation provided) # (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) # the name
attr_accessor :key attr_accessor :name
# the id
attr_accessor :id
# the json hash for this DeployResponse # the json hash for this ToscaRepresentation
def to_jaxb_json_hash def to_jaxb_json_hash
_h = super _h = super
_h['key'] = key.to_jaxb_json_hash unless key.nil? _h['name'] = name.to_jaxb_json_hash unless name.nil?
_h['id'] = id.to_jaxb_json_hash unless id.nil?
return _h return _h
end end
#initializes this DeployResponse with a json hash #initializes this ToscaRepresentation with a json hash
def init_jaxb_json_hash(_o) def init_jaxb_json_hash(_o)
super _o super _o
if !_o['key'].nil? if !_o['name'].nil?
_oa = _o['key'] _oa = _o['name']
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(_oa.is_a? Hash) if(_oa.is_a? Hash)
@id = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class'] @name = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@id = String.from_json(_oa) unless _oa['@class'] @name = String.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array) elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar #an array(of hashes hopefully) or scalar
@id = Array.new @name = Array.new
_oa.each { | _item | _oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true) if ((_item.nil? || _item['@class'].nil?)rescue true)
@id.push String.from_json(_item) @name.push String.from_json(_item)
else else
@id.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item) @name.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end end
} }
else else
@id = _oa @name = _oa
end end
end end
end end
# constructs a DeployResponse from a (parsed) JSON hash # constructs a ToscaRepresentation from a (parsed) JSON hash
def self.from_json(o) def self.from_json(o)
if o.nil? if o.nil?
return nil return nil
...@@ -1516,43 +1472,65 @@ module V1 ...@@ -1516,43 +1472,65 @@ module V1
module Types module Types
# (no documentation provided) # (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 # (no documentation provided)
attr_accessor :name 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 def to_jaxb_json_hash
_h = super _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 return _h
end end
#initializes this ToscaRepresentation with a json hash #initializes this DeployResponse with a json hash
def init_jaxb_json_hash(_o) def init_jaxb_json_hash(_o)
super _o super _o
if !_o['name'].nil? if !_o['key'].nil?
_oa = _o['name'] _oa = _o['key']
if(_oa.is_a? Hash) if(_oa.is_a? Hash)
@name = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class'] @key = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@name = String.from_json(_oa) unless _oa['@class'] @key = Nl::Uva::Sne::Drip::Commons::V1::Types::Key.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array) elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar #an array(of hashes hopefully) or scalar
@name = Array.new @key = Array.new
_oa.each { | _item | _oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true) 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 else
@name.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item) @key.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end end
} }
else 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 end
end end
# constructs a ToscaRepresentation from a (parsed) JSON hash # constructs a DeployResponse from a (parsed) JSON hash
def self.from_json(o) def self.from_json(o)
if o.nil? if o.nil?
return nil return nil
......
...@@ -139,7 +139,6 @@ ...@@ -139,7 +139,6 @@
<pre class="prettyprint language-js example">{ <pre class="prettyprint language-js example">{
&quot;key&quot; : { &quot;key&quot; : {
&quot;name&quot; : &quot;id_dsa.pub&quot;, &quot;name&quot; : &quot;id_dsa.pub&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;, &quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : { &quot;attributes&quot; : {
&quot;property1&quot; : &quot;domain_name:Virginia&quot;, &quot;property1&quot; : &quot;domain_name:Virginia&quot;,
......
...@@ -88,15 +88,6 @@ from the machine the keys correspond to.</p> ...@@ -88,15 +88,6 @@ from the machine the keys correspond to.</p>
</span> </span>
</td> </td>
<td> <span class="property-description">The name of the key.</span> <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> </td>
</tr> </tr>
<tr> <tr>
...@@ -145,7 +136,6 @@ to specify the domain name for ec2</span> ...@@ -145,7 +136,6 @@ to specify the domain name for ec2</span>
<pre class="prettyprint language-js example">{ <pre class="prettyprint language-js example">{
&quot;name&quot; : &quot;id_dsa.pub&quot;, &quot;name&quot; : &quot;id_dsa.pub&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;, &quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : { &quot;attributes&quot; : {
&quot;property1&quot; : &quot;domain_name:Virginia&quot;, &quot;property1&quot; : &quot;domain_name:Virginia&quot;,
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>Subtypes</dt> <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> </dl>
<table class="table datatype-properties"> <table class="table datatype-properties">
......
...@@ -339,8 +339,6 @@ from the machine the keys correspond to.]]> ...@@ -339,8 +339,6 @@ from the machine the keys correspond to.]]>
</xs:documentation> </xs:documentation>
</xs:annotation> </xs:annotation>
</xs:element> </xs:element>
<xs:element name="id" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="type" type="type" minOccurs="0"> <xs:element name="type" type="type" minOccurs="0">
<xs:annotation> <xs:annotation>
<xs:documentation> <xs:documentation>
......
...@@ -489,7 +489,6 @@ Content-Type: application/json ...@@ -489,7 +489,6 @@ Content-Type: application/json
{ {
&quot;key&quot; : { &quot;key&quot; : {
&quot;name&quot; : &quot;id_dsa.pub&quot;, &quot;name&quot; : &quot;id_dsa.pub&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;, &quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : { &quot;attributes&quot; : {
&quot;property1&quot; : &quot;domain_name:Virginia&quot;, &quot;property1&quot; : &quot;domain_name:Virginia&quot;,
......
...@@ -163,7 +163,6 @@ Accept: application/json ...@@ -163,7 +163,6 @@ Accept: application/json
<code class="prettyprint language-js"> <code class="prettyprint language-js">
{ {
&quot;name&quot; : &quot;id_dsa.pub&quot;, &quot;name&quot; : &quot;id_dsa.pub&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;, &quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : { &quot;attributes&quot; : {
&quot;property1&quot; : &quot;domain_name:Virginia&quot;, &quot;property1&quot; : &quot;domain_name:Virginia&quot;,
...@@ -360,7 +359,6 @@ Content-Type: application/json ...@@ -360,7 +359,6 @@ Content-Type: application/json
<code class="prettyprint language-js"> <code class="prettyprint language-js">
{ {
&quot;name&quot; : &quot;id_dsa.pub&quot;, &quot;name&quot; : &quot;id_dsa.pub&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;, &quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : { &quot;attributes&quot; : {
&quot;property1&quot; : &quot;domain_name:Virginia&quot;, &quot;property1&quot; : &quot;domain_name:Virginia&quot;,
...@@ -604,7 +602,6 @@ Content-Type: application/json ...@@ -604,7 +602,6 @@ Content-Type: application/json
<code class="prettyprint language-js"> <code class="prettyprint language-js">
{ {
&quot;name&quot; : &quot;id_dsa.pub&quot;, &quot;name&quot; : &quot;id_dsa.pub&quot;,
&quot;id&quot; : &quot;...&quot;,
&quot;type&quot; : &quot;PRIVATE&quot;, &quot;type&quot; : &quot;PRIVATE&quot;,
&quot;attributes&quot; : { &quot;attributes&quot; : {
&quot;property1&quot; : &quot;domain_name:Virginia&quot;, &quot;property1&quot; : &quot;domain_name:Virginia&quot;,
......
...@@ -188,7 +188,6 @@ ...@@ -188,7 +188,6 @@
<pre class="prettyprint language-xml example">&lt;d-----&gt; <pre class="prettyprint language-xml example">&lt;d-----&gt;
&lt;key&gt; &lt;key&gt;
&lt;name&gt;id_dsa.pub&lt;/name&gt; &lt;name&gt;id_dsa.pub&lt;/name&gt;
&lt;id&gt;...&lt;/id&gt;
&lt;type&gt;PRIVATE&lt;/type&gt; &lt;type&gt;PRIVATE&lt;/type&gt;
&lt;attributes&gt;domain_name:Virginia&lt;/attributes&gt; &lt;attributes&gt;domain_name:Virginia&lt;/attributes&gt;
&lt;key&gt;-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAm6AALYxkJFNzD3bfVJ4+h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Vpvs5MN48hoUKy5UKpoFeUWrS5QArjtvNCm4SGlXw=\n-----END RSA PRIVATE KEY-----\n&lt;/key&gt;
......
...@@ -105,24 +105,6 @@ from the machine the keys correspond to.</p> ...@@ -105,24 +105,6 @@ from the machine the keys correspond to.</p>
</td> </td>
<td> <span class="property-description">A general use key,value. In the case of the cloud credentials it's used <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> 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> </td>
</tr> </tr>
<tr> <tr>
...@@ -203,7 +185,6 @@ to specify the domain name for ec2</span> ...@@ -203,7 +185,6 @@ to specify the domain name for ec2</span>
<pre class="prettyprint language-xml example">&lt;k-----&gt; <pre class="prettyprint language-xml example">&lt;k-----&gt;
&lt;name&gt;id_dsa.pub&lt;/name&gt; &lt;name&gt;id_dsa.pub&lt;/name&gt;
&lt;id&gt;...&lt;/id&gt;
&lt;type&gt;PRIVATE&lt;/type&gt; &lt;type&gt;PRIVATE&lt;/type&gt;
&lt;attributes&gt;domain_name:Virginia&lt;/attributes&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/JKCYymiBqgSXu3ueFcEzw5SAukARWVjn1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h7VbLmJ3mOylfBmOdzcHeedJQw\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":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"}]}
"creationDate": 1488368936945, \ No newline at end of file
"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"
}
]
}
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
*/ */
package nl.uva.sne.drip.api.dao; 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; import org.springframework.data.mongodb.repository.MongoRepository;
/** /**
* *
* @author S. Koulouzis * @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; ...@@ -45,7 +45,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import nl.uva.sne.drip.api.dao.DeployDao; 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 { ...@@ -59,7 +60,7 @@ public class DeployService {
private DeployDao deployDao; private DeployDao deployDao;
@Autowired @Autowired
KeyDao keyDao; KeyPairDao keyDao;
@Value("${message.broker.host}") @Value("${message.broker.host}")
private String messageBrokerHost; private String messageBrokerHost;
...@@ -145,9 +146,9 @@ public class DeployService { ...@@ -145,9 +146,9 @@ public class DeployService {
String cloudConfID = pro.getCloudCredentialsID(); String cloudConfID = pro.getCloudCredentialsID();
CloudCredentials cCred = cloudCredentialsService.findOne(cloudConfID); CloudCredentials cCred = cloudCredentialsService.findOne(cloudConfID);
List<String> loginKeysIDs = cCred.getKeyIDs(); List<String> loginKeysIDs = cCred.getKeyIDs();
List<Key> loginKeys = new ArrayList<>(); List<KeyPair> loginKeys = new ArrayList<>();
for (String keyID : loginKeysIDs) { for (String keyID : loginKeysIDs) {
Key key = keyDao.findOne(keyID); KeyPair key = keyDao.findOne(keyID);
loginKeys.add(key); loginKeys.add(key);
} }
...@@ -178,16 +179,16 @@ public class DeployService { ...@@ -178,16 +179,16 @@ public class DeployService {
deployDao.deleteAll(); deployDao.deleteAll();
} }
private MessageParameter createCredentialPartameter(DeployParameter dp, List<Key> loginKeys) { private MessageParameter createCredentialPartameter(DeployParameter dp, List<KeyPair> loginKeys) {
String cName = dp.getCloudCertificateName(); String cName = dp.getCloudCertificateName();
MessageParameter messageParameter = new MessageParameter(); MessageParameter messageParameter = new MessageParameter();
messageParameter.setName("credential"); messageParameter.setName("credential");
messageParameter.setEncoding("UTF-8"); messageParameter.setEncoding("UTF-8");
String key = null; String key = null;
for (Key lk : loginKeys) { for (KeyPair lk : loginKeys) {
String lkName = lk.getAttributes().get("domain_name"); String lkName = lk.getPrivateKey().getAttributes().get("domain_name");
if (lkName.equals(cName)) { if (lkName.equals(cName)) {
key = lk.getKey(); key = lk.getPrivateKey().getKey();
break; break;
} }
} }
......
...@@ -18,34 +18,34 @@ package nl.uva.sne.drip.api.service; ...@@ -18,34 +18,34 @@ package nl.uva.sne.drip.api.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import nl.uva.sne.drip.api.exception.NotFoundException; 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 nl.uva.sne.drip.commons.v1.types.User;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PostAuthorize; import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PostFilter; import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service; 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 * @author S. Koulouzis
*/ */
@Service @Service
public class KeyService { public class KeyPairService {
@Autowired @Autowired
KeyDao dao; KeyPairDao dao;
@PostFilter("(filterObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))") @PostFilter("(filterObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))")
public List<Key> findAll() { public List<KeyPair> findAll() {
return dao.findAll(); return dao.findAll();
} }
@PostAuthorize("(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))") @PostAuthorize("(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))")
public Key findOne(String id) { public KeyPair findOne(String id) {
Key key = dao.findOne(id); KeyPair key = dao.findOne(id);
if (key == null) { if (key == null) {
throw new NotFoundException(); throw new NotFoundException();
} }
...@@ -53,13 +53,13 @@ public class KeyService { ...@@ -53,13 +53,13 @@ public class KeyService {
} }
@PostAuthorize("(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))") @PostAuthorize("(returnObject.owner == authentication.name) or (hasRole('ROLE_ADMIN'))")
public Key delete(Key k) { public KeyPair delete(KeyPair k) {
k = dao.findOne(k.getId()); k = dao.findOne(k.getId());
dao.delete(k); dao.delete(k);
return k; return k;
} }
public Key save(Key upk) { public KeyPair save(KeyPair upk) {
User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
String owner = user.getUsername(); String owner = user.getUsername();
upk.setOwner(owner); upk.setOwner(owner);
......
...@@ -27,7 +27,6 @@ import java.util.Set; ...@@ -27,7 +27,6 @@ import java.util.Set;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import nl.uva.sne.drip.api.dao.KeyDao;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import nl.uva.sne.drip.api.exception.BadRequestException; import nl.uva.sne.drip.api.exception.BadRequestException;
...@@ -41,7 +40,6 @@ import nl.uva.sne.drip.api.v1.rest.ProvisionController; ...@@ -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.utils.Converter;
import nl.uva.sne.drip.commons.v1.types.CloudCredentials; 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.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.Message;
import nl.uva.sne.drip.commons.v1.types.MessageParameter; import nl.uva.sne.drip.commons.v1.types.MessageParameter;
import nl.uva.sne.drip.commons.v1.types.PlanResponse; import nl.uva.sne.drip.commons.v1.types.PlanResponse;
...@@ -57,6 +55,8 @@ import org.springframework.security.access.prepost.PostFilter; ...@@ -57,6 +55,8 @@ import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import nl.uva.sne.drip.api.dao.ProvisionResponseDao; 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 { ...@@ -70,7 +70,7 @@ public class ProvisionService {
private ProvisionResponseDao provisionDao; private ProvisionResponseDao provisionDao;
@Autowired @Autowired
private KeyDao keyDao; private KeyPairDao keyDao;
@Autowired @Autowired
private CloudCredentialsService cloudCredentialsService; private CloudCredentialsService cloudCredentialsService;
...@@ -82,7 +82,7 @@ public class ProvisionService { ...@@ -82,7 +82,7 @@ public class ProvisionService {
private ScriptService userScriptService; private ScriptService userScriptService;
@Autowired @Autowired
private KeyService userKeysService; private KeyPairService userKeysService;
@Value("${message.broker.host}") @Value("${message.broker.host}")
private String messageBrokerHost; private String messageBrokerHost;
...@@ -216,24 +216,24 @@ public class ProvisionService { ...@@ -216,24 +216,24 @@ public class ProvisionService {
private List<MessageParameter> buildCertificatesParam(CloudCredentials cred) { private List<MessageParameter> buildCertificatesParam(CloudCredentials cred) {
List<String> loginKeysIDs = cred.getKeyIDs(); List<String> loginKeysIDs = cred.getKeyIDs();
List<Key> loginKeys = new ArrayList<>(); List<KeyPair> loginKeys = new ArrayList<>();
for (String keyID : loginKeysIDs) { for (String keyID : loginKeysIDs) {
Key key = keyDao.findOne(keyID); KeyPair key = keyDao.findOne(keyID);
loginKeys.add(key); loginKeys.add(key);
} }
if (loginKeys == null || loginKeys.isEmpty()) { if (loginKeys.isEmpty()) {
throw new BadRequestException("Log in keys can't be empty"); throw new BadRequestException("Log in keys can't be empty");
} }
List<MessageParameter> parameters = new ArrayList<>(); List<MessageParameter> parameters = new ArrayList<>();
for (Key lk : loginKeys) { for (KeyPair lk : loginKeys) {
String domainName = lk.getAttributes().get("domain_name"); String domainName = lk.getPrivateKey().getAttributes().get("domain_name");
if (domainName == null) { if (domainName == null) {
domainName = lk.getAttributes().get("domain_name "); domainName = lk.getPrivateKey().getAttributes().get("domain_name ");
} }
MessageParameter cert = new MessageParameter(); MessageParameter cert = new MessageParameter();
cert.setName("certificate"); cert.setName("certificate");
cert.setValue(lk.getKey()); cert.setValue(lk.getPrivateKey().getKey());
Map<String, String> attributes = new HashMap<>(); Map<String, String> attributes = new HashMap<>();
attributes.put("filename", domainName); attributes.put("filename", domainName);
cert.setAttributes(attributes); cert.setAttributes(attributes);
...@@ -301,14 +301,14 @@ public class ProvisionService { ...@@ -301,14 +301,14 @@ public class ProvisionService {
} }
private List<MessageParameter> buildKeysParams(String userKeyID) { private List<MessageParameter> buildKeysParams(String userKeyID) {
Key key = userKeysService.findOne(userKeyID); KeyPair key = userKeysService.findOne(userKeyID);
if (key == null) { if (key == null) {
throw new BadRequestException("User key: " + userKeyID + " was not found"); throw new BadRequestException("User key: " + userKeyID + " was not found");
} }
List<MessageParameter> parameters = new ArrayList(); List<MessageParameter> parameters = new ArrayList();
MessageParameter keyParameter = new MessageParameter(); MessageParameter keyParameter = new MessageParameter();
keyParameter.setName("sshkey"); keyParameter.setName("sshkey");
keyParameter.setValue(key.getKey()); keyParameter.setValue(key.getPublicKey().getKey());
keyParameter.setEncoding("UTF-8"); keyParameter.setEncoding("UTF-8");
parameters.add(keyParameter); parameters.add(keyParameter);
return parameters; return parameters;
......
...@@ -19,7 +19,10 @@ import java.util.ArrayList; ...@@ -19,7 +19,10 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.security.RolesAllowed; import javax.annotation.security.RolesAllowed;
import nl.uva.sne.drip.api.exception.KeyException;
import nl.uva.sne.drip.commons.v1.types.CloudCredentials; import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -30,10 +33,11 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -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.NullKeyException;
import nl.uva.sne.drip.api.exception.NullKeyIDException; import nl.uva.sne.drip.api.exception.NullKeyIDException;
import nl.uva.sne.drip.api.service.CloudCredentialsService; 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.api.service.UserService;
import nl.uva.sne.drip.commons.v0.types.Configure; 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.Key;
import nl.uva.sne.drip.commons.v1.types.KeyPair;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -53,7 +57,7 @@ public class CloudConfigurationController0 { ...@@ -53,7 +57,7 @@ public class CloudConfigurationController0 {
private CloudCredentialsService cloudCredentialsService; private CloudCredentialsService cloudCredentialsService;
@Autowired @Autowired
private KeyService keyService; private KeyPairService keyService;
@RequestMapping(value = "/ec2", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE) @RequestMapping(value = "/ec2", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE)
@RolesAllowed({UserService.USER, UserService.ADMIN}) @RolesAllowed({UserService.USER, UserService.ADMIN})
...@@ -72,13 +76,19 @@ public class CloudConfigurationController0 { ...@@ -72,13 +76,19 @@ public class CloudConfigurationController0 {
List<String> loginKeyIDs = new ArrayList<>(); List<String> loginKeyIDs = new ArrayList<>();
for (nl.uva.sne.drip.commons.v0.types.LoginKey0 key0 : configure.loginKey) { 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(); try {
key1.setKey(key0.content); nl.uva.sne.drip.commons.v1.types.Key key1 = new nl.uva.sne.drip.commons.v1.types.Key();
Map<String, String> attributes = new HashMap<>(); KeyPair pair = new KeyPair();
attributes.put("domain_name", key0.domain_name); key1.setKey(key0.content);
key1.setAttributes(attributes); Map<String, String> attributes = new HashMap<>();
key1 = keyService.save(key1); attributes.put("domain_name", key0.domain_name);
loginKeyIDs.add(key1.getId()); 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.setKeyIDs(loginKeyIDs);
cloudCredentials.setCloudProviderName("ec2"); cloudCredentials.setCloudProviderName("ec2");
...@@ -105,19 +115,31 @@ public class CloudConfigurationController0 { ...@@ -105,19 +115,31 @@ public class CloudConfigurationController0 {
List<String> loginKeyIDs = new ArrayList<>(); List<String> loginKeyIDs = new ArrayList<>();
for (nl.uva.sne.drip.commons.v0.types.LoginKey0 key0 : configure.loginPubKey) { 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(); try {
key1.setKey(key0.content); nl.uva.sne.drip.commons.v1.types.Key key1 = new nl.uva.sne.drip.commons.v1.types.Key();
key1.setType(Key.Type.PUBLIC); key1.setKey(key0.content);
key1 = keyService.save(key1); key1.setType(Key.Type.PUBLIC);
loginKeyIDs.add(key1.getId()); 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) { 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(); try {
key1.setKey(key0.content); nl.uva.sne.drip.commons.v1.types.Key key1 = new nl.uva.sne.drip.commons.v1.types.Key();
key1.setType(Key.Type.PRIVATE); key1.setKey(key0.content);
key1 = keyService.save(key1); key1.setType(Key.Type.PRIVATE);
loginKeyIDs.add(key1.getId()); 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.setKeyIDs(loginKeyIDs);
cloudCredentials.setCloudProviderName("geni"); cloudCredentials.setCloudProviderName("geni");
......
...@@ -36,7 +36,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -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.CloudCredentialsService;
import nl.uva.sne.drip.api.service.PlannerService; import nl.uva.sne.drip.api.service.PlannerService;
import nl.uva.sne.drip.api.service.ProvisionService; 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.ScriptService;
import nl.uva.sne.drip.api.service.UserService; import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.v0.types.Execute; import nl.uva.sne.drip.commons.v0.types.Execute;
...@@ -44,9 +44,8 @@ import nl.uva.sne.drip.commons.v0.types.Attribute; ...@@ -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.Result;
import nl.uva.sne.drip.commons.v0.types.Upload; 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.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.ProvisionResponse;
import nl.uva.sne.drip.commons.v1.types.Script;
import org.json.JSONException; import org.json.JSONException;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
...@@ -68,7 +67,7 @@ public class ProvisionController0 { ...@@ -68,7 +67,7 @@ public class ProvisionController0 {
private ScriptService userScriptService; private ScriptService userScriptService;
@Autowired @Autowired
private KeyService userKeysService; private KeyPairService userKeysService;
@Autowired @Autowired
private CloudCredentialsService cloudCredentialsService; private CloudCredentialsService cloudCredentialsService;
...@@ -105,7 +104,7 @@ public class ProvisionController0 { ...@@ -105,7 +104,7 @@ public class ProvisionController0 {
topLevelPlan = planService.save(topLevelPlan); topLevelPlan = planService.save(topLevelPlan);
String planID = topLevelPlan.getId(); String planID = topLevelPlan.getId();
resp.setPlanID(planID); resp.setPlanID(planID);
List<Key> allKeys = userKeysService.findAll(); List<KeyPair> allKeys = userKeysService.findAll();
if (allKeys != null && !allKeys.isEmpty()) { if (allKeys != null && !allKeys.isEmpty()) {
String userKeyID = allKeys.get(0).getId(); String userKeyID = allKeys.get(0).getId();
resp.setPublicKeyID(userKeyID); resp.setPublicKeyID(userKeyID);
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
*/ */
package nl.uva.sne.drip.api.v0.rest; package nl.uva.sne.drip.api.v0.rest;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.security.RolesAllowed; import javax.annotation.security.RolesAllowed;
import nl.uva.sne.drip.api.exception.KeyException;
import nl.uva.sne.drip.api.service.ProvisionService; import nl.uva.sne.drip.api.service.ProvisionService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -23,10 +26,11 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -23,10 +26,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; 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.api.service.UserService;
import nl.uva.sne.drip.commons.v0.types.ConfUserKey; 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.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.ProvisionRequest;
import nl.uva.sne.drip.commons.v1.types.ProvisionResponse; import nl.uva.sne.drip.commons.v1.types.ProvisionResponse;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
...@@ -45,7 +49,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -45,7 +49,7 @@ import org.springframework.web.bind.annotation.RequestBody;
public class UserPublicKeysController0 { public class UserPublicKeysController0 {
@Autowired @Autowired
private KeyService service; private KeyPairService service;
@Autowired @Autowired
private ProvisionService provisionService; private ProvisionService provisionService;
...@@ -54,17 +58,23 @@ public class UserPublicKeysController0 { ...@@ -54,17 +58,23 @@ public class UserPublicKeysController0 {
@RolesAllowed({UserService.USER, UserService.ADMIN}) @RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody public @ResponseBody
String uploadUserPublicKeys(@RequestBody ConfUserKey confUserKey) { String uploadUserPublicKeys(@RequestBody ConfUserKey confUserKey) {
Key upk = new Key(); try {
upk.setKey(confUserKey.file.get(0).content); KeyPair pair = new KeyPair();
upk.setName(confUserKey.file.get(0).name); Key upk = new Key();
upk.setType(Key.Type.PUBLIC); 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); return "Success: " + pair.getId();
provPlan.setPublicKeyID(upk.getId()); } catch (KeyException ex) {
provisionService.save(provPlan); Logger.getLogger(UserPublicKeysController0.class.getName()).log(Level.SEVERE, null, ex);
}
return "Success: " + upk.getId(); return null;
} }
} }
...@@ -33,12 +33,14 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -33,12 +33,14 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import nl.uva.sne.drip.api.exception.BadRequestException; 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.NotFoundException;
import nl.uva.sne.drip.api.exception.NullKeyException; import nl.uva.sne.drip.api.exception.NullKeyException;
import nl.uva.sne.drip.api.service.CloudCredentialsService; 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.api.service.UserService;
import nl.uva.sne.drip.commons.v1.types.Key; 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.apache.commons.io.FilenameUtils;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -61,7 +63,7 @@ public class CloudCredentialsController { ...@@ -61,7 +63,7 @@ public class CloudCredentialsController {
@Autowired @Autowired
private CloudCredentialsService cloudCredentialsService; private CloudCredentialsService cloudCredentialsService;
@Autowired @Autowired
private KeyService keyService; private KeyPairService keyService;
/** /**
* Post the cloud credentials. * Post the cloud credentials.
...@@ -124,13 +126,15 @@ public class CloudCredentialsController { ...@@ -124,13 +126,15 @@ public class CloudCredentialsController {
Map<String, String> attributes = new HashMap<>(); Map<String, String> attributes = new HashMap<>();
attributes.put("domain_name", FilenameUtils.removeExtension(originalFileName)); attributes.put("domain_name", FilenameUtils.removeExtension(originalFileName));
key.setAttributes(attributes); key.setAttributes(attributes);
key = keyService.save(key); KeyPair pair = new KeyPair();
loginKeyIDs.add(key.getId()); pair.setPrivateKey(key);
pair = keyService.save(pair);
loginKeyIDs.add(pair.getId());
} }
cloudCredentials.setKeyIDs(loginKeyIDs); cloudCredentials.setKeyIDs(loginKeyIDs);
cloudCredentials = cloudCredentialsService.save(cloudCredentials); cloudCredentials = cloudCredentialsService.save(cloudCredentials);
return cloudCredentials.getId(); return cloudCredentials.getId();
} catch (IOException ex) { } catch (IOException | KeyException ex) {
Logger.getLogger(CloudCredentialsController.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(CloudCredentialsController.class.getName()).log(Level.SEVERE, null, ex);
} }
return null; return null;
......
...@@ -17,8 +17,6 @@ package nl.uva.sne.drip.commons.v1.types; ...@@ -17,8 +17,6 @@ package nl.uva.sne.drip.commons.v1.types;
import com.webcohesion.enunciate.metadata.DocumentationExample; import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.util.Map; 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 * 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; ...@@ -27,11 +25,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
* *
* @author S. Koulouzis * @author S. Koulouzis
*/ */
@Document public class Key{
public class Key extends OwnedObject {
@Id
private String id;
private Map<String, String> attributes; private Map<String, String> attributes;
...@@ -54,20 +48,6 @@ public class Key extends OwnedObject { ...@@ -54,20 +48,6 @@ public class Key extends OwnedObject {
this.name = name; 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 { public static enum Type {
PRIVATE, PRIVATE,
PUBLIC 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): ...@@ -59,7 +59,8 @@ def install_prerequisites(vm):
stdout.read() stdout.read()
parentDir = os.path.dirname(os.path.abspath(vm.key)) 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) print "Ansible prerequisites installed in: %s " % (vm.ip)
except Exception as e: except Exception as e:
print '%s: %s' % (vm.ip, 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