knife-cosmic 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES.rdoc +186 -0
- data/LICENSE +202 -0
- data/README.rdoc +427 -0
- data/lib/chef/knife/cosmic_aag_list.rb +58 -0
- data/lib/chef/knife/cosmic_account_list.rb +87 -0
- data/lib/chef/knife/cosmic_base.rb +108 -0
- data/lib/chef/knife/cosmic_baselist.rb +111 -0
- data/lib/chef/knife/cosmic_cluster_list.rb +60 -0
- data/lib/chef/knife/cosmic_config_list.rb +56 -0
- data/lib/chef/knife/cosmic_disk_list.rb +58 -0
- data/lib/chef/knife/cosmic_domain_list.rb +53 -0
- data/lib/chef/knife/cosmic_firewallrule_create.rb +138 -0
- data/lib/chef/knife/cosmic_firewallrule_list.rb +62 -0
- data/lib/chef/knife/cosmic_forwardrule_create.rb +145 -0
- data/lib/chef/knife/cosmic_host_list.rb +61 -0
- data/lib/chef/knife/cosmic_hosts.rb +58 -0
- data/lib/chef/knife/cosmic_iso_list.rb +89 -0
- data/lib/chef/knife/cosmic_keypair_create.rb +72 -0
- data/lib/chef/knife/cosmic_keypair_delete.rb +60 -0
- data/lib/chef/knife/cosmic_keypair_list.rb +44 -0
- data/lib/chef/knife/cosmic_network_list.rb +63 -0
- data/lib/chef/knife/cosmic_oscategory_list.rb +50 -0
- data/lib/chef/knife/cosmic_ostype_list.rb +52 -0
- data/lib/chef/knife/cosmic_pod_list.rb +60 -0
- data/lib/chef/knife/cosmic_project_list.rb +63 -0
- data/lib/chef/knife/cosmic_publicip_list.rb +55 -0
- data/lib/chef/knife/cosmic_router_list.rb +64 -0
- data/lib/chef/knife/cosmic_securitygroup_list.rb +59 -0
- data/lib/chef/knife/cosmic_server_add_nic.rb +109 -0
- data/lib/chef/knife/cosmic_server_create.rb +674 -0
- data/lib/chef/knife/cosmic_server_delete.rb +153 -0
- data/lib/chef/knife/cosmic_server_list.rb +167 -0
- data/lib/chef/knife/cosmic_server_passwordreset.rb +91 -0
- data/lib/chef/knife/cosmic_server_reboot.rb +99 -0
- data/lib/chef/knife/cosmic_server_remove_nic.rb +101 -0
- data/lib/chef/knife/cosmic_server_start.rb +104 -0
- data/lib/chef/knife/cosmic_server_stop.rb +118 -0
- data/lib/chef/knife/cosmic_server_update.rb +47 -0
- data/lib/chef/knife/cosmic_service_list.rb +74 -0
- data/lib/chef/knife/cosmic_stack_create.rb +298 -0
- data/lib/chef/knife/cosmic_stack_delete.rb +79 -0
- data/lib/chef/knife/cosmic_template_create.rb +129 -0
- data/lib/chef/knife/cosmic_template_extract.rb +104 -0
- data/lib/chef/knife/cosmic_template_list.rb +88 -0
- data/lib/chef/knife/cosmic_template_register.rb +187 -0
- data/lib/chef/knife/cosmic_user_list.rb +62 -0
- data/lib/chef/knife/cosmic_volume_attach.rb +70 -0
- data/lib/chef/knife/cosmic_volume_create.rb +108 -0
- data/lib/chef/knife/cosmic_volume_delete.rb +97 -0
- data/lib/chef/knife/cosmic_volume_detach.rb +61 -0
- data/lib/chef/knife/cosmic_volume_list.rb +77 -0
- data/lib/chef/knife/cosmic_zone_list.rb +53 -0
- data/lib/knife-cosmic/connection.rb +1046 -0
- metadata +127 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
#
|
2
|
+
# Original knife-cloudstack author:: Sander Botman (<sbotman@schubergphilis.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013 Sander Botman.
|
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
|
+
require 'chef/knife/cosmic_baselist'
|
21
|
+
|
22
|
+
module Knifecosmic
|
23
|
+
class CosmicDiskList < Chef::Knife
|
24
|
+
|
25
|
+
include Chef::Knife::KnifecosmicBaseList
|
26
|
+
|
27
|
+
banner "knife cosmic disk list (options)"
|
28
|
+
|
29
|
+
option :name,
|
30
|
+
:long => "--name NAME",
|
31
|
+
:description => "Specify diskname to list"
|
32
|
+
|
33
|
+
option :keyword,
|
34
|
+
:long => "--service NAME",
|
35
|
+
:description => "Specify part of diskname to list"
|
36
|
+
|
37
|
+
def run
|
38
|
+
validate_base_options
|
39
|
+
|
40
|
+
columns = [
|
41
|
+
'Name :name',
|
42
|
+
'Domain :domain',
|
43
|
+
'Size :disksize',
|
44
|
+
'Comment :displaytext',
|
45
|
+
'Created :created'
|
46
|
+
]
|
47
|
+
|
48
|
+
params = { 'command' => "listDiskOfferings" }
|
49
|
+
params['filter'] = locate_config_value(:filter) if locate_config_value(:filter)
|
50
|
+
params['keyword'] = locate_config_value(:keyword) if locate_config_value(:keyword)
|
51
|
+
params['name'] = locate_config_value(:name) if locate_config_value(:name)
|
52
|
+
|
53
|
+
result = connection.list_object(params, "diskoffering")
|
54
|
+
list_object(columns, result)
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#
|
2
|
+
# Original knife-cloudstack author:: Sander Botman (<sbotman@schubergphilis.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013 Sander Botman.
|
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
|
+
require 'chef/knife/cosmic_baselist'
|
21
|
+
|
22
|
+
module Knifecosmic
|
23
|
+
class CosmicDomainList < Chef::Knife
|
24
|
+
|
25
|
+
include Chef::Knife::KnifecosmicBaseList
|
26
|
+
|
27
|
+
banner "knife cosmic domain list (options)"
|
28
|
+
|
29
|
+
option :listall,
|
30
|
+
:long => "--listall",
|
31
|
+
:description => "List all the domains",
|
32
|
+
:boolean => true
|
33
|
+
|
34
|
+
def run
|
35
|
+
validate_base_options
|
36
|
+
|
37
|
+
columns = [
|
38
|
+
'Name :name',
|
39
|
+
'ID :id',
|
40
|
+
'Level :level',
|
41
|
+
'Path :path'
|
42
|
+
]
|
43
|
+
|
44
|
+
params = { 'command' => "listDomains" }
|
45
|
+
params['filter'] = locate_config_value(:filter) if locate_config_value(:filter)
|
46
|
+
params['listall'] = locate_config_value(:listall) if locate_config_value(:listall)
|
47
|
+
|
48
|
+
result = connection.list_object(params, "domain")
|
49
|
+
list_object(columns, result)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
#
|
2
|
+
# Original knife-cloudstack author:: Sander Botman (<sbotman@schubergphilis.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013 Sander Botman.
|
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/cosmic_base'
|
20
|
+
|
21
|
+
module Knifecosmic
|
22
|
+
class CosmicFirewallruleCreate < Chef::Knife
|
23
|
+
|
24
|
+
include Chef::Knife::KnifecosmicBase
|
25
|
+
|
26
|
+
deps do
|
27
|
+
require 'knife-cosmic/connection'
|
28
|
+
Chef::Knife.load_deps
|
29
|
+
end
|
30
|
+
|
31
|
+
banner "knife cosmic firewallrule create hostname 8080:8090:TCP:10.0.0.0/24"
|
32
|
+
|
33
|
+
option :syncrequest,
|
34
|
+
:long => "--sync",
|
35
|
+
:description => "Execute command as sync request",
|
36
|
+
:boolean => true
|
37
|
+
|
38
|
+
option :public_ip,
|
39
|
+
:long => "--public_ip IP_ADDRESS",
|
40
|
+
:description => "Provide the public IP adrress. This makes it possible to create rules on VPCosmic"
|
41
|
+
|
42
|
+
def run
|
43
|
+
|
44
|
+
@hostname = @name_args.shift
|
45
|
+
unless /^[a-zA-Z0-9][a-zA-Z0-9-]*$/.match @hostname then
|
46
|
+
ui.error "Invalid hostname. Please specify a short hostname, not an fqdn (e.g. 'myhost' instead of 'myhost.domain.com')."
|
47
|
+
exit 1
|
48
|
+
end
|
49
|
+
|
50
|
+
params = {}
|
51
|
+
locate_config_value(:openfirewall) ? params['openfirewall'] = 'true' : params['openfirewall'] = 'false'
|
52
|
+
|
53
|
+
# Lookup all server objects.
|
54
|
+
params_for_list_object = { 'command' => 'listVirtualMachines' }
|
55
|
+
connection_result = connection.list_object(params_for_list_object, "virtualmachine")
|
56
|
+
|
57
|
+
# Lookup the hostname in the connection result
|
58
|
+
server = {}
|
59
|
+
connection_result.map { |n| server = n if n['name'].upcase == @hostname.upcase }
|
60
|
+
|
61
|
+
if server['name'].nil?
|
62
|
+
ui.error "Cannot find hostname: #{@hostname}."
|
63
|
+
exit 1
|
64
|
+
end
|
65
|
+
|
66
|
+
# Lookup the public ip address of the server
|
67
|
+
if config[:public_ip].nil?
|
68
|
+
server_public_address = connection.get_server_public_ip(server)
|
69
|
+
ip_address = connection.get_public_ip_address(server_public_address)
|
70
|
+
else
|
71
|
+
ip_address = connection.get_public_ip_address(config[:public_ip])
|
72
|
+
end
|
73
|
+
|
74
|
+
if ip_address.nil? || ip_address['id'].nil?
|
75
|
+
ui.error "Cannot find public ip address for hostname: #{@hostname}."
|
76
|
+
exit 1
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
@name_args.each do |rule|
|
81
|
+
create_port_forwarding_rule(ip_address, server['id'], rule, connection, params)
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
def create_port_forwarding_rule(ip_address, server_id, rule, connection, other_params)
|
87
|
+
args = rule.split(':')
|
88
|
+
startport = args[0]
|
89
|
+
endport = args[1] || args[0]
|
90
|
+
protocol = args[2] || "TCP"
|
91
|
+
cidrlist = args[3] || "0.0.0.0/0"
|
92
|
+
|
93
|
+
# Required parameters
|
94
|
+
params = {
|
95
|
+
'ipaddressId' => ip_address['id'],
|
96
|
+
'protocol' => protocol
|
97
|
+
}
|
98
|
+
|
99
|
+
if config[:public_ip].nil?
|
100
|
+
params['command'] = 'createFirewallRule'
|
101
|
+
else
|
102
|
+
params['command'] = 'createNetworkACL'
|
103
|
+
# Random rule number; will be temp and hopefully wont hit collision
|
104
|
+
params['number'] = (0...4).map { [rand(10)] }.join
|
105
|
+
params['action'] = 'Allow'
|
106
|
+
params['traffictype'] = 'Ingress'
|
107
|
+
# To keep the def backwards compatible..
|
108
|
+
@hostname
|
109
|
+
|
110
|
+
server = connection.get_server(@hostname)
|
111
|
+
server_nic_default = connection.get_server_default_nic(server)
|
112
|
+
networkid = server_nic_default['networkid']
|
113
|
+
params['aclid'] = connection.get_network(networkid)['aclid']
|
114
|
+
end
|
115
|
+
|
116
|
+
# Optional parameters
|
117
|
+
opt_params = {
|
118
|
+
'startport' => startport,
|
119
|
+
'endport' => endport,
|
120
|
+
'cidrlist' => cidrlist
|
121
|
+
}
|
122
|
+
|
123
|
+
params.merge!(opt_params)
|
124
|
+
|
125
|
+
Chef::Log.debug("Creating Firewall Rule for
|
126
|
+
#{ip_address['ipaddress']} with protocol: #{protocol}, start: #{startport} end: #{endport} cidr: #{cidrlist}")
|
127
|
+
|
128
|
+
if locate_config_value(:syncrequest)
|
129
|
+
result = connection.send_request(params)
|
130
|
+
Chef::Log.debug("JobResult: #{result}")
|
131
|
+
else
|
132
|
+
result = connection.send_async_request(params)
|
133
|
+
Chef::Log.debug("AsyncJobResult: #{result}")
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#
|
2
|
+
# Original knife-cloudstack author:: Sander Botman (<sbotman@schubergphilis.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013 Sander Botman.
|
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
|
+
require 'chef/knife/cosmic_baselist'
|
21
|
+
|
22
|
+
module Knifecosmic
|
23
|
+
class CosmicFirewallruleList < Chef::Knife
|
24
|
+
|
25
|
+
include Chef::Knife::KnifecosmicBaseList
|
26
|
+
|
27
|
+
banner "knife cosmic firewallrule list (options)"
|
28
|
+
|
29
|
+
option :listall,
|
30
|
+
:long => "--listall",
|
31
|
+
:description => "List all firewall rules",
|
32
|
+
:boolean => true
|
33
|
+
|
34
|
+
option :keyword,
|
35
|
+
:long => "--keyword KEY",
|
36
|
+
:description => "List by keyword"
|
37
|
+
|
38
|
+
def run
|
39
|
+
validate_base_options
|
40
|
+
|
41
|
+
columns = [
|
42
|
+
'ID :id',
|
43
|
+
'Protocol :protocol',
|
44
|
+
'Start Port :startport',
|
45
|
+
'End Port :endport',
|
46
|
+
'IP AddressID :ipaddressid',
|
47
|
+
'IP Address :ipaddress',
|
48
|
+
'State :state',
|
49
|
+
'CIDR List :cidrlist'
|
50
|
+
]
|
51
|
+
|
52
|
+
params = { 'command' => "listFirewallRules" }
|
53
|
+
params['filter'] = locate_config_value(:filter) if locate_config_value(:filter)
|
54
|
+
params['listall'] = locate_config_value(:listall) if locate_config_value(:listall)
|
55
|
+
params['keyword'] = locate_config_value(:keyword) if locate_config_value(:keyword)
|
56
|
+
|
57
|
+
result = connection.list_object(params, "firewallrule")
|
58
|
+
list_object(columns, result)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
#
|
2
|
+
# knife-cosmic author:: Robbert-Jan Sperna Weiland (<rspernaweiland@schubergphilis.com>)
|
3
|
+
# Original knife-cloudstack author:: Sander Botman (<sbotman@schubergphilis.com>)
|
4
|
+
# Copyright:: Copyright (c) 2013 Sander Botman.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'chef/knife/cosmic_base'
|
21
|
+
|
22
|
+
module Knifecosmic
|
23
|
+
class CosmicForwardruleCreate < Chef::Knife
|
24
|
+
|
25
|
+
include Chef::Knife::KnifecosmicBase
|
26
|
+
|
27
|
+
deps do
|
28
|
+
require 'knife-cosmic/connection'
|
29
|
+
Chef::Knife.load_deps
|
30
|
+
end
|
31
|
+
|
32
|
+
banner "knife cosmic forwardrule create hostname 8080:8090:TCP (options)"
|
33
|
+
|
34
|
+
option :openfirewall,
|
35
|
+
:long => "--openfirewall",
|
36
|
+
:description => "Add rule also to firewall",
|
37
|
+
:boolean => true
|
38
|
+
|
39
|
+
option :syncrequest,
|
40
|
+
:long => "--sync",
|
41
|
+
:description => "Execute command as sync request",
|
42
|
+
:boolean => true
|
43
|
+
|
44
|
+
option :vrip,
|
45
|
+
:long => "--vrip PUBLIC_ROUTER_IP",
|
46
|
+
:description => "Public IP associated with virtual router to expose the external port on. Use this to indicate the server has an internal IP that needs to be exposed on the router's public IP."
|
47
|
+
|
48
|
+
def run
|
49
|
+
|
50
|
+
hostname = @name_args.shift
|
51
|
+
unless /^[a-zA-Z0-9][a-zA-Z0-9-]*$/.match hostname then
|
52
|
+
ui.error "Invalid hostname. Please specify a short hostname, not an fqdn (e.g. 'myhost' instead of 'myhost.domain.com')."
|
53
|
+
exit 1
|
54
|
+
end
|
55
|
+
|
56
|
+
params = {}
|
57
|
+
locate_config_value(:openfirewall) ? params['openfirewall'] = 'true' : params['openfirewall'] = 'false'
|
58
|
+
|
59
|
+
# Lookup all server objects.
|
60
|
+
params_for_list_object = { 'command' => 'listVirtualMachines', 'name' => hostname }
|
61
|
+
connection_result = connection.list_object(params_for_list_object, "virtualmachine")
|
62
|
+
|
63
|
+
# Lookup the hostname in the connection result
|
64
|
+
server = {}
|
65
|
+
connection_result.map { |n| server = n if n['name'].upcase == hostname.upcase }
|
66
|
+
|
67
|
+
if server['name'].nil?
|
68
|
+
ui.error "Cannot find hostname: #{hostname}."
|
69
|
+
exit 1
|
70
|
+
end
|
71
|
+
|
72
|
+
if locate_config_value(:vrip)
|
73
|
+
Chef::Log.debug("Forwarding rule for VPC.")
|
74
|
+
server['nic'].each do |nic|
|
75
|
+
params['vmguestip'] = nic['ipaddress']
|
76
|
+
end
|
77
|
+
ip_address = {}
|
78
|
+
ip_address['ipaddress'] = config[:vrip]
|
79
|
+
else
|
80
|
+
Chef::Log.debug("Forwarding rule for public IP on server")
|
81
|
+
server_address = connection.get_server_public_ip(server)
|
82
|
+
ip_address = connection.get_public_ip_address(server_address)
|
83
|
+
|
84
|
+
if ip_address.nil? || ip_address['id'].nil?
|
85
|
+
ui.error "Cannot find public ip address for hostname: #{hostname}."
|
86
|
+
exit 1
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
@name_args.each do |rule|
|
91
|
+
create_port_forwarding_rule(ip_address, server, rule, connection, params)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def create_port_forwarding_rule(ip_address, server, rule, connection, other_params)
|
96
|
+
server_id = server['id']
|
97
|
+
args = rule.split(':')
|
98
|
+
public_port = args[0]
|
99
|
+
private_port = args[1] || args[0]
|
100
|
+
protocol = args[2] || "TCP"
|
101
|
+
|
102
|
+
params = {
|
103
|
+
'ipaddressId' => ip_address['id'],
|
104
|
+
'protocol' => protocol
|
105
|
+
}
|
106
|
+
|
107
|
+
if other_params['vmguestip']
|
108
|
+
# VPC based network
|
109
|
+
# Find networkid associated with primary VM nic
|
110
|
+
server_default_nic = connection.get_server_default_nic(server)
|
111
|
+
networkid = server_default_nic['networkid']
|
112
|
+
other_params['networkid'] = networkid
|
113
|
+
|
114
|
+
# Find id of public router IP
|
115
|
+
public_ip = connection.get_public_ip_address(ip_address['ipaddress'])
|
116
|
+
params['ipaddressId'] = public_ip['id']
|
117
|
+
|
118
|
+
other_params['command'] = 'createPortForwardingRule'
|
119
|
+
other_params['privatePort'] = private_port
|
120
|
+
other_params['privateEndPort'] = private_port
|
121
|
+
other_params['publicPort'] = public_port
|
122
|
+
other_params['publicEndPort'] = public_port
|
123
|
+
other_params['virtualMachineId'] = server_id
|
124
|
+
|
125
|
+
Chef::Log.debug("Creating port Forwarding Rule for router ip
|
126
|
+
#{ip_address['ipaddress']} with protocol: #{protocol}, public port: #{public_port}")
|
127
|
+
elsif ip_address['isstaticnat'] == 'true'
|
128
|
+
other_params['command'] = 'createIpForwardingRule'
|
129
|
+
other_params['startport'] = public_port
|
130
|
+
other_params['endport'] = public_port
|
131
|
+
Chef::Log.debug("Creating IP Forwarding Rule for
|
132
|
+
#{ip_address['ipaddress']} with protocol: #{protocol}, public port: #{public_port}")
|
133
|
+
else
|
134
|
+
other_params['command'] = 'createPortForwardingRule'
|
135
|
+
other_params['privatePort'] = private_port
|
136
|
+
other_params['publicPort'] = public_port
|
137
|
+
other_params['virtualMachineId'] = server_id
|
138
|
+
Chef::Log.debug("Creating Port Forwarding Rule for #{ip_address['id']} with protocol: #{protocol},
|
139
|
+
public port: #{public_port} and private port: #{private_port} and server: #{server_id}")
|
140
|
+
end
|
141
|
+
locate_config_value(:syncrequest) ? result = connection.send_request(params.merge(other_params)) : result = connection.send_async_request(params.merge(other_params))
|
142
|
+
Chef::Log.debug("AsyncJobResult: #{result}")
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|