Documentation ¶
Index ¶
- func Create(c *gcorecloud.ServiceClient, opts CreateOptsBuilder) (r tasks.Result)
- func Delete(c *gcorecloud.ServiceClient, subnetID string) (r tasks.Result)
- func ExtractSubnetIDFromTask(task *tasks.Task) (string, error)
- func ExtractSubnetsInto(r pagination.Page, v interface{}) error
- func IDFromName(client *gcorecloud.ServiceClient, name string) (string, error)
- func List(c *gcorecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type CreateOpts
- type CreateOptsBuilder
- type GetResult
- type HostRoute
- type ListOpts
- type ListOptsBuilder
- type Subnet
- type SubnetPage
- type SubnetTaskResult
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(c *gcorecloud.ServiceClient, opts CreateOptsBuilder) (r tasks.Result)
Create accepts a CreateOpts struct and creates a new subnet using the values provided.
func Delete ¶
func Delete(c *gcorecloud.ServiceClient, subnetID string) (r tasks.Result)
Delete accepts a unique ID and deletes the subnet associated with it.
func ExtractSubnetsInto ¶
func ExtractSubnetsInto(r pagination.Page, v interface{}) error
func IDFromName ¶
func IDFromName(client *gcorecloud.ServiceClient, name string) (string, error)
IDFromName is a convenience function that returns a subnet ID, given its name.
func List ¶
func List(c *gcorecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List returns a Pager which allows you to iterate over a collection of subnets.
Types ¶
type CreateOpts ¶
type CreateOpts struct { Name string `json:"name" required:"true"` EnableDHCP bool `json:"enable_dhcp,omitempty"` CIDR gcorecloud.CIDR `json:"cidr" required:"true"` NetworkID string `json:"network_id" required:"true"` ConnectToNetworkRouter bool `json:"connect_to_network_router"` DNSNameservers []net.IP `json:"dns_nameservers,omitempty"` HostRoutes []HostRoute `json:"host_routes,omitempty"` GatewayIP *net.IP `json:"gateway_ip"` }
CreateOpts represents options used to create a subnet. GatewayIP must be null in json because an empty key creates a gateway in the neutron API.
func (CreateOpts) ToSubnetCreateMap ¶
func (opts CreateOpts) ToSubnetCreateMap() (map[string]interface{}, error)
ToSubnetCreateMap builds a request body from CreateOpts.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult represents the result of a get operation. Call its Extract method to interpret it as a Subnet.
func Get ¶
func Get(c *gcorecloud.ServiceClient, id string) (r GetResult)
Get retrieves a specific subnet based on its unique ID.
func (GetResult) Extract ¶
Extract is a function that accepts a result and extracts a subnet resource.
func (GetResult) ExtractInto ¶
func (r GetResult) ExtractInto(v interface{}) error
type HostRoute ¶
type HostRoute struct { Destination gcorecloud.CIDR `json:"destination"` NextHop net.IP `json:"nexthop"` }
HostRoute represents a route that should be used by devices with IPs from a subnet (not including local subnet route).
type ListOpts ¶
type ListOpts struct {
NetworkID string `q:"network_id"`
}
ListOpts allows the filtering and sorting List API response.
func (ListOpts) ToSubnetListQuery ¶
ToSubnetListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type Subnet ¶
type Subnet struct { ID string `json:"id"` Name string `json:"name"` IPVersion int `json:"ip_version"` EnableDHCP bool `json:"enable_dhcp"` CIDR gcorecloud.CIDR `json:"cidr"` CreatedAt gcorecloud.JSONRFC3339Z `json:"created_at"` UpdatedAt gcorecloud.JSONRFC3339Z `json:"updated_at"` NetworkID string `json:"network_id"` TaskID string `json:"task_id"` CreatorTaskID string `json:"creator_task_id"` Region string `json:"region"` ProjectID int `json:"project_id"` RegionID int `json:"region_id"` AvailableIps int `json:"available_ips"` TotalIps int `json:"total_ips"` HasRouter bool `json:"has_router"` DNSNameservers []net.IP `json:"dns_nameservers"` HostRoutes []HostRoute `json:"host_routes"` GatewayIP net.IP `json:"gateway_ip"` }
Subnet represents a subnet structure.
func ExtractSubnets ¶
func ExtractSubnets(r pagination.Page) ([]Subnet, error)
ExtractSubnet accepts a Page struct, specifically a SubnetPage struct, and extracts the elements into a slice of Subnet structs. In other words, a generic collection is mapped into a relevant slice.
func ListAll ¶
func ListAll(c *gcorecloud.ServiceClient, opts ListOptsBuilder) ([]Subnet, error)
ListAll returns all SGs
type SubnetPage ¶
type SubnetPage struct {
pagination.LinkedPageBase
}
SubnetPage is the page returned by a pager when traversing over a collection of subnets.
func (SubnetPage) IsEmpty ¶
func (r SubnetPage) IsEmpty() (bool, error)
IsEmpty checks whether a SubnetPage struct is empty.
func (SubnetPage) NextPageURL ¶
func (r SubnetPage) NextPageURL() (string, error)
NextPageURL is invoked when a paginated collection of subnets has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.
type SubnetTaskResult ¶
type SubnetTaskResult struct {
Subnets []string `json:"subnets"`
}
type UpdateOpts ¶
type UpdateOpts struct { Name string `json:"name,omitempty"` DNSNameservers []net.IP `json:"dns_nameservers"` HostRoutes []HostRoute `json:"host_routes"` EnableDHCP bool `json:"enable_dhcp"` GatewayIP *net.IP `json:"gateway_ip"` }
UpdateOpts represents options used to update a subnet. GatewayIP must be null in json because an empty key creates a gateway in the neutron API.
func (UpdateOpts) ToSubnetUpdateMap ¶
func (opts UpdateOpts) ToSubnetUpdateMap() (map[string]interface{}, error)
ToSubnetUpdateMap builds a request body from UpdateOpts.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult represents the result of an update operation. Call its Extract method to interpret it as a Subnet.
func Update ¶
func Update(c *gcorecloud.ServiceClient, subnetID string, opts UpdateOptsBuilder) (r UpdateResult)
Update accepts a UpdateOpts struct and updates an existing subnet using the values provided. For more information, see the Create function.
func (UpdateResult) Extract ¶
Extract is a function that accepts a result and extracts a subnet resource.
func (UpdateResult) ExtractInto ¶
func (r UpdateResult) ExtractInto(v interface{}) error