すべてのプロダクト
Search
ドキュメントセンター

Resource Orchestration Service:ALIYUN::APIG::Policy

最終更新日:Jan 23, 2025

ALIYUN::APIG::Policy は、ポリシーを作成するために使用されます。

構文

{
  "Type": "ALIYUN::APIG::Policy",
  "Properties": {
    "AttachResourceIds": List,
    "AttachResourceType": String,
    "EnvironmentId": String,
    "GatewayId": String,
    "PolicyConfig": String,
    "PolicyClassName": String,
    "PolicyName": String
  }
}

プロパティ

プロパティ

タイプ

必須

編集可能

説明

制約

AttachResourceIds

List

はい

いいえ

マウントするリソースの ID。

最大 10 個のリソース ID を指定できます。

AttachResourceType

String

はい

いいえ

ポリシーでサポートされているマウント対象タイプ。

有効な値:

  • HttpApi: HTTP API

  • Operation: HTTP API 操作

  • GatewayRoute: ゲートウェイルート

  • GatewayService: ゲートウェイサービス

  • GatewayServicePort: ゲートウェイサービスポート

  • Domain: ゲートウェイドメイン

  • Gateway: ゲートウェイ

EnvironmentId

String

はい

いいえ

マウントするリソースが属する環境。

なし。

GatewayId

String

はい

いいえ

マウントするリソースが属するゲートウェイ。

なし。

PolicyConfig

String

はい

はい

ポリシーの構成。

なし。

PolicyClassName

String

はい

いいえ

ポリシークラスのエイリアス。

有効な値:

  • RateLimit

  • ConcurrencyLimit

  • CircuitBreaker

  • HttpRewrite

  • HeaderModify

  • Cors

  • FlowCopy

  • Timeout

  • Retry

  • IpAccessControl

  • DirectResponse

  • Redirect

  • Fallback

  • ServiceTls

  • ServiceLb

  • ServicePortTls

  • Waf

  • JWTAuth

  • OIDCAuth

  • ExternalZAuth

PolicyName

String

いいえ

はい

ポリシーの名前。

なし。

戻り値

Fn::GetAtt

  • PolicyConfig: ポリシーの構成。

  • PolicyClassId: ポリシークラスの ID。

  • PolicyClassName: ポリシークラスの名前。

  • PolicyName: ポリシーの名前。

  • PolicyId: ポリシーの ID

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  GatewayId:
    Type: String
    Description:
      en: The ID of the Gateway.
    Required: true
    AssociationProperty: ALIYUN::APIG::Gateway::GatewayId
Resources:
  ExtensionResource:
    Type: ALIYUN::APIG::Policy
    Properties:
      AttachResourceIds:
        - op-xxxxx
      PolicyConfig: '{"strategy":0,"minRequestAmount":10,"statDurationSec":20,"triggerRatio":80,"recoveryTimeoutSec":10,"enable":true,"maxAllowedMs":1000,"behaviorType":0,"responseStatusCode":429,"bodyEncoding":0,"responseContentBody":"Circuit Breaker"}'
      AttachResourceType: Operation
      EnvironmentId: env-xxx
      PolicyClassName: CircuitBreaker
      GatewayId:
        Ref: GatewayId
Outputs:
  PolicyConfig:
    Description: Policy Configuration.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - PolicyConfig
  PolicyClassId:
    Description: The ID of policy class.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - PolicyClassId
  PolicyClassName:
    Description: The name of policy class.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - PolicyClassName
  PolicyName:
    Description: The name of the policy.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - PolicyName
  PolicyId:
    Description: The ID of the policy.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - PolicyId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "GatewayId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the Gateway."
      },
      "Required": true,
      "AssociationProperty": "ALIYUN::APIG::Gateway::GatewayId"
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::APIG::Policy",
      "Properties": {
        "AttachResourceIds": [
          "op-xxxxx"
        ],
        "PolicyConfig": "{\"strategy\":0,\"minRequestAmount\":10,\"statDurationSec\":20,\"triggerRatio\":80,\"recoveryTimeoutSec\":10,\"enable\":true,\"maxAllowedMs\":1000,\"behaviorType\":0,\"responseStatusCode\":429,\"bodyEncoding\":0,\"responseContentBody\":\"Circuit Breaker\"}",
        "AttachResourceType": "Operation",
        "EnvironmentId": "env-xxx",
        "PolicyClassName": "CircuitBreaker",
        "GatewayId": {
          "Ref": "GatewayId"
        }
      }
    }
  },
  "Outputs": {
    "PolicyConfig": {
      "Description": "ポリシー構成。",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "PolicyConfig"
        ]
      }
    },
    "PolicyClassId": {
      "Description": "ポリシークラスの ID。",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "PolicyClassId"
        ]
      }
    },
    "PolicyClassName": {
      "Description": "ポリシークラスの名前。",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "PolicyClassName"
        ]
      }
    },
    "PolicyName": {
      "Description": "ポリシーの名前。",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "PolicyName"
        ]
      }
    },
    "PolicyId": {
      "Description": "ポリシーの ID。",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "PolicyId"
        ]
      }
    }
  }
}