Skip to content

Add privateendport and publicendport parameters to createPortForwardingRule API #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cloudstack/FirewallService.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ type FirewallServiceIface interface {
CreateFirewallRule(p *CreateFirewallRuleParams) (*CreateFirewallRuleResponse, error)
NewCreateFirewallRuleParams(ipaddressid string, protocol string) *CreateFirewallRuleParams
CreatePortForwardingRule(p *CreatePortForwardingRuleParams) (*CreatePortForwardingRuleResponse, error)
NewCreatePortForwardingRuleParams(ipaddressid string, privateport int, protocol string, publicport int, virtualmachineid string) *CreatePortForwardingRuleParams
NewCreatePortForwardingRuleParams(ipaddressid string, privateendport int, privateport int, protocol string, publicendport int, publicport int, virtualmachineid string) *CreatePortForwardingRuleParams
CreateRoutingFirewallRule(p *CreateRoutingFirewallRuleParams) (*CreateRoutingFirewallRuleResponse, error)
NewCreateRoutingFirewallRuleParams(networkid string, protocol string) *CreateRoutingFirewallRuleParams
DeleteEgressFirewallRule(p *DeleteEgressFirewallRuleParams) (*DeleteEgressFirewallRuleResponse, error)
Expand Down Expand Up @@ -1412,12 +1412,14 @@ func (p *CreatePortForwardingRuleParams) GetVmguestip() (string, bool) {

// You should always use this function to get a new CreatePortForwardingRuleParams instance,
// as then you are sure you have configured all required params
func (s *FirewallService) NewCreatePortForwardingRuleParams(ipaddressid string, privateport int, protocol string, publicport int, virtualmachineid string) *CreatePortForwardingRuleParams {
func (s *FirewallService) NewCreatePortForwardingRuleParams(ipaddressid string, privateendport int, privateport int, protocol string, publicendport int, publicport int, virtualmachineid string) *CreatePortForwardingRuleParams {
p := &CreatePortForwardingRuleParams{}
p.p = make(map[string]interface{})
p.p["ipaddressid"] = ipaddressid
p.p["privateendport"] = privateendport
p.p["privateport"] = privateport
p.p["protocol"] = protocol
p.p["publicendport"] = publicendport
p.p["publicport"] = publicport
p.p["virtualmachineid"] = virtualmachineid
return p
Expand Down
8 changes: 4 additions & 4 deletions cloudstack/FirewallService_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions generate/requiredParams.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,8 @@ var requiredParams = map[string][]string{
"updateGuestOs": {
"osdisplayname",
},
"createPortForwardingRule": {
"privateendport",
"publicendport",
},
}
2 changes: 1 addition & 1 deletion test/FirewallService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func TestFirewallService(t *testing.T) {
if _, ok := response["createPortForwardingRule"]; !ok {
t.Skipf("Skipping as no json response is provided in testdata")
}
p := client.Firewall.NewCreatePortForwardingRuleParams("ipaddressid", 0, "protocol", 0, "virtualmachineid")
p := client.Firewall.NewCreatePortForwardingRuleParams("ipaddressid", 0, 0, "protocol", 0, 0, "virtualmachineid")
r, err := client.Firewall.CreatePortForwardingRule(p)
if err != nil {
t.Errorf(err.Error())
Expand Down
Loading