ALIYUN::ESA::CompressionRule

ALIYUN::ESA::CompressionRule类型用于创建压缩规则配置。

语法

{
  "Type": "ALIYUN::ESA::CompressionRule",
  "Properties": {
    "SiteId": Integer,
    "Brotli": String,
    "Gzip": String,
    "PaymentType": String,
    "RuleEnable": String,
    "Rule": String,
    "RuleName": String,
    "Sequence": Integer,
    "SiteVersion": Integer,
    "Zstd": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

SiteId

Integer

站点 ID。

Brotli

String

Brotli 压缩。

取值范围:

  • on:开启。

  • off:关闭。

Gzip

String

Gzip 压缩。

取值范围:

  • on:开启。

  • off:关闭。

PaymentType

String

付费类型。

RuleEnable

String

规则开关。

添加全局配置的时候不需要设置该参数。取值范围:

  • on:开启。

  • off:关闭。

Rule

String

规则内容。

使用条件表达式来匹配用户请求。添加全局配置的时候不需要设置该参数。存在两种使用场景:

  • 匹配所有传入请求:值设置为 true

  • 匹配指定请求:值设置为自定义表达式,例如:(http.host eq "video.example.com")

RuleName

String

规则名称。

添加全局配置的时候不需要设置该参数。

Sequence

Integer

规则执行顺序。

数值越小越优先执行。

SiteVersion

Integer

站点配置的版本号。

开启了配置版本管理的站点,可以通过该参数指定配置生效的站点版本,默认为版本 0。

Zstd

String

Zstd 压缩。

取值范围:

  • on:开启。

  • off:关闭。

返回值

Fn::GetAtt

  • Zstd:Zstd 压缩。

  • RuleEnable:规则开关。

  • Brotli:Brotli 压缩。

  • Gzip:Gzip 压缩。

  • Sequence:规则执行顺序

  • Rule:规则内容

  • ConfigId:配置 ID。

  • SiteVersion:站点配置的版本号。

  • ConfigType:配置类型

  • RuleName:规则名称。

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SiteId:
    Type: Number
    Description:
      en: The site ID, which can be obtained by calling the ListSites API.
    Required: true
  RuleEnable:
    Type: String
    Description:
      en: |-
        Rule switch. When adding global configuration, this parameter does not need to be set. Value range:
        on: Enable.
        off: Disable.
    AllowedValues:
      - 'on'
      - 'off'
    Required: false
  Rule:
    Type: String
    Description:
      en: |-
        Rule content, using conditional expressions to match user requests. When adding global configuration, this parameter does not need to be set. There are two usage scenarios:
        - Match all incoming requests: value set to true
        - Match specified request: Set the value to a custom expression, for example: (http.host eq \"video.example.com\").
    Required: false
  RuleName:
    Type: String
    Description:
      en: Rule name. When adding global configuration, this parameter does not need to be set.
    Required: false
Resources:
  ExtensionResource:
    Type: ALIYUN::ESA::CompressionRule
    Properties:
      SiteId:
        Ref: SiteId
      RuleEnable:
        Ref: RuleEnable
      Rule:
        Ref: Rule
      RuleName:
        Ref: RuleName
Outputs:
  Zstd:
    Description: Zstd compression.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Zstd
  RuleEnable:
    Description: Rule switch. When adding global configuration, this parameter does not need to be set.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - RuleEnable
  Brotli:
    Description: Brotli compression.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Brotli
  Gzip:
    Description: Gzip compression.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Gzip
  Sequence:
    Description: Order of rule execution. The smaller the value, the higher the priority for execution.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Sequence
  Rule:
    Description: Rule content, using conditional expressions to match user requests. When adding global configuration, this parameter does not need to be set.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Rule
  ConfigId:
    Description: Config Id.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ConfigId
  SiteVersion:
    Description: The version number of the site configuration. For sites that have enabled configuration version management, this parameter can be used to specify the effective version of the configuration site, which defaults to version 0.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - SiteVersion
  ConfigType:
    Description: The type of the configuration.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ConfigType
  RuleName:
    Description: Rule name. When adding global configuration, this parameter does not need to be set.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - RuleName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SiteId": {
      "Type": "Number",
      "Description": {
        "en": "The site ID, which can be obtained by calling the ListSites API."
      },
      "Required": true
    },
    "RuleEnable": {
      "Type": "String",
      "Description": {
        "en": "Rule switch. When adding global configuration, this parameter does not need to be set. Value range:\non: Enable.\noff: Disable."
      },
      "AllowedValues": [
        "on",
        "off"
      ],
      "Required": false
    },
    "Rule": {
      "Type": "String",
      "Description": {
        "en": "Rule content, using conditional expressions to match user requests. When adding global configuration, this parameter does not need to be set. There are two usage scenarios:\n- Match all incoming requests: value set to true\n- Match specified request: Set the value to a custom expression, for example: (http.host eq \\\"video.example.com\\\")."
      },
      "Required": false
    },
    "RuleName": {
      "Type": "String",
      "Description": {
        "en": "Rule name. When adding global configuration, this parameter does not need to be set."
      },
      "Required": false
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::ESA::CompressionRule",
      "Properties": {
        "SiteId": {
          "Ref": "SiteId"
        },
        "RuleEnable": {
          "Ref": "RuleEnable"
        },
        "Rule": {
          "Ref": "Rule"
        },
        "RuleName": {
          "Ref": "RuleName"
        }
      }
    }
  },
  "Outputs": {
    "Zstd": {
      "Description": "Zstd compression.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Zstd"
        ]
      }
    },
    "RuleEnable": {
      "Description": "Rule switch. When adding global configuration, this parameter does not need to be set.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "RuleEnable"
        ]
      }
    },
    "Brotli": {
      "Description": "Brotli compression.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Brotli"
        ]
      }
    },
    "Gzip": {
      "Description": "Gzip compression.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Gzip"
        ]
      }
    },
    "Sequence": {
      "Description": "Order of rule execution. The smaller the value, the higher the priority for execution.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Sequence"
        ]
      }
    },
    "Rule": {
      "Description": "Rule content, using conditional expressions to match user requests. When adding global configuration, this parameter does not need to be set.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Rule"
        ]
      }
    },
    "ConfigId": {
      "Description": "Config Id.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ConfigId"
        ]
      }
    },
    "SiteVersion": {
      "Description": "The version number of the site configuration. For sites that have enabled configuration version management, this parameter can be used to specify the effective version of the configuration site, which defaults to version 0.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "SiteVersion"
        ]
      }
    },
    "ConfigType": {
      "Description": "The type of the configuration.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ConfigType"
        ]
      }
    },
    "RuleName": {
      "Description": "Rule name. When adding global configuration, this parameter does not need to be set.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "RuleName"
        ]
      }
    }
  }
}