Class: Vra::DeploymentRequest
- Inherits:
-
Object
- Object
- Vra::DeploymentRequest
- Defined in:
- lib/vra/deployment_request.rb
Overview
class that handles the deployment request with catalog
Instance Attribute Summary collapse
-
#catalog_id ⇒ Object
readonly
Returns the value of attribute catalog_id.
-
#count ⇒ Object
Returns the value of attribute count.
-
#flavor_mapping ⇒ Object
Returns the value of attribute flavor_mapping.
-
#image_mapping ⇒ Object
Returns the value of attribute image_mapping.
-
#name ⇒ Object
Returns the value of attribute name.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #delete_parameter(key) ⇒ Object
- #hash_parameters ⇒ Object
-
#initialize(client, catalog_id, opts = {}) ⇒ DeploymentRequest
constructor
A new instance of DeploymentRequest.
- #parameters ⇒ Object
- #set_parameter(key, type, value) ⇒ Object
- #set_parameters(key, value_data) ⇒ Object
- #submit ⇒ Object
Constructor Details
#initialize(client, catalog_id, opts = {}) ⇒ DeploymentRequest
Returns a new instance of DeploymentRequest.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/vra/deployment_request.rb', line 36 def initialize(client, catalog_id, opts = {}) @client = client @catalog_id = catalog_id @image_mapping = opts[:image_mapping] @name = opts[:name] @flavor_mapping = opts[:flavor_mapping] @project_id = opts[:project_id] @version = opts[:version] @count = opts[:count] || 1 @additional_params = opts[:additional_params] || Vra::RequestParameters.new end |
Instance Attribute Details
#catalog_id ⇒ Object (readonly)
Returns the value of attribute catalog_id.
32 33 34 |
# File 'lib/vra/deployment_request.rb', line 32 def catalog_id @catalog_id end |
#count ⇒ Object
Returns the value of attribute count.
33 34 35 |
# File 'lib/vra/deployment_request.rb', line 33 def count @count end |
#flavor_mapping ⇒ Object
Returns the value of attribute flavor_mapping.
33 34 35 |
# File 'lib/vra/deployment_request.rb', line 33 def flavor_mapping @flavor_mapping end |
#image_mapping ⇒ Object
Returns the value of attribute image_mapping.
33 34 35 |
# File 'lib/vra/deployment_request.rb', line 33 def image_mapping @image_mapping end |
#name ⇒ Object
Returns the value of attribute name.
33 34 35 |
# File 'lib/vra/deployment_request.rb', line 33 def name @name end |
#project_id ⇒ Object
Returns the value of attribute project_id.
33 34 35 |
# File 'lib/vra/deployment_request.rb', line 33 def project_id @project_id end |
#version ⇒ Object
Returns the value of attribute version.
33 34 35 |
# File 'lib/vra/deployment_request.rb', line 33 def version @version end |
Instance Method Details
#delete_parameter(key) ⇒ Object
70 71 72 |
# File 'lib/vra/deployment_request.rb', line 70 def delete_parameter(key) @additional_params.delete(key) end |
#hash_parameters ⇒ Object
78 79 80 |
# File 'lib/vra/deployment_request.rb', line 78 def hash_parameters @additional_params.to_h end |
#parameters ⇒ Object
74 75 76 |
# File 'lib/vra/deployment_request.rb', line 74 def parameters @additional_params.to_vra end |
#set_parameter(key, type, value) ⇒ Object
62 63 64 |
# File 'lib/vra/deployment_request.rb', line 62 def set_parameter(key, type, value) @additional_params.set(key, type, value) end |
#set_parameters(key, value_data) ⇒ Object
66 67 68 |
# File 'lib/vra/deployment_request.rb', line 66 def set_parameters(key, value_data) @additional_params.set_parameters(key, value_data) end |
#submit ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/vra/deployment_request.rb', line 48 def submit validate! begin response = send_request! rescue Vra::Exception::HTTPError => e raise Vra::Exception::RequestError, "Unable to submit request: #{e.}, trace: #{e.errors.join(", ")}" rescue StandardError => e raise e, e. end request_id = FFI_Yajl::Parser.parse(response)[0]["deploymentId"] Vra::Deployment.new(client, id: request_id) end |