Skip to content

Commit

Permalink
Add projectID to fwaas_v2 CreateOpts
Browse files Browse the repository at this point in the history
  • Loading branch information
nikParasyr committed Aug 2, 2023
1 parent d2f09a0 commit f81b744
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ type CreateOpts struct {
Protocol Protocol `json:"protocol" required:"true"`
Action Action `json:"action" required:"true"`
TenantID string `json:"tenant_id,omitempty"`
ProjectID string `json:"project_id,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
IPVersion gophercloud.IPVersion `json:"ip_version,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestList(t *testing.T) {
"id": "f03bd950-6c56-4f5e-a307-45967078f507",
"name": "ssh_form_any",
"tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"project_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"enabled": true,
"action": "allow",
"ip_version": 4,
Expand All @@ -53,6 +54,7 @@ func TestList(t *testing.T) {
"id": "ab7bd950-6c56-4f5e-a307-45967078f890",
"name": "deny_all_udp",
"tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"project_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"enabled": true,
"action": "deny",
"ip_version": 4,
Expand Down Expand Up @@ -85,6 +87,7 @@ func TestList(t *testing.T) {
ID: "f03bd950-6c56-4f5e-a307-45967078f507",
Name: "ssh_form_any",
TenantID: "80cf934d6ffb4ef5b244f1c512ad1e61",
ProjectID: "80cf934d6ffb4ef5b244f1c512ad1e61",
Enabled: true,
Action: string(rules.ActionAllow),
IPVersion: 4,
Expand All @@ -101,6 +104,7 @@ func TestList(t *testing.T) {
ID: "ab7bd950-6c56-4f5e-a307-45967078f890",
Name: "deny_all_udp",
TenantID: "80cf934d6ffb4ef5b244f1c512ad1e61",
ProjectID: "80cf934d6ffb4ef5b244f1c512ad1e61",
Enabled: true,
Action: "deny",
IPVersion: 4,
Expand Down Expand Up @@ -135,7 +139,8 @@ func TestCreate(t *testing.T) {
"destination_port": "22",
"name": "ssh_form_any",
"action": "allow",
"tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61"
"tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"project_id": "80cf934d6ffb4ef5b244f1c512ad1e61"
}
}
`)
Expand All @@ -157,6 +162,7 @@ func TestCreate(t *testing.T) {
"id": "f03bd950-6c56-4f5e-a307-45967078f507",
"name": "ssh_form_any",
"tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"project_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"enabled": true,
"action": "allow",
"ip_version": 4,
Expand All @@ -168,6 +174,7 @@ func TestCreate(t *testing.T) {

options := rules.CreateOpts{
TenantID: "80cf934d6ffb4ef5b244f1c512ad1e61",
ProjectID: "80cf934d6ffb4ef5b244f1c512ad1e61",
Protocol: rules.ProtocolTCP,
Description: "ssh rule",
DestinationIPAddress: "192.168.1.0/24",
Expand Down Expand Up @@ -197,7 +204,8 @@ func TestCreateAnyProtocol(t *testing.T) {
"destination_ip_address": "192.168.1.0/24",
"name": "any_to_192.168.1.0/24",
"action": "allow",
"tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61"
"tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"project_id": "80cf934d6ffb4ef5b244f1c512ad1e61"
}
}
`)
Expand All @@ -219,6 +227,7 @@ func TestCreateAnyProtocol(t *testing.T) {
"id": "f03bd950-6c56-4f5e-a307-45967078f507",
"name": "any_to_192.168.1.0/24",
"tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"project_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"enabled": true,
"action": "allow",
"ip_version": 4,
Expand All @@ -230,6 +239,7 @@ func TestCreateAnyProtocol(t *testing.T) {

options := rules.CreateOpts{
TenantID: "80cf934d6ffb4ef5b244f1c512ad1e61",
ProjectID: "80cf934d6ffb4ef5b244f1c512ad1e61",
Protocol: rules.ProtocolAny,
Description: "any to 192.168.1.0/24",
DestinationIPAddress: "192.168.1.0/24",
Expand Down Expand Up @@ -266,6 +276,7 @@ func TestGet(t *testing.T) {
"id": "f03bd950-6c56-4f5e-a307-45967078f507",
"name": "ssh_form_any",
"tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"project_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"enabled": true,
"action": "allow",
"ip_version": 4,
Expand All @@ -287,6 +298,7 @@ func TestGet(t *testing.T) {
th.AssertEquals(t, "f03bd950-6c56-4f5e-a307-45967078f507", rule.ID)
th.AssertEquals(t, "ssh_form_any", rule.Name)
th.AssertEquals(t, "80cf934d6ffb4ef5b244f1c512ad1e61", rule.TenantID)
th.AssertEquals(t, "80cf934d6ffb4ef5b244f1c512ad1e61", rule.ProjectID)
th.AssertEquals(t, true, rule.Enabled)
th.AssertEquals(t, "allow", rule.Action)
th.AssertEquals(t, 4, rule.IPVersion)
Expand Down Expand Up @@ -331,6 +343,7 @@ func TestUpdate(t *testing.T) {
"id": "f03bd950-6c56-4f5e-a307-45967078f507",
"name": "ssh_form_any",
"tenant_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"project_id": "80cf934d6ffb4ef5b244f1c512ad1e61",
"enabled": false,
"action": "allow",
"ip_version": 4,
Expand Down

0 comments on commit f81b744

Please sign in to comment.