Class: Rhc::Rest::Application
- Inherits:
-
Object
- Object
- Rhc::Rest::Application
- Includes:
- Rhc::Rest
- Defined in:
- lib/rhc-rest/application.rb
Constant Summary
Constants included from Rhc::Rest
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
Returns the value of attribute aliases.
-
#app_url ⇒ Object
readonly
Returns the value of attribute app_url.
-
#creation_time ⇒ Object
readonly
Returns the value of attribute creation_time.
-
#domain_id ⇒ Object
readonly
Returns the value of attribute domain_id.
-
#embedded ⇒ Object
readonly
Returns the value of attribute embedded.
-
#framework ⇒ Object
readonly
Returns the value of attribute framework.
-
#git_url ⇒ Object
readonly
Returns the value of attribute git_url.
-
#health_check_path ⇒ Object
readonly
Returns the value of attribute health_check_path.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node_profile ⇒ Object
readonly
Returns the value of attribute node_profile.
-
#scalable ⇒ Object
readonly
Returns the value of attribute scalable.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#add_cartridge(name) ⇒ Object
Add Cartridge.
-
#cartridges ⇒ Object
Get all Cartridge for this applications.
-
#destroy ⇒ Object
(also: #delete)
Delete Application.
-
#initialize(args) ⇒ Application
constructor
A new instance of Application.
-
#restart ⇒ Object
Restart Application.
-
#start ⇒ Object
Start Application.
-
#stop(force = false) ⇒ Object
Stop Application.
Methods included from Rhc::Rest
#logger, #parse_response, #process_error_response, #send
Constructor Details
#initialize(args) ⇒ Application
Returns a new instance of Application.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rhc-rest/application.rb', line 7 def initialize(args) #logger.debug args @domain_id = args[:domain_id] || args["domain_id"] @name = args[:name] || args["name"] @creation_time = args[:creation_time] || args["creation_time"] @uuid = args[:uuid] || args["uuid"] @aliases = args[:aliases] || args["aliases"] @server_identity = args[:server_identity] || args["server_identity"] @links = args[:links] || args["links"] end |
Instance Attribute Details
#aliases ⇒ Object (readonly)
Returns the value of attribute aliases.
6 7 8 |
# File 'lib/rhc-rest/application.rb', line 6 def aliases @aliases end |
#app_url ⇒ Object (readonly)
Returns the value of attribute app_url.
6 7 8 |
# File 'lib/rhc-rest/application.rb', line 6 def app_url @app_url end |
#creation_time ⇒ Object (readonly)
Returns the value of attribute creation_time.
6 7 8 |
# File 'lib/rhc-rest/application.rb', line 6 def creation_time @creation_time end |
#domain_id ⇒ Object (readonly)
Returns the value of attribute domain_id.
6 7 8 |
# File 'lib/rhc-rest/application.rb', line 6 def domain_id @domain_id end |
#embedded ⇒ Object (readonly)
Returns the value of attribute embedded.
6 7 8 |
# File 'lib/rhc-rest/application.rb', line 6 def @embedded end |
#framework ⇒ Object (readonly)
Returns the value of attribute framework.
6 7 8 |
# File 'lib/rhc-rest/application.rb', line 6 def framework @framework end |
#git_url ⇒ Object (readonly)
Returns the value of attribute git_url.
6 7 8 |
# File 'lib/rhc-rest/application.rb', line 6 def git_url @git_url end |
#health_check_path ⇒ Object (readonly)
Returns the value of attribute health_check_path.
6 7 8 |
# File 'lib/rhc-rest/application.rb', line 6 def health_check_path @health_check_path end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/rhc-rest/application.rb', line 6 def name @name end |
#node_profile ⇒ Object (readonly)
Returns the value of attribute node_profile.
6 7 8 |
# File 'lib/rhc-rest/application.rb', line 6 def node_profile @node_profile end |
#scalable ⇒ Object (readonly)
Returns the value of attribute scalable.
6 7 8 |
# File 'lib/rhc-rest/application.rb', line 6 def scalable @scalable end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
6 7 8 |
# File 'lib/rhc-rest/application.rb', line 6 def uuid @uuid end |
Instance Method Details
#add_cartridge(name) ⇒ Object
Add Cartridge
19 20 21 22 23 24 25 26 |
# File 'lib/rhc-rest/application.rb', line 19 def add_cartridge(name) logger.debug "Adding cartridge #{name}" if @mydebug url = @links['ADD_CARTRIDGE']['href'] method = @links['ADD_CARTRIDGE']['method'] payload = {:name => name} request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers, :payload => payload) return send(request) end |
#cartridges ⇒ Object
Get all Cartridge for this applications
29 30 31 32 33 34 35 |
# File 'lib/rhc-rest/application.rb', line 29 def cartridges logger.debug "Getting all cartridges for application #{self.name}" if @mydebug url = @links['LIST_CARTRIDGES']['href'] method = @links['LIST_CARTRIDGES']['method'] request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers) return send(request) end |
#destroy ⇒ Object Also known as: delete
Delete Application
72 73 74 75 76 77 78 |
# File 'lib/rhc-rest/application.rb', line 72 def destroy logger.debug "Deleting application #{self.name}" if @mydebug url = @links['DELETE']['href'] method = @links['DELETE']['method'] request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers) return send(request) end |
#restart ⇒ Object
Restart Application
62 63 64 65 66 67 68 69 |
# File 'lib/rhc-rest/application.rb', line 62 def restart logger.debug "Restarting application #{self.name}" if @mydebug url = @links['RESTART']['href'] method = @links['RESTART']['method'] payload = {:event=> "restart"} request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers, :payload => payload) return send(request) end |
#start ⇒ Object
Start Application
38 39 40 41 42 43 44 45 |
# File 'lib/rhc-rest/application.rb', line 38 def start logger.debug "Starting application #{self.name}" if @mydebug url = @links['START']['href'] method = @links['START']['method'] payload = {:event=> "start"} request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers, :payload => payload) return send(request) end |
#stop(force = false) ⇒ Object
Stop Application
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rhc-rest/application.rb', line 48 def stop(force=false) logger.debug "Stopping application #{self.name} force-#{force}" if @mydebug url = @links['STOP']['href'] method = @links['STOP']['method'] if force payload = {:event=> "force-stop"} else payload = {:event=> "stop"} end request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers, :payload => payload) return send(request) end |