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

     1  package tracker
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  	"github.com/huaweicloud/golangsdk/pagination"
     6  )
     7  
     8  type Tracker struct {
     9  	Status                    string                    `json:"status"`
    10  	BucketName                string                    `json:"bucket_name"`
    11  	FilePrefixName            string                    `json:"file_prefix_name"`
    12  	TrackerName               string                    `json:"tracker_name"`
    13  	SimpleMessageNotification SimpleMessageNotification `json:"smn"`
    14  }
    15  
    16  // Extract will get the tracker object from the commonResult
    17  func (r commonResult) Extract() (*Tracker, error) {
    18  	var s Tracker
    19  	err := r.ExtractInto(&s)
    20  	return &s, err
    21  }
    22  
    23  type TrackerPage struct {
    24  	pagination.LinkedPageBase
    25  }
    26  
    27  // ExtractTracker accepts a Page struct, specifically a TrackerPage struct,
    28  // and extracts the elements into a slice of Tracker structs. In other words,
    29  // a generic collection is mapped into a relevant slice.
    30  func (r commonResult) ExtractTracker() ([]Tracker, error) {
    31  	var s []Tracker
    32  	err := r.ExtractInto(&s)
    33  	if err != nil {
    34  		return nil, err
    35  	}
    36  
    37  	return s, nil
    38  
    39  }
    40  
    41  type commonResult struct {
    42  	golangsdk.Result
    43  }
    44  
    45  type CreateResult struct {
    46  	commonResult
    47  }
    48  
    49  type UpdateResult struct {
    50  	commonResult
    51  }
    52  
    53  type DeleteResult struct {
    54  	golangsdk.ErrResult
    55  }
    56  type ListResult struct {
    57  	commonResult
    58  }