Class: CFoundry::V1::Base
- Inherits:
-
BaseClient
- Object
- BaseClient
- CFoundry::V1::Base
- Defined in:
- lib/cfoundry/v1/base.rb
Instance Attribute Summary collapse
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#target ⇒ Object
Returns the value of attribute target.
-
#token ⇒ Object
Returns the value of attribute token.
-
#trace ⇒ Object
Returns the value of attribute trace.
Attributes inherited from BaseClient
Instance Method Summary collapse
- #app(name) ⇒ Object
-
#apps ⇒ Object
Applications.
- #check_resources(fingerprints) ⇒ Object
- #create_app(payload) ⇒ Object
- #create_service(manifest) ⇒ Object
- #create_token(payload, email) ⇒ Object
- #create_user(payload) ⇒ Object
- #delete_app(name) ⇒ Object
- #delete_service(name) ⇒ Object
- #delete_user(email) ⇒ Object
- #files(name, instance, *path) ⇒ Object (also: #file)
-
#info ⇒ Object
Cloud metadata.
-
#initialize(target = "https://api.cloudfoundry.com", token = nil) ⇒ Base
constructor
A new instance of Base.
- #instances(name) ⇒ Object
- #service(name) ⇒ Object
-
#services ⇒ Object
Services.
- #stats(name) ⇒ Object
- #system_runtimes ⇒ Object
- #system_services ⇒ Object
-
#uaa ⇒ Object
The UAA used for this client.
- #update_app(name, payload) ⇒ Object
- #update_user(email, payload) ⇒ Object
- #upload_app(name, zipfile, resources = []) ⇒ Object
- #user(email) ⇒ Object
-
#users ⇒ Object
Users.
Methods inherited from BaseClient
Constructor Details
#initialize(target = "https://api.cloudfoundry.com", token = nil) ⇒ Base
Returns a new instance of Base.
12 13 14 15 16 17 |
# File 'lib/cfoundry/v1/base.rb', line 12 def initialize( target = "https://api.cloudfoundry.com", token = nil) @target = target @token = token end |
Instance Attribute Details
#proxy ⇒ Object
Returns the value of attribute proxy.
10 11 12 |
# File 'lib/cfoundry/v1/base.rb', line 10 def proxy @proxy end |
#target ⇒ Object
Returns the value of attribute target.
10 11 12 |
# File 'lib/cfoundry/v1/base.rb', line 10 def target @target end |
#token ⇒ Object
Returns the value of attribute token.
10 11 12 |
# File 'lib/cfoundry/v1/base.rb', line 10 def token @token end |
#trace ⇒ Object
Returns the value of attribute trace.
10 11 12 |
# File 'lib/cfoundry/v1/base.rb', line 10 def trace @trace end |
Instance Method Details
#app(name) ⇒ Object
90 91 92 |
# File 'lib/cfoundry/v1/base.rb', line 90 def app(name) get("apps", name, nil => :json) end |
#apps ⇒ Object
Applications
82 83 84 |
# File 'lib/cfoundry/v1/base.rb', line 82 def apps get("apps", nil => :json) end |
#check_resources(fingerprints) ⇒ Object
116 117 118 |
# File 'lib/cfoundry/v1/base.rb', line 116 def check_resources(fingerprints) post(fingerprints, "resources", :json => :json) end |
#create_app(payload) ⇒ Object
86 87 88 |
# File 'lib/cfoundry/v1/base.rb', line 86 def create_app(payload) post(payload, "apps", :json => :json) end |
#create_service(manifest) ⇒ Object
143 144 145 |
# File 'lib/cfoundry/v1/base.rb', line 143 def create_service(manifest) post(manifest, "services", :json => :json) end |
#create_token(payload, email) ⇒ Object
77 78 79 |
# File 'lib/cfoundry/v1/base.rb', line 77 def create_token(payload, email) post(payload, "users", email, "tokens", :json => :json) end |
#create_user(payload) ⇒ Object
60 61 62 |
# File 'lib/cfoundry/v1/base.rb', line 60 def create_user(payload) post(payload, "users", :json => nil) end |
#delete_app(name) ⇒ Object
107 108 109 110 |
# File 'lib/cfoundry/v1/base.rb', line 107 def delete_app(name) delete("apps", name) true end |
#delete_service(name) ⇒ Object
151 152 153 154 |
# File 'lib/cfoundry/v1/base.rb', line 151 def delete_service(name) delete("services", name, nil => :json) true end |
#delete_user(email) ⇒ Object
68 69 70 71 |
# File 'lib/cfoundry/v1/base.rb', line 68 def delete_user(email) delete("users", email, nil => :json) true end |
#files(name, instance, *path) ⇒ Object Also known as: file
98 99 100 |
# File 'lib/cfoundry/v1/base.rb', line 98 def files(name, instance, *path) get("apps", name, "instances", instance, "files", *path) end |
#info ⇒ Object
Cloud metadata
43 44 45 |
# File 'lib/cfoundry/v1/base.rb', line 43 def info get("info", nil => :json) end |
#instances(name) ⇒ Object
94 95 96 |
# File 'lib/cfoundry/v1/base.rb', line 94 def instances(name) get("apps", name, "instances", nil => :json)[:instances] end |
#service(name) ⇒ Object
147 148 149 |
# File 'lib/cfoundry/v1/base.rb', line 147 def service(name) get("services", name, nil => :json) end |
#services ⇒ Object
Services
139 140 141 |
# File 'lib/cfoundry/v1/base.rb', line 139 def services get("services", nil => :json) end |
#stats(name) ⇒ Object
112 113 114 |
# File 'lib/cfoundry/v1/base.rb', line 112 def stats(name) get("apps", name, "stats", nil => :json) end |
#system_runtimes ⇒ Object
51 52 53 |
# File 'lib/cfoundry/v1/base.rb', line 51 def system_runtimes get("info", "runtimes", nil => :json) end |
#system_services ⇒ Object
47 48 49 |
# File 'lib/cfoundry/v1/base.rb', line 47 def system_services get("info", "services", nil => :json) end |
#uaa ⇒ Object
The UAA used for this client.
‘false` if no UAA (legacy)
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cfoundry/v1/base.rb', line 29 def uaa return @uaa unless @uaa.nil? endpoint = info[:authorization_endpoint] return @uaa = false unless endpoint @uaa = CFoundry::UAAClient.new(endpoint) @uaa.trace = @trace @uaa.token = @token @uaa end |
#update_app(name, payload) ⇒ Object
103 104 105 |
# File 'lib/cfoundry/v1/base.rb', line 103 def update_app(name, payload) put(payload, "apps", name, :json => nil) end |
#update_user(email, payload) ⇒ Object
73 74 75 |
# File 'lib/cfoundry/v1/base.rb', line 73 def update_user(email, payload) put(payload, "users", email, :json => nil) end |
#upload_app(name, zipfile, resources = []) ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/cfoundry/v1/base.rb', line 120 def upload_app(name, zipfile, resources = []) payload = { :_method => "put", :resources => MultiJson.dump(resources), :multipart => true, :application => if zipfile.is_a? File zipfile elsif zipfile.is_a? String File.new(zipfile, "rb") end } post(payload, "apps", name, "application") rescue RestClient::ServerBrokeConnection retry end |
#user(email) ⇒ Object
64 65 66 |
# File 'lib/cfoundry/v1/base.rb', line 64 def user(email) get("users", email, nil => :json) end |
#users ⇒ Object
Users
56 57 58 |
# File 'lib/cfoundry/v1/base.rb', line 56 def users get("users", nil => :json) end |