github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/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/chnsz/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 Name string `json:"name"` 22 Status int `json:"status"` 23 Description string `json:"description"` 24 IPGroup *IPGroup `json:"ip_group"` 25 } 26 27 type IPGroup struct { 28 ID string `json:"id"` 29 Name string `json:"name"` 30 Size int `json:"size"` 31 } 32 33 type commonResult struct { 34 golangsdk.Result 35 } 36 37 // Extract is a function that accepts a result and extracts a whiteblackip rule. 38 func (r commonResult) Extract() (*WhiteBlackIP, error) { 39 var response WhiteBlackIP 40 err := r.ExtractInto(&response) 41 return &response, err 42 } 43 44 // CreateResult represents the result of a create operation. Call its Extract 45 // method to interpret it as a WhiteBlackIP rule. 46 type CreateResult struct { 47 commonResult 48 } 49 50 // UpdateResult represents the result of a update operation. Call its Extract 51 // method to interpret it as a WhiteBlackIP rule. 52 type UpdateResult struct { 53 commonResult 54 } 55 56 // GetResult represents the result of a get operation. Call its Extract 57 // method to interpret it as a WhiteBlackIP rule. 58 type GetResult struct { 59 commonResult 60 } 61 62 // DeleteResult represents the result of a delete operation. Call its ExtractErr 63 // method to determine if the request succeeded or failed. 64 type DeleteResult struct { 65 golangsdk.ErrResult 66 }