Skip to content
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

[v1] Add projectID to fwaas_v2 CreateOpts #2716

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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