github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/elb/v3/ipgroups/results.go (about)

     1  package ipgroups
     2  
     3  import (
     4  	"github.com/chnsz/golangsdk"
     5  )
     6  
     7  type ListenerID struct {
     8  	ID string `json:"id"`
     9  }
    10  
    11  type IpGroup struct {
    12  	// The unique ID for the IpGroup.
    13  	ID string `json:"id"`
    14  
    15  	// Human-readable name for the IpGroup.
    16  	Name string `json:"name"`
    17  
    18  	// Human-readable description for the IpGroup.
    19  	Description string `json:"description"`
    20  
    21  	// whether to use HTTP2.
    22  	Http2Enable bool `json:"http2_enable"`
    23  
    24  	// A list of listener IDs.
    25  	Listeners []ListenerID `json:"listeners"`
    26  
    27  	// A list of IP addresses.
    28  	IpList []IpListOpt `json:"ip_list"`
    29  
    30  	// The create time.
    31  	CreatedAt string `json:"created_at"`
    32  
    33  	// The update time.
    34  	UpdatedAt string `json:"updated_at"`
    35  }
    36  
    37  type commonResult struct {
    38  	golangsdk.Result
    39  }
    40  
    41  // Extract is a function that accepts a result and extracts a ipgroup.
    42  func (r commonResult) Extract() (*IpGroup, error) {
    43  	var s struct {
    44  		IpGroup *IpGroup `json:"ipgroup"`
    45  	}
    46  	err := r.ExtractInto(&s)
    47  	return s.IpGroup, err
    48  }
    49  
    50  // CreateResult represents the result of a create operation. Call its Extract
    51  // method to interpret it as a IpGroup.
    52  type CreateResult struct {
    53  	commonResult
    54  }
    55  
    56  // GetResult represents the result of a get operation. Call its Extract
    57  // method to interpret it as a IpGroup.
    58  type GetResult struct {
    59  	commonResult
    60  }
    61  
    62  // UpdateResult represents the result of an update operation. Call its Extract
    63  // method to interpret it as a IpGroup.
    64  type UpdateResult struct {
    65  	commonResult
    66  }
    67  
    68  // DeleteResult represents the result of a delete operation. Call its
    69  // ExtractErr method to determine if the request succeeded or failed.
    70  type DeleteResult struct {
    71  	golangsdk.ErrResult
    72  }