knife-cloudstack-fog 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,74 +1,74 @@
1
- # Author:: Jeff Moody (<jmoody@datapipe.com>)
2
- # Copyright:: Copyright (c) 2012 Datapipe
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
-
19
- require 'chef/knife/cloudstack_base'
20
-
21
- class Chef
22
- class Knife
23
- class CloudstackNetworkofferingList < Knife
24
-
25
- include Knife::CloudstackBase
26
-
27
- banner "knife cloudstack networkoffering list"
28
-
29
- def run
30
- $stdout.sync = true
31
-
32
- validate!
33
-
34
- network_list = [
35
- ui.color('ID', :bold),
36
- ui.color('Name', :bold),
37
- ui.color('Display Name', :bold),
38
- ui.color('Traffic Type', :bold),
39
- ui.color('State', :bold),
40
- ui.color('Service Offering ID', :bold)
41
- ]
42
-
43
- response = connection.list_network_offerings['listnetworkofferingsresponse']
44
-
45
- if networks = response['networkoffering']
46
-
47
- networks.each do |networkoffering|
48
- # puts networkoffering
49
- network_list << networkoffering['id'].to_s
50
- network_list << networkoffering['name'].to_s
51
- network_list << networkoffering['displaytext'].to_s
52
- network_list << networkoffering['traffictype'].to_s
53
- network_list << begin
54
- state = networkoffering['state'].to_s.downcase
55
- case state
56
- when 'allocated'
57
- ui.color(state, :red)
58
- when 'pending'
59
- ui.color(state, :yellow)
60
- else
61
- ui.color(state, :green)
62
- end
63
- end
64
- network_list << networkoffering['serviceofferingid'].to_s
65
- end
66
- end
67
-
68
- puts ui.list(network_list, :uneven_columns_across, 6)
69
-
70
- end
71
-
72
- end
73
- end
74
- end
1
+ # Author:: Jeff Moody (<jmoody@datapipe.com>)
2
+ # Copyright:: Copyright (c) 2012 Datapipe
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+
19
+ require 'chef/knife/cloudstack_base'
20
+
21
+ class Chef
22
+ class Knife
23
+ class CloudstackNetworkofferingList < Knife
24
+
25
+ include Knife::CloudstackBase
26
+
27
+ banner "knife cloudstack networkoffering list"
28
+
29
+ def run
30
+ $stdout.sync = true
31
+
32
+ validate!
33
+
34
+ network_list = [
35
+ ui.color('ID', :bold),
36
+ ui.color('Name', :bold),
37
+ ui.color('Display Name', :bold),
38
+ ui.color('Traffic Type', :bold),
39
+ ui.color('State', :bold),
40
+ ui.color('Service Offering ID', :bold)
41
+ ]
42
+
43
+ response = connection.list_network_offerings['listnetworkofferingsresponse']
44
+
45
+ if networks = response['networkoffering']
46
+
47
+ networks.each do |networkoffering|
48
+ # puts networkoffering
49
+ network_list << networkoffering['id'].to_s
50
+ network_list << networkoffering['name'].to_s
51
+ network_list << networkoffering['displaytext'].to_s
52
+ network_list << networkoffering['traffictype'].to_s
53
+ network_list << begin
54
+ state = networkoffering['state'].to_s.downcase
55
+ case state
56
+ when 'allocated'
57
+ ui.color(state, :red)
58
+ when 'pending'
59
+ ui.color(state, :yellow)
60
+ else
61
+ ui.color(state, :green)
62
+ end
63
+ end
64
+ network_list << networkoffering['serviceofferingid'].to_s
65
+ end
66
+ end
67
+
68
+ puts ui.list(network_list, :uneven_columns_across, 6)
69
+
70
+ end
71
+
72
+ end
73
+ end
74
+ end
@@ -1,90 +1,90 @@
1
- # Author:: Takashi Kanai (<anikundesu@gmail.com>)
2
- # Copyright:: Copyright (c) 2012 IDC Frontier Inc.
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
-
19
- require 'chef/knife/cloudstack_base'
20
-
21
- class Chef
22
- class Knife
23
- class CloudstackPublicipCreate < Knife
24
-
25
- include Knife::CloudstackBase
26
-
27
- banner "knife cloudstack publicip create (options)"
28
-
29
- option :zoneid,
30
- :short => "-z ZONEID",
31
- :long => "--zoneid ZONEID",
32
- :description => "[REQUIRED]The CloudStack zone ID to create new public IP."
33
-
34
- option :networkid,
35
- :long => "--network-id NETWORKID",
36
- :description => "[OPTIONAL]The CloudStack network ID to crate new public IP."
37
-
38
- def run
39
- $stdout.sync = true
40
-
41
- validate!
42
-
43
- options = {}
44
-
45
- if locate_config_value(:networkid) != nil
46
- options['networkid']=locate_config_value(:networkid)
47
- end
48
-
49
- if locate_config_value(:zoneid) != nil
50
- options['zoneid']=locate_config_value(:zoneid)
51
-
52
- publicip_list = [
53
- ui.color('ID', :bold),
54
- ui.color('ipaddress', :bold),
55
- ui.color('isSourceNAT', :bold),
56
- ui.color('isStaticNAT', :bold)
57
- ]
58
-
59
- response = connection.acquire_ip_address(options)
60
- publicipid = response['associateipaddressresponse']['id']
61
- jobid = response['associateipaddressresponse'].fetch('jobid')
62
-
63
- publicip_assign = connection.query_async_job_result('jobid'=>jobid)
64
- print "#{ui.color("Waiting for assigning Public IP", :magenta)}"
65
- while publicip_assign['queryasyncjobresultresponse'].fetch('jobstatus') != 1
66
- print "#{ui.color(".", :magenta)}"
67
- sleep(5)
68
- publicip_assign = connection.query_async_job_result('jobid'=>jobid)
69
- end
70
- puts "\n\n"
71
-
72
- publicip_assign = connection.query_async_job_result('jobid'=>jobid)
73
- publicip = publicip_assign['queryasyncjobresultresponse']['jobresult']['ipaddress']
74
-
75
- publicip_list << publicip['id'].to_s
76
- publicip_list << publicip['ipaddress'].to_s
77
- publicip_list << publicip['issourcenat'].to_s
78
- publicip_list << publicip['isstaticnat'].to_s
79
-
80
- puts ui.list(publicip_list, :columns_across, 4)
81
-
82
- else
83
- puts 'Error. Missing Zone ID (-z).'
84
- end
85
-
86
- end
87
-
88
- end
89
- end
90
- end
1
+ # Author:: Takashi Kanai (<anikundesu@gmail.com>)
2
+ # Copyright:: Copyright (c) 2012 IDC Frontier Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+
19
+ require 'chef/knife/cloudstack_base'
20
+
21
+ class Chef
22
+ class Knife
23
+ class CloudstackPublicipCreate < Knife
24
+
25
+ include Knife::CloudstackBase
26
+
27
+ banner "knife cloudstack publicip create (options)"
28
+
29
+ option :zoneid,
30
+ :short => "-z ZONEID",
31
+ :long => "--zoneid ZONEID",
32
+ :description => "[REQUIRED]The CloudStack zone ID to create new public IP."
33
+
34
+ option :networkid,
35
+ :long => "--network-id NETWORKID",
36
+ :description => "[OPTIONAL]The CloudStack network ID to crate new public IP."
37
+
38
+ def run
39
+ $stdout.sync = true
40
+
41
+ validate!
42
+
43
+ options = {}
44
+
45
+ if locate_config_value(:networkid) != nil
46
+ options['networkid']=locate_config_value(:networkid)
47
+ end
48
+
49
+ if locate_config_value(:zoneid) != nil
50
+ options['zoneid']=locate_config_value(:zoneid)
51
+
52
+ publicip_list = [
53
+ ui.color('ID', :bold),
54
+ ui.color('ipaddress', :bold),
55
+ ui.color('isSourceNAT', :bold),
56
+ ui.color('isStaticNAT', :bold)
57
+ ]
58
+
59
+ response = connection.acquire_ip_address(options)
60
+ publicipid = response['associateipaddressresponse']['id']
61
+ jobid = response['associateipaddressresponse'].fetch('jobid')
62
+
63
+ publicip_assign = connection.query_async_job_result('jobid'=>jobid)
64
+ print "#{ui.color("Waiting for assigning Public IP", :magenta)}"
65
+ while publicip_assign['queryasyncjobresultresponse'].fetch('jobstatus') != 1
66
+ print "#{ui.color(".", :magenta)}"
67
+ sleep(5)
68
+ publicip_assign = connection.query_async_job_result('jobid'=>jobid)
69
+ end
70
+ puts "\n\n"
71
+
72
+ publicip_assign = connection.query_async_job_result('jobid'=>jobid)
73
+ publicip = publicip_assign['queryasyncjobresultresponse']['jobresult']['ipaddress']
74
+
75
+ publicip_list << publicip['id'].to_s
76
+ publicip_list << publicip['ipaddress'].to_s
77
+ publicip_list << publicip['issourcenat'].to_s
78
+ publicip_list << publicip['isstaticnat'].to_s
79
+
80
+ puts ui.list(publicip_list, :columns_across, 4)
81
+
82
+ else
83
+ puts 'Error. Missing Zone ID (-z).'
84
+ end
85
+
86
+ end
87
+
88
+ end
89
+ end
90
+ end
@@ -1,57 +1,57 @@
1
- # Author:: Takashi Kanai (<anikundesu@gmail.com>)
2
- # Copyright:: Copyright (c) 2012 IDC Frontier Inc.
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
-
19
- require 'chef/knife/cloudstack_base'
20
-
21
- class Chef
22
- class Knife
23
- class CloudstackPublicipList < Knife
24
-
25
- include Knife::CloudstackBase
26
-
27
- banner "knife cloudstack publicip list"
28
-
29
- def run
30
- $stdout.sync = true
31
-
32
- validate!
33
-
34
- publicip_list = [
35
- ui.color('ID', :bold),
36
- ui.color('ipaddress', :bold),
37
- ui.color('isSourceNAT', :bold),
38
- ui.color('isStaticNAT', :bold),
39
- ui.color('VirtualMachineDisplayName', :bold)
40
- ]
41
- response = connection.list_public_ip_addresses['listpublicipaddressesresponse']
42
- if publicips = response['publicipaddress']
43
- publicips.each do |publicip|
44
- publicip_list << publicip['id'].to_s
45
- publicip_list << publicip['ipaddress'].to_s
46
- publicip_list << publicip['issourcenat'].to_s
47
- publicip_list << publicip['isstaticnat'].to_s
48
- publicip_list << publicip['virtualmachinedisplayname'].to_s
49
- end
50
- end
51
- puts ui.list(publicip_list, :columns_across, 5)
52
-
53
- end
54
-
55
- end
56
- end
57
- end
1
+ # Author:: Takashi Kanai (<anikundesu@gmail.com>)
2
+ # Copyright:: Copyright (c) 2012 IDC Frontier Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+
19
+ require 'chef/knife/cloudstack_base'
20
+
21
+ class Chef
22
+ class Knife
23
+ class CloudstackPublicipList < Knife
24
+
25
+ include Knife::CloudstackBase
26
+
27
+ banner "knife cloudstack publicip list"
28
+
29
+ def run
30
+ $stdout.sync = true
31
+
32
+ validate!
33
+
34
+ publicip_list = [
35
+ ui.color('ID', :bold),
36
+ ui.color('ipaddress', :bold),
37
+ ui.color('isSourceNAT', :bold),
38
+ ui.color('isStaticNAT', :bold),
39
+ ui.color('VirtualMachineDisplayName', :bold)
40
+ ]
41
+ response = connection.list_public_ip_addresses['listpublicipaddressesresponse']
42
+ if publicips = response['publicipaddress']
43
+ publicips.each do |publicip|
44
+ publicip_list << publicip['id'].to_s
45
+ publicip_list << publicip['ipaddress'].to_s
46
+ publicip_list << publicip['issourcenat'].to_s
47
+ publicip_list << publicip['isstaticnat'].to_s
48
+ publicip_list << publicip['virtualmachinedisplayname'].to_s
49
+ end
50
+ end
51
+ puts ui.list(publicip_list, :columns_across, 5)
52
+
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -1,124 +1,124 @@
1
- # Author:: Jeff Moody (<jmoody@datapipe.com>)
2
- # Copyright:: Copyright (c) 2012 Datapipe
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
-
19
- require 'chef/knife/cloudstack_base'
20
-
21
- class Chef
22
- class Knife
23
- class CloudstackSecuritygroupList < Knife
24
-
25
- include Knife::CloudstackBase
26
-
27
- banner "knife cloudstack securitygroup list (options)"
28
- option :groupid,
29
- :short => "-g GROUPID",
30
- :long => "--groupid GROUPID",
31
- :description => "List the rules contained within a Security Group, specified by ID",
32
- :default => 'none'
33
- option :groupname,
34
- :short => "-G GROUPNAME",
35
- :long => "--groupname GROUPNAME",
36
- :description => "List the rules contained within a Security Group, specified by name.",
37
- :default => 'none'
38
-
39
- def sg_details_list(securitygroup_list, securitygroup_details, groups, options={})
40
- temp = groups
41
- if groupid = options[:groupid]
42
- temp.reject!{|g| g['id'] != groupid.to_i}
43
- end
44
- if groupname = options[:groupname]
45
- temp.reject!{|g| g['name'] != groupname}
46
- end
47
-
48
- temp.each do |securitygroup|
49
- securitygroup_list << securitygroup['id'].to_s
50
- securitygroup_list << securitygroup['name'].to_s
51
- securitygroup_list << securitygroup['description'].to_s
52
- if securitygroup['ingressrule'].nil?
53
- securitygroup_details << ' '
54
- else
55
- securitygroup['ingressrule'].each do |ingressrule|
56
- rule_details = []
57
- securitygroup_details << ingressrule['protocol'].to_s
58
- securitygroup_details << ingressrule['startport'].to_s
59
- securitygroup_details << ingressrule['endport'].to_s
60
- if ingressrule['cidr'].nil?
61
- rule_details << ingressrule['securitygroupname'].to_s
62
- rule_details << ingressrule['account'].to_s
63
- else
64
- rule_details << ingressrule['cidr'].to_s
65
- end
66
- securitygroup_details << rule_details.join(", ")
67
- end
68
- end
69
- end
70
- end
71
-
72
- def run
73
- $stdout.sync = true
74
-
75
- validate!
76
- groupid = locate_config_value(:groupid)
77
- groupname = locate_config_value(:groupname)
78
-
79
- if (groupid == 'none' and groupname == 'none')
80
- securitygroup_list = [
81
- ui.color('ID', :bold),
82
- ui.color('Name', :bold),
83
- ui.color('Description', :bold)
84
- ]
85
- response = connection.list_security_groups['listsecuritygroupsresponse']
86
- if securitygroups = response['securitygroup']
87
- securitygroups.each do |securitygroup|
88
- securitygroup_list << securitygroup['id'].to_s
89
- securitygroup_list << securitygroup['name'].to_s
90
- securitygroup_list << securitygroup['description'].to_s
91
- end
92
- end
93
- puts ui.list(securitygroup_list, :columns_across, 3)
94
- else
95
- securitygroup_details = [
96
- ui.color('Protocol', :bold),
97
- ui.color('Start Port', :bold),
98
- ui.color('End Port', :bold),
99
- ui.color('Restricted To', :bold)
100
- ]
101
- securitygroup_list = [
102
- ui.color('ID', :bold),
103
- ui.color('Name', :bold),
104
- ui.color('Description', :bold)
105
- ]
106
-
107
- if response = connection.list_security_groups['listsecuritygroupsresponse']
108
- if securitygroups = response['securitygroup']
109
- filters = {}
110
- filters[:groupid] = groupid unless groupid == 'none'
111
- filters[:groupname] = groupname unless groupname == 'none'
112
- sg_details_list(securitygroup_list, securitygroup_details, securitygroups, filters)
113
-
114
- puts ui.list(securitygroup_list, :columns_across, 3)
115
- puts ui.list(securitygroup_details, :columns_across, 4)
116
- end
117
- end
118
-
119
- end
120
- end
121
-
122
- end
123
- end
124
- end
1
+ # Author:: Jeff Moody (<jmoody@datapipe.com>)
2
+ # Copyright:: Copyright (c) 2012 Datapipe
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+
19
+ require 'chef/knife/cloudstack_base'
20
+
21
+ class Chef
22
+ class Knife
23
+ class CloudstackSecuritygroupList < Knife
24
+
25
+ include Knife::CloudstackBase
26
+
27
+ banner "knife cloudstack securitygroup list (options)"
28
+ option :groupid,
29
+ :short => "-g GROUPID",
30
+ :long => "--groupid GROUPID",
31
+ :description => "List the rules contained within a Security Group, specified by ID",
32
+ :default => 'none'
33
+ option :groupname,
34
+ :short => "-G GROUPNAME",
35
+ :long => "--groupname GROUPNAME",
36
+ :description => "List the rules contained within a Security Group, specified by name.",
37
+ :default => 'none'
38
+
39
+ def sg_details_list(securitygroup_list, securitygroup_details, groups, options={})
40
+ temp = groups
41
+ if groupid = options[:groupid]
42
+ temp.reject!{|g| g['id'] != groupid.to_i}
43
+ end
44
+ if groupname = options[:groupname]
45
+ temp.reject!{|g| g['name'] != groupname}
46
+ end
47
+
48
+ temp.each do |securitygroup|
49
+ securitygroup_list << securitygroup['id'].to_s
50
+ securitygroup_list << securitygroup['name'].to_s
51
+ securitygroup_list << securitygroup['description'].to_s
52
+ if securitygroup['ingressrule'].nil?
53
+ securitygroup_details << ' '
54
+ else
55
+ securitygroup['ingressrule'].each do |ingressrule|
56
+ rule_details = []
57
+ securitygroup_details << ingressrule['protocol'].to_s
58
+ securitygroup_details << ingressrule['startport'].to_s
59
+ securitygroup_details << ingressrule['endport'].to_s
60
+ if ingressrule['cidr'].nil?
61
+ rule_details << ingressrule['securitygroupname'].to_s
62
+ rule_details << ingressrule['account'].to_s
63
+ else
64
+ rule_details << ingressrule['cidr'].to_s
65
+ end
66
+ securitygroup_details << rule_details.join(", ")
67
+ end
68
+ end
69
+ end
70
+ end
71
+
72
+ def run
73
+ $stdout.sync = true
74
+
75
+ validate!
76
+ groupid = locate_config_value(:groupid)
77
+ groupname = locate_config_value(:groupname)
78
+
79
+ if (groupid == 'none' and groupname == 'none')
80
+ securitygroup_list = [
81
+ ui.color('ID', :bold),
82
+ ui.color('Name', :bold),
83
+ ui.color('Description', :bold)
84
+ ]
85
+ response = connection.list_security_groups['listsecuritygroupsresponse']
86
+ if securitygroups = response['securitygroup']
87
+ securitygroups.each do |securitygroup|
88
+ securitygroup_list << securitygroup['id'].to_s
89
+ securitygroup_list << securitygroup['name'].to_s
90
+ securitygroup_list << securitygroup['description'].to_s
91
+ end
92
+ end
93
+ puts ui.list(securitygroup_list, :columns_across, 3)
94
+ else
95
+ securitygroup_details = [
96
+ ui.color('Protocol', :bold),
97
+ ui.color('Start Port', :bold),
98
+ ui.color('End Port', :bold),
99
+ ui.color('Restricted To', :bold)
100
+ ]
101
+ securitygroup_list = [
102
+ ui.color('ID', :bold),
103
+ ui.color('Name', :bold),
104
+ ui.color('Description', :bold)
105
+ ]
106
+
107
+ if response = connection.list_security_groups['listsecuritygroupsresponse']
108
+ if securitygroups = response['securitygroup']
109
+ filters = {}
110
+ filters[:groupid] = groupid unless groupid == 'none'
111
+ filters[:groupname] = groupname unless groupname == 'none'
112
+ sg_details_list(securitygroup_list, securitygroup_details, securitygroups, filters)
113
+
114
+ puts ui.list(securitygroup_list, :columns_across, 3)
115
+ puts ui.list(securitygroup_details, :columns_across, 4)
116
+ end
117
+ end
118
+
119
+ end
120
+ end
121
+
122
+ end
123
+ end
124
+ end