Commit c156913c authored by Spiros Koulouzis's avatar Spiros Koulouzis

fixed vm scaling bug

parent 889d2274
......@@ -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 July 17, 2017</p>
<p class="lead">Created July 18, 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.
......@@ -97,7 +97,7 @@
</tbody>
</table>
<h3 id="artifact_java_json_client_library">Java JSON Client Library</h3>
<p class="lead">Created July 17, 2017</p>
<p class="lead">Created July 18, 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
......@@ -121,13 +121,13 @@
</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">13.96K</span></td>
<td><span class="downloadfile-size">13.97K</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 July 17, 2017</p>
<p class="lead">Created July 18, 2017</p>
<p><p>
The Java client-side library is used to access the Web service API for this application using Java.
</p>
......@@ -144,7 +144,7 @@
<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">24.59K</span></td>
<td><span class="downloadfile-size">24.60K</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">
......@@ -155,7 +155,7 @@
</tbody>
</table>
<h3 id="artifact_js_client_library">JavaScript Client Library</h3>
<p class="lead">Created July 17, 2017</p>
<p class="lead">Created July 18, 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
......@@ -190,7 +190,7 @@
</tbody>
</table>
<h3 id="artifact_php_json_client_library">PHP JSON Client Library</h3>
<p class="lead">Created July 17, 2017</p>
<p class="lead">Created July 18, 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">5.78K</span></td>
<td><span class="downloadfile-size">5.79K</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 July 17, 2017</p>
<p class="lead">Created July 18, 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
......@@ -251,7 +251,7 @@
</tbody>
</table>
<h3 id="artifact_ruby_json_client_library">Ruby JSON Client Library</h3>
<p class="lead">Created July 17, 2017</p>
<p class="lead">Created July 18, 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
......
......@@ -1416,50 +1416,50 @@ module Ansible
class BenchmarkResult < Nl::Uva::Sne::Drip::Drip::Commons::Data::V1::External::OwnedObject
# (no documentation provided)
attr_accessor :start
attr_accessor :vmType
# (no documentation provided)
attr_accessor :end
# (no documentation provided)
attr_accessor :delta
attr_accessor :start
# (no documentation provided)
attr_accessor :host
# (no documentation provided)
attr_accessor :cloudDeploymentDomain
attr_accessor :delta
# (no documentation provided)
attr_accessor :vmType
attr_accessor :cloudDeploymentDomain
# the json hash for this BenchmarkResult
def to_jaxb_json_hash
_h = super
_h['start'] = start.to_jaxb_json_hash unless start.nil?
_h['vmType'] = vmType.to_jaxb_json_hash unless vmType.nil?
_h['end'] = end.to_jaxb_json_hash unless end.nil?
_h['delta'] = delta.to_jaxb_json_hash unless delta.nil?
_h['start'] = start.to_jaxb_json_hash unless start.nil?
_h['host'] = host.to_jaxb_json_hash unless host.nil?
_h['delta'] = delta.to_jaxb_json_hash unless delta.nil?
_h['cloudDeploymentDomain'] = cloudDeploymentDomain.to_jaxb_json_hash unless cloudDeploymentDomain.nil?
_h['vmType'] = vmType.to_jaxb_json_hash unless vmType.nil?
return _h
end
#initializes this BenchmarkResult with a json hash
def init_jaxb_json_hash(_o)
super _o
if !_o['start'].nil?
_oa = _o['start']
if !_o['vmType'].nil?
_oa = _o['vmType']
if(_oa.is_a? Hash)
@start = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@start = Time.from_json(_oa) unless _oa['@class']
@vmType = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@vmType = String.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@start = Array.new
@vmType = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@start.push Time.from_json(_item)
@vmType.push String.from_json(_item)
else
@start.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
@vmType.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@start = _oa
@vmType = _oa
end
end
if !_o['end'].nil?
......@@ -1481,23 +1481,23 @@ module Ansible
@end = _oa
end
end
if !_o['delta'].nil?
_oa = _o['delta']
if !_o['start'].nil?
_oa = _o['start']
if(_oa.is_a? Hash)
@delta = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@delta = Time.from_json(_oa) unless _oa['@class']
@start = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@start = Time.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@delta = Array.new
@start = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@delta.push Time.from_json(_item)
@start.push Time.from_json(_item)
else
@delta.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
@start.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@delta = _oa
@start = _oa
end
end
if !_o['host'].nil?
......@@ -1519,42 +1519,42 @@ module Ansible
@host = _oa
end
end
if !_o['cloudDeploymentDomain'].nil?
_oa = _o['cloudDeploymentDomain']
if !_o['delta'].nil?
_oa = _o['delta']
if(_oa.is_a? Hash)
@cloudDeploymentDomain = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@cloudDeploymentDomain = String.from_json(_oa) unless _oa['@class']
@delta = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@delta = Time.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@cloudDeploymentDomain = Array.new
@delta = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@cloudDeploymentDomain.push String.from_json(_item)
@delta.push Time.from_json(_item)
else
@cloudDeploymentDomain.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
@delta.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@cloudDeploymentDomain = _oa
@delta = _oa
end
end
if !_o['vmType'].nil?
_oa = _o['vmType']
if !_o['cloudDeploymentDomain'].nil?
_oa = _o['cloudDeploymentDomain']
if(_oa.is_a? Hash)
@vmType = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@vmType = String.from_json(_oa) unless _oa['@class']
@cloudDeploymentDomain = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@cloudDeploymentDomain = String.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@vmType = Array.new
@cloudDeploymentDomain = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@vmType.push String.from_json(_item)
@cloudDeploymentDomain.push String.from_json(_item)
else
@vmType.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
@cloudDeploymentDomain.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@vmType = _oa
@cloudDeploymentDomain = _oa
end
end
end
......
......@@ -81,25 +81,25 @@ class</p>
</thead>
<tbody>
<tr>
<td> <span class="property-name">end</span>
<td> <span class="property-name">cloudDeploymentDomain</span>
</td>
<td> <span class="datatype-reference">number
<td> <span class="datatype-reference">string
</span>
</td>
<td> <span class="property-description"></span>
</td>
</tr>
<tr>
<td> <span class="property-name">host</span>
<td> <span class="property-name">end</span>
</td>
<td> <span class="datatype-reference">string
<td> <span class="datatype-reference">number
</span>
</td>
<td> <span class="property-description"></span>
</td>
</tr>
<tr>
<td> <span class="property-name">start</span>
<td> <span class="property-name">delta</span>
</td>
<td> <span class="datatype-reference">number
</span>
......@@ -108,9 +108,9 @@ class</p>
</td>
</tr>
<tr>
<td> <span class="property-name">delta</span>
<td> <span class="property-name">host</span>
</td>
<td> <span class="datatype-reference">number
<td> <span class="datatype-reference">string
</span>
</td>
<td> <span class="property-description"></span>
......@@ -126,9 +126,9 @@ class</p>
</td>
</tr>
<tr>
<td> <span class="property-name">cloudDeploymentDomain</span>
<td> <span class="property-name">start</span>
</td>
<td> <span class="datatype-reference">string
<td> <span class="datatype-reference">number
</span>
</td>
<td> <span class="property-description"></span>
......@@ -165,12 +165,12 @@ object is saved.</span></td>
<p class="lead">Example</p>
<pre class="prettyprint language-js example">{
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;end&quot; : 12345,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;start&quot; : 12345,
&quot;delta&quot; : 12345,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;vmType&quot; : &quot;...&quot;,
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;start&quot; : 12345,
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;,
&quot;timestamp&quot; : 1499793079011
......
......@@ -69,7 +69,7 @@ class</p>
<dl class="dl-horizontal">
<dt>Subtypes</dt>
<dd><a href="json_KeyPair.html">KeyPair</a>, <a href="json_AnsibleOutput.html">AnsibleOutput</a>, <a href="json_ScaleRequest.html">ScaleRequest</a>, <a href="json_BenchmarkResult.html">BenchmarkResult</a>, <a href="json_CloudCredentials.html">CloudCredentials</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_Script.html">Script</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a></dd>
<dd><a href="json_KeyPair.html">KeyPair</a>, <a href="json_ScaleRequest.html">ScaleRequest</a>, <a href="json_AnsibleOutput.html">AnsibleOutput</a>, <a href="json_CloudCredentials.html">CloudCredentials</a>, <a href="json_BenchmarkResult.html">BenchmarkResult</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_Script.html">Script</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a></dd>
</dl>
<table class="table datatype-properties">
......
......@@ -804,18 +804,18 @@ class]]>
<xs:complexContent>
<xs:extension base="ownedObject">
<xs:sequence>
<xs:element name="start" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="end" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="vmType" type="xs:string" minOccurs="0">
<xs:element name="cloudDeploymentDomain" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="delta" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="start" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="cloudDeploymentDomain" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="host" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="vmType" type="xs:string" minOccurs="0">
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
......
......@@ -144,12 +144,12 @@ Content-Type: application/json
<code class="prettyprint language-js">
[ {
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;end&quot; : 12345,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;start&quot; : 12345,
&quot;delta&quot; : 12345,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;vmType&quot; : &quot;...&quot;,
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;start&quot; : 12345,
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;,
&quot;timestamp&quot; : 1499793079011
......@@ -514,12 +514,12 @@ Content-Type: application/json
<code class="prettyprint language-js">
{
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;end&quot; : 12345,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;start&quot; : 12345,
&quot;delta&quot; : 12345,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;vmType&quot; : &quot;...&quot;,
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;start&quot; : 12345,
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;,
&quot;timestamp&quot; : 1499793079011
......
......@@ -79,7 +79,7 @@ based the plan generated by the planner</p>
<div id="resource_ProvisionController_deleteAll_DELETE">
<h3><span class="label label-default resource-method">DELETE</span> <span class="resource-path">/user/v1.0/provisioner/all <a href="../user/v1.0/provisioner/all" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
<p></p>
<p>Deletes all entries. Use with caution !</p>
<dl class="dl-horizontal">
<dt>Security Roles Allowed</dt>
......@@ -95,6 +95,10 @@ based the plan generated by the planner</p>
</tr>
</thead>
<tbody>
<tr>
<td><span class="label label-success response-code">200</span></td>
<td><span class="response-condition">Successful delete</span></td>
</tr>
<tr>
<td><span class="label label-warning response-code">401</span></td>
<td><span class="response-condition">Bad credentials</span></td>
......@@ -138,7 +142,7 @@ Accept: application/json
<div class="col-md-6">
<h5>Response</h5>
<pre>
HTTP/1.1 204 Looks Good
HTTP/1.1 200 Looks Good
Content-Type: application/json
<code class="prettyprint language-txt">
......@@ -169,6 +173,10 @@ Content-Type: application/json
</tr>
</thead>
<tbody>
<tr>
<td><span class="label label-success response-code">200</span></td>
<td><span class="response-condition">Successful query</span></td>
</tr>
<tr>
<td><span class="label label-warning response-code">401</span></td>
<td><span class="response-condition">Bad credentials</span></td>
......@@ -580,6 +588,14 @@ Content-Type: application/json
</tr>
</thead>
<tbody>
<tr>
<td><span class="label label-warning response-code">404</span></td>
<td><span class="response-condition">object not found</span></td>
</tr>
<tr>
<td><span class="label label-success response-code">200</span></td>
<td><span class="response-condition">delete successful</span></td>
</tr>
<tr>
<td><span class="label label-warning response-code">401</span></td>
<td><span class="response-condition">Bad credentials</span></td>
......@@ -625,7 +641,7 @@ Accept: application/json
<div class="col-md-6">
<h5>Response</h5>
<pre>
HTTP/1.1 204 Looks Good
HTTP/1.1 200 Looks Good
Content-Type: application/json
<code class="prettyprint language-txt">
......@@ -676,6 +692,14 @@ Content-Type: application/json
</tr>
</thead>
<tbody>
<tr>
<td><span class="label label-warning response-code">404</span></td>
<td><span class="response-condition">object not found</span></td>
</tr>
<tr>
<td><span class="label label-success response-code">200</span></td>
<td><span class="response-condition">object exists</span></td>
</tr>
<tr>
<td><span class="label label-warning response-code">401</span></td>
<td><span class="response-condition">Bad credentials</span></td>
......
......@@ -231,12 +231,12 @@ the DAO saves the object based on the principal how made the call</span></td>
<p class="lead">Example</p>
<pre class="prettyprint language-xml example">&lt;b-----&gt;
&lt;end&gt;...&lt;/end&gt;
&lt;vmType&gt;...&lt;/vmType&gt;
&lt;delta&gt;...&lt;/delta&gt;
&lt;start&gt;...&lt;/start&gt;
&lt;end&gt;...&lt;/end&gt;
&lt;cloudDeploymentDomain&gt;us-east-1&lt;/cloudDeploymentDomain&gt;
&lt;delta&gt;...&lt;/delta&gt;
&lt;host&gt;147.228.242.58&lt;/host&gt;
&lt;vmType&gt;...&lt;/vmType&gt;
&lt;owner&gt;user1&lt;/owner&gt;
&lt;timestamp&gt;1499793079011&lt;/timestamp&gt;
&lt;/b-----&gt;
......
......@@ -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 July 17, 2017</p>
<p class="lead">Created July 18, 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.
......@@ -97,7 +97,7 @@
</tbody>
</table>
<h3 id="artifact_java_json_client_library">Java JSON Client Library</h3>
<p class="lead">Created July 17, 2017</p>
<p class="lead">Created July 18, 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
......@@ -121,13 +121,13 @@
</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">13.96K</span></td>
<td><span class="downloadfile-size">13.97K</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 July 17, 2017</p>
<p class="lead">Created July 18, 2017</p>
<p><p>
The Java client-side library is used to access the Web service API for this application using Java.
</p>
......@@ -144,7 +144,7 @@
<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">24.59K</span></td>
<td><span class="downloadfile-size">24.60K</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">
......@@ -155,7 +155,7 @@
</tbody>
</table>
<h3 id="artifact_js_client_library">JavaScript Client Library</h3>
<p class="lead">Created July 17, 2017</p>
<p class="lead">Created July 18, 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
......@@ -190,7 +190,7 @@
</tbody>
</table>
<h3 id="artifact_php_json_client_library">PHP JSON Client Library</h3>
<p class="lead">Created July 17, 2017</p>
<p class="lead">Created July 18, 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">5.78K</span></td>
<td><span class="downloadfile-size">5.79K</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 July 17, 2017</p>
<p class="lead">Created July 18, 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
......@@ -251,7 +251,7 @@
</tbody>
</table>
<h3 id="artifact_ruby_json_client_library">Ruby JSON Client Library</h3>
<p class="lead">Created July 17, 2017</p>
<p class="lead">Created July 18, 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
......
......@@ -1416,50 +1416,50 @@ module Ansible
class BenchmarkResult < Nl::Uva::Sne::Drip::Drip::Commons::Data::V1::External::OwnedObject
# (no documentation provided)
attr_accessor :start
attr_accessor :vmType
# (no documentation provided)
attr_accessor :end
# (no documentation provided)
attr_accessor :delta
attr_accessor :start
# (no documentation provided)
attr_accessor :host
# (no documentation provided)
attr_accessor :cloudDeploymentDomain
attr_accessor :delta
# (no documentation provided)
attr_accessor :vmType
attr_accessor :cloudDeploymentDomain
# the json hash for this BenchmarkResult
def to_jaxb_json_hash
_h = super
_h['start'] = start.to_jaxb_json_hash unless start.nil?
_h['vmType'] = vmType.to_jaxb_json_hash unless vmType.nil?
_h['end'] = end.to_jaxb_json_hash unless end.nil?
_h['delta'] = delta.to_jaxb_json_hash unless delta.nil?
_h['start'] = start.to_jaxb_json_hash unless start.nil?
_h['host'] = host.to_jaxb_json_hash unless host.nil?
_h['delta'] = delta.to_jaxb_json_hash unless delta.nil?
_h['cloudDeploymentDomain'] = cloudDeploymentDomain.to_jaxb_json_hash unless cloudDeploymentDomain.nil?
_h['vmType'] = vmType.to_jaxb_json_hash unless vmType.nil?
return _h
end
#initializes this BenchmarkResult with a json hash
def init_jaxb_json_hash(_o)
super _o
if !_o['start'].nil?
_oa = _o['start']
if !_o['vmType'].nil?
_oa = _o['vmType']
if(_oa.is_a? Hash)
@start = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@start = Time.from_json(_oa) unless _oa['@class']
@vmType = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@vmType = String.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@start = Array.new
@vmType = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@start.push Time.from_json(_item)
@vmType.push String.from_json(_item)
else
@start.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
@vmType.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@start = _oa
@vmType = _oa
end
end
if !_o['end'].nil?
......@@ -1481,23 +1481,23 @@ module Ansible
@end = _oa
end
end
if !_o['delta'].nil?
_oa = _o['delta']
if !_o['start'].nil?
_oa = _o['start']
if(_oa.is_a? Hash)
@delta = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@delta = Time.from_json(_oa) unless _oa['@class']
@start = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@start = Time.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@delta = Array.new
@start = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@delta.push Time.from_json(_item)
@start.push Time.from_json(_item)
else
@delta.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
@start.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@delta = _oa
@start = _oa
end
end
if !_o['host'].nil?
......@@ -1519,42 +1519,42 @@ module Ansible
@host = _oa
end
end
if !_o['cloudDeploymentDomain'].nil?
_oa = _o['cloudDeploymentDomain']
if !_o['delta'].nil?
_oa = _o['delta']
if(_oa.is_a? Hash)
@cloudDeploymentDomain = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@cloudDeploymentDomain = String.from_json(_oa) unless _oa['@class']
@delta = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@delta = Time.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@cloudDeploymentDomain = Array.new
@delta = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@cloudDeploymentDomain.push String.from_json(_item)
@delta.push Time.from_json(_item)
else
@cloudDeploymentDomain.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
@delta.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@cloudDeploymentDomain = _oa
@delta = _oa
end
end
if !_o['vmType'].nil?
_oa = _o['vmType']
if !_o['cloudDeploymentDomain'].nil?
_oa = _o['cloudDeploymentDomain']
if(_oa.is_a? Hash)
@vmType = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@vmType = String.from_json(_oa) unless _oa['@class']
@cloudDeploymentDomain = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']
@cloudDeploymentDomain = String.from_json(_oa) unless _oa['@class']
elsif (_oa.is_a? Array)
#an array(of hashes hopefully) or scalar
@vmType = Array.new
@cloudDeploymentDomain = Array.new
_oa.each { | _item |
if ((_item.nil? || _item['@class'].nil?)rescue true)
@vmType.push String.from_json(_item)
@cloudDeploymentDomain.push String.from_json(_item)
else
@vmType.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
@cloudDeploymentDomain.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)
end
}
else
@vmType = _oa
@cloudDeploymentDomain = _oa
end
end
end
......
......@@ -81,25 +81,25 @@ class</p>
</thead>
<tbody>
<tr>
<td> <span class="property-name">start</span>
<td> <span class="property-name">vmType</span>
</td>
<td> <span class="datatype-reference">number
<td> <span class="datatype-reference">string
</span>
</td>
<td> <span class="property-description"></span>
</td>
</tr>
<tr>
<td> <span class="property-name">end</span>
<td> <span class="property-name">host</span>
</td>
<td> <span class="datatype-reference">number
<td> <span class="datatype-reference">string
</span>
</td>
<td> <span class="property-description"></span>
</td>
</tr>
<tr>
<td> <span class="property-name">delta</span>
<td> <span class="property-name">end</span>
</td>
<td> <span class="datatype-reference">number
</span>
......@@ -108,9 +108,9 @@ class</p>
</td>
</tr>
<tr>
<td> <span class="property-name">host</span>
<td> <span class="property-name">delta</span>
</td>
<td> <span class="datatype-reference">string
<td> <span class="datatype-reference">number
</span>
</td>
<td> <span class="property-description"></span>
......@@ -126,9 +126,9 @@ class</p>
</td>
</tr>
<tr>
<td> <span class="property-name">vmType</span>
<td> <span class="property-name">start</span>
</td>
<td> <span class="datatype-reference">string
<td> <span class="datatype-reference">number
</span>
</td>
<td> <span class="property-description"></span>
......@@ -165,12 +165,12 @@ object is saved.</span></td>
<p class="lead">Example</p>
<pre class="prettyprint language-js example">{
&quot;start&quot; : 12345,
&quot;vmType&quot; : &quot;...&quot;,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;end&quot; : 12345,
&quot;delta&quot; : 12345,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;vmType&quot; : &quot;...&quot;,
&quot;start&quot; : 12345,
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;,
&quot;timestamp&quot; : 1499793079011
......
......@@ -69,7 +69,7 @@ class</p>
<dl class="dl-horizontal">
<dt>Subtypes</dt>
<dd><a href="json_KeyPair.html">KeyPair</a>, <a href="json_ScaleRequest.html">ScaleRequest</a>, <a href="json_AnsibleOutput.html">AnsibleOutput</a>, <a href="json_CloudCredentials.html">CloudCredentials</a>, <a href="json_BenchmarkResult.html">BenchmarkResult</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_Script.html">Script</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a></dd>
<dd><a href="json_KeyPair.html">KeyPair</a>, <a href="json_ScaleRequest.html">ScaleRequest</a>, <a href="json_AnsibleOutput.html">AnsibleOutput</a>, <a href="json_BenchmarkResult.html">BenchmarkResult</a>, <a href="json_CloudCredentials.html">CloudCredentials</a>, <a href="json_DeployResponse.html">DeployResponse</a>, <a href="json_ProvisionRequest.html">ProvisionRequest</a>, <a href="json_Script.html">Script</a>, <a href="json_KeyValueHolder.html">KeyValueHolder</a>, <a href="json_DeployRequest.html">DeployRequest</a>, <a href="json_ProvisionResponse.html">ProvisionResponse</a></dd>
</dl>
<table class="table datatype-properties">
......
......@@ -804,18 +804,18 @@ class]]>
<xs:complexContent>
<xs:extension base="ownedObject">
<xs:sequence>
<xs:element name="vmType" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="delta" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="cloudDeploymentDomain" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="start" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="host" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="end" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="start" type="xs:dateTime" minOccurs="0">
</xs:element>
<xs:element name="vmType" type="xs:string" minOccurs="0">
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
......
......@@ -144,12 +144,12 @@ Content-Type: application/json
<code class="prettyprint language-js">
[ {
&quot;start&quot; : 12345,
&quot;vmType&quot; : &quot;...&quot;,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;end&quot; : 12345,
&quot;delta&quot; : 12345,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;vmType&quot; : &quot;...&quot;,
&quot;start&quot; : 12345,
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;,
&quot;timestamp&quot; : 1499793079011
......@@ -514,12 +514,12 @@ Content-Type: application/json
<code class="prettyprint language-js">
{
&quot;start&quot; : 12345,
&quot;vmType&quot; : &quot;...&quot;,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;end&quot; : 12345,
&quot;delta&quot; : 12345,
&quot;host&quot; : &quot;147.228.242.58&quot;,
&quot;cloudDeploymentDomain&quot; : &quot;us-east-1&quot;,
&quot;vmType&quot; : &quot;...&quot;,
&quot;start&quot; : 12345,
&quot;owner&quot; : &quot;user1&quot;,
&quot;id&quot; : &quot;58e3946e0fb4f562d84ba1ad&quot;,
&quot;timestamp&quot; : 1499793079011
......
......@@ -79,7 +79,7 @@ based the plan generated by the planner</p>
<div id="resource_ProvisionController_deleteAll_DELETE">
<h3><span class="label label-default resource-method">DELETE</span> <span class="resource-path">/user/v1.0/provisioner/all <a href="./user/v1.0/provisioner/all" class="glyphicon glyphicon-new-window" target="_blank"></a></span></h3>
<p></p>
<p>Deletes all entries. Use with caution !</p>
<dl class="dl-horizontal">
<dt>Security Roles Allowed</dt>
......@@ -95,6 +95,10 @@ based the plan generated by the planner</p>
</tr>
</thead>
<tbody>
<tr>
<td><span class="label label-success response-code">200</span></td>
<td><span class="response-condition">Successful delete</span></td>
</tr>
<tr>
<td><span class="label label-warning response-code">401</span></td>
<td><span class="response-condition">Bad credentials</span></td>
......@@ -138,7 +142,7 @@ Accept: application/json
<div class="col-md-6">
<h5>Response</h5>
<pre>
HTTP/1.1 204 Looks Good
HTTP/1.1 200 Looks Good
Content-Type: application/json
<code class="prettyprint language-txt">
......@@ -169,6 +173,10 @@ Content-Type: application/json
</tr>
</thead>
<tbody>
<tr>
<td><span class="label label-success response-code">200</span></td>
<td><span class="response-condition">Successful query</span></td>
</tr>
<tr>
<td><span class="label label-warning response-code">401</span></td>
<td><span class="response-condition">Bad credentials</span></td>
......@@ -580,6 +588,14 @@ Content-Type: application/json
</tr>
</thead>
<tbody>
<tr>
<td><span class="label label-warning response-code">404</span></td>
<td><span class="response-condition">object not found</span></td>
</tr>
<tr>
<td><span class="label label-success response-code">200</span></td>
<td><span class="response-condition">delete successful</span></td>
</tr>
<tr>
<td><span class="label label-warning response-code">401</span></td>
<td><span class="response-condition">Bad credentials</span></td>
......@@ -625,7 +641,7 @@ Accept: application/json
<div class="col-md-6">
<h5>Response</h5>
<pre>
HTTP/1.1 204 Looks Good
HTTP/1.1 200 Looks Good
Content-Type: application/json
<code class="prettyprint language-txt">
......@@ -676,6 +692,14 @@ Content-Type: application/json
</tr>
</thead>
<tbody>
<tr>
<td><span class="label label-warning response-code">404</span></td>
<td><span class="response-condition">object not found</span></td>
</tr>
<tr>
<td><span class="label label-success response-code">200</span></td>
<td><span class="response-condition">object exists</span></td>
</tr>
<tr>
<td><span class="label label-warning response-code">401</span></td>
<td><span class="response-condition">Bad credentials</span></td>
......
......@@ -231,12 +231,12 @@ the DAO saves the object based on the principal how made the call</span></td>
<p class="lead">Example</p>
<pre class="prettyprint language-xml example">&lt;b-----&gt;
&lt;vmType&gt;...&lt;/vmType&gt;
&lt;delta&gt;...&lt;/delta&gt;
&lt;cloudDeploymentDomain&gt;us-east-1&lt;/cloudDeploymentDomain&gt;
&lt;start&gt;...&lt;/start&gt;
&lt;host&gt;147.228.242.58&lt;/host&gt;
&lt;end&gt;...&lt;/end&gt;
&lt;start&gt;...&lt;/start&gt;
&lt;vmType&gt;...&lt;/vmType&gt;
&lt;owner&gt;user1&lt;/owner&gt;
&lt;timestamp&gt;1499793079011&lt;/timestamp&gt;
&lt;/b-----&gt;
......
/*
* Base structure
*/
/* Move down content because we have a fixed navbar that is 50px tall */
body {
position:relative;
padding-top: 50px;
}
.footer {
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;
}
/*
* Global add-ons
*/
.sub-header {
padding-bottom: 10px;
border-bottom: 1px solid #eee;
}
/*
* Sidebar
*/
/* Hide for mobile, show later */
.sidebar {
display: none;
}
@media (min-width: 768px) {
.sidebar {
position: fixed;
top: 51px;
bottom: 0;
left: 0;
z-index: 1000;
display: block;
padding: 20px;
overflow-x: hidden;
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
background-color: #f5f5f5;
border-right: 1px solid #eee;
}
}
/* Sidebar navigation */
.nav-sidebar {
margin-right: -21px; /* 20px padding + 1px border */
margin-bottom: 20px;
margin-left: -20px;
}
.nav-sidebar > li > a {
padding-right: 20px;
padding-left: 20px;
}
.nav-sidebar > .active > a,
.nav-sidebar > .active > a:hover,
.nav-sidebar > .active > a:focus {
color: #fff;
background-color: #428bca;
}
/*
* Main content
*/
.main {
padding: 20px;
}
@media (min-width: 768px) {
.main {
padding-right: 40px;
padding-left: 40px;
}
}
.main .page-header {
margin-top: 0;
}
.footer > .container {
padding-top: 20px;
text-align: center;
}
/*
* Row Links
*/
.table.rowlink td:not(.rowlink-skip),
.table .rowlink td:not(.rowlink-skip) {
cursor: pointer;
}
.table.rowlink td:not(.rowlink-skip) a,
.table .rowlink td:not(.rowlink-skip) a {
font: inherit;
color: inherit;
text-decoration: inherit;
}
.multi-row-description {
border-left: 1px solid #DDD;
}
pre {
max-height: 40em;
}
/* shift the anchors to accommodate fixed navbar. See https://github.com/twbs/bootstrap/issues/1768#issuecomment-46519033 */
*[id]:before {
display: block;
content: " ";
margin-top: -70px;
height: 70px;
visibility: hidden;
}
......@@ -110,8 +110,10 @@ public class ProvisionService {
ProvisionResponse provisionInfo = provisionDao.findOne(id);
if (provisionInfo != null) {
provisionDao.delete(provisionInfo);
return provisionInfo;
} else {
throw new NotFoundException();
}
return provisionInfo;
}
// @PreAuthorize(" (hasRole('ROLE_ADMIN')) or (hasRole('ROLE_USER'))")
......@@ -440,12 +442,8 @@ public class ProvisionService {
Message provisionerInvokationMessage = buildProvisioner0Message(provisionRequest);
Message response = (provisioner.call(provisionerInvokationMessage));
// Message response = MessageGenerator.generateArtificialMessage(System.getProperty("user.home")
// + File.separator + "workspace" + File.separator + "DRIP"
// + File.separator + "docs" + File.separator + "json_samples"
// + File.separator + "ec2_provisioner_provisoned3.json");
return parseCreateResourcesResponse(response.getParameters(), provisionRequest, null);
return parseCreateResourcesResponse(response.getParameters(), provisionRequest, null, true, true);
}
......@@ -455,7 +453,7 @@ public class ProvisionService {
try (DRIPCaller provisioner = new ProvisionerCaller1(messageBrokerHost);) {
Message provisionerInvokationMessage = buildProvisioner1Message(provisionRequest);
Message response = (provisioner.call(provisionerInvokationMessage));
return parseCreateResourcesResponse(response.getParameters(), provisionRequest, null);
return parseCreateResourcesResponse(response.getParameters(), provisionRequest, null, true, true);
}
}
......@@ -476,6 +474,7 @@ public class ProvisionService {
}
ProvisionResponse provisionInfo = findOne(provisionID);
boolean scaleNameExists = false;
int currentNumOfInstances = 0;
Map<String, Object> plan = provisionInfo.getKeyValue();
String cloudProvider = null;
String domain = null;
......@@ -483,33 +482,48 @@ public class ProvisionService {
Map<String, Object> subMap = (Map<String, Object>) plan.get(key);
if (subMap.containsKey("topologies")) {
List< Map<String, Object>> topologies = (List< Map<String, Object>>) subMap.get("topologies");
for (Map<String, Object> topology : topologies) {
if (topology.get("tag").equals("scaling") && topology.get("topology").equals(scaleName)) {
if (topology.get("tag").equals("scaling") && topology.get("topology").equals(scaleName) && !scaleNameExists) {
cloudProvider = (String) topology.get("cloudProvider");
domain = (String) topology.get("domain");
scaleNameExists = true;
break;
} else if (topology.get("tag").equals("scaled") && topology.get("copyOf").equals(scaleName)) {
currentNumOfInstances++;
}
}
}
if (scaleNameExists) {
break;
}
}
if (!scaleNameExists) {
throw new BadRequestException("Name of topology dosen't exist");
}
try (DRIPCaller provisioner = new ProvisionerCaller1(messageBrokerHost);) {
Map<String, String> extra = new HashMap<>();
extra.put("scale_topology_name", scaleName);
extra.put("number_of_instances", String.valueOf(scaleRequest.getNumOfInstances()));
extra.put("cloud_provider", cloudProvider);
extra.put("domain", domain);
int numOfInstances = Math.abs(currentNumOfInstances - scaleRequest.getNumOfInstances());
Message scaleMessage = buildTopoplogyModificationMessage(provisionInfo, "scale_topology", extra);
Message response = provisioner.call(scaleMessage);
parseCreateResourcesResponse(response.getParameters(), null, provisionInfo);
if (currentNumOfInstances > scaleRequest.getNumOfInstances() && currentNumOfInstances != 0) {
try (DRIPCaller provisioner = new ProvisionerCaller1(messageBrokerHost);) {
Map<String, String> extra = new HashMap<>();
extra.put("scale_topology_name", scaleName);
extra.put("number_of_instances", String.valueOf(numOfInstances));
extra.put("cloud_provider", cloudProvider);
extra.put("domain", domain);
Message scaleMessage = buildTopoplogyModificationMessage(provisionInfo, "scale_topology_down", extra);
Message response = provisioner.call(scaleMessage);
parseCreateResourcesResponse(response.getParameters(), null, provisionInfo, false, false);
}
} else if (currentNumOfInstances < scaleRequest.getNumOfInstances() || currentNumOfInstances == 0) {
try (DRIPCaller provisioner = new ProvisionerCaller1(messageBrokerHost);) {
Map<String, String> extra = new HashMap<>();
extra.put("scale_topology_name", scaleName);
extra.put("number_of_instances", String.valueOf(numOfInstances));
extra.put("cloud_provider", cloudProvider);
extra.put("domain", domain);
Message scaleMessage = buildTopoplogyModificationMessage(provisionInfo, "scale_topology_up", extra);
Message response = provisioner.call(scaleMessage);
parseCreateResourcesResponse(response.getParameters(), null, provisionInfo, false, false);
}
}
return provisionInfo;
}
......@@ -617,7 +631,8 @@ public class ProvisionService {
return parameters;
}
private ProvisionResponse parseCreateResourcesResponse(List<MessageParameter> parameters, ProvisionRequest provisionRequest, ProvisionResponse provisionResponse) throws Exception {
private ProvisionResponse parseCreateResourcesResponse(List<MessageParameter> parameters,
ProvisionRequest provisionRequest, ProvisionResponse provisionResponse, boolean saveUserKeys, boolean saveDeployerKeyI) throws Exception {
if (provisionResponse == null) {
provisionResponse = new ProvisionResponse();
provisionResponse.setTimestamp(System.currentTimeMillis());
......@@ -719,34 +734,59 @@ public class ProvisionService {
if (provisionRequest != null) {
userKeyIds = provisionRequest.getUserKeyPairIDs();
} else {
userKeyIds = provisionResponse.getCloudKeyPairIDs();
userKeyIds = provisionResponse.getUserKeyPairIDs();
}
if (userKeyIds != null && !userKeyIds.isEmpty()) {
} else {
userKeyIds = new ArrayList<>();
if (userKey.getPublicKey() != null) {
userKey = keyPairService.save(userKey);
userKeyIds.add(userKey.getId());
if (saveUserKeys) {
if (userKeyIds != null && !userKeyIds.isEmpty()) {
} else {
userKeyIds = new ArrayList<>();
if (userKey.getPublicKey() != null) {
userKey = keyPairService.save(userKey);
userKeyIds.add(userKey.getId());
}
}
}
ArrayList<String> deployerKeyIds = new ArrayList<>();
if (deployerKey.getPublicKey() != null) {
deployerKey = keyPairService.save(deployerKey);
deployerKeyIds.add(deployerKey.getId());
ArrayList<String> deployerKeyIds = null;
if (saveDeployerKeyI) {
deployerKeyIds = new ArrayList<>();
if (deployerKey.getPublicKey() != null) {
deployerKey = keyPairService.save(deployerKey);
deployerKeyIds.add(deployerKey.getId());
}
}
ArrayList<String> cloudKeyPairIDs = new ArrayList<>();
List<KeyPair> allPirs = keyPairService.findAll();
for (String id : publicCloudKeys.keySet()) {
KeyPair cloudPair = new KeyPair();
cloudPair.setPrivateKey(privateCloudKeys.get(id));
cloudPair.setPublicKey(publicCloudKeys.get(id));
cloudPair.setKeyPairId(id);
cloudPair = keyPairService.save(cloudPair);
cloudKeyPairIDs.add(cloudPair.getId());
}
boolean save = true;
String key_pair_id = privateCloudKeys.get(id).getAttributes().get("key_pair_id");
for (KeyPair p : allPirs) {
Key pk = p.getPrivateKey();
if (pk != null && pk.getAttributes() != null && pk.getAttributes().containsKey("key_pair_id")) {
if (key_pair_id.equals(pk.getAttributes().get("key_pair_id"))) {
save = false;
break;
}
}
}
if (save) {
KeyPair cloudPair = new KeyPair();
cloudPair.setPrivateKey(privateCloudKeys.get(id));
cloudPair.setPublicKey(publicCloudKeys.get(id));
cloudPair.setKeyPairId(id);
cloudPair = keyPairService.save(cloudPair);
cloudKeyPairIDs.add(cloudPair.getId());
}
provisionResponse.setCloudKeyPairIDs(cloudKeyPairIDs);
}
ArrayList<String> existingCloudKeyPairIDs = provisionResponse.getCloudKeyPairIDs();
if (existingCloudKeyPairIDs != null) {
existingCloudKeyPairIDs.addAll(cloudKeyPairIDs);
} else {
existingCloudKeyPairIDs = cloudKeyPairIDs;
}
provisionResponse.setCloudKeyPairIDs(existingCloudKeyPairIDs);
provisionResponse.setDeployParameters(deployParameters);
provisionResponse.setKvMap(kvMap);
......@@ -755,8 +795,12 @@ public class ProvisionService {
provisionResponse.setPlanID(provisionRequest.getPlanID());
}
provisionResponse.setUserKeyPairIDs(userKeyIds);
provisionResponse.setDeployerKeyPairIDs(deployerKeyIds);
if (userKeyIds != null) {
provisionResponse.setUserKeyPairIDs(userKeyIds);
}
if (deployerKeyIds != null) {
provisionResponse.setDeployerKeyPairIDs(deployerKeyIds);
}
provisionResponse = save(provisionResponse);
return provisionResponse;
......
......@@ -67,6 +67,10 @@ public class ProvisionController {
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@RolesAllowed({UserService.USER, UserService.ADMIN})
@StatusCodes({
@ResponseCode(code = 404, condition = "object not found"),
@ResponseCode(code = 200, condition = "object exists")
})
public @ResponseBody
ProvisionResponse get(@PathVariable("id") String id) {
ProvisionResponse pro = provisionService.findOne(id);
......@@ -84,6 +88,10 @@ public class ProvisionController {
*/
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@RolesAllowed({UserService.USER, UserService.ADMIN})
@StatusCodes({
@ResponseCode(code = 404, condition = "object not found"),
@ResponseCode(code = 200, condition = "delete successful")
})
public @ResponseBody
String delete(@PathVariable("id") String id) {
ProvisionResponse provPlan = provisionService.findOne(id);
......@@ -99,8 +107,16 @@ public class ProvisionController {
throw new NotFoundException();
}
/**
* Deletes all entries. Use with caution !
*
* @return
*/
@RequestMapping(value = "/all", method = RequestMethod.DELETE)
@RolesAllowed({UserService.ADMIN})
@StatusCodes({
@ResponseCode(code = 200, condition = "Successful delete")
})
public @ResponseBody
String deleteAll() {
provisionService.deleteAll();
......@@ -114,6 +130,9 @@ public class ProvisionController {
*/
@RequestMapping(value = "/ids", method = RequestMethod.GET)
@RolesAllowed({UserService.USER, UserService.ADMIN})
@StatusCodes({
@ResponseCode(code = 200, condition = "Successful query")
})
public @ResponseBody
List<String> getIds() {
List<ProvisionResponse> all = provisionService.findAll();
......
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