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

Commit

Permalink
Allow setting dns_name while creating ports
Browse files Browse the repository at this point in the history
  • Loading branch information
feiskyer committed Feb 29, 2016
1 parent dcbe61d commit f9e6fc0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 12 additions & 2 deletions openstack/networking/v2/ports/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ type CreateOpts struct {
FixedIPs interface{}
DeviceID string
DeviceOwner string
DNSName string
TenantID string
SecurityGroups []string
HostID string
HostID string
AllowedAddressPairs []AddressPair
}

Expand All @@ -123,6 +124,9 @@ func (opts CreateOpts) ToPortCreateMap() (map[string]interface{}, error) {
if opts.DeviceOwner != "" {
p["device_owner"] = opts.DeviceOwner
}
if opts.DNSName != "" {
p["dns_name"] = opts.DNSName
}
if opts.FixedIPs != nil {
p["fixed_ips"] = opts.FixedIPs
}
Expand All @@ -143,6 +147,7 @@ func (opts CreateOpts) ToPortCreateMap() (map[string]interface{}, error) {
}
if opts.AllowedAddressPairs != nil {
p["allowed_address_pairs"] = opts.AllowedAddressPairs
}
if opts.HostID != "" {
p["binding:host_id"] = opts.HostID
}
Expand Down Expand Up @@ -181,7 +186,8 @@ type UpdateOpts struct {
DeviceID string
DeviceOwner string
SecurityGroups []string
HostID string
DNSName string
HostID string
AllowedAddressPairs []AddressPair
}

Expand All @@ -195,6 +201,9 @@ func (opts UpdateOpts) ToPortUpdateMap() (map[string]interface{}, error) {
if opts.DeviceOwner != "" {
p["device_owner"] = opts.DeviceOwner
}
if opts.DNSName != "" {
p["dns_name"] = opts.DNSName
}
if opts.FixedIPs != nil {
p["fixed_ips"] = opts.FixedIPs
}
Expand All @@ -209,6 +218,7 @@ func (opts UpdateOpts) ToPortUpdateMap() (map[string]interface{}, error) {
}
if opts.AllowedAddressPairs != nil {
p["allowed_address_pairs"] = opts.AllowedAddressPairs
}
if opts.HostID != "" {
p["binding:host_id"] = opts.HostID
}
Expand Down
2 changes: 2 additions & 0 deletions openstack/networking/v2/ports/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ type Port struct {
DeviceID string `mapstructure:"device_id" json:"device_id"`
// Identifies the list of IP addresses the port will recognize/accept
AllowedAddressPairs []AddressPair `mapstructure:"allowed_address_pairs" json:"allowed_address_pairs"`
// Dns name for the port
DNSName string `mapstructure:"dns_name" json:"dns_name"`
}

// PortPage is the page returned by a pager when traversing over a collection
Expand Down

0 comments on commit f9e6fc0

Please sign in to comment.