blob: f626f665b99156f062bef42befd5ed6ac9e48897 [file] [log] [blame]
Jamie Hannaford7db63f22014-09-29 11:18:45 +02001package external
2
Jon Perrittcf6e5242015-03-04 09:36:19 -07003import (
Jon Perritte1c6ceb2016-03-14 12:09:36 -05004 "github.com/gophercloud/gophercloud"
Jon Perritt27249f42016-02-18 10:35:59 -06005 "github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
Jon Perrittcf6e5242015-03-04 09:36:19 -07006)
Jamie Hannaford7db63f22014-09-29 11:18:45 +02007
Jamie Hannafordffcd6792014-10-06 15:49:28 +02008// CreateOpts is the structure used when creating new external network
9// resources. It embeds networks.CreateOpts and so inherits all of its required
10// and optional fields, with the addition of the External field.
Jamie Hannaford7db63f22014-09-29 11:18:45 +020011type CreateOpts struct {
Jon Perritte1c6ceb2016-03-14 12:09:36 -050012 networks.CreateOpts
13 External *bool `json:"router:extenal,omitempty"`
Jamie Hannaford7db63f22014-09-29 11:18:45 +020014}
15
Jamie Hannafordffcd6792014-10-06 15:49:28 +020016// ToNetworkCreateMap casts a CreateOpts struct to a map.
Jon Perritte1c6ceb2016-03-14 12:09:36 -050017func (opts CreateOpts) ToNetworkCreateMap() (map[string]interface{}, error) {
18 return gophercloud.BuildRequestBody(opts, "network")
Jamie Hannaford7db63f22014-09-29 11:18:45 +020019}
20
Jamie Hannafordffcd6792014-10-06 15:49:28 +020021// UpdateOpts is the structure used when updating existing external network
22// resources. It embeds networks.UpdateOpts and so inherits all of its required
23// and optional fields, with the addition of the External field.
Jamie Hannaford7db63f22014-09-29 11:18:45 +020024type UpdateOpts struct {
25 Parent networks.UpdateOpts
Jon Perritte1c6ceb2016-03-14 12:09:36 -050026 External *bool `json:"router:extenal,omitempty"`
Jamie Hannaford7db63f22014-09-29 11:18:45 +020027}
28
Jamie Hannafordffcd6792014-10-06 15:49:28 +020029// ToNetworkUpdateMap casts an UpdateOpts struct to a map.
Jon Perritte1c6ceb2016-03-14 12:09:36 -050030func (opts UpdateOpts) ToNetworkUpdateMap() (map[string]interface{}, error) {
31 return gophercloud.BuildRequestBody(opts, "network")
Jamie Hannaford7db63f22014-09-29 11:18:45 +020032}