github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/fgs/v2/trigger/results.go (about)

     1  package trigger
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  	"github.com/huaweicloud/golangsdk/pagination"
     6  )
     7  
     8  type commonResult struct {
     9  	golangsdk.Result
    10  }
    11  
    12  // CreateResult represents a result of the Create method.
    13  type CreateResult struct {
    14  	commonResult
    15  }
    16  
    17  // GetResult represents a result of the Update method.
    18  type GetResult struct {
    19  	commonResult
    20  }
    21  
    22  // UpdateResult represents a result of the Update method.
    23  type UpdateResult struct {
    24  	golangsdk.ErrResult
    25  }
    26  
    27  // DeleteResult represents a result of the Delete method.
    28  type DeleteResult struct {
    29  	golangsdk.ErrResult
    30  }
    31  
    32  // Trigger is a struct that represents the result of Create and Get methods.
    33  type Trigger struct {
    34  	TriggerId       string                 `json:"trigger_id"`
    35  	TriggerTypeCode string                 `json:"trigger_type_code"`
    36  	EventData       map[string]interface{} `json:"event_data"`
    37  	EventTypeCode   string                 `json:"event_type_code"`
    38  	Status          string                 `json:"trigger_status"`
    39  	LastUpdatedTime string                 `json:"last_updated_time"`
    40  	CreatedTime     string                 `json:"created_time"`
    41  	LastError       string                 `json:"last_error"`
    42  }
    43  
    44  func (r commonResult) Extract() (*Trigger, error) {
    45  	var s Trigger
    46  	err := r.ExtractInto(&s)
    47  	return &s, err
    48  }
    49  
    50  // TriggerPage represents the response pages of the List method.
    51  type TriggerPage struct {
    52  	pagination.SinglePageBase
    53  }
    54  
    55  // ExtractList is a method which to extract the response to a trigger list.
    56  func ExtractList(r pagination.Page) ([]Trigger, error) {
    57  	var s []Trigger
    58  	err := (r.(TriggerPage)).ExtractInto(&s)
    59  	return s, err
    60  }