module Nucleus::Adapters::V1::CloudFoundryV2::Lifecycle

Public Instance Methods

restart(application_name_or_id) click to toggle source

@see Stub#restart

# File lib/nucleus/adapters/v1/cloud_foundry_v2/lifecycle.rb, line 33
def restart(application_name_or_id)
  stop(application_name_or_id)
  start(application_name_or_id)
end
start(application_name_or_id) click to toggle source

@see Stub#start

# File lib/nucleus/adapters/v1/cloud_foundry_v2/lifecycle.rb, line 7
def start(application_name_or_id)
  app_guid = app_guid(application_name_or_id)
  # fail if there is no deployment
  unless deployed?(app_guid)
    raise Errors::SemanticAdapterRequestError, 'Application must be deployed before it can be started'
  end

  # start by name or id
  start_response = put("/v2/apps/#{app_guid}", body: { state: 'STARTED' })
  to_nucleus_app(start_response.body)
end
stop(application_name_or_id) click to toggle source

@see Stub#stop

# File lib/nucleus/adapters/v1/cloud_foundry_v2/lifecycle.rb, line 20
def stop(application_name_or_id)
  app_guid = app_guid(application_name_or_id)
  # fail if there is no deployment
  unless deployed?(app_guid)
    raise Errors::SemanticAdapterRequestError, 'Application must be deployed before it can be stopped'
  end

  # stop by name or id
  stop_response = put("/v2/apps/#{app_guid}", body: { state: 'STOPPED' })
  to_nucleus_app(stop_response.body)
end