github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/waf/v1/falsealarmmasking_rules/results.go (about)

     1  package falsealarmmasking_rules
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     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  	// False Alarm Masking Rule ID
    17  	Id string `json:"id"`
    18  	// False Alarm Maksing Rule URL
    19  	Path string `json:"path"`
    20  	// Rule ID
    21  	Rule      string `json:"rule"`
    22  	EventID   string `json:"event_id"`
    23  	EventType string `json:"event_type"`
    24  	// Policy ID
    25  	PolicyID string `json:"policy_id"`
    26  }
    27  
    28  type commonResult struct {
    29  	golangsdk.Result
    30  }
    31  
    32  // Extract is a function that accepts a result and extracts a falsealarmmasking rule.
    33  func (r commonResult) Extract() (*AlarmMasking, error) {
    34  	var response AlarmMasking
    35  	err := r.ExtractInto(&response)
    36  	return &response, err
    37  }
    38  
    39  // CreateResult represents the result of a create operation. Call its Extract
    40  // method to interpret it as a False Alarm Masking rule.
    41  type CreateResult struct {
    42  	commonResult
    43  }
    44  
    45  type ListResult struct {
    46  	commonResult
    47  }
    48  
    49  func (r ListResult) Extract() ([]AlarmMasking, error) {
    50  	var s ListResponse
    51  	err := r.ExtractInto(&s)
    52  	if err != nil {
    53  		return nil, err
    54  	}
    55  	return s.Items, nil
    56  }
    57  
    58  // DeleteResult represents the result of a delete operation. Call its ExtractErr
    59  // method to determine if the request succeeded or failed.
    60  type DeleteResult struct {
    61  	golangsdk.ErrResult
    62  }