knife-vcloud 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,71 @@
1
+ #
2
+ # Author:: Stefano Tortarolo (<stefano.tortarolo@gmail.com>)
3
+ # Copyright:: Copyright (c) 2012
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife'
20
+
21
+ module KnifeVCloud
22
+ class VcLogin < Chef::Knife
23
+ include KnifeVCloud::Common
24
+
25
+ deps do
26
+ require 'vcloud-rest/connection'
27
+ require 'chef/api_client'
28
+ end
29
+
30
+ banner "knife vc login (options)"
31
+
32
+ option :vcloud_url,
33
+ :short => "-H URL",
34
+ :long => "--vcloud-url URL",
35
+ :description => "The vCloud endpoint URL",
36
+ :proc => Proc.new { |url| Chef::Config[:knife][:vcloud_url] = url }
37
+
38
+ option :vcloud_user,
39
+ :short => "-U USER",
40
+ :long => "--vcloud-user USER",
41
+ :description => "Your vCloud User",
42
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_user] = key }
43
+
44
+ option :vcloud_password,
45
+ :short => "-P SECRET",
46
+ :long => "--vcloud-password SECRET",
47
+ :description => "Your vCloud secret key",
48
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_password] = key }
49
+
50
+ option :vcloud_org,
51
+ :short => "-O ORGANIZATION",
52
+ :long => "--vcloud-organization ORGANIZATION",
53
+ :description => "Your vCloud Organization",
54
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_org] = key }
55
+
56
+ option :vcloud_api_version,
57
+ :short => "-A API_VERSION",
58
+ :long => "--vcloud-api-version API_VERSION",
59
+ :description => "vCloud API version (1.5 and 5.1 supported)",
60
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_api_version] = key }
61
+
62
+ def run
63
+ $stdout.sync = true
64
+
65
+ connection.login
66
+ msg("Authenticated successfully, code", connection.auth_key)
67
+
68
+ connection.logout
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,81 @@
1
+ #
2
+ # Author:: Stefano Tortarolo (<stefano.tortarolo@gmail.com>)
3
+ # Copyright:: Copyright (c) 2012
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife'
20
+
21
+ module KnifeVCloud
22
+ class VcOrgList < Chef::Knife
23
+ include KnifeVCloud::Common
24
+
25
+ deps do
26
+ require 'vcloud-rest/connection'
27
+ require 'chef/api_client'
28
+ end
29
+
30
+ banner "knife vc org list (options)"
31
+
32
+ option :vcloud_url,
33
+ :short => "-H URL",
34
+ :long => "--vcloud-url URL",
35
+ :description => "The vCloud endpoint URL",
36
+ :proc => Proc.new { |url| Chef::Config[:knife][:vcloud_url] = url }
37
+
38
+ option :vcloud_user,
39
+ :short => "-U USER",
40
+ :long => "--vcloud-user USER",
41
+ :description => "Your vCloud User",
42
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_user] = key }
43
+
44
+ option :vcloud_password,
45
+ :short => "-P SECRET",
46
+ :long => "--vcloud-password SECRET",
47
+ :description => "Your vCloud secret key",
48
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_password] = key }
49
+
50
+ option :vcloud_org,
51
+ :short => "-O ORGANIZATION",
52
+ :long => "--vcloud-organization ORGANIZATION",
53
+ :description => "Your vCloud Organization",
54
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_org] = key }
55
+
56
+ option :vcloud_api_version,
57
+ :short => "-A API_VERSION",
58
+ :long => "--vcloud-api-version API_VERSION",
59
+ :description => "vCloud API version (1.5 and 5.1 supported)",
60
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_api_version] = key }
61
+
62
+ def run
63
+ $stdout.sync = true
64
+
65
+ list = [
66
+ ui.color('Name', :bold),
67
+ ui.color('ID', :bold)
68
+ ]
69
+
70
+ connection.login
71
+ org_list = connection.list_organizations
72
+ connection.logout
73
+
74
+ org_list.each do |k, v|
75
+ list << (k || '')
76
+ list << (v || '')
77
+ end
78
+ puts ui.list(list, :columns_across, 2)
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,112 @@
1
+ #
2
+ # Author:: Stefano Tortarolo (<stefano.tortarolo@gmail.com>)
3
+ # Copyright:: Copyright (c) 2012
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife'
20
+
21
+ module KnifeVCloud
22
+ class VcOrgShow < Chef::Knife
23
+ include KnifeVCloud::Common
24
+
25
+ deps do
26
+ require 'vcloud-rest/connection'
27
+ require 'chef/api_client'
28
+ end
29
+
30
+ banner "knife vc org show [ORG_ID] (options)"
31
+
32
+ option :vcloud_url,
33
+ :short => "-H URL",
34
+ :long => "--vcloud-url URL",
35
+ :description => "The vCloud endpoint URL",
36
+ :proc => Proc.new { |url| Chef::Config[:knife][:vcloud_url] = url }
37
+
38
+ option :vcloud_user,
39
+ :short => "-U USER",
40
+ :long => "--vcloud-user USER",
41
+ :description => "Your vCloud User",
42
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_user] = key }
43
+
44
+ option :vcloud_password,
45
+ :short => "-P SECRET",
46
+ :long => "--vcloud-password SECRET",
47
+ :description => "Your vCloud secret key",
48
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_password] = key }
49
+
50
+ option :vcloud_org,
51
+ :short => "-O ORGANIZATION",
52
+ :long => "--vcloud-organization ORGANIZATION",
53
+ :description => "Your vCloud Organization",
54
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_org] = key }
55
+
56
+ option :vcloud_api_version,
57
+ :short => "-A API_VERSION",
58
+ :long => "--vcloud-api-version API_VERSION",
59
+ :description => "vCloud API version (1.5 and 5.1 supported)",
60
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_api_version] = key }
61
+
62
+ def run
63
+ $stdout.sync = true
64
+
65
+ org_id = @name_args.first
66
+
67
+ connection.login
68
+
69
+ header = [
70
+ ui.color('Name', :bold),
71
+ ui.color('ID', :bold)
72
+ ]
73
+
74
+ catalogs, vdcs, networks, tasklists = connection.show_organization org_id
75
+ connection.logout
76
+
77
+ list = ["#{ui.color('CATALOGS', :cyan)}", '']
78
+ list << header
79
+ list.flatten!
80
+ catalogs.each do |k, v|
81
+ list << (k || '')
82
+ list << (v || '')
83
+ end
84
+
85
+ list << ['', '', "#{ui.color('VDCs', :cyan)}", '']
86
+ list << header
87
+ list.flatten!
88
+ vdcs.each do |k, v|
89
+ list << (k || '')
90
+ list << (v || '')
91
+ end
92
+
93
+ list << ['', '', "#{ui.color('NETWORKS', :cyan)}", '']
94
+ list << header
95
+ list.flatten!
96
+ networks.each do |k, v|
97
+ list << (k || '')
98
+ list << (v || '')
99
+ end
100
+
101
+ list << ['', '', "#{ui.color('TASKLISTS', :cyan)}", '']
102
+ list << header
103
+ list.flatten!
104
+ tasklists.each do |k, v|
105
+ list << (k || '<unnamed list>')
106
+ list << (v || '')
107
+ end
108
+
109
+ puts ui.list(list, :columns_across, 2)
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,80 @@
1
+ #
2
+ # Author:: Stefano Tortarolo (<stefano.tortarolo@gmail.com>)
3
+ # Copyright:: Copyright (c) 2012
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife'
20
+
21
+ module KnifeVCloud
22
+ class VcVappConfigNetwork < Chef::Knife
23
+ include KnifeVCloud::Common
24
+
25
+ deps do
26
+ require 'vcloud-rest/connection'
27
+ require 'chef/api_client'
28
+ end
29
+
30
+ banner "knife vc vapp config network [VAPP_ID] [NETWORK_NAME] (options)"
31
+
32
+ option :vcloud_url,
33
+ :short => "-H URL",
34
+ :long => "--vcloud-url URL",
35
+ :description => "The vCloud endpoint URL",
36
+ :proc => Proc.new { |url| Chef::Config[:knife][:vcloud_url] = url }
37
+
38
+ option :vcloud_user,
39
+ :short => "-U USER",
40
+ :long => "--vcloud-user USER",
41
+ :description => "Your vCloud User",
42
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_user] = key }
43
+
44
+ option :vcloud_password,
45
+ :short => "-P SECRET",
46
+ :long => "--vcloud-password SECRET",
47
+ :description => "Your vCloud secret key",
48
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_password] = key }
49
+
50
+ option :vcloud_org,
51
+ :short => "-O ORGANIZATION",
52
+ :long => "--vcloud-organization ORGANIZATION",
53
+ :description => "Your vCloud Organization",
54
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_org] = key }
55
+
56
+ option :vcloud_api_version,
57
+ :short => "-A API_VERSION",
58
+ :long => "--vcloud-api-version API_VERSION",
59
+ :description => "vCloud API version (1.5 and 5.1 supported)",
60
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_api_version] = key }
61
+
62
+ def run
63
+ $stdout.sync = true
64
+
65
+ vapp_id = @name_args.shift
66
+ network_name = @name_args.shift
67
+
68
+ connection.login
69
+
70
+ task_id, response = connection.set_vapp_network_config vapp_id, network_name
71
+
72
+ puts response
73
+
74
+ print "vApp network configuration..."
75
+ wait_task(connection, task_id)
76
+
77
+ connection.logout
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,81 @@
1
+ #
2
+ # Author:: Stefano Tortarolo (<stefano.tortarolo@gmail.com>)
3
+ # Copyright:: Copyright (c) 2012
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife'
20
+
21
+ module KnifeVCloud
22
+ class VcVappCreate < Chef::Knife
23
+ include KnifeVCloud::Common
24
+
25
+ deps do
26
+ require 'vcloud-rest/connection'
27
+ require 'chef/api_client'
28
+ end
29
+
30
+ banner "knife vc vapp create [VDC_ID] [NAME] [DESCRIPTION] [TEMPLATE_ID] (options)"
31
+
32
+ option :vcloud_url,
33
+ :short => "-H URL",
34
+ :long => "--vcloud-url URL",
35
+ :description => "The vCloud endpoint URL",
36
+ :proc => Proc.new { |url| Chef::Config[:knife][:vcloud_url] = url }
37
+
38
+ option :vcloud_user,
39
+ :short => "-U USER",
40
+ :long => "--vcloud-user USER",
41
+ :description => "Your vCloud User",
42
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_user] = key }
43
+
44
+ option :vcloud_password,
45
+ :short => "-P SECRET",
46
+ :long => "--vcloud-password SECRET",
47
+ :description => "Your vCloud secret key",
48
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_password] = key }
49
+
50
+ option :vcloud_org,
51
+ :short => "-O ORGANIZATION",
52
+ :long => "--vcloud-organization ORGANIZATION",
53
+ :description => "Your vCloud Organization",
54
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_org] = key }
55
+
56
+ option :vcloud_api_version,
57
+ :short => "-A API_VERSION",
58
+ :long => "--vcloud-api-version API_VERSION",
59
+ :description => "vCloud API version (1.5 and 5.1 supported)",
60
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_api_version] = key }
61
+
62
+ def run
63
+ $stdout.sync = true
64
+
65
+ vdc_id = @name_args.shift
66
+ name = @name_args.shift
67
+ description = @name_args.shift
68
+ templateId = @name_args.shift
69
+
70
+ connection.login
71
+
72
+ vapp_id, task_id = connection.create_vapp_from_template vdc_id, name, description, templateId
73
+
74
+ print "vApp creation..."
75
+ wait_task(connection, task_id)
76
+ puts "vApp created with ID: #{ui.color(vapp_id, :cyan)}"
77
+
78
+ connection.logout
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,78 @@
1
+ #
2
+ # Author:: Stefano Tortarolo (<stefano.tortarolo@gmail.com>)
3
+ # Copyright:: Copyright (c) 2012
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife'
20
+
21
+ module KnifeVCloud
22
+ class VcVappDelete < Chef::Knife
23
+ include KnifeVCloud::Common
24
+
25
+ deps do
26
+ require 'vcloud-rest/connection'
27
+ require 'chef/api_client'
28
+ end
29
+
30
+ banner "knife vc vapp delete [VAPP_ID] (options)"
31
+
32
+ option :vcloud_url,
33
+ :short => "-H URL",
34
+ :long => "--vcloud-url URL",
35
+ :description => "The vCloud endpoint URL",
36
+ :proc => Proc.new { |url| Chef::Config[:knife][:vcloud_url] = url }
37
+
38
+ option :vcloud_user,
39
+ :short => "-U USER",
40
+ :long => "--vcloud-user USER",
41
+ :description => "Your vCloud User",
42
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_user] = key }
43
+
44
+ option :vcloud_password,
45
+ :short => "-P SECRET",
46
+ :long => "--vcloud-password SECRET",
47
+ :description => "Your vCloud secret key",
48
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_password] = key }
49
+
50
+ option :vcloud_org,
51
+ :short => "-O ORGANIZATION",
52
+ :long => "--vcloud-organization ORGANIZATION",
53
+ :description => "Your vCloud Organization",
54
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_org] = key }
55
+
56
+ option :vcloud_api_version,
57
+ :short => "-A API_VERSION",
58
+ :long => "--vcloud-api-version API_VERSION",
59
+ :description => "vCloud API version (1.5 and 5.1 supported)",
60
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_api_version] = key }
61
+
62
+ def run
63
+ $stdout.sync = true
64
+
65
+ vapp_id = @name_args.first
66
+
67
+ if ui.confirm("Do you really want to #{ui.color('DELETE', :red)} vApp #{vapp_id}?")
68
+ connection.login
69
+ task_id = connection.delete_vapp vapp_id
70
+
71
+ print "vApp deletion..."
72
+ wait_task(connection, task_id)
73
+
74
+ connection.logout
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,92 @@
1
+ #
2
+ # Author:: Stefano Tortarolo (<stefano.tortarolo@gmail.com>)
3
+ # Copyright:: Copyright (c) 2012
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife'
20
+
21
+ module KnifeVCloud
22
+ class VcVappShow < Chef::Knife
23
+ include KnifeVCloud::Common
24
+
25
+ deps do
26
+ require 'vcloud-rest/connection'
27
+ require 'chef/api_client'
28
+ end
29
+
30
+ banner "knife vc vapp show [VAPP_ID] (options)"
31
+
32
+ option :vcloud_url,
33
+ :short => "-H URL",
34
+ :long => "--vcloud-url URL",
35
+ :description => "The vCloud endpoint URL",
36
+ :proc => Proc.new { |url| Chef::Config[:knife][:vcloud_url] = url }
37
+
38
+ option :vcloud_user,
39
+ :short => "-U USER",
40
+ :long => "--vcloud-user USER",
41
+ :description => "Your vCloud User",
42
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_user] = key }
43
+
44
+ option :vcloud_password,
45
+ :short => "-P SECRET",
46
+ :long => "--vcloud-password SECRET",
47
+ :description => "Your vCloud secret key",
48
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_password] = key }
49
+
50
+ option :vcloud_org,
51
+ :short => "-O ORGANIZATION",
52
+ :long => "--vcloud-organization ORGANIZATION",
53
+ :description => "Your vCloud Organization",
54
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_org] = key }
55
+
56
+ option :vcloud_api_version,
57
+ :short => "-A API_VERSION",
58
+ :long => "--vcloud-api-version API_VERSION",
59
+ :description => "vCloud API version (1.5 and 5.1 supported)",
60
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_api_version] = key }
61
+
62
+ def run
63
+ $stdout.sync = true
64
+
65
+ vapp_id = @name_args.first
66
+
67
+ list = [
68
+ ui.color('Name', :bold),
69
+ ui.color('Status', :bold),
70
+ ui.color('IPs', :bold),
71
+ ui.color('ID', :bold)
72
+ ]
73
+
74
+ connection.login
75
+ name, description, status, ip, vms_hash = connection.show_vapp vapp_id
76
+ connection.logout
77
+
78
+ msg("Name", name)
79
+ msg("Description", description)
80
+ msg("Status", status)
81
+ msg("IP", ip)
82
+
83
+ vms_hash.each do |k, v|
84
+ list << (k || '')
85
+ list << (v[:status] || '')
86
+ list << (v[:addresses].join(', ') || '<no ip>')
87
+ list << (v[:id] || '')
88
+ end
89
+ puts ui.list(list, :columns_across, 4)
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,77 @@
1
+ #
2
+ # Author:: Stefano Tortarolo (<stefano.tortarolo@gmail.com>)
3
+ # Copyright:: Copyright (c) 2012
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife'
20
+
21
+ module KnifeVCloud
22
+ class VcVappStart < Chef::Knife
23
+ include KnifeVCloud::Common
24
+
25
+ deps do
26
+ require 'vcloud-rest/connection'
27
+ require 'chef/api_client'
28
+ end
29
+
30
+ banner "knife vc vapp start [VAPP_ID] (options)"
31
+
32
+ option :vcloud_url,
33
+ :short => "-H URL",
34
+ :long => "--vcloud-url URL",
35
+ :description => "The vCloud endpoint URL",
36
+ :proc => Proc.new { |url| Chef::Config[:knife][:vcloud_url] = url }
37
+
38
+ option :vcloud_user,
39
+ :short => "-U USER",
40
+ :long => "--vcloud-user USER",
41
+ :description => "Your vCloud User",
42
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_user] = key }
43
+
44
+ option :vcloud_password,
45
+ :short => "-P SECRET",
46
+ :long => "--vcloud-password SECRET",
47
+ :description => "Your vCloud secret key",
48
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_password] = key }
49
+
50
+ option :vcloud_org,
51
+ :short => "-O ORGANIZATION",
52
+ :long => "--vcloud-organization ORGANIZATION",
53
+ :description => "Your vCloud Organization",
54
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_org] = key }
55
+
56
+ option :vcloud_api_version,
57
+ :short => "-A API_VERSION",
58
+ :long => "--vcloud-api-version API_VERSION",
59
+ :description => "vCloud API version (1.5 and 5.1 supported)",
60
+ :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_api_version] = key }
61
+
62
+ def run
63
+ $stdout.sync = true
64
+
65
+ vapp_id = @name_args.first
66
+
67
+ connection.login
68
+
69
+ task_id = connection.poweron_vapp vapp_id
70
+
71
+ print "vApp startup..."
72
+ wait_task(connection, task_id)
73
+
74
+ connection.logout
75
+ end
76
+ end
77
+ end