github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/dns/v2/endpoints/results.go (about)

     1  package endpoints
     2  
     3  import "github.com/chnsz/golangsdk"
     4  
     5  type CreateResult struct {
     6  	commonResult
     7  }
     8  
     9  type GetResult struct {
    10  	commonResult
    11  }
    12  
    13  type UpdateResult struct {
    14  	commonResult
    15  }
    16  
    17  type DeleteResult struct {
    18  	golangsdk.ErrResult
    19  }
    20  
    21  type commonResult struct {
    22  	golangsdk.Result
    23  }
    24  
    25  type Endpoint struct {
    26  	ID                string `json:"id"`
    27  	Name              string `json:"name"`
    28  	Direction         string `json:"direction"`
    29  	Status            string `json:"status"`
    30  	VpcID             string `json:"vpc_id"`
    31  	IPAddressCount    int    `json:"ipaddress_count"`
    32  	ResolverRuleCount int    `json:"resolver_rule_count"`
    33  	CreateTime        string `json:"create_time"`
    34  	UpdateTime        string `json:"update_time"`
    35  }
    36  
    37  func (r commonResult) Extract() (*Endpoint, error) {
    38  	type response struct {
    39  		Endpoint `json:"endpoint"`
    40  	}
    41  	var res response
    42  	err := r.ExtractInto(&res)
    43  	return &res.Endpoint, err
    44  }