Class: CFoundry::V1::Base
Constant Summary
Constants inherited
from BaseClient
BaseClient::LOG_LENGTH
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from BaseClient
#request_path, #token_data
Constructor Details
#initialize(target = "https://api.cloudfoundry.com", token = nil) ⇒ Base
Returns a new instance of Base.
12
13
14
15
16
|
# File 'lib/cfoundry/v1/base.rb', line 12
def initialize(
target = "https://api.cloudfoundry.com",
token = nil)
super
end
|
Instance Attribute Details
#backtrace ⇒ Object
Returns the value of attribute backtrace.
10
11
12
|
# File 'lib/cfoundry/v1/base.rb', line 10
def backtrace
@backtrace
end
|
#log ⇒ Object
Returns the value of attribute log.
10
11
12
|
# File 'lib/cfoundry/v1/base.rb', line 10
def log
@log
end
|
#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
84
85
86
|
# File 'lib/cfoundry/v1/base.rb', line 84
def app(name)
get("apps", name, :accept => :json)
end
|
#apps ⇒ Object
76
77
78
|
# File 'lib/cfoundry/v1/base.rb', line 76
def apps
get("apps", :accept => :json)
end
|
#check_resources(fingerprints) ⇒ Object
114
115
116
|
# File 'lib/cfoundry/v1/base.rb', line 114
def check_resources(fingerprints)
post(fingerprints, "resources", :content => :json, :accept => :json)
end
|
#crashes(name) ⇒ Object
92
93
94
|
# File 'lib/cfoundry/v1/base.rb', line 92
def crashes(name)
get("apps", name, "crashes", :accept => :json)[:crashes]
end
|
#create_app(payload) ⇒ Object
80
81
82
|
# File 'lib/cfoundry/v1/base.rb', line 80
def create_app(payload)
post(payload, "apps", :content => :json, :accept => :json)
end
|
#create_service(manifest) ⇒ Object
142
143
144
|
# File 'lib/cfoundry/v1/base.rb', line 142
def create_service(manifest)
post(manifest, "services", :content => :json, :accept => :json)
end
|
#create_token(payload, email) ⇒ Object
70
71
72
73
|
# File 'lib/cfoundry/v1/base.rb', line 70
def create_token(payload, email)
post(payload, "users", email, "tokens",
:content => :json, :accept => :json)
end
|
#create_user(payload) ⇒ Object
53
54
55
|
# File 'lib/cfoundry/v1/base.rb', line 53
def create_user(payload)
post(payload, "users", :content => :json)
end
|
#delete_app(name) ⇒ Object
105
106
107
108
|
# File 'lib/cfoundry/v1/base.rb', line 105
def delete_app(name)
delete("apps", name)
true
end
|
#delete_service(name) ⇒ Object
150
151
152
153
|
# File 'lib/cfoundry/v1/base.rb', line 150
def delete_service(name)
delete("services", name, :accept => :json)
true
end
|
#delete_user(email) ⇒ Object
61
62
63
64
|
# File 'lib/cfoundry/v1/base.rb', line 61
def delete_user(email)
delete("users", email, :accept => :json)
true
end
|
#files(name, instance, *path) ⇒ Object
Also known as:
file
96
97
98
|
# File 'lib/cfoundry/v1/base.rb', line 96
def files(name, instance, *path)
get("apps", name, "instances", instance, "files", *path)
end
|
#info ⇒ Object
36
37
38
|
# File 'lib/cfoundry/v1/base.rb', line 36
def info
get("info", :accept => :json)
end
|
#instances(name) ⇒ Object
88
89
90
|
# File 'lib/cfoundry/v1/base.rb', line 88
def instances(name)
get("apps", name, "instances", :accept => :json)[:instances]
end
|
#service(name) ⇒ Object
146
147
148
|
# File 'lib/cfoundry/v1/base.rb', line 146
def service(name)
get("services", name, :accept => :json)
end
|
#services ⇒ Object
138
139
140
|
# File 'lib/cfoundry/v1/base.rb', line 138
def services
get("services", :accept => :json)
end
|
#stats(name) ⇒ Object
110
111
112
|
# File 'lib/cfoundry/v1/base.rb', line 110
def stats(name)
get("apps", name, "stats", :accept => :json)
end
|
#system_runtimes ⇒ Object
44
45
46
|
# File 'lib/cfoundry/v1/base.rb', line 44
def system_runtimes
get("info", "runtimes", :accept => :json)
end
|
#system_services ⇒ Object
40
41
42
|
# File 'lib/cfoundry/v1/base.rb', line 40
def system_services
get("services", "v1", "offerings", :content => :json, :accept => :json)
end
|
#uaa ⇒ Object
The UAA used for this client.
‘false` if no UAA (legacy)
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/cfoundry/v1/base.rb', line 22
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
101
102
103
|
# File 'lib/cfoundry/v1/base.rb', line 101
def update_app(name, payload)
put(payload, "apps", name, :content => :json)
end
|
#update_user(email, payload) ⇒ Object
66
67
68
|
# File 'lib/cfoundry/v1/base.rb', line 66
def update_user(email, payload)
put(payload, "users", email, :content => :json)
end
|
#upload_app(name, zipfile, resources = []) ⇒ Object
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'lib/cfoundry/v1/base.rb', line 118
def upload_app(name, zipfile, resources = [])
payload = {
:_method => "put",
:resources => MultiJson.dump(resources),
:application =>
UploadIO.new(
if zipfile.is_a? File
zipfile
elsif zipfile.is_a? String
File.new(zipfile, "rb")
end,
"application/zip")
}
post(payload, "apps", name, "application")
rescue EOFError
retry
end
|
#user(email) ⇒ Object
57
58
59
|
# File 'lib/cfoundry/v1/base.rb', line 57
def user(email)
get("users", email, :accept => :json)
end
|
#users ⇒ Object
49
50
51
|
# File 'lib/cfoundry/v1/base.rb', line 49
def users
get("users", :accept => :json)
end
|