Class: Nucleus::Adapters::V1::CloudFoundryV2
- Inherits:
-
Stub
- Object
- BaseAdapter
- Stub
- Nucleus::Adapters::V1::CloudFoundryV2
- Includes:
- AppStates, Application, Authentication, Buildpacks, Data, Domains, Lifecycle, Logs, Regions, Scaling, SemanticErrors, Services, Vars, Logging
- Defined in:
- lib/nucleus/adapters/v1/cloud_foundry_v2/cloud_foundry_v2.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/data.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/logs.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/vars.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/domains.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/regions.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/scaling.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/services.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/lifecycle.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/app_states.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/buildpacks.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/application.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/authentication.rb,
lib/nucleus/adapters/v1/cloud_foundry_v2/semantic_errors.rb
Overview
The CloudFoundryV2 adapter is designed to support the Cloud Foundry API and uses only commands of the API version 2.
Besides native Cloud Foundry installations, this adapter shall also work with forks, such as Stackato 3.4.2.
The Nucleus API is fully supported, there are no known issues.
Defined Under Namespace
Modules: AppStates, Application, Authentication, Buildpacks, Data, Domains, Lifecycle, Logs, Regions, Scaling, SemanticErrors, Services, Vars
Constant Summary
Constants included from Logs
Logs::CRLF, Logs::LOGGREGATOR_TYPES, Logs::WSP
Constants included from BuildpackTranslator
BuildpackTranslator::PUBLIC_BUILDPACKS
Constants inherited from Stub
Instance Attribute Summary
Attributes inherited from BaseAdapter
Instance Method Summary collapse
- #handle_error(error) ⇒ Object
-
#initialize(endpoint_url, endpoint_app_domain = nil, check_certificates = true) ⇒ CloudFoundryV2
constructor
A new instance of CloudFoundryV2.
Methods included from Vars
#create_env_var, #delete_env_var, #env_var, #env_vars, #update_env_var
Methods included from Services
#add_service, #change_service, #installed_service, #installed_services, #remove_service, #service, #service_plan, #service_plans, #services
Methods included from SemanticErrors
Methods included from Scaling
Methods included from Regions
Methods included from Logs
#log?, #log_entries, #logs, #tail
Methods included from Lifecycle
Methods included from Data
Methods included from Domains
#create_domain, #delete_domain, #domain, #domains
Methods included from Application
#application, #applications, #create_application, #delete_application, #update_application
Methods included from Buildpacks
Methods included from BuildpackTranslator
#find_runtime, #native_runtime?
Methods included from Authentication
Methods included from Logging
configure_logger_for, #log, logger_for
Methods inherited from Stub
#add_service, #application, #applications, #auth_client, #change_service, #create_application, #create_domain, #create_env_var, #delete_application, #delete_domain, #delete_env_var, #deploy, #domain, #domains, #download, #env_var, #env_vars, #installed_service, #installed_services, #log?, #log_entries, #logs, #rebuild, #region, #regions, #remove_service, #restart, #scale, #service, #service_plan, #service_plans, #services, #start, #stop, #tail, #update_application, #update_env_var
Methods inherited from BaseAdapter
#cache, #cache?, #cache_key, #cached, #endpoint_call, #fail_with
Methods included from HttpTailClient
Methods included from HttpClient
#delete, #get, #head, #patch, #post, #put
Constructor Details
#initialize(endpoint_url, endpoint_app_domain = nil, check_certificates = true) ⇒ CloudFoundryV2
Returns a new instance of CloudFoundryV2.
27 28 29 |
# File 'lib/nucleus/adapters/v1/cloud_foundry_v2/cloud_foundry_v2.rb', line 27 def initialize(endpoint_url, endpoint_app_domain = nil, check_certificates = true) super(endpoint_url, endpoint_app_domain, check_certificates) end |
Instance Method Details
#handle_error(error) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nucleus/adapters/v1/cloud_foundry_v2/cloud_foundry_v2.rb', line 31 def handle_error(error) cf_error = error.body.is_a?(Hash) ? error.body[:code] : nil case error.status when 400 handle_400_error(error, cf_error) when 404 fail Errors::AdapterResourceNotFoundError, error.body[:description] if cf_error > 10_000 else if [1001].include? cf_error fail Errors::AdapterRequestError, "#{error.body[:description]} (#{cf_error} - #{error.body[:error_code]})" elsif [10_002].include?(cf_error) || error.status == 401 fail Errors::EndpointAuthenticationError, 'Endpoint authentication failed with OAuth2 token' end end # error still unhandled, will result in a 500, server error log.warn "Cloud Foundry error still unhandled: #{error}" end |