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

     1  package preciseprotection_rules
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  )
     6  
     7  type Precise struct {
     8  	Id         string      `json:"id"`
     9  	PolicyID   string      `json:"policy_id"`
    10  	Name       string      `json:"name"`
    11  	Time       bool        `json:"time"`
    12  	Start      int64       `json:"start"`
    13  	End        int64       `json:"end"`
    14  	Conditions []Condition `json:"conditions"`
    15  	Action     Action      `json:"action"`
    16  	Priority   int         `json:"priority"`
    17  }
    18  
    19  type commonResult struct {
    20  	golangsdk.Result
    21  }
    22  
    23  // Extract is a function that accepts a result and extracts a precise protection rule.
    24  func (r commonResult) Extract() (*Precise, error) {
    25  	var response Precise
    26  	err := r.ExtractInto(&response)
    27  	return &response, err
    28  }
    29  
    30  // CreateResult represents the result of a create operation. Call its Extract
    31  // method to interpret it as a precise protection rule.
    32  type CreateResult struct {
    33  	commonResult
    34  }
    35  
    36  // UpdateResult represents the result of a update operation. Call its Extract
    37  // method to interpret it as a precise protection rule.
    38  type UpdateResult struct {
    39  	commonResult
    40  }
    41  
    42  // GetResult represents the result of a get operation. Call its Extract
    43  // method to interpret it as a precise protection rule.
    44  type GetResult struct {
    45  	commonResult
    46  }
    47  
    48  // DeleteResult represents the result of a delete operation. Call its ExtractErr
    49  // method to determine if the request succeeded or failed.
    50  type DeleteResult struct {
    51  	golangsdk.ErrResult
    52  }