Documentation
¶
Overview ¶
Generated by https://github.com/tamac-io/openapi-to-eclcloud-rb
Package target_groups contains functionality for working with ECL Managed Load Balancer resources.
Example to list target groups
listOpts := target_groups.ListOpts{}
allPages, err := target_groups.List(managedLoadBalancerClient, listOpts).AllPages()
if err != nil {
panic(err)
}
allTargetGroups, err := target_groups.ExtractTargetGroups(allPages)
if err != nil {
panic(err)
}
for _, targetGroup := range allTargetGroups {
fmt.Printf("%+v\n", targetGroup)
}
Example to create a target group
member1 := target_groups.CreateOptsMember{
IPAddress: "192.168.0.7",
Port: 80,
Weight: 1,
}
var tags map[string]interface{}
tagsJson := `{"key":"value"}`
err := json.Unmarshal([]byte(tagsJson), &tags)
if err != nil {
panic(err)
}
createOpts := target_groups.CreateOpts{
Name: "target_group",
Description: "description",
Tags: tags,
LoadBalancerID: "67fea379-cff0-4191-9175-de7d6941a040",
Members: &[]target_groups.CreateOptsMember{member1},
}
targetGroup, err := target_groups.Create(managedLoadBalancerClient, createOpts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", targetGroup)
Example to show a target group
showOpts := target_groups.ShowOpts{}
id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
targetGroup, err := target_groups.Show(managedLoadBalancerClient, id, showOpts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", targetGroup)
Example to update a target group
name := "target_group"
description := "description"
var tags map[string]interface{}
tagsJson := `{"key":"value"}`
err := json.Unmarshal([]byte(tagsJson), &tags)
if err != nil {
panic(err)
}
updateOpts := target_groups.UpdateOpts{
Name: &name,
Description: &description,
Tags: &tags,
}
id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
targetGroup, err := target_groups.Update(managedLoadBalancerClient, updateOpts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", targetGroup)
Example to delete a target group
id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
err := target_groups.Delete(managedLoadBalancerClient, id).ExtractErr()
if err != nil {
panic(err)
}
Example to create staged target group configurations
member1 := target_groups.CreateStagedOptsMember{
IPAddress: "192.168.0.7",
Port: 80,
Weight: 1,
}
createStagedOpts := target_groups.CreateStagedOpts{
Members: &[]target_groups.CreateStagedOptsMember{member1},
}
id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
targetGroupConfigurations, err := target_groups.CreateStaged(managedLoadBalancerClient, id, createStagedOpts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", targetGroupConfigurations)
Example to show staged target group configurations
id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
targetGroupConfigurations, err := target_groups.ShowStaged(managedLoadBalancerClient, id).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", targetGroupConfigurations)
Example to update staged target group configurations
member1IPAddress := "192.168.0.7"
member1Port := 80
member1Weight := 1
member1 := target_groups.UpdateStagedOptsMember{
IPAddress: &member1IPAddress,
Port: &member1Port,
Weight: &member1Weight,
}
updateStagedOpts := target_groups.UpdateStagedOpts{
Members: &[]target_groups.UpdateStagedOptsMember{member1},
}
id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
targetGroupConfigurations, err := target_groups.UpdateStaged(managedLoadBalancerClient, updateStagedOpts).Extract()
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", targetGroupConfigurations)
Example to cancel staged target group configurations
id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
err := target_groups.CancelStaged(managedLoadBalancerClient, id).ExtractErr()
if err != nil {
panic(err)
}
Generated by https://github.com/tamac-io/openapi-to-eclcloud-rb
Generated by https://github.com/tamac-io/openapi-to-eclcloud-rb
Generated by https://github.com/tamac-io/openapi-to-eclcloud-rb
Index ¶
- func ExtractTargetGroupsInto(r pagination.Page, v interface{}) error
- func List(c *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type CancelStagedResult
- type ConfigurationInResponse
- type CreateOpts
- type CreateOptsBuilder
- type CreateOptsMember
- type CreateResult
- type CreateStagedOpts
- type CreateStagedOptsBuilder
- type CreateStagedOptsMember
- type CreateStagedResult
- type DeleteResult
- type ListOpts
- type ListOptsBuilder
- type MemberInResponse
- type ShowOpts
- type ShowOptsBuilder
- type ShowResult
- type ShowStagedResult
- type TargetGroup
- type TargetGroupPage
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
- type UpdateStagedOpts
- type UpdateStagedOptsBuilder
- type UpdateStagedOptsMember
- type UpdateStagedResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTargetGroupsInto ¶
func ExtractTargetGroupsInto(r pagination.Page, v interface{}) error
ExtractTargetGroupsInto interprets the results of a single page from a List() call, producing a slice of target group 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 target groups. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.
Types ¶
type CancelStagedResult ¶
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 target group configurations associated with it.
type ConfigurationInResponse ¶
type ConfigurationInResponse struct {
// - Members (real servers) of the target group
Members []MemberInResponse `json:"members,omitempty"`
}
ConfigurationInResponse represents a configuration in a target group.
type CreateOpts ¶
type CreateOpts struct {
// - Name of the target group
// - This field accepts single-byte characters only
Name string `json:"name,omitempty"`
// - Description of the target group
// - This field accepts single-byte characters only
Description string `json:"description,omitempty"`
// - Tags of the target group
// - 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"`
// - ID of the load balancer which the target group belongs to
LoadBalancerID string `json:"load_balancer_id,omitempty"`
// - Members (real servers) of the target group
Members *[]CreateOptsMember `json:"members,omitempty"`
}
CreateOpts represents options used to create a new target group.
func (CreateOpts) ToTargetGroupCreateMap ¶
func (opts CreateOpts) ToTargetGroupCreateMap() (map[string]interface{}, error)
ToTargetGroupCreateMap builds a request body from CreateOpts.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type CreateOptsMember ¶
type CreateOptsMember struct {
// - IP address of the member (real server)
// - Set an unique combination of IP address and port in all members which belong to the same target group
// - Must not set a IP address which is included in `virtual_ip_address` and `reserved_fixed_ips` of load balancer interfaces that the target group belongs to
// - Must not set a IP address of listeners which belong to the same load balancer as the target group
// - Must not set a link-local IP address (RFC 3927) which includes Common Function Gateway
IPAddress string `json:"ip_address"`
// - Port number of the member (real server)
// - Set an unique combination of IP address and port in all members which belong to the same target group
Port int `json:"port"`
// - Weight for the member (real server)
// - If `policy.algorithm` is `"weighted-round-robin"` or `"weighted-least-connection"`, use this parameter
// - Set same weight for the combination of IP address and port in all members which belong to the same load balancer
Weight int `json:"weight,omitempty"`
}
CreateOptsMember represents member information in the target group creation.
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 TargetGroup.
func Create ¶
func Create(c *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create accepts a CreateOpts struct and creates a new target group using the values provided.
func (CreateResult) Extract ¶
func (r CreateResult) Extract() (*TargetGroup, error)
Extract is a function that accepts a result and extracts a TargetGroup resource.
func (CreateResult) ExtractInto ¶
func (r CreateResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a target group, if possible.
type CreateStagedOpts ¶
type CreateStagedOpts struct {
// - Members (real servers) of the target group
Members *[]CreateStagedOptsMember `json:"members,omitempty"`
}
CreateStagedOpts represents options used to create new target group configurations.
func (CreateStagedOpts) ToTargetGroupCreateStagedMap ¶
func (opts CreateStagedOpts) ToTargetGroupCreateStagedMap() (map[string]interface{}, error)
ToTargetGroupCreateStagedMap builds a request body from CreateStagedOpts.
type CreateStagedOptsBuilder ¶
type CreateStagedOptsBuilder interface {
ToTargetGroupCreateStagedMap() (map[string]interface{}, error)
}
CreateStagedOptsBuilder allows extensions to add additional parameters to the CreateStaged request.
type CreateStagedOptsMember ¶
type CreateStagedOptsMember struct {
// - IP address of the member (real server)
// - Set an unique combination of IP address and port in all members which belong to the same target group
// - Must not set a IP address which is included in `virtual_ip_address` and `reserved_fixed_ips` of load balancer interfaces that the target group belongs to
// - Must not set a IP address of listeners which belong to the same load balancer as the target group
// - Must not set a link-local IP address (RFC 3927) which includes Common Function Gateway
IPAddress string `json:"ip_address"`
// - Port number of the member (real server)
// - Set an unique combination of IP address and port in all members which belong to the same target group
Port int `json:"port"`
// - Weight for the member (real server)
// - If `policy.algorithm` is `"weighted-round-robin"` or `"weighted-least-connection"`, use this parameter
// - Set same weight for the combination of IP address and port in all members which belong to the same load balancer
Weight int `json:"weight,omitempty"`
}
CreateStagedOptsMember represents member information in the target group configurations creation.
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 TargetGroup.
func CreateStaged ¶
func CreateStaged(c *eclcloud.ServiceClient, id string, opts CreateStagedOptsBuilder) (r CreateStagedResult)
CreateStaged accepts a CreateStagedOpts struct and creates new target group configurations using the values provided.
func (CreateStagedResult) Extract ¶
func (r CreateStagedResult) Extract() (*TargetGroup, error)
Extract is a function that accepts a result and extracts a TargetGroup resource.
func (CreateStagedResult) ExtractInto ¶
func (r CreateStagedResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a target group, if possible.
type DeleteResult ¶
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 target group 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"`
// - 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 target group attributes you want to see returned.
func (ListOpts) ToTargetGroupListQuery ¶
ToTargetGroupListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type MemberInResponse ¶
type MemberInResponse struct {
// - IP address of the member (real server)
IPAddress string `json:"ip_address"`
// - Port number of the member (real server)
Port int `json:"port"`
// - Weight for the member (real server)
// - If `policy.algorithm` is `"weighted-round-robin"` or `"weighted-least-connection"`, uses this parameter
Weight int `json:"weight"`
}
MemberInResponse represents a member in a target group.
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 target group.
func (ShowOpts) ToTargetGroupShowQuery ¶
ToTargetGroupShowQuery 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 TargetGroup.
func Show ¶
func Show(c *eclcloud.ServiceClient, id string, opts ShowOptsBuilder) (r ShowResult)
Show retrieves a specific target group based on its unique ID.
func (ShowResult) Extract ¶
func (r ShowResult) Extract() (*TargetGroup, error)
Extract is a function that accepts a result and extracts a TargetGroup resource.
func (ShowResult) ExtractInto ¶
func (r ShowResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a target group, 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 TargetGroup.
func ShowStaged ¶
func ShowStaged(c *eclcloud.ServiceClient, id string) (r ShowStagedResult)
ShowStaged retrieves specific target group configurations based on its unique ID.
func (ShowStagedResult) Extract ¶
func (r ShowStagedResult) Extract() (*TargetGroup, error)
Extract is a function that accepts a result and extracts a TargetGroup resource.
func (ShowStagedResult) ExtractInto ¶
func (r ShowStagedResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a target group, if possible.
type TargetGroup ¶
type TargetGroup struct {
// - ID of the target group
ID string `json:"id"`
// - Name of the target group
Name string `json:"name"`
// - Description of the target group
Description string `json:"description"`
// - Tags of the target group (JSON object format)
Tags map[string]interface{} `json:"tags"`
// - Configuration status of the target group
// - `"ACTIVE"`
// - There are no configurations of the target group that waiting to be applied
// - `"CREATE_STAGED"`
// - The target group has been added and waiting to be applied
// - `"UPDATE_STAGED"`
// - Changed configurations of the target group exists that waiting to be applied
// - `"DELETE_STAGED"`
// - The target group has been removed and waiting to be applied
ConfigurationStatus string `json:"configuration_status"`
// - Operation status of the load balancer which the target group 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"`
// - ID of the load balancer which the target group belongs to
LoadBalancerID string `json:"load_balancer_id"`
// - ID of the owner tenant of the target group
TenantID string `json:"tenant_id"`
// - Members (real servers) of the target group
Members []MemberInResponse `json:"members,omitempty"`
// - Running configurations of the target group
// - 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 target group that waiting to be applied
// - If `changes` is `true`, return object
// - If staged configuration does not exist, return `null`
Staged ConfigurationInResponse `json:"staged,omitempty"`
}
TargetGroup represents a target group.
func ExtractTargetGroups ¶
func ExtractTargetGroups(r pagination.Page) ([]TargetGroup, error)
ExtractTargetGroups accepts a Page struct, specifically a NetworkPage struct, and extracts the elements into a slice of TargetGroup structs. In other words, a generic collection is mapped into a relevant slice.
type TargetGroupPage ¶
type TargetGroupPage struct {
pagination.LinkedPageBase
}
TargetGroupPage is the page returned by a pager when traversing over a collection of target group.
func (TargetGroupPage) IsEmpty ¶
func (r TargetGroupPage) IsEmpty() (bool, error)
IsEmpty checks whether a TargetGroupPage struct is empty.
type UpdateOpts ¶
type UpdateOpts struct {
// - Name of the target group
// - This field accepts single-byte characters only
Name *string `json:"name,omitempty"`
// - Description of the target group
// - This field accepts single-byte characters only
Description *string `json:"description,omitempty"`
// - Tags of the target group
// - 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 target group.
func (UpdateOpts) ToTargetGroupUpdateMap ¶
func (opts UpdateOpts) ToTargetGroupUpdateMap() (map[string]interface{}, error)
ToTargetGroupUpdateMap 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 TargetGroup.
func Update ¶
func Update(c *eclcloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)
Update accepts a UpdateOpts struct and updates a existing target group using the values provided.
func (UpdateResult) Extract ¶
func (r UpdateResult) Extract() (*TargetGroup, error)
Extract is a function that accepts a result and extracts a TargetGroup resource.
func (UpdateResult) ExtractInto ¶
func (r UpdateResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a target group, if possible.
type UpdateStagedOpts ¶
type UpdateStagedOpts struct {
// - Members (real servers) of the target group
Members *[]UpdateStagedOptsMember `json:"members,omitempty"`
}
UpdateStagedOpts represents options used to update existing Target Group configurations.
func (UpdateStagedOpts) ToTargetGroupUpdateStagedMap ¶
func (opts UpdateStagedOpts) ToTargetGroupUpdateStagedMap() (map[string]interface{}, error)
ToTargetGroupUpdateStagedMap builds a request body from UpdateStagedOpts.
type UpdateStagedOptsBuilder ¶
type UpdateStagedOptsBuilder interface {
ToTargetGroupUpdateStagedMap() (map[string]interface{}, error)
}
UpdateStagedOptsBuilder allows extensions to add additional parameters to the UpdateStaged request.
type UpdateStagedOptsMember ¶
type UpdateStagedOptsMember struct {
// - IP address of the member (real server)
// - Set an unique combination of IP address and port in all members which belong to the same target group
// - Must not set a IP address which is included in `virtual_ip_address` and `reserved_fixed_ips` of load balancer interfaces that the target group belongs to
// - Must not set a IP address of listeners which belong to the same load balancer as the target group
// - Must not set a link-local IP address (RFC 3927) which includes Common Function Gateway
IPAddress *string `json:"ip_address"`
// - Port number of the member (real server)
// - Set an unique combination of IP address and port in all members which belong to the same target group
Port *int `json:"port"`
// - Weight for the member (real server)
// - If `policy.algorithm` is `"weighted-round-robin"` or `"weighted-least-connection"`, use this parameter
// - Set same weight for the combination of IP address and port in all members which belong to the same load balancer
Weight *int `json:"weight,omitempty"`
}
UpdateStagedOptsMember represents member information in target group configurations updation.
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 TargetGroup.
func UpdateStaged ¶
func UpdateStaged(c *eclcloud.ServiceClient, id string, opts UpdateStagedOptsBuilder) (r UpdateStagedResult)
UpdateStaged accepts a UpdateStagedOpts struct and updates existing Target Group configurations using the values provided.
func (UpdateStagedResult) Extract ¶
func (r UpdateStagedResult) Extract() (*TargetGroup, error)
Extract is a function that accepts a result and extracts a TargetGroup resource.
func (UpdateStagedResult) ExtractInto ¶
func (r UpdateStagedResult) ExtractInto(v interface{}) error
ExtractInto interprets any commonResult as a target group, if possible.