github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/iec/v1/ports/results.go (about)

     1  package ports
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  	"github.com/huaweicloud/golangsdk/openstack/iec/v1/common"
     6  )
     7  
     8  type commonResult struct {
     9  	golangsdk.Result
    10  }
    11  
    12  type CreateResult struct {
    13  	commonResult
    14  }
    15  
    16  func (r CreateResult) Extract() (*common.Port, error) {
    17  	var entity common.Port
    18  	err := r.ExtractIntoStructPtr(&entity, "port")
    19  	return &entity, err
    20  }
    21  
    22  type DeleteResult struct {
    23  	golangsdk.ErrResult
    24  }
    25  
    26  type GetResult struct {
    27  	commonResult
    28  }
    29  
    30  func (r GetResult) Extract() (*common.Port, error) {
    31  	var entity common.Port
    32  	err := r.ExtractIntoStructPtr(&entity, "port")
    33  	return &entity, err
    34  }
    35  
    36  type UpdateResult struct {
    37  	commonResult
    38  }
    39  
    40  func (r UpdateResult) Extract() (*common.Port, error) {
    41  	var entity common.Port
    42  	err := r.ExtractIntoStructPtr(&entity, "port")
    43  	return &entity, err
    44  }
    45  
    46  // Ports 端口列表对象
    47  type Ports struct {
    48  	Ports []common.Port `json:"ports"`
    49  	Count int           `json:"count"`
    50  }
    51  
    52  type ListResult struct {
    53  	commonResult
    54  }
    55  
    56  func (r ListResult) Extract() (*Ports, error) {
    57  	var entity Ports
    58  	err := r.ExtractIntoStructPtr(&entity, "")
    59  	return &entity, err
    60  }