Class: CfRubyClient::AppInstance

Inherits:
Base
  • Object
show all
Defined in:
lib/cf_ruby_client/app_instance.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#api_endpoint, #authorization_string, #cloud_foundry_config, #delete_entity, #fetch_entities, #logger, #patch_entity, #post_entity, #put_entity, #resource, #uaa_endpoint

Constructor Details

#initialize(guid, index) ⇒ AppInstance

Returns a new instance of AppInstance.



6
7
8
9
# File 'lib/cf_ruby_client/app_instance.rb', line 6

def initialize(guid, index)
  @app_guid = guid
  @index = index
end

Instance Attribute Details

#app_guidObject (readonly)

Returns the value of attribute app_guid.



4
5
6
# File 'lib/cf_ruby_client/app_instance.rb', line 4

def app_guid
  @app_guid
end

#indexObject (readonly)

Returns the value of attribute index.



4
5
6
# File 'lib/cf_ruby_client/app_instance.rb', line 4

def index
  @index
end

Instance Method Details

#restartObject



11
12
13
14
# File 'lib/cf_ruby_client/app_instance.rb', line 11

def restart
  url_path = "/v2/apps/#{app_guid}/instances/#{index}"
  delete_entity(url_path)
end

#statusObject



16
17
18
19
# File 'lib/cf_ruby_client/app_instance.rb', line 16

def status
  url_path = "/v2/apps/#{app_guid}/instances"
  JSON::parse(fetch_entities(url_path))[index.to_s]
end