tencent cloud

文档反馈

ModifySpartaProtection

最后更新时间:2024-11-27 09:47:01

1. API Description

Domain name for API request: waf.intl.tencentcloudapi.com.

This API is used to edit the configuration of domain names protected by SaaS WAF.

A maximum of 2 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ModifySpartaProtection.
Version Yes String Common Params. The value used for this API: 2018-01-25.
Region Yes String Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-guangzhou, ap-seoul.
Domain Yes String Domain name
DomainId Yes String Required. Unique domain name ID
InstanceID Yes String Required. Instance ID of the domain name
CertType No Integer Certificate type. 0: no certificate, with only the HTTP listening port configured; 1: self-owned certificate; 2: managed certificate.
Cert No String When CertType is 1, this parameter is required, indicating the self-owned certificate chain
PrivateKey No String When CertType=1, this parameter is required, indicating the private key of the self-owned certificate.
SSLId No String When CertType is 2, this parameter must be filled, indicating the certificate ID hosted on Tencent Cloud's SSL platform
IsCdn No Integer Whether a layer-7 proxy service is deployed before the WAF. 0: No proxy service is deployed; 1: The proxy service is deployed. The WAF will use XFF to obtain the client IP address; 2: The proxy service is deployed. The WAF will use remote_addr to obtain the client IP address; 3: The proxy service is deployed. The WAF will use a custom header in ip_headers to obtain the client IP address.
UpstreamScheme No String Origin-pull protocol for HTTPS when the service is configured with an HTTPS port.
http: Use the HTTP protocol for origin-pull. It is used with HttpsUpstreamPort.
https: Use the HTTPS protocol for origin-pull.
HttpsUpstreamPort No String HTTPS upstream port, required only when UpstreamScheme is http
HttpsRewrite No Integer Whether to enable forced redirection from HTTP to HTTPS. 0: disable; 1: enable
UpstreamType No Integer upstream type. 0: proxy to upstream by IP; 1: proxy to upstream by domain name
UpstreamDomain No String Upstream domain when proxy to upstream by domain. When UpstreamType=1, this field needs to be filled
SrcList.N No Array of String Upstream IP list when proxy to upstream by IP. When UpstreamType=0, this field is required
IsHttp2 No Integer Whether to enable HTTP2. You should enable HTTPS as well. 0: disable; 1: enable
IsWebsocket No Integer Whether to enable WebSocket. 0: disable; 1: enable
LoadBalance No Integer Load balancing policy for upstream. 0: round-robin scheduling; 1: IP hash; 2: weighted round-robin scheduling
IsGray No Integer To be deprecated, can be left blank. Whether to enable grayscale: 0 indicates not to enable grayscale.
Edition No String Instance type of the domain name
Ports.N No Array of SpartaProtectionPort Port information, which can be obtained through the DescribeDomains API
IsKeepAlive No String Whether to enable persistent connection. 0: non-persistent connection; 1: persistent connection
Anycast No Integer To be deprecated. Currently, set this parameter to 0. Anycast IP type switch. 0: common IP; 1: Anycast IP
Weights.N No Array of Integer Weight of each IP in the upstream IP List, corresponding to SrcList. Required only when UpstreamType is 0, and SrcList contains multiple IPs, and LoadBalance is 2; otherwise, fill in [ ].
ActiveCheck No Integer Whether to enable proactive health detection. 0: disable; 1: enable
TLSVersion No Integer TLS version information
Ciphers.N No Array of Integer Cipher suite information
CipherTemplate No Integer Cipher suite template. 0: default template (no selection); 1: general template; 2: secure template; 3: custom template
ProxyReadTimeout No Integer Read timeout between WAF and upstream server, 300s by default.
ProxySendTimeout No Integer WAF and origin server write timeout, 300s by default.
SniType No Integer SNI type when proxy to upstream.
0: Disable SNI and do not configure server_name in client_hello.
1: Enable SNI. server_name in client_hello is the protected domain name.
2: Enable SNI. SNI is the origin server domain name when proxy to upstream by domain.
3: Enable SNI. SNI is the custom domain name.
SniHost No String When SniType=3, this parameter is required, indicating a custom SNI;
IpHeaders.N No Array of String IsCdn=3 required for this parameter, indicates custom header
XFFReset No Integer Whether to enable XFF reset. 0: disable; 1: enable
Note No String Domain name remarks
UpstreamHost No String Custom upstream host. The default value is a null string, indicating that the protected domain name is used as the upstream host.
ProxyBuffer No Integer Whether to enable caching. 0: disable; 1: enable.
ProbeStatus No Integer Whether to enable the test. 0: disable; 1: enable. The test is enabled by default.
GmType No Integer SM option. 0: do not enable SM; 1: add support for SM based on the existing TLS option; 2: enable SM and support only SM client access.
GmCertType No Integer SM certificate type. 0: no SM certificate is available; 1: the certificate is a self-owned SM certificate; 2: the certificate is a managed SM certificate.
GmCert No String When GmCertType is 1, this parameter needs to be set, indicating the certificate chain of the self-owned SM certificate.
GmPrivateKey No String When GmCertType is 1, this parameter needs to be set, indicating the private key of the self-owned SM certificate.
GmEncCert No String When GmCertType is 1, this parameter needs to be set, indicating the encryption certificate of the self-owned SM certificate.
GmEncPrivateKey No String When GmCertType is 1, this parameter needs to be set, indicating the private key of the encryption certificate for the self-owned SM certificate.
GmSSLId No String When GmCertType is 2, this parameter needs to be set, indicating the ID of the certificate managed by the Tencent Cloud SSL platform.

3. Output Parameters

Parameter Name Type Description
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 修改SaaS型WAF域名

修改SaaS型WAF域名

Input Example

POST / HTTP/1.1
Host: waf.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifySpartaProtection
<common request parameters>

{
    "Ports": [
        {
            "NginxServerId": 230056,
            "Port": "80",
            "Protocol": "http",
            "UpstreamPort": "80",
            "UpstreamProtocol": "http"
        },
        {
            "NginxServerId": 321607,
            "Port": "443",
            "Protocol": "https",
            "UpstreamPort": "80",
            "UpstreamProtocol": "http"
        }
    ],
    "Domain": "randygz8.qcloudwaf.com",
    "DomainId": "7d58ebf3db7e5f7e8f91eb017c6a7b31",
    "SrcList": [
        "114.132.246.237",
        "114.132.246.239"
    ],
    "Weights": [
        "10",
        "10"
    ],
    "UpstreamType": 0,
    "HttpsRewrite": 0,
    "CertType": 2,
    "ActiveCheck": 0,
    "SSLId": "H0LMTjmj",
    "IsCdn": 1,
    "UpstreamScheme": "http",
    "HttpsUpstreamPort": "80",
    "IsGray": 0,
    "IsHttp2": 0,
    "IsWebsocket": 0,
    "ProxyBuffer": 1,
    "IsKeepAlive": "1",
    "LoadBalance": 0,
    "InstanceID": "waf_2kw60zgy0508e8j3",
    "Anycast": 0,
    "CipherTemplate": 2,
    "TLSVersion": 3,
    "Ciphers": [
        0,
        1,
        12,
        13,
        22
    ],
    "ProxyReadTimeout": 10,
    "ProxySendTimeout": 300,
    "SniHost": "randy.sni.com",
    "SniType": 1,
    "IpHeaders": [
        "x-real-ip"
    ],
    "XFFReset": 0,
    "UpstreamHost": "randy.upstream.com",
    "Note": "randy domain",
    "ProbeStatus": 1
}

Output Example

{
    "Response": {
        "RequestId": "13b8a309-3e7d-4393-91a4-271bf6d5dd71"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
FailedOperation.MysqlDBOperationFailed Failed to operate the MySQL database.
InternalError Internal error.
InternalError.AsynchronousCallFailed Asynchronous call failed.
InvalidParameter Parameter error.
InvalidParameter.CertificationParameterErr Certificate information parameter error
InvalidParameter.PortParameterErr Port information parameter error
InvalidParameter.ProtectionDomainParameterErr Protective domain parameter error
InvalidParameter.SupportTLSConfFailed The current instance version does not support enabling TLS by definition. Please upgrade to the Advanced Edition or above.
InvalidParameter.TLSParameterErr TLS or encryption suite parameter error
InvalidParameter.UpstreamParameterErr Origin information parameter error
InvalidParameterValue Invalid parameter value.
LimitExceeded The quota limit is exceeded.
MissingParameter Parameters are missing
ResourceInUse Resources are occupied.
ResourceInsufficient Insufficient resources.
ResourceNotFound Resources do not exist.
ResourceUnavailable Resources are unavailable.
ResourcesSoldOut Resources are sold out.
UnauthorizedOperation Unauthorized operation.
UnknownParameter Unknown parameter.