health_monitors

package
v2.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Generated by https://github.com/tamac-io/openapi-to-eclcloud-rb

Package health_monitors contains functionality for working with ECL Managed Load Balancer resources.

Example to list health monitors

listOpts := health_monitors.ListOpts{}

allPages, err := health_monitors.List(managedLoadBalancerClient, listOpts).AllPages()
if err != nil {
	panic(err)
}

allHealthMonitors, err := health_monitors.ExtractHealthMonitors(allPages)
if err != nil {
	panic(err)
}

for _, healthMonitor := range allHealthMonitors {
	fmt.Printf("%+v\n", healthMonitor)
}

Example to create a health monitor

var tags map[string]interface{}
tagsJson := `{"key":"value"}`
err := json.Unmarshal([]byte(tagsJson), &tags)
if err != nil {
	panic(err)
}

createOpts := health_monitors.CreateOpts{
	Name: "health_monitor",
	Description: "description",
	Tags: tags,
	Port: 80,
	Protocol: "http",
	Interval: 5,
	Retry: 3,
	Timeout: 5,
	Path: "/health",
	HttpStatusCode: "200-299",
	LoadBalancerID: "67fea379-cff0-4191-9175-de7d6941a040",
}

healthMonitor, err := health_monitors.Create(managedLoadBalancerClient, createOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", healthMonitor)

Example to show a health monitor

showOpts := health_monitors.ShowOpts{}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
healthMonitor, err := health_monitors.Show(managedLoadBalancerClient, id, showOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", healthMonitor)

Example to update a health monitor

name := "health_monitor"
description := "description"

var tags map[string]interface{}
tagsJson := `{"key":"value"}`
err := json.Unmarshal([]byte(tagsJson), &tags)
if err != nil {
	panic(err)
}

updateOpts := health_monitors.UpdateOpts{
	Name: &name,
	Description: &description,
	Tags: &tags,
}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
healthMonitor, err := health_monitors.Update(managedLoadBalancerClient, updateOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", healthMonitor)

Example to delete a health monitor

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
err := health_monitors.Delete(managedLoadBalancerClient, id).ExtractErr()
if err != nil {
	panic(err)
}

Example to create staged health monitor configurations

createStagedOpts := health_monitors.CreateStagedOpts{
	Port: 80,
	Protocol: "http",
	Interval: 5,
	Retry: 3,
	Timeout: 5,
	Path: "/health",
	HttpStatusCode: "200-299",
}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
healthMonitorConfigurations, err := health_monitors.CreateStaged(managedLoadBalancerClient, id, createStagedOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", healthMonitorConfigurations)

Example to show staged health monitor configurations

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
healthMonitorConfigurations, err := health_monitors.ShowStaged(managedLoadBalancerClient, id).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", healthMonitorConfigurations)

Example to update staged health monitor configurations

port := 80
protocol := "http"
interval := 5
retry := 3
timeout := 5
path := "/health"
httpStatusCode := "200-299"
updateStagedOpts := health_monitors.UpdateStagedOpts{
	Port: &port,
	Protocol: &protocol,
	Interval: &interval,
	Retry: &retry,
	Timeout: &timeout,
	Path: &path,
	HttpStatusCode: &httpStatusCode,
}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
healthMonitorConfigurations, err := health_monitors.UpdateStaged(managedLoadBalancerClient, updateStagedOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", healthMonitorConfigurations)

Example to cancel staged health monitor configurations

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
err := health_monitors.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

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractHealthMonitorsInto

func ExtractHealthMonitorsInto(r pagination.Page, v interface{}) error

ExtractHealthMonitorsInto interprets the results of a single page from a List() call, producing a slice of health monitor 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 health monitors. 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 health monitor configurations associated with it.

type ConfigurationInResponse

type ConfigurationInResponse struct {

	// - Port number of the health monitor for healthchecking
	// - Returns `0` when `protocol` is `"icmp"`
	Port int `json:"port,omitempty"`

	// - Protocol of the health monitor for healthchecking
	Protocol string `json:"protocol,omitempty"`

	// - Interval of healthchecking (in seconds)
	Interval int `json:"interval,omitempty"`

	// - Retry count of healthchecking
	// - Initial monitoring is not included
	// - Retry is executed at the interval specified by `interval`
	Retry int `json:"retry,omitempty"`

	// - Timeout of healthchecking (in seconds)
	Timeout int `json:"timeout,omitempty"`

	// - URL path of healthchecking
	// - Used when `protocol` is `"http"` or `"https"`
	Path string `json:"path,omitempty"`

	// - HTTP status codes expected in healthchecking
	// - Used when `protocol` is `"http"` or `"https"`
	// - Format: `"xxx"` or `"xxx-xxx"` ( `xxx` between [100, 599])
	HttpStatusCode string `json:"http_status_code,omitempty"`
}

ConfigurationInResponse represents a configuration in a health monitor.

type CreateOpts

type CreateOpts struct {

	// - Name of the health monitor
	Name string `json:"name,omitempty"`

	// - Description of the health monitor
	Description string `json:"description,omitempty"`

	// - Tags of the health monitor
	// - Must be specified as JSON object
	Tags map[string]interface{} `json:"tags,omitempty"`

	// - Port number of the health monitor for healthchecking
	// - Must be specified `0` when `protocol` is `"icmp"`
	Port int `json:"port"`

	// - Protocol of the health monitor for healthchecking
	Protocol string `json:"protocol"`

	// - Interval of healthchecking (in seconds)
	Interval int `json:"interval,omitempty"`

	// - Retry count of healthchecking
	// - Initial monitoring is not included
	// - Retry is executed at the interval specified by `interval`
	Retry int `json:"retry,omitempty"`

	// - Timeout of healthchecking (in seconds)
	// - Must be specified a number less than or equal to `interval`
	Timeout int `json:"timeout,omitempty"`

	// - URL path of healthchecking
	// - Can be specified path to monitor when `protocol` is `"http"` or `"https"`
	// - Must be started with /
	Path string `json:"path,omitempty"`

	// - HTTP status codes expected in healthchecking
	// - Can be specified HTTP status code (or range) when `protocol` is `"http"` or `"https"`
	// - Format: `"xxx"` or `"xxx-xxx"` ( `xxx` between [100, 599])
	HttpStatusCode string `json:"http_status_code,omitempty"`

	// - ID of the load balancer which the health monitor belongs to
	LoadBalancerID string `json:"load_balancer_id"`
}

CreateOpts represents options used to create a new health monitor.

func (CreateOpts) ToHealthMonitorCreateMap

func (opts CreateOpts) ToHealthMonitorCreateMap() (map[string]interface{}, error)

ToHealthMonitorCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToHealthMonitorCreateMap() (map[string]interface{}, error)
}

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 HealthMonitor.

func Create

func Create(c *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create accepts a CreateOpts struct and creates a new health monitor using the values provided.

func (CreateResult) Extract

func (r CreateResult) Extract() (*HealthMonitor, error)

Extract is a function that accepts a result and extracts a HealthMonitor resource.

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v interface{}) error

ExtractInto interprets any commonResult as a health monitor, if possible.

type CreateStagedOpts

type CreateStagedOpts struct {

	// - Port number of the health monitor for healthchecking
	// - Must be specified `0` when `protocol` is `"icmp"`
	Port int `json:"port,omitempty"`

	// - Protocol of the health monitor for healthchecking
	Protocol string `json:"protocol,omitempty"`

	// - Interval of healthchecking (in seconds)
	Interval int `json:"interval,omitempty"`

	// - Retry count of healthchecking
	// - Initial monitoring is not included
	// - Retry is executed at the interval specified by `interval`
	Retry int `json:"retry,omitempty"`

	// - Timeout of healthchecking (in seconds)
	// - Must be specified a number less than or equal to `interval`
	Timeout int `json:"timeout,omitempty"`

	// - URL path of healthchecking
	// - Can be specified path to monitor when `protocol` is `"http"` or `"https"`
	// - Must be started with /
	Path string `json:"path,omitempty"`

	// - HTTP status codes expected in healthchecking
	// - Can be specified HTTP status code (or range) when `protocol` is `"http"` or `"https"`
	// - Format: `"xxx"` or `"xxx-xxx"` ( `xxx` between [100, 599])
	HttpStatusCode string `json:"http_status_code,omitempty"`
}

CreateStagedOpts represents options used to create new health monitor configurations.

func (CreateStagedOpts) ToHealthMonitorCreateStagedMap

func (opts CreateStagedOpts) ToHealthMonitorCreateStagedMap() (map[string]interface{}, error)

ToHealthMonitorCreateStagedMap builds a request body from CreateStagedOpts.

type CreateStagedOptsBuilder

type CreateStagedOptsBuilder interface {
	ToHealthMonitorCreateStagedMap() (map[string]interface{}, error)
}

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 HealthMonitor.

func CreateStaged

func CreateStaged(c *eclcloud.ServiceClient, id string, opts CreateStagedOptsBuilder) (r CreateStagedResult)

CreateStaged accepts a CreateStagedOpts struct and creates new health monitor configurations using the values provided.

func (CreateStagedResult) Extract

func (r CreateStagedResult) Extract() (*HealthMonitor, error)

Extract is a function that accepts a result and extracts a HealthMonitor resource.

func (CreateStagedResult) ExtractInto

func (r CreateStagedResult) ExtractInto(v interface{}) error

ExtractInto interprets any commonResult as a health monitor, 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 health monitor associated with it.

type HealthMonitor

type HealthMonitor struct {

	// - ID of the health monitor
	ID string `json:"id"`

	// - Name of the health monitor
	Name string `json:"name"`

	// - Description of the health monitor
	Description string `json:"description"`

	// - Tags of the health monitor (JSON object format)
	Tags map[string]interface{} `json:"tags"`

	// - Configuration status of the health monitor
	//   - `"ACTIVE"`
	//     - There are no configurations of the health monitor that waiting to be applied
	//   - `"CREATE_STAGED"`
	//     - The health monitor has been added and waiting to be applied
	//   - `"UPDATE_STAGED"`
	//     - Changed configurations of the health monitor exists that waiting to be applied
	//   - `"DELETE_STAGED"`
	//     - The health monitor has been removed and waiting to be applied
	ConfigurationStatus string `json:"configuration_status"`

	// - Operation status of the load balancer which the health monitor 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 health monitor belongs to
	LoadBalancerID string `json:"load_balancer_id"`

	// - ID of the owner tenant of the health monitor
	TenantID string `json:"tenant_id"`

	// - Port number of the health monitor for healthchecking
	// - Returns `0` when `protocol` is `"icmp"`
	Port int `json:"port,omitempty"`

	// - Protocol of the health monitor for healthchecking
	Protocol string `json:"protocol,omitempty"`

	// - Interval of healthchecking (in seconds)
	Interval int `json:"interval,omitempty"`

	// - Retry count of healthchecking
	// - Initial monitoring is not included
	// - Retry is executed at the interval specified by `interval`
	Retry int `json:"retry,omitempty"`

	// - Timeout of healthchecking (in seconds)
	Timeout int `json:"timeout,omitempty"`

	// - URL path of healthchecking
	// - Used when `protocol` is `"http"` or `"https"`
	Path string `json:"path,omitempty"`

	// - HTTP status codes expected in healthchecking
	// - Used when `protocol` is `"http"` or `"https"`
	// - Format: `"xxx"` or `"xxx-xxx"` ( `xxx` between [100, 599])
	HttpStatusCode string `json:"http_status_code,omitempty"`

	// - Running configurations of the health monitor
	// - Return object when `changes` is `true`
	// - Return `null` when current configuration does not exist
	Current ConfigurationInResponse `json:"current,omitempty"`

	// - Added or changed configurations of the health monitor that waiting to be applied
	// - Return object when `changes` is `true`
	// - Return `null` when staged configuration does not exist
	Staged ConfigurationInResponse `json:"staged,omitempty"`
}

HealthMonitor represents a health monitor.

func ExtractHealthMonitors

func ExtractHealthMonitors(r pagination.Page) ([]HealthMonitor, error)

ExtractHealthMonitors accepts a Page struct, specifically a NetworkPage struct, and extracts the elements into a slice of HealthMonitor structs. In other words, a generic collection is mapped into a relevant slice.

type HealthMonitorPage

type HealthMonitorPage struct {
	pagination.LinkedPageBase
}

HealthMonitorPage is the page returned by a pager when traversing over a collection of health monitor.

func (HealthMonitorPage) IsEmpty

func (r HealthMonitorPage) IsEmpty() (bool, error)

IsEmpty checks whether a HealthMonitorPage struct is empty.

type ListOpts

type ListOpts struct {

	// - ID of the resource
	ID string `q:"id"`

	// - Name of the resource
	Name string `q:"name"`

	// - Description of the resource
	Description string `q:"description"`

	// - Configuration status of the resource
	ConfigurationStatus string `q:"configuration_status"`

	// - Operation status of the resource
	OperationStatus string `q:"operation_status"`

	// - Port number of the resource for healthchecking or listening
	Port int `q:"port"`

	// - Protocol of the resource for healthchecking or listening
	Protocol string `q:"protocol"`

	// - Interval of healthchecking (in seconds)
	Interval int `q:"interval"`

	// - Retry count of healthchecking
	Retry int `q:"retry"`

	// - Timeout of healthchecking (in seconds)
	Timeout int `q:"timeout"`

	// - URL path of healthchecking
	// - Must be started with `"/"`
	Path string `q:"path"`

	// - HTTP status codes expected in healthchecking
	// - Format: `"xxx"` or `"xxx-xxx"` ( `xxx` between [100, 599])
	HttpStatusCode string `q:"http_status_code"`

	// - 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 health monitor attributes you want to see returned.

func (ListOpts) ToHealthMonitorListQuery

func (opts ListOpts) ToHealthMonitorListQuery() (string, error)

ToHealthMonitorListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToHealthMonitorListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type ShowOpts

type ShowOpts struct {

	// - When `true` is specified, `current` and `staged` are returned in response body
	Changes bool `q:"changes"`
}

ShowOpts represents options used to show a health monitor.

func (ShowOpts) ToHealthMonitorShowQuery

func (opts ShowOpts) ToHealthMonitorShowQuery() (string, error)

ToHealthMonitorShowQuery formats a ShowOpts into a query string.

type ShowOptsBuilder

type ShowOptsBuilder interface {
	ToHealthMonitorShowQuery() (string, error)
}

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 HealthMonitor.

func Show

func Show(c *eclcloud.ServiceClient, id string, opts ShowOptsBuilder) (r ShowResult)

Show retrieves a specific health monitor based on its unique ID.

func (ShowResult) Extract

func (r ShowResult) Extract() (*HealthMonitor, error)

Extract is a function that accepts a result and extracts a HealthMonitor resource.

func (ShowResult) ExtractInto

func (r ShowResult) ExtractInto(v interface{}) error

ExtractInto interprets any commonResult as a health monitor, 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 HealthMonitor.

func ShowStaged

func ShowStaged(c *eclcloud.ServiceClient, id string) (r ShowStagedResult)

ShowStaged retrieves specific health monitor configurations based on its unique ID.

func (ShowStagedResult) Extract

func (r ShowStagedResult) Extract() (*HealthMonitor, error)

Extract is a function that accepts a result and extracts a HealthMonitor resource.

func (ShowStagedResult) ExtractInto

func (r ShowStagedResult) ExtractInto(v interface{}) error

ExtractInto interprets any commonResult as a health monitor, if possible.

type UpdateOpts

type UpdateOpts struct {

	// - Name of the health monitor
	Name *string `json:"name,omitempty"`

	// - Description of the health monitor
	Description *string `json:"description,omitempty"`

	// - Tags of the health monitor
	// - Must be specified as JSON object
	Tags *map[string]interface{} `json:"tags,omitempty"`
}

UpdateOpts represents options used to update a existing health monitor.

func (UpdateOpts) ToHealthMonitorUpdateMap

func (opts UpdateOpts) ToHealthMonitorUpdateMap() (map[string]interface{}, error)

ToHealthMonitorUpdateMap builds a request body from UpdateOpts.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToHealthMonitorUpdateMap() (map[string]interface{}, error)
}

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 HealthMonitor.

func Update

func Update(c *eclcloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update accepts a UpdateOpts struct and updates a existing health monitor using the values provided.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*HealthMonitor, error)

Extract is a function that accepts a result and extracts a HealthMonitor resource.

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

ExtractInto interprets any commonResult as a health monitor, if possible.

type UpdateStagedOpts

type UpdateStagedOpts struct {

	// - Port number of the health monitor for healthchecking
	// - Must be specified `0` when `protocol` is `"icmp"`
	Port *int `json:"port,omitempty"`

	// - Protocol of the health monitor for healthchecking
	Protocol *string `json:"protocol,omitempty"`

	// - Interval of healthchecking (in seconds)
	Interval *int `json:"interval,omitempty"`

	// - Retry count of healthchecking
	// - Initial monitoring is not included
	// - Retry is executed at the interval specified by `interval`
	Retry *int `json:"retry,omitempty"`

	// - Timeout of healthchecking (in seconds)
	// - Must be specified a number less than or equal to `interval`
	Timeout *int `json:"timeout,omitempty"`

	// - URL path of healthchecking
	// - Can be specified path to monitor when `protocol` is `"http"` or `"https"`
	// - Must be started with /
	Path *string `json:"path,omitempty"`

	// - HTTP status codes expected in healthchecking
	// - Can be specified HTTP status code (or range) when `protocol` is `"http"` or `"https"`
	// - Format: `"xxx"` or `"xxx-xxx"` ( `xxx` between [100, 599])
	HttpStatusCode *string `json:"http_status_code,omitempty"`
}

UpdateStagedOpts represents options used to update existing Health Monitor configurations.

func (UpdateStagedOpts) ToHealthMonitorUpdateStagedMap

func (opts UpdateStagedOpts) ToHealthMonitorUpdateStagedMap() (map[string]interface{}, error)

ToHealthMonitorUpdateStagedMap builds a request body from UpdateStagedOpts.

type UpdateStagedOptsBuilder

type UpdateStagedOptsBuilder interface {
	ToHealthMonitorUpdateStagedMap() (map[string]interface{}, error)
}

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 HealthMonitor.

func UpdateStaged

func UpdateStaged(c *eclcloud.ServiceClient, id string, opts UpdateStagedOptsBuilder) (r UpdateStagedResult)

UpdateStaged accepts a UpdateStagedOpts struct and updates existing Health Monitor configurations using the values provided.

func (UpdateStagedResult) Extract

func (r UpdateStagedResult) Extract() (*HealthMonitor, error)

Extract is a function that accepts a result and extracts a HealthMonitor resource.

func (UpdateStagedResult) ExtractInto

func (r UpdateStagedResult) ExtractInto(v interface{}) error

ExtractInto interprets any commonResult as a health monitor, if possible.

Directories

Path Synopsis
Generated by https://github.com/tamac-io/openapi-to-eclcloud-rb
Generated by https://github.com/tamac-io/openapi-to-eclcloud-rb

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL