Documentation ¶
Overview ¶
Package routes contains functionality for working with ECL Managed Load Balancer resources.
Example to list routes
listOpts := routes.ListOpts{} allPages, err := routes.List(managedLoadBalancerClient, listOpts).AllPages() if err != nil { panic(err) } allRoutes, err := routes.ExtractRoutes(allPages) if err != nil { panic(err) } for _, route := range allRoutes { fmt.Printf("%+v\n", route) }
Example to create a route
var tags map[string]interface{} tagsJson := `{"key":"value"}` err := json.Unmarshal([]byte(tagsJson), &tags) if err != nil { panic(err) } createOpts := routes.CreateOpts{ Name: "route", Description: "description", Tags: tags, DestinationCidr: "172.16.0.0/24", NextHopIPAddress: "192.168.0.254", LoadBalancerID: "67fea379-cff0-4191-9175-de7d6941a040", } route, err := routes.Create(managedLoadBalancerClient, createOpts).Extract() if err != nil { panic(err) } fmt.Printf("%+v\n", route)
Example to show a route
showOpts := routes.ShowOpts{} id := "497f6eca-6276-4993-bfeb-53cbbbba6f08" route, err := routes.Show(managedLoadBalancerClient, id, showOpts).Extract() if err != nil { panic(err) } fmt.Printf("%+v\n", route)
Example to update a route
name := "route" description := "description" var tags map[string]interface{} tagsJson := `{"key":"value"}` err := json.Unmarshal([]byte(tagsJson), &tags) if err != nil { panic(err) } updateOpts := routes.UpdateOpts{ Name: &name, Description: &description, Tags: &tags, } id := "497f6eca-6276-4993-bfeb-53cbbbba6f08" route, err := routes.Update(managedLoadBalancerClient, updateOpts).Extract() if err != nil { panic(err) } fmt.Printf("%+v\n", route)
Example to delete a route
id := "497f6eca-6276-4993-bfeb-53cbbbba6f08" err := routes.Delete(managedLoadBalancerClient, id).ExtractErr() if err != nil { panic(err) }
Example to create staged route configurations
createStagedOpts := routes.CreateStagedOpts{ NextHopIPAddress: "192.168.0.254", } id := "497f6eca-6276-4993-bfeb-53cbbbba6f08" routeConfigurations, err := routes.CreateStaged(managedLoadBalancerClient, id, createStagedOpts).Extract() if err != nil { panic(err) } fmt.Printf("%+v\n", routeConfigurations)
Example to show staged route configurations
id := "497f6eca-6276-4993-bfeb-53cbbbba6f08" routeConfigurations, err := routes.ShowStaged(managedLoadBalancerClient, id).Extract() if err != nil { panic(err) } fmt.Printf("%+v\n", routeConfigurations)
Example to update staged route configurations
nextHopIPAddress := "192.168.0.254" updateStagedOpts := routes.UpdateStagedOpts{ NextHopIPAddress: &nextHopIPAddress, } id := "497f6eca-6276-4993-bfeb-53cbbbba6f08" routeConfigurations, err := routes.UpdateStaged(managedLoadBalancerClient, updateStagedOpts).Extract() if err != nil { panic(err) } fmt.Printf("%+v\n", routeConfigurations)
Example to cancel staged route configurations
id := "497f6eca-6276-4993-bfeb-53cbbbba6f08" err := routes.CancelStaged(managedLoadBalancerClient, id).ExtractErr() if err != nil { panic(err) }
Index ¶
- func ExtractRoutesInto(r pagination.Page, v interface{}) error
- func List(c *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type CancelStagedResult
- type ConfigurationInResponse
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type CreateStagedOpts
- type CreateStagedOptsBuilder
- type CreateStagedResult
- type DeleteResult
- type ListOpts
- type ListOptsBuilder
- type Route
- type RoutePage
- type ShowOpts
- type ShowOptsBuilder
- type ShowResult
- type ShowStagedResult
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
- type UpdateStagedOpts
- type UpdateStagedOptsBuilder
- type UpdateStagedResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractRoutesInto ¶
func ExtractRoutesInto(r pagination.Page, v interface{}) error
ExtractRoutesInto interprets the results of a single page from a List() call, producing a slice of route entities.
func List ¶
func List(c *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List returns a Pager which allows you to iterate over a collection of routes. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.
Types ¶
type CancelStagedResult ¶
type CancelStagedResult struct {
eclcloud.ErrResult
}
CancelStagedResult represents the result of a CancelStaged operation. Call its ExtractErr method to determine if the request succeeded or failed.
func CancelStaged ¶
func CancelStaged(c *eclcloud.ServiceClient, id string) (r CancelStagedResult)
CancelStaged accepts a unique ID and deletes route configurations associated with it.
type ConfigurationInResponse ¶
type ConfigurationInResponse struct { // - IP address of next hop for the (static) route NextHopIPAddress string `json:"next_hop_ip_address,omitempty"` }
ConfigurationInResponse represents a configuration in a route.
type CreateOpts ¶
type CreateOpts struct { // - Name of the (static) route // - This field accepts single-byte characters only Name string `json:"name,omitempty"` // - Description of the (static) route // - This field accepts single-byte characters only Description string `json:"description,omitempty"` // - Tags of the (static) route // - Set JSON object up to 32,768 characters // - Nested structure is permitted // - This field accepts single-byte characters only Tags map[string]interface{} `json:"tags,omitempty"` // - CIDR of destination for the (static) route // - If you configure `destination_cidr` as default gateway, set `0.0.0.0/0` // - `destination_cidr` can not be changed once configured // - If you want to change `destination_cidr`, recreate the (static) route again // - Set a unique CIDR for all (static) routes which belong to the same load balancer // - Set a CIDR which is not included in subnet of load balancer interfaces that the (static) route belongs to // - Must not set a link-local CIDR (RFC 3927) which includes Common Function Gateway DestinationCidr string `json:"destination_cidr"` // - ID of the load balancer which the (static) route belongs to // - Set a CIDR which is not included in subnet of load balancer interfaces that the (static) route belongs to // - Must not set a network IP address and broadcast IP address NextHopIPAddress string `json:"next_hop_ip_address"` // - ID of the load balancer which the (static) route belongs to LoadBalancerID string `json:"load_balancer_id"` }
CreateOpts represents options used to create a new route.
func (CreateOpts) ToRouteCreateMap ¶
func (opts CreateOpts) ToRouteCreateMap() (map[string]interface{}, error)
ToRouteCreateMap builds a request body from CreateOpts.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult represents the result of a Create operation. Call its Extract method to interpret it as a Route.
func Create ¶
func Create(c *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create accepts a CreateOpts struct and creates a new route using the values provided.
func (CreateResult) Extract ¶
Extract is a function that accepts a result and extracts a Route resource.
func (CreateResult) ExtractInto ¶
func (r CreateResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a route, if possible.
type CreateStagedOpts ¶
type CreateStagedOpts struct { // - ID of the load balancer which the (static) route belongs to // - Set a CIDR which is included in subnet of load balancer interfaces that the (static) route belongs to // - Must not set a network IP address and broadcast IP address NextHopIPAddress string `json:"next_hop_ip_address,omitempty"` }
CreateStagedOpts represents options used to create new route configurations.
func (CreateStagedOpts) ToRouteCreateStagedMap ¶
func (opts CreateStagedOpts) ToRouteCreateStagedMap() (map[string]interface{}, error)
ToRouteCreateStagedMap builds a request body from CreateStagedOpts.
type CreateStagedOptsBuilder ¶
CreateStagedOptsBuilder allows extensions to add additional parameters to the CreateStaged request.
type CreateStagedResult ¶
type CreateStagedResult struct {
// contains filtered or unexported fields
}
CreateStagedResult represents the result of a CreateStaged operation. Call its Extract method to interpret it as a Route.
func CreateStaged ¶
func CreateStaged(c *eclcloud.ServiceClient, id string, opts CreateStagedOptsBuilder) (r CreateStagedResult)
CreateStaged accepts a CreateStagedOpts struct and creates new route configurations using the values provided.
func (CreateStagedResult) Extract ¶
Extract is a function that accepts a result and extracts a Route resource.
func (CreateStagedResult) ExtractInto ¶
func (r CreateStagedResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a route, if possible.
type DeleteResult ¶
type DeleteResult struct {
eclcloud.ErrResult
}
DeleteResult represents the result of a Delete operation. Call its ExtractErr method to determine if the request succeeded or failed.
func Delete ¶
func Delete(c *eclcloud.ServiceClient, id string) (r DeleteResult)
Delete accepts a unique ID and deletes the route associated with it.
type ListOpts ¶
type ListOpts struct { // - ID of the resource ID string `q:"id"` // - Name of the resource // - This field accepts single-byte characters only Name string `q:"name"` // - Description of the resource // - This field accepts single-byte characters only Description string `q:"description"` // - Configuration status of the resource ConfigurationStatus string `q:"configuration_status"` // - Operation status of the resource OperationStatus string `q:"operation_status"` // - CIDR of destination for the (static) route DestinationCidr string `q:"destination_cidr"` // - IP address of next hop for the (static) route NextHopIPAddress string `q:"next_hop_ip_address"` // - ID of the load balancer which the resource belongs to LoadBalancerID string `q:"load_balancer_id"` // - ID of the owner tenant of the resource TenantID string `q:"tenant_id"` }
ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the route attributes you want to see returned.
func (ListOpts) ToRouteListQuery ¶
ToRouteListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type Route ¶
type Route struct { // - ID of the (static) route ID string `json:"id"` // - Name of the (static) route Name string `json:"name"` // - Description of the (static) route Description string `json:"description"` // - Tags of the (static) route (JSON object format) Tags map[string]interface{} `json:"tags"` // - Configuration status of the (static) route // - `"ACTIVE"` // - There are no configurations of the (static) route that waiting to be applied // - `"CREATE_STAGED"` // - The (static) route has been added and waiting to be applied // - `"UPDATE_STAGED"` // - Changed configurations of the (static) route exists that waiting to be applied // - `"DELETE_STAGED"` // - The (static) route has been removed and waiting to be applied ConfigurationStatus string `json:"configuration_status"` // - Operation status of the load balancer which the (static) route belongs to // - `"NONE"` : // - There are no operations of the load balancer // - The load balancer and related resources can be operated // - `"PROCESSING"` // - The latest operation of the load balancer is processing // - The load balancer and related resources cannot be operated // - `"COMPLETE"` // - The latest operation of the load balancer has been succeeded // - The load balancer and related resources can be operated // - `"STUCK"` // - The latest operation of the load balancer has been stopped // - Operators of NTT Communications will investigate the operation // - The load balancer and related resources cannot be operated // - `"ERROR"` // - The latest operation of the load balancer has been failed // - The operation was roll backed normally // - The load balancer and related resources can be operated OperationStatus string `json:"operation_status"` // - CIDR of destination for the (static) route DestinationCidr string `json:"destination_cidr,omitempty"` // - ID of the load balancer which the (static) route belongs to LoadBalancerID string `json:"load_balancer_id"` // - ID of the owner tenant of the (static) route TenantID string `json:"tenant_id"` // - IP address of next hop for the (static) route NextHopIPAddress string `json:"next_hop_ip_address,omitempty"` // - Running configurations of the (static) route // - If `changes` is `true`, return object // - If current configuration does not exist, return `null` Current ConfigurationInResponse `json:"current,omitempty"` // - Added or changed configurations of the (static) route that waiting to be applied // - If `changes` is `true`, return object // - If staged configuration does not exist, return `null` Staged ConfigurationInResponse `json:"staged,omitempty"` }
Route represents a route.
func ExtractRoutes ¶
func ExtractRoutes(r pagination.Page) ([]Route, error)
ExtractRoutes accepts a Page struct, specifically a NetworkPage struct, and extracts the elements into a slice of Route structs. In other words, a generic collection is mapped into a relevant slice.
type RoutePage ¶
type RoutePage struct {
pagination.LinkedPageBase
}
RoutePage is the page returned by a pager when traversing over a collection of route.
type ShowOpts ¶
type ShowOpts struct { // - If `true` is set, `current` and `staged` are returned in response body Changes bool `q:"changes"` }
ShowOpts represents options used to show a route.
func (ShowOpts) ToRouteShowQuery ¶
ToRouteShowQuery formats a ShowOpts into a query string.
type ShowOptsBuilder ¶
ShowOptsBuilder allows extensions to add additional parameters to the Show request.
type ShowResult ¶
type ShowResult struct {
// contains filtered or unexported fields
}
ShowResult represents the result of a Show operation. Call its Extract method to interpret it as a Route.
func Show ¶
func Show(c *eclcloud.ServiceClient, id string, opts ShowOptsBuilder) (r ShowResult)
Show retrieves a specific route based on its unique ID.
func (ShowResult) Extract ¶
Extract is a function that accepts a result and extracts a Route resource.
func (ShowResult) ExtractInto ¶
func (r ShowResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a route, if possible.
type ShowStagedResult ¶
type ShowStagedResult struct {
// contains filtered or unexported fields
}
ShowStagedResult represents the result of a ShowStaged operation. Call its Extract method to interpret it as a Route.
func ShowStaged ¶
func ShowStaged(c *eclcloud.ServiceClient, id string) (r ShowStagedResult)
ShowStaged retrieves specific route configurations based on its unique ID.
func (ShowStagedResult) Extract ¶
Extract is a function that accepts a result and extracts a Route resource.
func (ShowStagedResult) ExtractInto ¶
func (r ShowStagedResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a route, if possible.
type UpdateOpts ¶
type UpdateOpts struct { // - Name of the (static) route // - This field accepts single-byte characters only Name *string `json:"name,omitempty"` // - Description of the (static) route // - This field accepts single-byte characters only Description *string `json:"description,omitempty"` // - Tags of the (static) route // - Set JSON object up to 32,768 characters // - Nested structure is permitted // - This field accepts single-byte characters only Tags *map[string]interface{} `json:"tags,omitempty"` }
UpdateOpts represents options used to update a existing route.
func (UpdateOpts) ToRouteUpdateMap ¶
func (opts UpdateOpts) ToRouteUpdateMap() (map[string]interface{}, error)
ToRouteUpdateMap 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 a Update operation. Call its Extract method to interpret it as a Route.
func Update ¶
func Update(c *eclcloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)
Update accepts a UpdateOpts struct and updates a existing route using the values provided.
func (UpdateResult) Extract ¶
Extract is a function that accepts a result and extracts a Route resource.
func (UpdateResult) ExtractInto ¶
func (r UpdateResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a route, if possible.
type UpdateStagedOpts ¶
type UpdateStagedOpts struct { // - ID of the load balancer which the (static) route belongs to // - Set a CIDR which is included in subnet of load balancer interfaces that the (static) route belongs to // - Must not set a network IP address and broadcast IP address NextHopIPAddress *string `json:"next_hop_ip_address,omitempty"` }
UpdateStagedOpts represents options used to update existing Route configurations.
func (UpdateStagedOpts) ToRouteUpdateStagedMap ¶
func (opts UpdateStagedOpts) ToRouteUpdateStagedMap() (map[string]interface{}, error)
ToRouteUpdateStagedMap builds a request body from UpdateStagedOpts.
type UpdateStagedOptsBuilder ¶
UpdateStagedOptsBuilder allows extensions to add additional parameters to the UpdateStaged request.
type UpdateStagedResult ¶
type UpdateStagedResult struct {
// contains filtered or unexported fields
}
UpdateStagedResult represents the result of a UpdateStaged operation. Call its Extract method to interpret it as a Route.
func UpdateStaged ¶
func UpdateStaged(c *eclcloud.ServiceClient, id string, opts UpdateStagedOptsBuilder) (r UpdateStagedResult)
UpdateStaged accepts a UpdateStagedOpts struct and updates existing Route configurations using the values provided.
func (UpdateStagedResult) Extract ¶
Extract is a function that accepts a result and extracts a Route resource.
func (UpdateStagedResult) ExtractInto ¶
func (r UpdateStagedResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a route, if possible.