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

     1  /*
     2   Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
     3  */
     4  
     5  package whiteblackip_rules
     6  
     7  import (
     8  	"github.com/huaweicloud/golangsdk"
     9  )
    10  
    11  type WhiteBlackIP struct {
    12  	// WhiteBlackIP Rule ID
    13  	Id string `json:"id"`
    14  	// WhiteBlackIP Rule Addr
    15  	Addr string `json:"addr"`
    16  	// IP address type
    17  	White int `json:"white"`
    18  	// Policy ID
    19  	PolicyID string `json:"policyid"`
    20  }
    21  
    22  type commonResult struct {
    23  	golangsdk.Result
    24  }
    25  
    26  // Extract is a function that accepts a result and extracts a whiteblackip rule.
    27  func (r commonResult) Extract() (*WhiteBlackIP, error) {
    28  	var response WhiteBlackIP
    29  	err := r.ExtractInto(&response)
    30  	return &response, err
    31  }
    32  
    33  // CreateResult represents the result of a create operation. Call its Extract
    34  // method to interpret it as a WhiteBlackIP rule.
    35  type CreateResult struct {
    36  	commonResult
    37  }
    38  
    39  // UpdateResult represents the result of a update operation. Call its Extract
    40  // method to interpret it as a WhiteBlackIP rule.
    41  type UpdateResult struct {
    42  	commonResult
    43  }
    44  
    45  // GetResult represents the result of a get operation. Call its Extract
    46  // method to interpret it as a WhiteBlackIP rule.
    47  type GetResult struct {
    48  	commonResult
    49  }
    50  
    51  // DeleteResult represents the result of a delete operation. Call its ExtractErr
    52  // method to determine if the request succeeded or failed.
    53  type DeleteResult struct {
    54  	golangsdk.ErrResult
    55  }