Class: CloudFoundry::Client
- Inherits:
-
Object
- Object
- CloudFoundry::Client
- Defined in:
- lib/cloudfoundry/client.rb,
lib/cloudfoundry/version.rb,
lib/cloudfoundry/constants.rb,
lib/cloudfoundry/exception.rb,
lib/cloudfoundry/client/apps.rb,
lib/cloudfoundry/client/info.rb,
lib/cloudfoundry/client/users.rb,
lib/cloudfoundry/client/request.rb,
lib/cloudfoundry/client/response.rb,
lib/cloudfoundry/client/services.rb,
lib/cloudfoundry/client/resources.rb
Overview
This is a Ruby wrapper for the CloudFoundry API, the industry’s first open Platform as a Service (PaaS) offering.
Defined Under Namespace
Modules: Apps, Exception, Info, Request, Resources, Response, Services, Users
Constant Summary collapse
- VERSION =
CloudFoundry::Client Version.
[major, minor, patch, pre].compact.join(".")
- DEFAULT_ADAPTER =
The HTTP connection adapter that will be used to connect if none is set.
:net_http
- DEFAULT_TARGET =
Default CloudFoundry API Target URL.
"http://api.vcap.me"
- CLOUD_INFO_PATH =
CloudFoundry API Info Path.
"/info"
- CLOUD_SERVICES_INFO_PATH =
CloudFoundry API System Services Info Path.
"/info/services"
- CLOUD_RUNTIMES_INFO_PATH =
CloudFoundry API Runtimes Info Path.
"/info/runtimes"
- APPS_PATH =
CloudFoundry API Applications Path.
"/apps"
- RESOURCES_PATH =
CloudFoundry API Resources Path.
"/resources"
- SERVICES_PATH =
CloudFoundry API Services Path.
"/services"
- USERS_PATH =
CloudFoundry API Users Path.
"/users"
Instance Attribute Summary collapse
-
#auth_token ⇒ Object
readonly
Returns the CloudFoundry API Authorization Token.
-
#net_adapter ⇒ Object
readonly
Returns the HTTP connection adapter that will be used to connect.
-
#proxy_url ⇒ Object
readonly
Returns the Proxy URL that will be used to connect.
-
#proxy_user ⇒ Object
readonly
Returns the CloudFoundry Proxied User.
-
#target_url ⇒ Object
readonly
Returns the CloudFoundry API Target URL.
-
#trace_key ⇒ Object
readonly
Returns the CloudFoundry API Trace Key.
-
#user ⇒ Object
readonly
Returns the CloudFoundry Logged User.
Class Method Summary collapse
-
.major ⇒ Object
Major CloudFoundry::Client Version.
-
.minor ⇒ Object
Minor CloudFoundry::Client Version.
-
.patch ⇒ Object
Patch CloudFoundry::Client Version.
-
.pre ⇒ Object
Pre CloudFoundry::Client Version.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ CloudFoundry::Client
constructor
Creates a new CloudFoundry::Client object.
Methods included from Users
#create_user, #delete_user, #list_users, #logged_in?, #login, #set_proxy_user, #unset_proxy_user, #update_user, #user_info
Methods included from Services
#bind_service, #create_service, #delete_service, #list_services, #service_info, #unbind_service
Methods included from Resources
Methods included from Request
Methods included from Info
#cloud_info, #cloud_runtimes_info, #cloud_services_info
Methods included from Apps
#app_crashes, #app_files, #app_info, #app_instances, #app_stats, #create_app, #delete_app, #download_app, #list_apps, #update_app, #update_app_info, #upload_app
Constructor Details
#initialize(options = {}) ⇒ CloudFoundry::Client
Creates a new CloudFoundry::Client object.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cloudfoundry/client.rb', line 45 def initialize( = {}) @net_adapter = [:adapter] || DEFAULT_ADAPTER @proxy_url = [:proxy_url] || nil @target_url = [:target_url] || DEFAULT_TARGET @target_url = sanitize_url(@target_url) @trace_key = [:trace_key] || nil @auth_token = [:auth_token] || nil @user = nil @proxy_user = nil raise CloudFoundry::Client::Exception::BadParams, "Invalid CloudFoundry API URL: " + @target_url unless valid_target_url? if @auth_token raise CloudFoundry::Client::Exception::AuthError, "Invalid CloudFoundry API authorization token" unless logged_in? end end |
Instance Attribute Details
#auth_token ⇒ Object (readonly)
Returns the CloudFoundry API Authorization Token.
28 29 30 |
# File 'lib/cloudfoundry/client.rb', line 28 def auth_token @auth_token end |
#net_adapter ⇒ Object (readonly)
Returns the HTTP connection adapter that will be used to connect.
20 21 22 |
# File 'lib/cloudfoundry/client.rb', line 20 def net_adapter @net_adapter end |
#proxy_url ⇒ Object (readonly)
Returns the Proxy URL that will be used to connect.
22 23 24 |
# File 'lib/cloudfoundry/client.rb', line 22 def proxy_url @proxy_url end |
#proxy_user ⇒ Object (readonly)
Returns the CloudFoundry Proxied User.
32 33 34 |
# File 'lib/cloudfoundry/client.rb', line 32 def proxy_user @proxy_user end |
#target_url ⇒ Object (readonly)
Returns the CloudFoundry API Target URL.
24 25 26 |
# File 'lib/cloudfoundry/client.rb', line 24 def target_url @target_url end |
#trace_key ⇒ Object (readonly)
Returns the CloudFoundry API Trace Key.
26 27 28 |
# File 'lib/cloudfoundry/client.rb', line 26 def trace_key @trace_key end |
#user ⇒ Object (readonly)
Returns the CloudFoundry Logged User.
30 31 32 |
# File 'lib/cloudfoundry/client.rb', line 30 def user @user end |
Class Method Details
.major ⇒ Object
Major CloudFoundry::Client Version.
5 6 7 |
# File 'lib/cloudfoundry/version.rb', line 5 def self.major 0 end |
.minor ⇒ Object
Minor CloudFoundry::Client Version.
10 11 12 |
# File 'lib/cloudfoundry/version.rb', line 10 def self.minor 3 end |
.patch ⇒ Object
Patch CloudFoundry::Client Version.
15 16 17 |
# File 'lib/cloudfoundry/version.rb', line 15 def self.patch 0 end |
.pre ⇒ Object
Pre CloudFoundry::Client Version.
20 21 22 |
# File 'lib/cloudfoundry/version.rb', line 20 def self.pre nil end |