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

     1  package falsealarmmasking_rules
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  )
     6  
     7  type ListResponse struct {
     8  	// Total number of the Rules
     9  	Total int `json:"total"`
    10  
    11  	// List of AlarmMasking
    12  	Items []AlarmMasking `json:"items"`
    13  }
    14  
    15  type AlarmMasking struct {
    16  	// the ID of a false alarm masking rule
    17  	Id string `json:"id"`
    18  	// the policy ID
    19  	PolicyID string `json:"policy_id"`
    20  	// a misreported URL excluding a domain name
    21  	Path string `json:"path"`
    22  	// the event ID
    23  	EventID string `json:"event_id"`
    24  	// the event ID
    25  	EventType string `json:"event_type"`
    26  	// the rule ID, which consists of six digits and cannot be empty
    27  	Rule string `json:"rule"`
    28  	// the time when a false alarm masking rule is added
    29  	TimeStamp int `json:"timestamp"`
    30  }
    31  
    32  type commonResult struct {
    33  	golangsdk.Result
    34  }
    35  
    36  // Extract is a function that accepts a result and extracts a falsealarmmasking rule.
    37  func (r commonResult) Extract() (*AlarmMasking, error) {
    38  	var response AlarmMasking
    39  	err := r.ExtractInto(&response)
    40  	return &response, err
    41  }
    42  
    43  // CreateResult represents the result of a create operation. Call its Extract
    44  // method to interpret it as a False Alarm Masking rule.
    45  type CreateResult struct {
    46  	commonResult
    47  }
    48  
    49  type UpdateResult struct {
    50  	commonResult
    51  }
    52  
    53  type GetResult struct {
    54  	commonResult
    55  }
    56  
    57  type ListResult struct {
    58  	commonResult
    59  }
    60  
    61  func (r ListResult) Extract() ([]AlarmMasking, error) {
    62  	var s ListResponse
    63  	err := r.ExtractInto(&s)
    64  	if err != nil {
    65  		return nil, err
    66  	}
    67  	return s.Items, nil
    68  }
    69  
    70  // DeleteResult represents the result of a delete operation. Call its ExtractErr
    71  // method to determine if the request succeeded or failed.
    72  type DeleteResult struct {
    73  	golangsdk.ErrResult
    74  }