github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/waf_hw/v1/domains/results.go (about)

     1  package domains
     2  
     3  import (
     4  	"github.com/chnsz/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  	PolicyId            string `json:"policyid"`
    14  	DomainId            string `json:"domainid"`
    15  	ProjectId           string `json:"projectid"`
    16  	EnterpriseProjectID string `json:"enterprise_project_id"`
    17  	// Access Code
    18  	AccessCode string `json:"access_code"`
    19  	// WAF mode: 0 - disabled, 1 - enabled, -1 - bypassed.
    20  	ProtectStatus int `json:"protect_status"`
    21  	// Whether a domain name is connected to WAF
    22  	AccessStatus int `json:"access_status"`
    23  	Locked       int `json:"locked"`
    24  	// Protocol type
    25  	Protocol string `json:"protocol,omitempty"`
    26  	// Certificate ID
    27  	CertificateId string `json:"certificateid"`
    28  	// Certificate name
    29  	CertificateName  string              `json:"certificatename"`
    30  	Tls              string              `json:"tls"`
    31  	Cipher           string              `json:"cipher"`
    32  	BlockPage        DomainBlockPage     `json:"block_page"`
    33  	Extend           map[string]string   `json:"extend"`
    34  	TrafficMark      TrafficMark         `json:"traffic_mark"`
    35  	LbAlgorithm      string              `json:"lb_algorithm"`
    36  	TimeoutConfig    DomainTimeoutConfig `json:"timeout_config"`
    37  	WebTag           string              `json:"web_tag"`
    38  	Flag             Flag                `josn:"falg"`
    39  	Description      string              `json:"description"`
    40  	Http2Enable      bool                `json:"http2_enable"`
    41  	ExclusiveIp      bool                `json:"exclusive_ip"`
    42  	AccessProgress   []AccessProgress    `json:"access_progress"`
    43  	ForwardHeaderMap map[string]string   `json:"forward_header_map"`
    44  	//The original server information
    45  	Servers []Server `json:"server"`
    46  	//Whether proxy is configured
    47  	Proxy bool `json:"proxy"`
    48  	// the time when the domain is created in unix timestamp
    49  	Timestamp int `json:"timestamp"`
    50  }
    51  
    52  type Server struct {
    53  	// Protocol type of the client
    54  	FrontProtocol string `json:"front_protocol"`
    55  	// Protocol used by WAF to forward client requests to the server
    56  	BackProtocol string `json:"back_protocol"`
    57  	// IP address or domain name of the web server that the client accesses.
    58  	Address string `json:"address"`
    59  	// Port number used by the web server
    60  	Port int `json:"port"`
    61  	// The type of network: ipv4, ipv6. Default: ipv4
    62  	Type string `json:"type"`
    63  	// VPC ID where the site is located
    64  	VpcId  string `json:"vpc_id"`
    65  	Weight int    `json:"weight"`
    66  }
    67  
    68  type AccessProgress struct {
    69  	Step   int `json:"step"`
    70  	Status int `json:"status"`
    71  }
    72  
    73  type DomainBlockPage struct {
    74  	Template    string     `json:"template" required:"true"`
    75  	CustomPage  CustomPage `json:"custom_page,omitempty"`
    76  	RedirectUrl string     `json:"redirect_url,omitempty"`
    77  }
    78  
    79  type DomainTimeoutConfig struct {
    80  	ConnectTimeout int `json:"connect_timeout,omitempty"`
    81  	SendTimeout    int `json:"send_timeout,omitempty"`
    82  	ReadTimeout    int `json:"read_timeout,omitempty"`
    83  }
    84  
    85  type commonResult struct {
    86  	golangsdk.Result
    87  }
    88  
    89  // Extract is a function that accepts a result and extracts a domain.
    90  func (r commonResult) Extract() (*Domain, error) {
    91  	var response Domain
    92  	err := r.ExtractInto(&response)
    93  	return &response, err
    94  }
    95  
    96  // CreateResult represents the result of a create operation. Call its Extract
    97  // method to interpret it as a Domain.
    98  type CreateResult struct {
    99  	commonResult
   100  }
   101  
   102  // UpdateResult represents the result of a update operation. Call its Extract
   103  // method to interpret it as a Domain.
   104  type UpdateResult struct {
   105  	commonResult
   106  }
   107  
   108  // GetResult represents the result of a get operation. Call its Extract
   109  // method to interpret it as a Domain.
   110  type GetResult struct {
   111  	commonResult
   112  }
   113  
   114  // DeleteResult represents the result of a delete operation. Call its ExtractErr
   115  // method to determine if the request succeeded or failed.
   116  type DeleteResult struct {
   117  	golangsdk.ErrResult
   118  }
   119  
   120  type HostProtectStatus struct {
   121  	ProtectStatus int `json:"protect_status"`
   122  }