github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/waf-premium/v1/hosts/Get.go (about)

     1  package hosts
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  func Get(client *golangsdk.ServiceClient, id string) (*Host, error) {
     9  	// GET /v1/{project_id}/premium-waf/host
    10  	raw, err := client.Get(client.ServiceURL("premium-waf", "host", id), nil, nil)
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  
    15  	var res Host
    16  	return &res, extract.Into(raw.Body, &res)
    17  }
    18  
    19  type Host struct {
    20  	// Domain name ID
    21  	ID string `json:"id"`
    22  	// ID of the policy initially used to the domain name.
    23  	// It can be obtained by calling the API described in 2.1.1 Querying Protection Policies.
    24  	PolicyId string `json:"policyid"`
    25  	// Domain name added to cloud WAF.
    26  	Hostname string `json:"hostname"`
    27  	// User domain ID.
    28  	DomainId string `json:"domainid"`
    29  	// Project ID.
    30  	ProjectId string `json:"project_id"`
    31  	// HTTP protocol.
    32  	Protocol string `json:"protocol"`
    33  	// Minimum TLS version supported.
    34  	// TLS v1.0 is used by default.
    35  	// The value can be:TLS v1.0TLS v1.1TLS v1.2TLS v1.3
    36  	Tls string `json:"tls"`
    37  	// Cipher suite. The value can be:
    38  	// cipher_1: ECDHE-ECDSA-AES256-GCM-SHA384:HIGH:!MEDIUM:!LOW:!aNULL:!eNULL:!DES:!MD5:!PSK:!RC4:!kRSA:!SRP:!3DES:!DSS:!EXP:!CAMELLIA:@STRENGTH
    39  	// cipher_2: EECDH+AESGCM:EDH+AESGCM
    40  	// cipher_3: ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH
    41  	// cipher_4. ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!EDH n - cipher_default: ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM
    42  	Cipher string `json:"cipher"`
    43  	// Origin server details
    44  	Server []ServerResponse `json:"server"`
    45  	// HTTPS certificate ID.
    46  	// It can be obtained by calling the ListCertificates API.
    47  	// n - This parameter is not required when the client protocol is HTTP.
    48  	// n - This parameter is mandatory when the client protocol is HTTPS.
    49  	CertificateId string `json:"certificateid"`
    50  	// Certificate name.
    51  	// n - This parameter is not required when the client protocol is HTTP.
    52  	// n - This parameter is mandatory when the client protocol is HTTPS.
    53  	CertificateName string `json:"certificatename"`
    54  	// Whether the proxy is enabled
    55  	Proxy bool `json:"proxy"`
    56  	// Lock status. This parameter is redundant and can be ignored. Default value: 0
    57  	Locked int `json:"locked"`
    58  	// WAF status of the protected domain name. The value can be:
    59  	// -1: Bypassed. Requests are directly sent to the backend servers without passing through WAF.
    60  	// 0: Suspended. WAF only forwards requests for the domain name but does not detect attacks.
    61  	// 1: Enabled. WAF detects attacks based on the configured policy.
    62  	ProtectStatus int `json:"protect_status"`
    63  	// Whether a domain name is connected to WAF.
    64  	// 0: The domain name is not connected to the engine instance.
    65  	// 1: The domain name is connected to the engine instance.
    66  	AccessStatus int `json:"access_status"`
    67  	// Time a domain name is added to WAF
    68  	CreatedAt int `json:"timestamp"`
    69  	// Special domain name identifier, which is used to store additional domain name configurations
    70  	Flag *FlagObject `json:"flag"`
    71  	// Alarm configuration page
    72  	BlockPage *BlockPageResponse `json:"block_page"`
    73  	// Extended attribute
    74  	Extend *ExtendResponse `json:"extend"`
    75  	// WAF mode. The value is premium, indicating
    76  	// the dedicated WAF engine
    77  	WafType string `json:"waf_type"`
    78  	// Website name
    79  	WebTag string `json:"web_tag"`
    80  	// Traffic identifier
    81  	TrafficMark *TrafficMarkObject `json:"traffic_mark"`
    82  	// Circuit breaker configuration
    83  	CircuitBreaker *CircuitBreakerObject `json:"circuit_breaker"`
    84  	// Timeout settings
    85  	TimeoutConfig *TimeoutConfigObject `json:"timeout_config"`
    86  	// Description
    87  	Description string `json:"description"`
    88  }
    89  
    90  type TrafficMarkObject struct {
    91  	// IP tag. HTTP request header field of the original client IP address.
    92  	Sip []string `json:"sip"`
    93  	// Session tag. This tag is used by known attack source rules
    94  	// to block malicious attacks based on cookie attributes.
    95  	// This parameter must be configured in known attack source rules
    96  	// to block requests based on cookie attributes.
    97  	Cookie string `json:"cookie"`
    98  	// User tag. This tag is used by known attack source rules
    99  	// to block malicious attacks based on params attributes.
   100  	// This parameter must be configured to block requests based on the params attributes.
   101  	Params string `json:"params"`
   102  }
   103  
   104  type CircuitBreakerObject struct {
   105  	// Whether to enable connection protection.
   106  	// true: Enable connection protection.
   107  	// false: Disable the connection protection.
   108  	Switch bool `json:"switch"`
   109  	// 502/504 error threshold. 502/504 errors allowed for every 30 seconds.
   110  	DeadNum int `json:"dead_num"`
   111  	// A breakdown protection is triggered when
   112  	// the 502/504 error threshold and percentage threshold have been reached.
   113  	DeadRatio int `json:"dead_ratio"`
   114  	// Protection period upon the first breakdown.
   115  	// During this period, WAF stops forwarding client requests.
   116  	BlockTime int `json:"block_time"`
   117  	// The maximum multiplier you can use for consecutive breakdowns.
   118  	SuperpositionNum int `json:"superposition_num"`
   119  	// Threshold of the number of pending URL requests.
   120  	// Connection protection is triggered when the threshold has been reached.
   121  	SuspendNum int `json:"suspend_num"`
   122  	// Downtime duration after the connection protection is triggered.
   123  	// During this period, WAF stops forwarding website requests.
   124  	SusBlockTime int `json:"sus_block_time"`
   125  }
   126  
   127  type TimeoutConfigObject struct {
   128  	// Timeout for WAF to connect to the origin server.
   129  	ConnectionTimeout int `json:"connect_timeout"`
   130  	// Timeout for WAF to send requests to the origin server.
   131  	SendTimeout int `json:"send_timeout"`
   132  	// Timeout for WAF to receive responses from the origin server.
   133  	ReadTimeout int `json:"read_timeout"`
   134  }