tencent cloud

Feedback

ModifySpartaProtection

Last updated: 2024-09-25 10:13:46

1. API Description

Domain name for API request: waf.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 0: Disable probe test; 1: Enable probe test. The probe test is enabled by default.

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 Modify SaaS WAF domain 1

This example shows you how to modify domain names protected by SaaS WAF.

Input Example

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



{
    "IsGray": "0",
    "Domain": "lucas0407-1.qcloudwaf.com",
    "LoadBalance": "0",
    "CipherTemplate": "0",
    "InstanceID": "waf_2kuj60v200b09bsr",
    "UpstreamType": "0",
    "IsWebsocket": "0",
    "IsHttp2": "0",
    "SrcList": [
        "114.132.223.23"
    ],
    "CertType": "0",
    "DomainId": "eb454223185451fe8b255a82b9d4bf94",
    "Weights": [
        "100"
    ],
    "IsKeepAlive": "1",
    "IsCdn": "1",
    "TLSVersion": "3",
    "Anycast": "0",
    "Ports": [
        {
            "NginxServerId": "62094",
            "Protocol": "http",
            "Port": "80",
            "UpstreamPort": "80",
            "UpstreamProtocol": "http"
        }
    ],
    "ActiveCheck": "1"
}

Output Example

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

Example2 Modify SaaS WAF domain 2

This example shows you how to modify domain names protected by SaaS WAF.

Input Example

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



{
    "IsGray": "0",
    "Domain": "lucas0919.qcloudwaf.com",
    "LoadBalance": "0",
    "CipherTemplate": "0",
    "InstanceID": "lucas",
    "UpstreamType": "0",
    "IsWebsocket": "0",
    "IsHttp2": "0",
    "SrcList": [
        "114.132.223.23"
    ],
    "CertType": "0",
    "DomainId": "e801733b69605960a17388999868512a",
    "Weights": [
        "100"
    ],
    "IsKeepAlive": "1",
    "IsCdn": "1",
    "TLSVersion": "3",
    "Anycast": "0",
    "Ports": [
        {
            "NginxServerId": "63953",
            "Protocol": "http",
            "Port": "80",
            "UpstreamPort": "80",
            "UpstreamProtocol": "http"
        }
    ],
    "ActiveCheck": "1"
}

Output Example

{
    "Response": {
        "RequestId": "d6bd6f14-926e-4a3e-9a34-bb1dd7d9a51d"
    }
}

Example3 Modify domain configuration

This example shows you how to modify domain names protected by SaaS WAF.

Input Example

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



{
    "Domain": "www.test.com",
    "LoadBalance": "0",
    "UpstreamType": "0",
    "CertType": "0",
    "Ports": [
        {
            "NginxServerId": "0",
            "Protocol": "http",
            "Port": "80",
            "UpstreamPort": "80",
            "UpstreamProtocol": "http"
        }
    ],
    "SrcList": [
        "1.1.1.1"
    ],
    "IsCdn": "0",
    "IsWebsocket": "0",
    "IsGray": "0",
    "IsHttp2": "0",
    "DomainId": "womdaswadfgsdgd",
    "InstanceID": "waf-9dja7dasggdsgs"
}

Output Example

{
    "Response": {
        "RequestId": "9ee8be5b-6caa-4c39-ab70-890e0e673515"
    }
}

Example4 Modifying the Domain Name Access Configuration

This example shows you how to modify domain names protected by SaaS WAF.

Input Example

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



{
    "Domain": "lucas0407-1.qcloudwaf.com",
    "LoadBalance": "0",
    "InstanceID": "waf_2kuj60v200b09bsr",
    "UpstreamType": "0",
    "IsWebsocket": "0",
    "IsHttp2": "0",
    "SrcList": [
        "11.148.84.137"
    ],
    "CertType": "0",
    "DomainId": "eb454223185451fe8b255a82b9d4bf94",
    "Weights": [
        "100"
    ],
    "IsKeepAlive": "1",
    "IsCdn": "1",
    "IsGray": "0",
    "Anycast": "0",
    "Ports": [
        {
            "NginxServerId": "62094",
            "Protocol": "http",
            "Port": "80",
            "UpstreamPort": "80",
            "UpstreamProtocol": "http"
        }
    ],
    "ActiveCheck": "1"
}

Output Example

{
    "Response": {
        "RequestId": "9c553d61-526a-44cf-a874-b24956033973"
    }
}

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.