fixes after adding rackspace/gophercloud commits
diff --git a/openstack/compute/v2/extensions/defsecrules/fixtures.go b/openstack/compute/v2/extensions/defsecrules/fixtures.go
index 4fee896..bf708f8 100644
--- a/openstack/compute/v2/extensions/defsecrules/fixtures.go
+++ b/openstack/compute/v2/extensions/defsecrules/fixtures.go
@@ -83,8 +83,8 @@
{
"security_group_default_rule": {
"ip_protocol": "ICMP",
- "from_port": 0,
- "to_port": 0,
+ "from_port": 80,
+ "to_port": 80,
"cidr": "10.10.12.0/24"
}
}
@@ -96,13 +96,13 @@
fmt.Fprintf(w, `
{
"security_group_default_rule": {
- "from_port": 0,
+ "from_port": 80,
"id": "{ruleID}",
"ip_protocol": "ICMP",
"ip_range": {
"cidr": "10.10.12.0/24"
},
- "to_port": 0
+ "to_port": 80
}
}
`)
diff --git a/openstack/compute/v2/extensions/defsecrules/requests.go b/openstack/compute/v2/extensions/defsecrules/requests.go
index 6f24bb3..5d74256 100644
--- a/openstack/compute/v2/extensions/defsecrules/requests.go
+++ b/openstack/compute/v2/extensions/defsecrules/requests.go
@@ -14,7 +14,7 @@
// CreateOpts represents the configuration for adding a new default rule.
type CreateOpts struct {
- // The lower bound of the port range that will be opened.
+ // The lower bound of the port range that will be opened.s
FromPort int `json:"from_port" required:"true"`
// The upper bound of the port range that will be opened.
ToPort int `json:"to_port" required:"true"`
diff --git a/openstack/compute/v2/extensions/defsecrules/requests_test.go b/openstack/compute/v2/extensions/defsecrules/requests_test.go
index df568fe..3cbc990 100644
--- a/openstack/compute/v2/extensions/defsecrules/requests_test.go
+++ b/openstack/compute/v2/extensions/defsecrules/requests_test.go
@@ -77,8 +77,8 @@
opts := CreateOpts{
IPProtocol: "ICMP",
- FromPort: 0,
- ToPort: 0,
+ FromPort: 80,
+ ToPort: 80,
CIDR: "10.10.12.0/24",
}
@@ -87,8 +87,8 @@
expected := &DefaultRule{
ID: ruleID,
- FromPort: 0,
- ToPort: 0,
+ FromPort: 80,
+ ToPort: 80,
IPProtocol: "ICMP",
IPRange: secgroups.IPRange{CIDR: "10.10.12.0/24"},
}
diff --git a/openstack/compute/v2/extensions/secgroups/fixtures.go b/openstack/compute/v2/extensions/secgroups/fixtures.go
index e4ca587..4e4c0e4 100644
--- a/openstack/compute/v2/extensions/secgroups/fixtures.go
+++ b/openstack/compute/v2/extensions/secgroups/fixtures.go
@@ -226,9 +226,9 @@
th.TestJSONRequest(t, r, `
{
"security_group_rule": {
- "from_port": 0,
+ "from_port": 80,
"ip_protocol": "ICMP",
- "to_port": 0,
+ "to_port": 80,
"parent_group_id": "{groupID}",
"cidr": "0.0.0.0/0"
}
@@ -240,10 +240,10 @@
fmt.Fprintf(w, `
{
"security_group_rule": {
- "from_port": 0,
+ "from_port": 80,
"group": {},
"ip_protocol": "ICMP",
- "to_port": 0,
+ "to_port": 80,
"parent_group_id": "{groupID}",
"ip_range": {
"cidr": "0.0.0.0/0"
diff --git a/openstack/compute/v2/extensions/secgroups/requests.go b/openstack/compute/v2/extensions/secgroups/requests.go
index 81993bd..1cdbde0 100644
--- a/openstack/compute/v2/extensions/secgroups/requests.go
+++ b/openstack/compute/v2/extensions/secgroups/requests.go
@@ -101,23 +101,23 @@
// CreateRuleOpts represents the configuration for adding a new rule to an
// existing security group.
type CreateRuleOpts struct {
- // Required - the ID of the group that this rule will be added to.
+ // the ID of the group that this rule will be added to.
ParentGroupID string `json:"parent_group_id" required:"true"`
- // Required - the lower bound of the port range that will be opened.
+ // the lower bound of the port range that will be opened.
FromPort int `json:"from_port" required:"true"`
- // Required - the upper bound of the port range that will be opened.
+ // the upper bound of the port range that will be opened.
ToPort int `json:"to_port" required:"true"`
- // Required - the protocol type that will be allowed, e.g. TCP.
+ // the protocol type that will be allowed, e.g. TCP.
IPProtocol string `json:"ip_protocol" required:"true"`
// ONLY required if FromGroupID is blank. This represents the IP range that
// will be the source of network traffic to your security group. Use
// 0.0.0.0/0 to allow all IP addresses.
- CIDR string `json:"cidr,omitempty"`
+ CIDR string `json:"cidr,omitempty" or:"FromGroupID"`
// ONLY required if CIDR is blank. This value represents the ID of a group
// that forwards traffic to the parent group. So, instead of accepting
// network traffic from an entire IP range, you can instead refine the
// inbound source by an existing security group.
- FromGroupID string `json:"group_id,omitempty"`
+ FromGroupID string `json:"group_id,omitempty" or:"CIDR"`
}
// CreateRuleOptsBuilder builds the create rule options into a serializable format.
diff --git a/openstack/compute/v2/extensions/secgroups/requests_test.go b/openstack/compute/v2/extensions/secgroups/requests_test.go
index bdbedcd..1509733 100644
--- a/openstack/compute/v2/extensions/secgroups/requests_test.go
+++ b/openstack/compute/v2/extensions/secgroups/requests_test.go
@@ -225,8 +225,8 @@
opts := CreateRuleOpts{
ParentGroupID: groupID,
- FromPort: 0,
- ToPort: 0,
+ FromPort: 80,
+ ToPort: 80,
IPProtocol: "ICMP",
CIDR: "0.0.0.0/0",
}
@@ -235,8 +235,8 @@
th.AssertNoErr(t, err)
expected := &Rule{
- FromPort: 0,
- ToPort: 0,
+ FromPort: 80,
+ ToPort: 80,
Group: Group{},
IPProtocol: "ICMP",
ParentGroupID: groupID,