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

     1  package domains
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  )
     6  
     7  type Domain struct {
     8  	// Domain ID
     9  	Id string `json:"id"`
    10  	// Domain name
    11  	HostName string `json:"hostname"`
    12  	// CNAME value
    13  	Cname string `json:"cname"`
    14  	// TXT record
    15  	TxtCode string `json:"txt_code"`
    16  	// Sub Domain name
    17  	SubDomain string `json:"sub_domain"`
    18  	// Policy ID
    19  	PolicyID string `json:"policy_id"`
    20  	// WAF mode: 0 - disabled, 1 - enabled, -1 - bypassed.
    21  	ProtectStatus int `json:"protect_status"`
    22  	// Whether a domain name is connected to WAF
    23  	AccessStatus int `json:"access_status"`
    24  	// Protocol type
    25  	Protocol string `json:"protocol"`
    26  	// Certificate ID
    27  	CertificateId string `json:"certificate_id"`
    28  	//The original server information
    29  	Servers []Server `json:"server"`
    30  	//Whether proxy is configured
    31  	Proxy bool `json:"proxy"`
    32  	//The type of the source IP header
    33  	SipHeaderName string `json:"sip_header_name"`
    34  	//The HTTP request header for identifying the real source IP.
    35  	SipHeaderList []string `json:"sip_header_list"`
    36  	// the time when the domain is created in unix timestamp
    37  	TimeStamp int `json:"timestamp"`
    38  }
    39  
    40  type Server struct {
    41  	// Protocol type of the client
    42  	ClientProtocol string `json:"client_protocol"`
    43  	// Protocol used by WAF to forward client requests to the server
    44  	ServerProtocol string `json:"server_protocol"`
    45  	// IP address or domain name of the web server that the client accesses.
    46  	Address string `json:"address"`
    47  	// Port number used by the web server
    48  	Port int `json:"port"`
    49  }
    50  
    51  type commonResult struct {
    52  	golangsdk.Result
    53  }
    54  
    55  // Extract is a function that accepts a result and extracts a domain.
    56  func (r commonResult) Extract() (*Domain, error) {
    57  	var response Domain
    58  	err := r.ExtractInto(&response)
    59  	return &response, err
    60  }
    61  
    62  // CreateResult represents the result of a create operation. Call its Extract
    63  // method to interpret it as a Domain.
    64  type CreateResult struct {
    65  	commonResult
    66  }
    67  
    68  // UpdateResult represents the result of a update operation. Call its Extract
    69  // method to interpret it as a Domain.
    70  type UpdateResult struct {
    71  	commonResult
    72  }
    73  
    74  // GetResult represents the result of a get operation. Call its Extract
    75  // method to interpret it as a Domain.
    76  type GetResult struct {
    77  	commonResult
    78  }
    79  
    80  // DeleteResult represents the result of a delete operation. Call its ExtractErr
    81  // method to determine if the request succeeded or failed.
    82  type DeleteResult struct {
    83  	golangsdk.ErrResult
    84  }