Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func TestSecurityGroupsCreateUpdateDelete(t *testing.T) {
group, err := CreateSecurityGroup(t, client)
th.AssertNoErr(t, err)
defer DeleteSecurityGroup(t, client, group.ID)
th.AssertEquals(t, group.Stateful, true)

rule, err := CreateSecurityGroupRule(t, client, group.ID)
th.AssertNoErr(t, err)
Expand All @@ -32,6 +33,7 @@ func TestSecurityGroupsCreateUpdateDelete(t *testing.T) {
updateOpts := groups.UpdateOpts{
Name: name,
Description: &description,
Stateful: new(bool),
}

newGroup, err := groups.Update(context.TODO(), client, group.ID, updateOpts).Extract()
Expand All @@ -40,6 +42,7 @@ func TestSecurityGroupsCreateUpdateDelete(t *testing.T) {
tools.PrintResource(t, newGroup)
th.AssertEquals(t, newGroup.Name, name)
th.AssertEquals(t, newGroup.Description, description)
th.AssertEquals(t, newGroup.Stateful, false)

listOpts := groups.ListOpts{}
allPages, err := groups.List(client, listOpts).AllPages(context.TODO())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type ListOpts struct {
ID string `q:"id"`
Name string `q:"name"`
Description string `q:"description"`
Stateful *bool `q:"stateful"`
TenantID string `q:"tenant_id"`
ProjectID string `q:"project_id"`
Limit int `q:"limit"`
Expand Down Expand Up @@ -63,6 +64,9 @@ type CreateOpts struct {

// Describes the security group.
Description string `json:"description,omitempty"`

// Stateful indicates if the security group is stateful or stateless.
Stateful *bool `json:"stateful,omitempty"`
}

// ToSecGroupCreateMap builds a request body from CreateOpts.
Expand Down Expand Up @@ -97,6 +101,9 @@ type UpdateOpts struct {

// Describes the security group.
Description *string `json:"description,omitempty"`

// Stateful indicates if the security group is stateful or stateless.
Stateful *bool `json:"stateful,omitempty"`
}

// ToSecGroupUpdateMap builds a request body from UpdateOpts.
Expand Down
3 changes: 3 additions & 0 deletions openstack/networking/v2/extensions/security/groups/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ type SecGroup struct {
// traffic entering and leaving the group.
Rules []rules.SecGroupRule `json:"security_group_rules"`

// Indicates if the security group is stateful or stateless.
Stateful bool `json:"stateful"`

// TenantID is the project owner of the security group.
TenantID string `json:"tenant_id"`

Expand Down