Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 8e6b4c7

Browse files
committed
Allow setting tenantID when creating security-groups
1 parent 1d8b6f1 commit 8e6b4c7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

openstack/networking/v2/extensions/security/groups/requests.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ type CreateOpts struct {
4545
// Required. Human-readable name for the VIP. Does not have to be unique.
4646
Name string
4747

48+
// Required for admins. Indicates the owner of the VIP.
49+
TenantID string
50+
4851
// Optional. Describes the security group.
4952
Description string
5053
}
@@ -62,6 +65,7 @@ func Create(c *gophercloud.ServiceClient, opts CreateOpts) CreateResult {
6265

6366
type secgroup struct {
6467
Name string `json:"name"`
68+
TenantID string `json:"tenant_id,omitempty"`
6569
Description string `json:"description,omitempty"`
6670
}
6771

@@ -71,6 +75,7 @@ func Create(c *gophercloud.ServiceClient, opts CreateOpts) CreateResult {
7175

7276
reqBody := request{SecGroup: secgroup{
7377
Name: opts.Name,
78+
TenantID: opts.TenantID,
7479
Description: opts.Description,
7580
}}
7681

openstack/networking/v2/extensions/security/rules/requests.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ type CreateOpts struct {
9999
// attribute matches the specified IP prefix as the source IP address of the
100100
// IP packet.
101101
RemoteIPPrefix string
102+
103+
// Required for admins. Indicates the owner of the VIP.
104+
TenantID string
102105
}
103106

104107
// Create is an operation which provisions a new security group with default
@@ -133,6 +136,7 @@ func Create(c *gophercloud.ServiceClient, opts CreateOpts) CreateResult {
133136
Protocol string `json:"protocol,omitempty"`
134137
RemoteGroupID string `json:"remote_group_id,omitempty"`
135138
RemoteIPPrefix string `json:"remote_ip_prefix,omitempty"`
139+
TenantID string `json:"tenant_id,omitempty"`
136140
}
137141

138142
type request struct {
@@ -148,6 +152,7 @@ func Create(c *gophercloud.ServiceClient, opts CreateOpts) CreateResult {
148152
Protocol: opts.Protocol,
149153
RemoteGroupID: opts.RemoteGroupID,
150154
RemoteIPPrefix: opts.RemoteIPPrefix,
155+
TenantID: opts.TenantID,
151156
}}
152157

153158
_, res.Err = c.Post(rootURL(c), reqBody, &res.Body, nil)

0 commit comments

Comments
 (0)