14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/lds-cf-plugin/wam_service.rb', line 14
def create_wam_service
offerings = client.services
offerings.keep_if { |s| s.label == 'wam-service' && s.provider.start_with?('ICS') && s.active }
service = offerings.first
if !service
fail "Cannot find Wam service on #{client.target}"
end
if service.version != "0.1"
fail "Your lds-cf-plugin version is out of date. To update execute `gem update lds-cf-plugin`"
end
rest_client = CFoundry::RestClient.new(service.url, client.token)
rest_client.trace = client.trace
instance_name = input[:name]
if !instance_name
instance_name = ask("Name")
end
plan = service.service_plans.first
instance = client.managed_service_instance
instance.name = instance_name
instance.service_plan = plan
instance.space = client.current_space
with_progress("Creating service #{c(instance.name, :name)}") do
instance.create!
end
instance
end
|