lds-cf-plugin 0.4.2 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ module LdsCfPlugin
13
13
 
14
14
  def create_app_dynamics_service
15
15
  offerings = client.services
16
- offerings.keep_if { |s| s.label == 'app-dynamics-service' && s.provider == 'ICS' }
16
+ offerings.keep_if { |s| s.label == 'app-dynamics-service' && s.provider.start_with?('ICS') && s.active }
17
17
  service = offerings.first
18
18
 
19
19
  if !service
@@ -13,7 +13,7 @@ module LdsCfPlugin
13
13
  input :credentials, :desc => "The service credentials JSON string to be passed to the application", :argument => :optional
14
14
  def create_custom_service
15
15
  offerings = client.services
16
- offerings.keep_if { |s| s.label == 'custom-service' && s.provider == 'ICS' }
16
+ offerings.keep_if { |s| s.label == 'custom-service' && s.provider.start_with?('ICS') && s.active }
17
17
  service = offerings.first
18
18
 
19
19
  if !service
@@ -17,14 +17,14 @@ module LdsCfPlugin
17
17
 
18
18
  def create_enterprise_ws_service
19
19
  offerings = client.services
20
- offerings.keep_if { |s| s.label == 'enterprise-ws-service' && s.provider == 'ICS' }
20
+ offerings.keep_if { |s| s.label == 'enterprise-ws-service' && s.provider.start_with?('ICS') && s.active }
21
21
  service = offerings.first
22
22
 
23
23
  if !service
24
24
  fail "Cannot find the Enterprise WS service on #{client.target}"
25
25
  end
26
26
 
27
- if service.version != "0.1"
27
+ if service.version != "0.2" && service.version != "0.1"
28
28
  fail "Your lds-cf-plugin version is out of date. To update execute `gem update lds-cf-plugin`"
29
29
  end
30
30
 
@@ -15,7 +15,7 @@ module LdsCfPlugin
15
15
 
16
16
  def create_http_service
17
17
  offerings = client.services
18
- offerings.keep_if { |s| s.label == 'http-service' && s.provider == 'ICS' }
18
+ offerings.keep_if { |s| s.label == 'http-service' && s.provider.start_with?('ICS') && s.active }
19
19
  service = offerings.first
20
20
 
21
21
  if !service
@@ -16,7 +16,7 @@ module LdsCfPlugin
16
16
 
17
17
  def create_lds_account_service
18
18
  offerings = client.services
19
- offerings.keep_if { |s| s.label == 'lds-account-service' && s.provider == 'ICS' }
19
+ offerings.keep_if { |s| s.label == 'lds-account-service' && s.provider.start_with?('ICS') && s.active }
20
20
  service = offerings.first
21
21
 
22
22
  if !service
@@ -10,10 +10,15 @@ module LdsCfPlugin
10
10
  desc "Create a Marklogic Service"
11
11
  group :lds, :services
12
12
  input :name, :desc => "Name for your service", :argument => :optional
13
+ input :plan, :desc => "The plan for your service. (Existing, or Provisioned)", :argument => :optional
14
+ input :host, :desc => "The hostname the marklogic database is listening on if using 'Existing' plan.", :argument => :optional
15
+ input :port, :desc => "The port the marklogic database is listening on if using 'Existing' plan.", :argument => :optional
16
+ input :username, :desc => "The user to use if using 'Existing' plan.", :argument => :optional
17
+ input :password, :desc => "The password used to connect to the database if using 'Existing' plan.", :argument => :optional
13
18
 
14
19
  def create_marklogic_service
15
20
  offerings = client.services
16
- offerings.keep_if { |s| s.label == 'marklogic-service' && s.provider == 'ICS' }
21
+ offerings.keep_if { |s| s.label == 'marklogic-service' && s.provider.start_with?('ICS') && s.active }
17
22
  service = offerings.first
18
23
 
19
24
  if !service
@@ -32,13 +37,95 @@ module LdsCfPlugin
32
37
  instance_name = ask("Name")
33
38
  end
34
39
 
35
- plan = service.service_plans.first
40
+ plans = service.service_plans
41
+
42
+ selected_plan = nil
43
+
44
+ plans.each do |plan|
45
+ selcted_plan = plan if plan.name == input[:plan]
46
+ end unless input[:plan].nil?
47
+
48
+ existing_plan = nil?
49
+ plans.each do | plan |
50
+ existing_plan = plan if plan.name == "Existing"
51
+ end
52
+
53
+ provision_plan = nil?
54
+ plans.each do | plan |
55
+ provision_plan = plan if plan.name == "Default"
56
+ end
57
+
58
+ plan_type = nil
59
+ plan_type = "Default" unless existing_plan.nil?
60
+
61
+ if(plans.length > 1 && !existing_plan.nil? && selected_plan.nil?)
62
+ choices = ["Existing", "Provision New"]
63
+ options = {
64
+ :choices => choices,
65
+ :default => "Existing",
66
+ :allow_other => false
67
+ }
68
+ plan_type = ask("What type of Marklogic Service", options)
69
+ end
70
+
71
+ if plan_type == "Existing"
72
+ selected_plan = existing_plan
73
+
74
+ host = input[:host]
75
+ if !host
76
+ host = ask("Marklogic host")
77
+ end
78
+
79
+ port = input[:port]
80
+ if !port
81
+ port = ask("Marklogic Port")
82
+ end
83
+
84
+ username = input[:username]
85
+ if !username
86
+ username = ask("Marklogic User")
87
+ end
88
+
89
+ password = input[:password]
90
+ if !password
91
+ password = ask("Marklogic password", :echo => "*", :forget => true)
92
+ end
93
+
94
+ # Register service with gateway
95
+
96
+ payload = {
97
+ :space_guid => client.current_space.guid,
98
+ :name => instance_name,
99
+ :host => host,
100
+ :port => port,
101
+ :username => username,
102
+ :password => password
103
+ }
104
+ options = {
105
+ :payload => JSON.generate(payload)
106
+ }
107
+ request, response = rest_client.request("POST", "/register", options)
108
+ if response[:status].to_i != 200
109
+ fail "Error registering Marklogic service with gateway:\n#{response[:body]}"
110
+ end
111
+ else
112
+ selected_plan = provision_plan
113
+ #plans.delete(existing_plan) unless existing_plan.nil?
114
+ #options = {
115
+ # :choices => plans,
116
+ # :display => proc { |choice|
117
+ # "#{choice.name}: #{choice.description}"
118
+ # },
119
+ # :allow_other => false
120
+ #}
121
+ #selected_plan = ask("What type of plan do you want", options)
122
+ end
36
123
 
37
124
  # Create service instance
38
125
  instance = client.managed_service_instance
39
126
  instance.name = instance_name
40
127
 
41
- instance.service_plan = plan
128
+ instance.service_plan = selected_plan
42
129
  instance.space = client.current_space
43
130
 
44
131
  with_progress("Creating service #{c(instance.name, :name)}") do
@@ -17,7 +17,7 @@ module LdsCfPlugin
17
17
 
18
18
  def create_oracle_service
19
19
  offerings = client.services
20
- offerings.keep_if { |s| s.label == 'oracle-service' && s.provider == 'ICS' }
20
+ offerings.keep_if { |s| s.label == 'oracle-service' && s.provider.start_with?('ICS') && s.active }
21
21
  service = offerings.first
22
22
 
23
23
  if !service
@@ -24,7 +24,7 @@ module LdsCfPlugin
24
24
 
25
25
  def create_servicemanager_service
26
26
  offerings = client.services
27
- offerings.keep_if { |s| s.label == 'servicemanager-service' && s.provider == 'ICS' }
27
+ offerings.keep_if { |s| s.label == 'servicemanager-service' && s.provider.start_with?('ICS') && s.active }
28
28
  service = offerings.first
29
29
 
30
30
  if !service
@@ -1,3 +1,3 @@
1
1
  module LdsCfPlugin
2
- VERSION = "0.4.2".freeze
2
+ VERSION = "0.4.4".freeze
3
3
  end
@@ -13,7 +13,7 @@ module LdsCfPlugin
13
13
 
14
14
  def create_wam_service
15
15
  offerings = client.services
16
- offerings.keep_if { |s| s.label == 'wam-service' && s.provider == 'ICS' }
16
+ offerings.keep_if { |s| s.label == 'wam-service' && s.provider.start_with?('ICS') && s.active }
17
17
  service = offerings.first
18
18
 
19
19
  if !service
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lds-cf-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-11 00:00:00.000000000 Z
12
+ date: 2014-03-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cf
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 5.4.5
21
+ version: 5.4.7
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 5.4.5
29
+ version: 5.4.7
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: eventmachine
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -99,26 +99,26 @@ extensions: []
99
99
  extra_rdoc_files: []
100
100
  files:
101
101
  - Rakefile
102
- - lib/lds-cf-plugin/http_service.rb
103
- - lib/lds-cf-plugin/custom_service.rb
104
- - lib/lds-cf-plugin/lds_account_service.rb
102
+ - lib/lds-cf-plugin/app_dynamics_service.rb
103
+ - lib/lds-cf-plugin/version.rb
105
104
  - lib/lds-cf-plugin/enterprise_ws_service.rb
106
- - lib/lds-cf-plugin/marklogic_service.rb
107
105
  - lib/lds-cf-plugin/oracle_service.rb
108
- - lib/lds-cf-plugin/tunnel.rb
109
- - lib/lds-cf-plugin/version.rb
110
- - lib/lds-cf-plugin/plugin.rb
111
- - lib/lds-cf-plugin/app_dynamics_service.rb
112
- - lib/lds-cf-plugin/loggregator/log_message_extender.rb
113
- - lib/lds-cf-plugin/loggregator/tailling_logs_client.rb
106
+ - lib/lds-cf-plugin/loggregator/logs.rb
114
107
  - lib/lds-cf-plugin/loggregator/client_config.rb
115
108
  - lib/lds-cf-plugin/loggregator/log_message.pb.rb
109
+ - lib/lds-cf-plugin/loggregator/tailling_logs_client.rb
116
110
  - lib/lds-cf-plugin/loggregator/message_writer.rb
117
- - lib/lds-cf-plugin/loggregator/logs.rb
118
111
  - lib/lds-cf-plugin/loggregator/log_message.proto
119
- - lib/lds-cf-plugin/tunnel/tunnelclient.rb
120
- - lib/lds-cf-plugin/wam_service.rb
112
+ - lib/lds-cf-plugin/loggregator/log_message_extender.rb
113
+ - lib/lds-cf-plugin/plugin.rb
114
+ - lib/lds-cf-plugin/marklogic_service.rb
115
+ - lib/lds-cf-plugin/lds_account_service.rb
121
116
  - lib/lds-cf-plugin/servicemanager_service.rb
117
+ - lib/lds-cf-plugin/wam_service.rb
118
+ - lib/lds-cf-plugin/tunnel.rb
119
+ - lib/lds-cf-plugin/tunnel/tunnelclient.rb
120
+ - lib/lds-cf-plugin/custom_service.rb
121
+ - lib/lds-cf-plugin/http_service.rb
122
122
  homepage: https://cf.lds.org/
123
123
  licenses: []
124
124
  post_install_message: