Docs
api
Load Balance(ULB)
CreatePolicy

Creating content forwarding strategy for traditional load balancing - CreatePolicy

Overview

Creating VServer Content Forwarding Strategy in Traditional Load Balancing

💡 Specifying forwarding rule priority currently only supports path rules, and does not temporarily support adjustments between domain name rules or between domain name and path rules.

Definition

Public Parameters

Parameter NameTypeDescription InformationRequired
ActionstringCorresponding API command name, the current API is CreatePolicy.Yes
PublicKeystringThe user's public key can be obtained from Console (opens in a new tab)Yes
SignaturestringUser signature generated based on public key and API command, see Signature AlgorithmYes

Request Parameters

Parameter NameTypeDescription InformationRequired
RegionstringRegion. See List of Regions and Availability ZonesYes
ProjectIdstringProject ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the GetProjectList interface.Yes
ULBIdstringID of the traditional load balancing instance that requires adding content forwarding strategyYes
VServerIdstringThe ID of the traditional load balancing VServer instance that requires the addition of content forwarding strategy.Yes
BackendId.NstringThe ID of the traditional load balancing backend resource instance where the content forwarding strategy is applied, derived from the BackendId returned by AllocateBackend.Yes
MatchstringContent Forwarding Matching FieldYes
DomainMatchModestringThe matching method of the domain name in the content forwarding rule, by default, is consistent with the original. Enumeration values: Regular, regular expression; Wildcard, wildcard domain name.No
TypestringType of content forwarding matching fieldNo
PolicyPriorityintPolicy priority, 1-9999; Only effective for path rules.No

Response Field

Field NameTypeDescription InformationRequired
RetCodeintReturn status code. If it is 0, it means successful return. If it is not 0, it means failure.Yes
ActionstringOperation command name.Yes
MessagestringReturns an error message, providing detailed description when RetCode is non-zero.No
PolicyIdstringContent Forwarding Strategy IDNo

Example

Request Example

https://api.ucloud-global.com/?Action=CreatePolicy
&Region=cn-bj2
&ProjectId=project-XXX
&Match=ok
&Type=Domain
&ULBId=ulb-XXXXX
&VServerId=vserver-XXXX
&BackendId.0=backend-XXXX
&PolicyPriority=7
&DomainMatchMode=GxmqumOf

Response Example

{
  "Action": "CreatePolicyResponse",
  "PolicyId": "0a074d02-b7c9-4a5d-9acf-XXXXXXX",
  "RetCode": 0
}