github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/elbaas/healthcheck/results.go (about)

     1  package healthcheck
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  	//"github.com/huaweicloud/golangsdk/pagination"
     6  	//"fmt"
     7  )
     8  
     9  // Health represents a load balancer health check. A health monitor is used
    10  // to determine whether or not back-end members of the VIP's pool are usable
    11  // for processing a request. A pool can have several health monitors associated
    12  // with it. There are different types of health monitors supported:
    13  //
    14  // PING: used to ping the members using ICMP.
    15  // TCP: used to connect to the members using TCP.
    16  // HTTP: used to send an HTTP request to the member.
    17  // HTTPS: used to send a secure HTTP request to the member.
    18  //
    19  // When a pool has several monitors associated with it, each member of the pool
    20  // is monitored by all these monitors. If any monitor declares the member as
    21  // unhealthy, then the member status is changed to INACTIVE and the member
    22  // won't participate in its pool's load balancing. In other words, ALL monitors
    23  // must declare the member to be healthy for it to stay ACTIVE.
    24  type Health struct {
    25  	// Specifies the maximum interval (s) for health check.
    26  	HealthcheckInterval int `json:"healthcheck_interval,omitempty"`
    27  	// Specifies the ID of the listener to which the health check task belongs.
    28  	ListenerID string `json:"listener_id" required:"true"`
    29  	// Specifies the health check ID.
    30  	ID string `json:"id"`
    31  	// Specifies the protocol used for the health check. The value can be HTTP or TCP (case-insensitive).
    32  	HealthcheckProtocol string `json:"healthcheck_protocol,omitempty"`
    33  	// Specifies the threshold at which the health check result is fail, that is, the number of consecutive
    34  	// failed health checks when the health check result of the backend server changes from success to fail.
    35  	UnhealthyThreshold int `json:"unhealthy_threshold,omitempty"`
    36  	// Specifies the time when information about the health check was updated.
    37  	UpdateTime string `json:"update_time"`
    38  	// Specifies the time when the health check was created.
    39  	CreateTime string `json:"create_time"`
    40  	// Specifies the port used for the health check.  The value ranges from 1 to 65535.
    41  	HealthcheckConnectPort int `json:"healthcheck_connect_port,omitempty"`
    42  	// Specifies the maximum timeout duration (s) for the health check.
    43  	HealthcheckTimeout int `json:"healthcheck_timeout,omitempty"`
    44  	// Specifies the URI for health check.
    45  	HealthcheckUri string `json:"healthcheck_uri,omitempty"`
    46  	// Specifies the threshold at which the health check result is success, that is, the number of consecutive successful
    47  	// health checks when the health check result of the backend server changes from fail to success.
    48  	HealthyThreshold int `json:"healthy_threshold,omitempty"`
    49  }
    50  
    51  type commonResult struct {
    52  	golangsdk.Result
    53  }
    54  
    55  // Extract is a function that accepts a result and extracts a monitor.
    56  func (r commonResult) Extract() (*Health, error) {
    57  	//fmt.Printf("Extracting Health...\n")
    58  	l := new(Health)
    59  	err := r.ExtractInto(l)
    60  	if err != nil {
    61  		//fmt.Printf("Error: %s.\n", err.Error())
    62  		return nil, err
    63  	} else {
    64  		//fmt.Printf("Returning extract: %+v.\n", l)
    65  		return l, nil
    66  	}
    67  }
    68  
    69  // CreateResult represents the result of a create operation.
    70  type CreateResult struct {
    71  	commonResult
    72  }
    73  
    74  // GetResult represents the result of a get operation.
    75  type GetResult struct {
    76  	commonResult
    77  }
    78  
    79  // UpdateResult represents the result of an update operation.
    80  type UpdateResult struct {
    81  	commonResult
    82  }
    83  
    84  // DeleteResult represents the result of a delete operation.
    85  type DeleteResult struct {
    86  	golangsdk.ErrResult
    87  }